diff options
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 @@ | |||
14 | #define _CRT_SECURE_NO_WARNINGS | 14 | #define _CRT_SECURE_NO_WARNINGS |
15 | #endif | 15 | #endif |
16 | 16 | ||
17 | #ifdef __APPLE__ | ||
18 | // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions | ||
19 | #define FOPEN_FUNC(filename, mode) fopen(filename, mode) | ||
20 | #define FTELLO_FUNC(stream) ftello(stream) | ||
21 | #define FSEEKO_FUNC(stream, offset, origin) fseeko(stream, offset, origin) | ||
22 | #else | ||
23 | #define FOPEN_FUNC(filename, mode) fopen64(filename, mode) | ||
24 | #define FTELLO_FUNC(stream) ftello64(stream) | ||
25 | #define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin) | ||
26 | #endif | ||
27 | |||
28 | |||
17 | #include "ioapi.h" | 29 | #include "ioapi.h" |
18 | 30 | ||
19 | voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode) | 31 | 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, | |||
112 | mode_fopen = "wb"; | 124 | mode_fopen = "wb"; |
113 | 125 | ||
114 | if ((filename!=NULL) && (mode_fopen != NULL)) | 126 | if ((filename!=NULL) && (mode_fopen != NULL)) |
115 | file = fopen64((const char*)filename, mode_fopen); | 127 | file = FOPEN_FUNC((const char*)filename, mode_fopen); |
116 | return file; | 128 | return file; |
117 | } | 129 | } |
118 | 130 | ||
@@ -142,7 +154,7 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) | |||
142 | static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream) | 154 | static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream) |
143 | { | 155 | { |
144 | ZPOS64_T ret; | 156 | ZPOS64_T ret; |
145 | ret = ftello64((FILE *)stream); | 157 | ret = FTELLO_FUNC((FILE *)stream); |
146 | return ret; | 158 | return ret; |
147 | } | 159 | } |
148 | 160 | ||
@@ -188,7 +200,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T | |||
188 | } | 200 | } |
189 | ret = 0; | 201 | ret = 0; |
190 | 202 | ||
191 | if(fseeko64((FILE *)stream, offset, fseek_origin) != 0) | 203 | if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0) |
192 | ret = -1; | 204 | ret = -1; |
193 | 205 | ||
194 | return ret; | 206 | return ret; |