14
14
#define _CRT_SECURE_NO_WARNINGS
15
15
#endif
16
16
17
- #if defined(__APPLE__ ) || defined(IOAPI_NO_64 )
17
+ #if defined(__APPLE__ ) || defined(IOAPI_NO_64 ) || defined( __HAIKU__ ) || defined( MINIZIP_FOPEN_NO_64 )
18
18
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
19
19
#define FOPEN_FUNC (filename , mode ) fopen(filename, mode)
20
20
#define FTELLO_FUNC (stream ) ftello(stream)
28
28
29
29
#include "ioapi.h"
30
30
31
- voidpf call_zopen64 (const zlib_filefunc64_32_def * pfilefunc ,const void * filename ,int mode )
32
- {
31
+ voidpf call_zopen64 (const zlib_filefunc64_32_def * pfilefunc , const void * filename , int mode ) {
33
32
if (pfilefunc -> zfile_func64 .zopen64_file != NULL )
34
33
return (* (pfilefunc -> zfile_func64 .zopen64_file )) (pfilefunc -> zfile_func64 .opaque ,filename ,mode );
35
34
else
@@ -38,8 +37,7 @@ voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename
38
37
}
39
38
}
40
39
41
- long call_zseek64 (const zlib_filefunc64_32_def * pfilefunc ,voidpf filestream , ZPOS64_T offset , int origin )
42
- {
40
+ long call_zseek64 (const zlib_filefunc64_32_def * pfilefunc ,voidpf filestream , ZPOS64_T offset , int origin ) {
43
41
if (pfilefunc -> zfile_func64 .zseek64_file != NULL )
44
42
return (* (pfilefunc -> zfile_func64 .zseek64_file )) (pfilefunc -> zfile_func64 .opaque ,filestream ,offset ,origin );
45
43
else
@@ -52,8 +50,7 @@ long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZP
52
50
}
53
51
}
54
52
55
- ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def * pfilefunc ,voidpf filestream )
56
- {
53
+ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def * pfilefunc , voidpf filestream ) {
57
54
if (pfilefunc -> zfile_func64 .zseek64_file != NULL )
58
55
return (* (pfilefunc -> zfile_func64 .ztell64_file )) (pfilefunc -> zfile_func64 .opaque ,filestream );
59
56
else
@@ -66,11 +63,9 @@ ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream
66
63
}
67
64
}
68
65
69
- void fill_zlib_filefunc64_32_def_from_filefunc32 (zlib_filefunc64_32_def * p_filefunc64_32 ,const zlib_filefunc_def * p_filefunc32 )
70
- {
66
+ void fill_zlib_filefunc64_32_def_from_filefunc32 (zlib_filefunc64_32_def * p_filefunc64_32 , const zlib_filefunc_def * p_filefunc32 ) {
71
67
p_filefunc64_32 -> zfile_func64 .zopen64_file = NULL ;
72
68
p_filefunc64_32 -> zopen32_file = p_filefunc32 -> zopen_file ;
73
- p_filefunc64_32 -> zfile_func64 .zerror_file = p_filefunc32 -> zerror_file ;
74
69
p_filefunc64_32 -> zfile_func64 .zread_file = p_filefunc32 -> zread_file ;
75
70
p_filefunc64_32 -> zfile_func64 .zwrite_file = p_filefunc32 -> zwrite_file ;
76
71
p_filefunc64_32 -> zfile_func64 .ztell64_file = NULL ;
@@ -91,16 +86,7 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef
91
86
// GODOT end
92
87
93
88
94
- static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode));
95
- static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
96
- static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size));
97
- static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream));
98
- static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
99
- static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
100
- static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
101
-
102
- static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
103
- {
89
+ static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char* filename, int mode) {
104
90
FILE* file = NULL;
105
91
const char* mode_fopen = NULL;
106
92
(void)opaque;
@@ -118,8 +104,7 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in
118
104
return file;
119
105
}
120
106
121
- static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
122
- {
107
+ static voidpf ZCALLBACK fopen64_file_func(voidpf opaque, const void* filename, int mode) {
123
108
FILE* file = NULL;
124
109
const char* mode_fopen = NULL;
125
110
(void)opaque;
@@ -138,41 +123,36 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
138
123
}
139
124
140
125
141
- static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
142
- {
126
+ static uLong ZCALLBACK fread_file_func(voidpf opaque, voidpf stream, void* buf, uLong size) {
143
127
uLong ret;
144
128
(void)opaque;
145
129
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
146
130
return ret;
147
131
}
148
132
149
- static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
150
- {
133
+ static uLong ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) {
151
134
uLong ret;
152
135
(void)opaque;
153
136
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
154
137
return ret;
155
138
}
156
139
157
- static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
158
- {
140
+ static long ZCALLBACK ftell_file_func(voidpf opaque, voidpf stream) {
159
141
long ret;
160
142
(void)opaque;
161
143
ret = ftell((FILE *)stream);
162
144
return ret;
163
145
}
164
146
165
147
166
- static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
167
- {
148
+ static ZPOS64_T ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream) {
168
149
ZPOS64_T ret;
169
150
(void)opaque;
170
151
ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream);
171
152
return ret;
172
153
}
173
154
174
- static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
175
- {
155
+ static long ZCALLBACK fseek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) {
176
156
int fseek_origin=0;
177
157
long ret;
178
158
(void)opaque;
@@ -195,8 +175,7 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs
195
175
return ret;
196
176
}
197
177
198
- static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
199
- {
178
+ static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) {
200
179
int fseek_origin=0;
201
180
long ret;
202
181
(void)opaque;
@@ -215,32 +194,28 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
215
194
}
216
195
ret = 0;
217
196
218
- if(FSEEKO_FUNC((FILE *)stream, (z_off_t )offset, fseek_origin) != 0)
197
+ if(FSEEKO_FUNC((FILE *)stream, (z_off64_t )offset, fseek_origin) != 0)
219
198
ret = -1;
220
199
221
200
return ret;
222
201
}
223
202
224
203
225
- static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
226
- {
204
+ static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream) {
227
205
int ret;
228
206
(void)opaque;
229
207
ret = fclose((FILE *)stream);
230
208
return ret;
231
209
}
232
210
233
- static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
234
- {
211
+ static int ZCALLBACK ferror_file_func(voidpf opaque, voidpf stream) {
235
212
int ret;
236
213
(void)opaque;
237
214
ret = ferror((FILE *)stream);
238
215
return ret;
239
216
}
240
217
241
- void fill_fopen_filefunc (pzlib_filefunc_def)
242
- zlib_filefunc_def* pzlib_filefunc_def;
243
- {
218
+ void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def) {
244
219
pzlib_filefunc_def->zopen_file = fopen_file_func;
245
220
pzlib_filefunc_def->zread_file = fread_file_func;
246
221
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
@@ -251,8 +226,7 @@ void fill_fopen_filefunc (pzlib_filefunc_def)
251
226
pzlib_filefunc_def->opaque = NULL;
252
227
}
253
228
254
- void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def)
255
- {
229
+ void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) {
256
230
pzlib_filefunc_def->zopen64_file = fopen64_file_func;
257
231
pzlib_filefunc_def->zread_file = fread_file_func;
258
232
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
0 commit comments