Pete Batard's patches offset types especially for MinGW and MS Visual C.
This commit is contained in:
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
/* portable.h has to come first else _FILE_OFFSET_BITS are redefined in
|
/* portable.h has to come first else _FILE_OFFSET_BITS are redefined in
|
||||||
say opensolaris. */
|
say opensolaris. */
|
||||||
#include "portable.h"
|
#include "filemode.h"
|
||||||
|
|
||||||
#include <cdio/cdio.h>
|
#include <cdio/cdio.h>
|
||||||
#include <cdio/iso9660.h>
|
#include <cdio/iso9660.h>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
/* portable.h has to come first else _FILE_OFFSET_BITS are redefined in
|
/* portable.h has to come first else _FILE_OFFSET_BITS are redefined in
|
||||||
say opensolaris. */
|
say opensolaris. */
|
||||||
#include "portable.h"
|
#include "filemode.h"
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
/* portable.h has to come first else _FILE_OFFSET_BITS are redefined in
|
/* portable.h has to come first else _FILE_OFFSET_BITS are redefined in
|
||||||
say opensolaris. */
|
say opensolaris. */
|
||||||
#include "portable.h"
|
#include "filemode.h"
|
||||||
|
|
||||||
#ifdef HAVE_STDIO_H
|
#ifdef HAVE_STDIO_H
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ typedef struct udf_dirent_s {
|
|||||||
|
|
||||||
/* This field has to come last because it is variable in length. */
|
/* This field has to come last because it is variable in length. */
|
||||||
udf_file_entry_t fe;
|
udf_file_entry_t fe;
|
||||||
} udf_dirent_t;;
|
} udf_dirent_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,11 +27,10 @@
|
|||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#ifndef HAVE_STRUCT_TIMESPEC
|
#if defined(__MINGW32__) && !defined(__MINGW64__)
|
||||||
#define HAVE_STRUCT_TIMESPEC
|
|
||||||
struct timespec {
|
struct timespec {
|
||||||
time_t tv_sec; /* Seconds */
|
time_t tv_sec; /* Seconds */
|
||||||
long tv_nsec; /* Nanoseconds */
|
long tv_nsec; /* Nanoseconds */
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2004, 2005, 2006, 2008, 2010 Rocky Bernstein <rocky@gnu.org>
|
Copyright (C) 2004, 2005, 2006, 2008, 2010, 2012
|
||||||
|
Rocky Bernstein <rocky@gnu.org>
|
||||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
@@ -28,6 +29,18 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <cdio/types.h>
|
#include <cdio/types.h>
|
||||||
|
|
||||||
|
#if !defined CDIO_INLINE
|
||||||
|
#if defined(__cplusplus) || defined(inline)
|
||||||
|
#define CDIO_INLINE inline
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#define CDIO_INLINE __inline__
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
#define CDIO_INLINE __inline
|
||||||
|
#else
|
||||||
|
#define CDIO_INLINE
|
||||||
|
#endif
|
||||||
|
#endif /* CDIO_INLINE */
|
||||||
|
|
||||||
#undef MAX
|
#undef MAX
|
||||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||||
|
|
||||||
@@ -40,7 +53,7 @@
|
|||||||
#undef CLAMP
|
#undef CLAMP
|
||||||
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
|
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
|
||||||
|
|
||||||
static inline uint32_t
|
static CDIO_INLINE uint32_t
|
||||||
_cdio_len2blocks (uint32_t i_len, uint16_t i_blocksize)
|
_cdio_len2blocks (uint32_t i_len, uint16_t i_blocksize)
|
||||||
{
|
{
|
||||||
uint32_t i_blocks;
|
uint32_t i_blocks;
|
||||||
@@ -53,13 +66,13 @@ _cdio_len2blocks (uint32_t i_len, uint16_t i_blocksize)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* round up to next block boundary */
|
/* round up to next block boundary */
|
||||||
static inline unsigned
|
static CDIO_INLINE unsigned
|
||||||
_cdio_ceil2block (unsigned offset, uint16_t i_blocksize)
|
_cdio_ceil2block (unsigned offset, uint16_t i_blocksize)
|
||||||
{
|
{
|
||||||
return _cdio_len2blocks (offset, i_blocksize) * i_blocksize;
|
return _cdio_len2blocks (offset, i_blocksize) * i_blocksize;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned int
|
static CDIO_INLINE unsigned int
|
||||||
_cdio_ofs_add (unsigned offset, unsigned length, uint16_t i_blocksize)
|
_cdio_ofs_add (unsigned offset, unsigned length, uint16_t i_blocksize)
|
||||||
{
|
{
|
||||||
if (i_blocksize - (offset % i_blocksize) < length)
|
if (i_blocksize - (offset % i_blocksize) < length)
|
||||||
@@ -70,7 +83,7 @@ _cdio_ofs_add (unsigned offset, unsigned length, uint16_t i_blocksize)
|
|||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const char *
|
static CDIO_INLINE const char *
|
||||||
_cdio_bool_str (bool b)
|
_cdio_bool_str (bool b)
|
||||||
{
|
{
|
||||||
return b ? "yes" : "no";
|
return b ? "yes" : "no";
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ EXTRA_DIST = image/Makefile \
|
|||||||
FreeBSD/Makefile MSWindows/Makefile \
|
FreeBSD/Makefile MSWindows/Makefile \
|
||||||
libcdio.sym
|
libcdio.sym
|
||||||
|
|
||||||
noinst_HEADERS = cdio_assert.h cdio_private.h portable.h
|
noinst_HEADERS = cdio_assert.h cdio_private.h filemode.h
|
||||||
|
|
||||||
libcdio_sources = \
|
libcdio_sources = \
|
||||||
_cdio_generic.c \
|
_cdio_generic.c \
|
||||||
|
|||||||
@@ -31,13 +31,17 @@
|
|||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif /*HAVE_UNISTD_H*/
|
#endif
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_STAT_H
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <cdio/sector.h>
|
#include <cdio/sector.h>
|
||||||
#include <cdio/util.h>
|
#include <cdio/util.h>
|
||||||
@@ -45,12 +49,22 @@
|
|||||||
#include "cdio_assert.h"
|
#include "cdio_assert.h"
|
||||||
#include "cdio_private.h"
|
#include "cdio_private.h"
|
||||||
#include "_cdio_stdio.h"
|
#include "_cdio_stdio.h"
|
||||||
#include "portable.h"
|
#include "filemode.h"
|
||||||
|
|
||||||
#ifndef PATH_MAX
|
#ifndef PATH_MAX
|
||||||
#define PATH_MAX 4096
|
#define PATH_MAX 4096
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* If available and LFS is enabled, try to use lseek64 */
|
||||||
|
#if defined(HAVE_LSEEK64) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
#define CDIO_LSEEK lseek64
|
||||||
|
#else
|
||||||
|
#define CDIO_LSEEK lseek
|
||||||
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Eject media -- there's nothing to do here. We always return -2.
|
Eject media -- there's nothing to do here. We always return -2.
|
||||||
Should we also free resources?
|
Should we also free resources?
|
||||||
@@ -150,13 +164,13 @@ cdio_generic_read_form1_sector (void * user_data, void *data, lsn_t lsn)
|
|||||||
/*!
|
/*!
|
||||||
Reads into buf the next size bytes.
|
Reads into buf the next size bytes.
|
||||||
Returns -1 on error.
|
Returns -1 on error.
|
||||||
Is in fact libc's lseek().
|
Is in fact libc's lseek()/lseek64().
|
||||||
*/
|
*/
|
||||||
off_t
|
off_t
|
||||||
cdio_generic_lseek (void *user_data, off_t offset, int whence)
|
cdio_generic_lseek (void *user_data, off_t offset, int whence)
|
||||||
{
|
{
|
||||||
generic_img_private_t *p_env = user_data;
|
generic_img_private_t *p_env = user_data;
|
||||||
return lseek(p_env->fd, offset, whence);
|
return CDIO_LSEEK(p_env->fd, offset, whence);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -21,22 +21,50 @@
|
|||||||
# define __CDIO_CONFIG_H__ 1
|
# define __CDIO_CONFIG_H__ 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STDIO_H
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif /*HAVE_UNISTD_H*/
|
#endif
|
||||||
|
#ifdef HAVE_SYS_STAT_H
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_ERRNO_H
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <cdio/logging.h>
|
#include <cdio/logging.h>
|
||||||
#include <cdio/util.h>
|
#include <cdio/util.h>
|
||||||
#include "_cdio_stream.h"
|
#include "_cdio_stream.h"
|
||||||
#include "_cdio_stdio.h"
|
#include "_cdio_stdio.h"
|
||||||
|
|
||||||
|
/* On 32 bit platforms, fseek can only access streams of 2 GB or less.
|
||||||
|
Prefer fseeko/fseeko64, that take a 64 bit offset when LFS is enabled */
|
||||||
|
#if defined(HAVE_FSEEKO64) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
|
||||||
|
#define CDIO_FSEEK fseeko64
|
||||||
|
#elif defined(HAVE_FSEEKO)
|
||||||
|
#define CDIO_FSEEK fseeko
|
||||||
|
#else
|
||||||
|
#define CDIO_FSEEK fseek
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Use _stati64 if needed, on platforms that don't have transparent LFS support */
|
||||||
|
#if defined(HAVE__STATI64) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
|
||||||
|
#define CDIO_STAT _stati64
|
||||||
|
#else
|
||||||
|
#define CDIO_STAT stat
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _STRINGIFY(a) #a
|
||||||
|
#define STRINGIFY(a) _STRINGIFY(a)
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: _cdio_stdio.c,v 1.6 2008/04/22 15:29:11 karl Exp $";
|
static const char _rcsid[] = "$Id: _cdio_stdio.c,v 1.6 2008/04/22 15:29:11 karl Exp $";
|
||||||
|
|
||||||
#define CDIO_STDIO_BUFSIZE (128*1024)
|
#define CDIO_STDIO_BUFSIZE (128*1024)
|
||||||
@@ -93,7 +121,7 @@ _stdio_free(void *user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Like fseek(3) and in fact may be the same.
|
Like fseek/fseeko(3) and in fact may be the same.
|
||||||
|
|
||||||
This function sets the file position indicator for the stream
|
This function sets the file position indicator for the stream
|
||||||
pointed to by stream. The new position, measured in bytes, is obtained
|
pointed to by stream. The new position, measured in bytes, is obtained
|
||||||
@@ -108,19 +136,28 @@ _stdio_free(void *user_data)
|
|||||||
DRIVER_OP_ERROR is returned and the global variable errno is set to
|
DRIVER_OP_ERROR is returned and the global variable errno is set to
|
||||||
indicate the error.
|
indicate the error.
|
||||||
*/
|
*/
|
||||||
static driver_return_code_t
|
static int
|
||||||
_stdio_seek(void *p_user_data, long i_offset, int whence)
|
_stdio_seek(void *p_user_data, off_t i_offset, int whence)
|
||||||
{
|
{
|
||||||
_UserData *const ud = p_user_data;
|
_UserData *const ud = p_user_data;
|
||||||
|
int ret;
|
||||||
|
#if !defined(HAVE_FSEEKO) && !defined(HAVE_FSEEKO64)
|
||||||
|
/* Detect if off_t is lossy-truncated to long to avoid data corruption */
|
||||||
|
if ( (sizeof(off_t) > sizeof(long)) && (i_offset != (off_t)((long)i_offset)) ) {
|
||||||
|
cdio_error ( STRINGIFY(CDIO_FSEEK) " (): lossy truncation detected!");
|
||||||
|
errno = EFBIG;
|
||||||
|
return DRIVER_OP_ERROR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( (i_offset=fseek (ud->fd, i_offset, whence)) ) {
|
if ( (ret=CDIO_FSEEK (ud->fd, i_offset, whence)) ) {
|
||||||
cdio_error ("fseek (): %s", strerror (errno));
|
cdio_error ( STRINGIFY(CDIO_FSEEK) " (): %s", strerror (errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
return i_offset;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long int
|
static off_t
|
||||||
_stdio_stat(void *p_user_data)
|
_stdio_stat(void *p_user_data)
|
||||||
{
|
{
|
||||||
const _UserData *const ud = p_user_data;
|
const _UserData *const ud = p_user_data;
|
||||||
@@ -145,15 +182,15 @@ _stdio_stat(void *p_user_data)
|
|||||||
We do not distinguish between end-of-file and error, and callers
|
We do not distinguish between end-of-file and error, and callers
|
||||||
must use feof(3) and ferror(3) to determine which occurred.
|
must use feof(3) and ferror(3) to determine which occurred.
|
||||||
*/
|
*/
|
||||||
static long
|
static ssize_t
|
||||||
_stdio_read(void *user_data, void *buf, long int count)
|
_stdio_read(void *user_data, void *buf, size_t count)
|
||||||
{
|
{
|
||||||
_UserData *const ud = user_data;
|
_UserData *const ud = user_data;
|
||||||
long read;
|
long read_count;
|
||||||
|
|
||||||
read = fread(buf, 1, count, ud->fd);
|
read_count = fread(buf, 1, count, ud->fd);
|
||||||
|
|
||||||
if (read != count)
|
if (read_count != count)
|
||||||
{ /* fixme -- ferror/feof */
|
{ /* fixme -- ferror/feof */
|
||||||
if (feof (ud->fd))
|
if (feof (ud->fd))
|
||||||
{
|
{
|
||||||
@@ -169,7 +206,7 @@ _stdio_read(void *user_data, void *buf, long int count)
|
|||||||
cdio_debug ("fread (): short read and no EOF?!?");
|
cdio_debug ("fread (): short read and no EOF?!?");
|
||||||
}
|
}
|
||||||
|
|
||||||
return read;
|
return read_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -187,9 +224,9 @@ cdio_stdio_new(const char pathname[])
|
|||||||
CdioDataSource_t *new_obj = NULL;
|
CdioDataSource_t *new_obj = NULL;
|
||||||
cdio_stream_io_functions funcs = { NULL, NULL, NULL, NULL, NULL, NULL };
|
cdio_stream_io_functions funcs = { NULL, NULL, NULL, NULL, NULL, NULL };
|
||||||
_UserData *ud = NULL;
|
_UserData *ud = NULL;
|
||||||
struct stat statbuf;
|
struct CDIO_STAT statbuf;
|
||||||
|
|
||||||
if (stat (pathname, &statbuf) == -1)
|
if (CDIO_STAT (pathname, &statbuf) == -1)
|
||||||
{
|
{
|
||||||
cdio_warn ("could not retrieve file info for `%s': %s",
|
cdio_warn ("could not retrieve file info for `%s': %s",
|
||||||
pathname, strerror (errno));
|
pathname, strerror (errno));
|
||||||
|
|||||||
@@ -21,10 +21,18 @@
|
|||||||
# define __CDIO_CONFIG_H__ 1
|
# define __CDIO_CONFIG_H__ 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STDIO_H
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STDARG_H
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#endif
|
||||||
#include "cdio_assert.h"
|
#include "cdio_assert.h"
|
||||||
|
|
||||||
/* #define STREAM_DEBUG */
|
/* #define STREAM_DEBUG */
|
||||||
@@ -43,7 +51,7 @@ struct _CdioDataSource {
|
|||||||
void* user_data;
|
void* user_data;
|
||||||
cdio_stream_io_functions op;
|
cdio_stream_io_functions op;
|
||||||
int is_open;
|
int is_open;
|
||||||
long position;
|
off_t position;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -80,8 +88,8 @@ cdio_stream_destroy(CdioDataSource_t *p_obj)
|
|||||||
@return unpon successful completion, return value is positive, else,
|
@return unpon successful completion, return value is positive, else,
|
||||||
the global variable errno is set to indicate the error.
|
the global variable errno is set to indicate the error.
|
||||||
*/
|
*/
|
||||||
ssize_t
|
off_t
|
||||||
cdio_stream_getpos(CdioDataSource_t* p_obj, /*out*/ ssize_t *i_offset)
|
cdio_stream_getpos(CdioDataSource_t* p_obj, /*out*/ off_t *i_offset)
|
||||||
{
|
{
|
||||||
if (!p_obj || !p_obj->is_open) return DRIVER_OP_UNINIT;
|
if (!p_obj || !p_obj->is_open) return DRIVER_OP_UNINIT;
|
||||||
return *i_offset = p_obj->position;
|
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.
|
must use feof(3) and ferror(3) to determine which occurred.
|
||||||
*/
|
*/
|
||||||
ssize_t
|
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;
|
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,
|
@return unpon successful completion, return value is positive, else,
|
||||||
the global variable errno is set to indicate the error.
|
the global variable errno is set to indicate the error.
|
||||||
*/
|
*/
|
||||||
ssize_t
|
int
|
||||||
cdio_stream_seek(CdioDataSource_t* p_obj, ssize_t offset, int whence)
|
cdio_stream_seek(CdioDataSource_t* p_obj, off_t offset, int whence)
|
||||||
{
|
{
|
||||||
if (!p_obj) return DRIVER_OP_UNINIT;
|
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;
|
return DRIVER_OP_ERROR;
|
||||||
|
|
||||||
if (offset < 0) 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) {
|
if (p_obj->position != offset) {
|
||||||
#ifdef STREAM_DEBUG
|
#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
|
#endif
|
||||||
p_obj->position = offset;
|
p_obj->position = offset;
|
||||||
return p_obj->op.seek(p_obj->user_data, offset, whence);
|
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.
|
Return whatever size of stream reports, I guess unit size is bytes.
|
||||||
On error return -1;
|
On error return -1;
|
||||||
*/
|
*/
|
||||||
ssize_t
|
off_t
|
||||||
cdio_stream_stat(CdioDataSource_t *p_obj)
|
cdio_stream_stat(CdioDataSource_t *p_obj)
|
||||||
{
|
{
|
||||||
if (!p_obj) return -1;
|
if (!p_obj) return -1;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
$Id: _cdio_stream.h,v 1.5 2008/04/22 15:29:11 karl Exp $
|
Copyright (C) 2003, 2004, 2005, 2006, 2008, 2012
|
||||||
|
Rocky Bernstein <rocky@gnu.org>
|
||||||
Copyright (C) 2003, 2004, 2005, 2006, 2008 Rocky Bernstein <rocky@gnu.org>
|
|
||||||
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
@@ -33,12 +32,12 @@ extern "C" {
|
|||||||
|
|
||||||
typedef int(*cdio_data_open_t)(void *user_data);
|
typedef int(*cdio_data_open_t)(void *user_data);
|
||||||
|
|
||||||
typedef long(*cdio_data_read_t)(void *user_data, void *buf, long count);
|
typedef ssize_t(*cdio_data_read_t)(void *user_data, void *buf, size_t count);
|
||||||
|
|
||||||
typedef driver_return_code_t(*cdio_data_seek_t)(void *user_data, long offset,
|
typedef int(*cdio_data_seek_t)(void *user_data, off_t offset,
|
||||||
int whence);
|
int whence);
|
||||||
|
|
||||||
typedef long(*cdio_data_stat_t)(void *user_data);
|
typedef off_t(*cdio_data_stat_t)(void *user_data);
|
||||||
|
|
||||||
typedef int(*cdio_data_close_t)(void *user_data);
|
typedef int(*cdio_data_close_t)(void *user_data);
|
||||||
|
|
||||||
@@ -65,8 +64,8 @@ extern "C" {
|
|||||||
@return unpon successful completion, return value is positive, else,
|
@return unpon successful completion, return value is positive, else,
|
||||||
the global variable errno is set to indicate the error.
|
the global variable errno is set to indicate the error.
|
||||||
*/
|
*/
|
||||||
ssize_t cdio_stream_getpos(CdioDataSource_t* p_obj,
|
off_t cdio_stream_getpos(CdioDataSource_t* p_obj,
|
||||||
/*out*/ ssize_t *i_offset);
|
/*out*/ off_t *i_offset);
|
||||||
|
|
||||||
CdioDataSource_t *
|
CdioDataSource_t *
|
||||||
cdio_stream_new(void *user_data, const cdio_stream_io_functions *funcs);
|
cdio_stream_new(void *user_data, const cdio_stream_io_functions *funcs);
|
||||||
@@ -88,11 +87,11 @@ extern "C" {
|
|||||||
We do not distinguish between end-of-file and error, and callers
|
We do not distinguish between end-of-file and error, and callers
|
||||||
must use feof(3) and ferror(3) to determine which occurred.
|
must use feof(3) and ferror(3) to determine which occurred.
|
||||||
*/
|
*/
|
||||||
ssize_t cdio_stream_read(CdioDataSource_t* p_obj, void *ptr, long i_size,
|
ssize_t cdio_stream_read(CdioDataSource_t* p_obj, void *ptr, size_t i_size,
|
||||||
long nmemb);
|
size_t nmemb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Like fseek(3) and in fact may be the same.
|
Like fseek(3)/fseeko(3) and in fact may be the same.
|
||||||
|
|
||||||
This function sets the file position indicator for the stream
|
This function sets the file position indicator for the stream
|
||||||
pointed to by stream. The new position, measured in bytes, is obtained
|
pointed to by stream. The new position, measured in bytes, is obtained
|
||||||
@@ -107,14 +106,14 @@ extern "C" {
|
|||||||
DRIVER_OP_ERROR is returned and the global variable errno is set to
|
DRIVER_OP_ERROR is returned and the global variable errno is set to
|
||||||
indicate the error.
|
indicate the error.
|
||||||
*/
|
*/
|
||||||
ssize_t cdio_stream_seek(CdioDataSource_t *p_obj, ssize_t i_offset,
|
int cdio_stream_seek(CdioDataSource_t *p_obj, off_t i_offset,
|
||||||
int whence);
|
int whence);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return whatever size of stream reports, I guess unit size is bytes.
|
Return whatever size of stream reports, I guess unit size is bytes.
|
||||||
On error return -1;
|
On error return -1;
|
||||||
*/
|
*/
|
||||||
ssize_t cdio_stream_stat(CdioDataSource_t *p_obj);
|
off_t cdio_stream_stat(CdioDataSource_t *p_obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Deallocate resources associated with p_obj. After this p_obj is unusable.
|
Deallocate resources associated with p_obj. After this p_obj is unusable.
|
||||||
|
|||||||
@@ -20,23 +20,25 @@
|
|||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#ifdef HAVE_STDIO_H
|
||||||
|
# include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef PATH_MAX
|
#ifndef PATH_MAX
|
||||||
#define PATH_MAX 4096
|
# define PATH_MAX 4096
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
# define NULL 0
|
# define NULL 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
#undef DOSISH
|
# undef DOSISH
|
||||||
#endif
|
#endif
|
||||||
#if defined __CYGWIN__ || defined DOSISH
|
#if defined __CYGWIN__ || defined DOSISH
|
||||||
#define DOSISH_UNC
|
# define DOSISH_UNC
|
||||||
#define DOSISH_DRIVE_LETTER
|
# define DOSISH_DRIVE_LETTER
|
||||||
#define FILE_ALT_SEPARATOR '\\'
|
# define FILE_ALT_SEPARATOR '\\'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef CDIO_FILE_SEPARATOR
|
#ifndef CDIO_FILE_SEPARATOR
|
||||||
@@ -44,18 +46,19 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined __CYGWIN__ || defined DOSISH
|
#if defined __CYGWIN__ || defined DOSISH
|
||||||
# define FILE_ALT_SEPARATOR '\\'
|
# define FILE_ALT_SEPARATOR '\\'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CDIO_FILE_ALT_SEPARATOR
|
#ifdef CDIO_FILE_ALT_SEPARATOR
|
||||||
# define isdirsep(x) ((x) == CDIO_FILE_SEPARATOR || (x) == CDIO_FILE_ALT_SEPARATOR)
|
# define isdirsep(x) ((x) == CDIO_FILE_SEPARATOR || (x) == CDIO_FILE_ALT_SEPARATOR)
|
||||||
#else
|
#else
|
||||||
# define isdirsep(x) ((x) == CDIO_FILE_SEPARATOR)
|
# define isdirsep(x) ((x) == CDIO_FILE_SEPARATOR)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define skipprefix(path) (path)
|
#define skipprefix(path) (path)
|
||||||
|
|
||||||
#ifndef CharNext /* defined as CharNext[AW] on Windows. */
|
#if !defined(CharNext) || defined(_MSC_VER) /* defined as CharNext[AW] on Windows. */
|
||||||
|
# undef CharNext
|
||||||
# define CharNext(p) ((p) + 1)
|
# define CharNext(p) ((p) + 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "portable.h"
|
#include "filemode.h"
|
||||||
/* reader */
|
/* reader */
|
||||||
|
|
||||||
#define DEFAULT_CDIO_DEVICE "videocd.bin"
|
#define DEFAULT_CDIO_DEVICE "videocd.bin"
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "portable.h"
|
#include "filemode.h"
|
||||||
|
|
||||||
/* reader */
|
/* reader */
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <cdio/logging.h>
|
#include <cdio/logging.h>
|
||||||
#include "cdio_assert.h"
|
#include "cdio_assert.h"
|
||||||
#include "portable.h"
|
#include "filemode.h"
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: logging.c,v 1.2 2008/04/22 15:29:12 karl Exp $";
|
static const char _rcsid[] = "$Id: logging.c,v 1.2 2008/04/22 15:29:12 karl Exp $";
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
/* Program to read ISO-9660 images. */
|
/* Program to read ISO-9660 images. */
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "portable.h"
|
#include "filemode.h"
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
# define __CDIO_CONFIG_H__ 1
|
# define __CDIO_CONFIG_H__ 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "portable.h"
|
#include "filemode.h"
|
||||||
|
|
||||||
#include <cdio/cdio.h>
|
#include <cdio/cdio.h>
|
||||||
#include <cdio/iso9660.h>
|
#include <cdio/iso9660.h>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
/* $Id: testisocd2.c.in,v 1.2 2008/03/22 18:08:25 karl Exp $
|
/*
|
||||||
|
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2012 Rocky Bernstein
|
||||||
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Rocky Bernstein
|
|
||||||
<rocky@gnu.org>
|
<rocky@gnu.org>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
@@ -23,8 +22,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "portable.h"
|
#include "filemode.h"
|
||||||
|
|
||||||
#include <cdio/cdio.h>
|
#include <cdio/cdio.h>
|
||||||
#include <cdio/iso9660.h>
|
#include <cdio/iso9660.h>
|
||||||
#include <cdio/cd_types.h>
|
#include <cdio/cd_types.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user