|
From: Jean-Francois P. <pan...@co...> - 2004-07-06 07:55:49
|
There is code in lib/io_file.c and utils/recover.c to force the use of ftello64() and fseeko64() on platforms which have it to avoid problems seeking on files larger than 2GB. OS X doesn't have ftello64() or fseeko64(), but it does have ftello() and fsseko(). The following changes fix this problem and allow larger than 2GB files to work on OS X. First, test for the presence of fseeko()/ftello() in configure.in: --- configure.in.orig 2004-07-06 00:40:59.000000000 -0700 +++ configure.in 2004-07-06 00:52:33.000000000 -0700 @@ -208,6 +208,7 @@ dnl ------------------- AC_CHECK_FUNCS(ftello64, has_ftello64=yes, has_ftello64=no) +AC_CHECK_FUNCS(ftello fseeko) AH_TEMPLATE([OQT_64SEEK], [Use 64bit versions of ftell and fseek ?]) echo "Support for 64-bit file seeking.......... $has_ftello64" Then make sure to use the right functions in lib/io_files.c and utils/recover.c --- io_file.c.orig 2004-07-06 00:54:33.000000000 -0700 +++ io_file.c 2004-07-06 00:54:43.000000000 -0700 @@ -43,8 +43,16 @@ #define FSEEK(f,o,w) fseeko64((FILE*)f,o,w) #define FOPEN(p,m) fopen64(p,m) #else +#if HAVE_FTELLO +#define FTELL(f) ftello((FILE*)f) +#else #define FTELL(f) ftell((FILE*)f) +#endif +#if HAVE_FSEEKO +#define FSEEK(f,o,w) fseeko((FILE*)f,o,w) +#else #define FSEEK(f,o,w) fseek((FILE*)f,o,w) +#endif #define FOPEN(p,m) fopen(p,m) #endif --- recover.c.orig 2004-07-06 00:55:27.000000000 -0700 +++ recover.c 2004-07-06 00:55:41.000000000 -0700 @@ -49,9 +49,17 @@ #define FTELL(f) ftello64((FILE*)f) #define FSEEK(f,o,w) fseeko64((FILE*)f,o,w) #else +#if HAVE_FTELLO +#define FTELL(f) ftello((FILE*)f) +#else #define FTELL(f) ftell((FILE*)f) +#endif +#if HAVE_FSEEKO +#define FSEEK(f,o,w) fseeko((FILE*)f,o,w) +#else #define FSEEK(f,o,w) fseek((FILE*)f,o,w) #endif +#endif #define SEARCH_FRAGMENT (oqt_uint64_t)0x1000 |