diff options
Diffstat (limited to 'contrib/minizip/ioapi.c')
-rw-r--r-- | contrib/minizip/ioapi.c | 57 |
1 files changed, 16 insertions, 41 deletions
diff --git a/contrib/minizip/ioapi.c b/contrib/minizip/ioapi.c index 814a6fd..d3c1ead 100644 --- a/contrib/minizip/ioapi.c +++ b/contrib/minizip/ioapi.c | |||
@@ -28,8 +28,7 @@ | |||
28 | 28 | ||
29 | #include "ioapi.h" | 29 | #include "ioapi.h" |
30 | 30 | ||
31 | 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) { |
32 | { | ||
33 | if (pfilefunc->zfile_func64.zopen64_file != NULL) | 32 | if (pfilefunc->zfile_func64.zopen64_file != NULL) |
34 | return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode); | 33 | return (*(pfilefunc->zfile_func64.zopen64_file)) (pfilefunc->zfile_func64.opaque,filename,mode); |
35 | else | 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) | 40 | long call_zseek64 (const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin) { |
42 | { | ||
43 | if (pfilefunc->zfile_func64.zseek64_file != NULL) | 41 | if (pfilefunc->zfile_func64.zseek64_file != NULL) |
44 | return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin); | 42 | return (*(pfilefunc->zfile_func64.zseek64_file)) (pfilefunc->zfile_func64.opaque,filestream,offset,origin); |
45 | else | 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) | 53 | ZPOS64_T call_ztell64 (const zlib_filefunc64_32_def* pfilefunc, voidpf filestream) { |
56 | { | ||
57 | if (pfilefunc->zfile_func64.zseek64_file != NULL) | 54 | if (pfilefunc->zfile_func64.zseek64_file != NULL) |
58 | return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream); | 55 | return (*(pfilefunc->zfile_func64.ztell64_file)) (pfilefunc->zfile_func64.opaque,filestream); |
59 | else | 56 | else |
@@ -66,8 +63,7 @@ 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) | 66 | void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32, const zlib_filefunc_def* p_filefunc32) { |
70 | { | ||
71 | p_filefunc64_32->zfile_func64.zopen64_file = NULL; | 67 | p_filefunc64_32->zfile_func64.zopen64_file = NULL; |
72 | p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file; | 68 | p_filefunc64_32->zopen32_file = p_filefunc32->zopen_file; |
73 | p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file; | 69 | p_filefunc64_32->zfile_func64.zerror_file = p_filefunc32->zerror_file; |
@@ -84,16 +80,7 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef | |||
84 | 80 | ||
85 | 81 | ||
86 | 82 | ||
87 | static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode)); | 83 | static voidpf ZCALLBACK fopen_file_func(voidpf opaque, const char* filename, int mode) { |
88 | static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); | ||
89 | static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size)); | ||
90 | static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream)); | ||
91 | static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); | ||
92 | static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream)); | ||
93 | static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream)); | ||
94 | |||
95 | static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode) | ||
96 | { | ||
97 | FILE* file = NULL; | 84 | FILE* file = NULL; |
98 | const char* mode_fopen = NULL; | 85 | const char* mode_fopen = NULL; |
99 | (void)opaque; | 86 | (void)opaque; |
@@ -111,8 +98,7 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in | |||
111 | return file; | 98 | return file; |
112 | } | 99 | } |
113 | 100 | ||
114 | static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode) | 101 | static voidpf ZCALLBACK fopen64_file_func(voidpf opaque, const void* filename, int mode) { |
115 | { | ||
116 | FILE* file = NULL; | 102 | FILE* file = NULL; |
117 | const char* mode_fopen = NULL; | 103 | const char* mode_fopen = NULL; |
118 | (void)opaque; | 104 | (void)opaque; |
@@ -131,24 +117,21 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, | |||
131 | } | 117 | } |
132 | 118 | ||
133 | 119 | ||
134 | static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size) | 120 | static uLong ZCALLBACK fread_file_func(voidpf opaque, voidpf stream, void* buf, uLong size) { |
135 | { | ||
136 | uLong ret; | 121 | uLong ret; |
137 | (void)opaque; | 122 | (void)opaque; |
138 | ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); | 123 | ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); |
139 | return ret; | 124 | return ret; |
140 | } | 125 | } |
141 | 126 | ||
142 | static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size) | 127 | static uLong ZCALLBACK fwrite_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) { |
143 | { | ||
144 | uLong ret; | 128 | uLong ret; |
145 | (void)opaque; | 129 | (void)opaque; |
146 | ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); | 130 | ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); |
147 | return ret; | 131 | return ret; |
148 | } | 132 | } |
149 | 133 | ||
150 | static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) | 134 | static long ZCALLBACK ftell_file_func(voidpf opaque, voidpf stream) { |
151 | { | ||
152 | long ret; | 135 | long ret; |
153 | (void)opaque; | 136 | (void)opaque; |
154 | ret = ftell((FILE *)stream); | 137 | ret = ftell((FILE *)stream); |
@@ -156,16 +139,14 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) | |||
156 | } | 139 | } |
157 | 140 | ||
158 | 141 | ||
159 | static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream) | 142 | static ZPOS64_T ZCALLBACK ftell64_file_func(voidpf opaque, voidpf stream) { |
160 | { | ||
161 | ZPOS64_T ret; | 143 | ZPOS64_T ret; |
162 | (void)opaque; | 144 | (void)opaque; |
163 | ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream); | 145 | ret = (ZPOS64_T)FTELLO_FUNC((FILE *)stream); |
164 | return ret; | 146 | return ret; |
165 | } | 147 | } |
166 | 148 | ||
167 | static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin) | 149 | static long ZCALLBACK fseek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) { |
168 | { | ||
169 | int fseek_origin=0; | 150 | int fseek_origin=0; |
170 | long ret; | 151 | long ret; |
171 | (void)opaque; | 152 | (void)opaque; |
@@ -188,8 +169,7 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs | |||
188 | return ret; | 169 | return ret; |
189 | } | 170 | } |
190 | 171 | ||
191 | static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) | 172 | static long ZCALLBACK fseek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) { |
192 | { | ||
193 | int fseek_origin=0; | 173 | int fseek_origin=0; |
194 | long ret; | 174 | long ret; |
195 | (void)opaque; | 175 | (void)opaque; |
@@ -215,25 +195,21 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T | |||
215 | } | 195 | } |
216 | 196 | ||
217 | 197 | ||
218 | static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream) | 198 | static int ZCALLBACK fclose_file_func(voidpf opaque, voidpf stream) { |
219 | { | ||
220 | int ret; | 199 | int ret; |
221 | (void)opaque; | 200 | (void)opaque; |
222 | ret = fclose((FILE *)stream); | 201 | ret = fclose((FILE *)stream); |
223 | return ret; | 202 | return ret; |
224 | } | 203 | } |
225 | 204 | ||
226 | static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream) | 205 | static int ZCALLBACK ferror_file_func(voidpf opaque, voidpf stream) { |
227 | { | ||
228 | int ret; | 206 | int ret; |
229 | (void)opaque; | 207 | (void)opaque; |
230 | ret = ferror((FILE *)stream); | 208 | ret = ferror((FILE *)stream); |
231 | return ret; | 209 | return ret; |
232 | } | 210 | } |
233 | 211 | ||
234 | void fill_fopen_filefunc (pzlib_filefunc_def) | 212 | void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def) { |
235 | zlib_filefunc_def* pzlib_filefunc_def; | ||
236 | { | ||
237 | pzlib_filefunc_def->zopen_file = fopen_file_func; | 213 | pzlib_filefunc_def->zopen_file = fopen_file_func; |
238 | pzlib_filefunc_def->zread_file = fread_file_func; | 214 | pzlib_filefunc_def->zread_file = fread_file_func; |
239 | pzlib_filefunc_def->zwrite_file = fwrite_file_func; | 215 | pzlib_filefunc_def->zwrite_file = fwrite_file_func; |
@@ -244,8 +220,7 @@ void fill_fopen_filefunc (pzlib_filefunc_def) | |||
244 | pzlib_filefunc_def->opaque = NULL; | 220 | pzlib_filefunc_def->opaque = NULL; |
245 | } | 221 | } |
246 | 222 | ||
247 | void fill_fopen64_filefunc (zlib_filefunc64_def* pzlib_filefunc_def) | 223 | void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def) { |
248 | { | ||
249 | pzlib_filefunc_def->zopen64_file = fopen64_file_func; | 224 | pzlib_filefunc_def->zopen64_file = fopen64_file_func; |
250 | pzlib_filefunc_def->zread_file = fread_file_func; | 225 | pzlib_filefunc_def->zread_file = fread_file_func; |
251 | pzlib_filefunc_def->zwrite_file = fwrite_file_func; | 226 | pzlib_filefunc_def->zwrite_file = fwrite_file_func; |