Pete Batard's patches offset types especially for MinGW and MS Visual C.
This commit is contained in:
@@ -21,10 +21,18 @@
|
||||
# define __CDIO_CONFIG_H__ 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
#include "cdio_assert.h"
|
||||
|
||||
/* #define STREAM_DEBUG */
|
||||
@@ -43,7 +51,7 @@ struct _CdioDataSource {
|
||||
void* user_data;
|
||||
cdio_stream_io_functions op;
|
||||
int is_open;
|
||||
long position;
|
||||
off_t position;
|
||||
};
|
||||
|
||||
void
|
||||
@@ -80,8 +88,8 @@ cdio_stream_destroy(CdioDataSource_t *p_obj)
|
||||
@return unpon successful completion, return value is positive, else,
|
||||
the global variable errno is set to indicate the error.
|
||||
*/
|
||||
ssize_t
|
||||
cdio_stream_getpos(CdioDataSource_t* p_obj, /*out*/ ssize_t *i_offset)
|
||||
off_t
|
||||
cdio_stream_getpos(CdioDataSource_t* p_obj, /*out*/ off_t *i_offset)
|
||||
{
|
||||
if (!p_obj || !p_obj->is_open) return DRIVER_OP_UNINIT;
|
||||
return *i_offset = p_obj->position;
|
||||
@@ -140,7 +148,7 @@ _cdio_stream_open_if_necessary(CdioDataSource_t *p_obj)
|
||||
must use feof(3) and ferror(3) to determine which occurred.
|
||||
*/
|
||||
ssize_t
|
||||
cdio_stream_read(CdioDataSource_t* p_obj, void *ptr, long size, long nmemb)
|
||||
cdio_stream_read(CdioDataSource_t* p_obj, void *ptr, size_t size, size_t nmemb)
|
||||
{
|
||||
long read_bytes;
|
||||
|
||||
@@ -168,8 +176,8 @@ cdio_stream_read(CdioDataSource_t* p_obj, void *ptr, long size, long nmemb)
|
||||
@return unpon successful completion, return value is positive, else,
|
||||
the global variable errno is set to indicate the error.
|
||||
*/
|
||||
ssize_t
|
||||
cdio_stream_seek(CdioDataSource_t* p_obj, ssize_t offset, int whence)
|
||||
int
|
||||
cdio_stream_seek(CdioDataSource_t* p_obj, off_t offset, int whence)
|
||||
{
|
||||
if (!p_obj) return DRIVER_OP_UNINIT;
|
||||
|
||||
@@ -178,10 +186,11 @@ cdio_stream_seek(CdioDataSource_t* p_obj, ssize_t offset, int whence)
|
||||
return DRIVER_OP_ERROR;
|
||||
|
||||
if (offset < 0) return DRIVER_OP_ERROR;
|
||||
if (p_obj->position < 0) return DRIVER_OP_ERROR;
|
||||
|
||||
if (p_obj->position != offset) {
|
||||
#ifdef STREAM_DEBUG
|
||||
cdio_warn("had to reposition DataSource from %ld to %ld!", obj->position, offset);
|
||||
cdio_warn("had to reposition DataSource from %ld to %ld!", p_obj->position, offset);
|
||||
#endif
|
||||
p_obj->position = offset;
|
||||
return p_obj->op.seek(p_obj->user_data, offset, whence);
|
||||
@@ -194,7 +203,7 @@ cdio_stream_seek(CdioDataSource_t* p_obj, ssize_t offset, int whence)
|
||||
Return whatever size of stream reports, I guess unit size is bytes.
|
||||
On error return -1;
|
||||
*/
|
||||
ssize_t
|
||||
off_t
|
||||
cdio_stream_stat(CdioDataSource_t *p_obj)
|
||||
{
|
||||
if (!p_obj) return -1;
|
||||
|
||||
Reference in New Issue
Block a user