diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-11 11:04:49 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-11 11:04:49 -0700 |
commit | 10daf0d4d7815447799d555d04d30325836e1d44 (patch) | |
tree | 75579fbe11e42dc3197acca53f5f887ac3808b57 /contrib/minizip/ioapi.c | |
parent | 9712272c78b9d9c93746d9c8e156a3728c65ca72 (diff) | |
download | zlib-10daf0d4d7815447799d555d04d30325836e1d44.tar.gz |
zlib 1.2.5.1v1.2.5.1
Diffstat (limited to 'contrib/minizip/ioapi.c')
-rw-r--r-- | contrib/minizip/ioapi.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/contrib/minizip/ioapi.c b/contrib/minizip/ioapi.c index 49958f6..d4bc020 100644 --- a/contrib/minizip/ioapi.c +++ b/contrib/minizip/ioapi.c @@ -14,6 +14,18 @@ #define _CRT_SECURE_NO_WARNINGS #endif +#ifdef __APPLE__ +// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions +#define FOPEN_FUNC(filename, mode) fopen(filename, mode) +#define FTELLO_FUNC(stream) ftello(stream) +#define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin) +#else +#define FOPEN_FUNC(filename, mode) fopen64(filename, mode) +#define FTELLO_FUNC(stream) ftello64(stream) +#define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin) +#endif + + #include "ioapi.h" voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode) @@ -112,7 +124,7 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, mode_fopen = "wb"; if ((filename!=NULL) && (mode_fopen != NULL)) - file = fopen64((const char*)filename, mode_fopen); + file = FOPEN_FUNC((const char*)filename, mode_fopen); return file; } @@ -142,7 +154,7 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream) { ZPOS64_T ret; - ret = ftello64((FILE *)stream); + ret = FTELLO_FUNC((FILE *)stream); return ret; } @@ -188,7 +200,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T } ret = 0; - if(fseeko64((FILE *)stream, offset, fseek_origin) != 0) + if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0) ret = -1; return ret; |