diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2023-04-15 11:16:17 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2023-04-15 22:56:37 -0700 |
commit | bf2578be2d0566dc3ee47655d56b62063fe6bae6 (patch) | |
tree | bcd69242c3cda836d7f146d44008be4f1b99fe56 | |
parent | c4aa356742e03af6670c043905cd2c96f515ad72 (diff) | |
download | zlib-bf2578be2d0566dc3ee47655d56b62063fe6bae6.tar.gz zlib-bf2578be2d0566dc3ee47655d56b62063fe6bae6.tar.bz2 zlib-bf2578be2d0566dc3ee47655d56b62063fe6bae6.zip |
Remove K&R function definitions from contrib/minizip.
-rw-r--r-- | contrib/minizip/crypt.h | 12 | ||||
-rw-r--r-- | contrib/minizip/ioapi.c | 57 | ||||
-rw-r--r-- | contrib/minizip/ioapi.h | 32 | ||||
-rw-r--r-- | contrib/minizip/iowin32.c | 65 | ||||
-rw-r--r-- | contrib/minizip/iowin32.h | 8 | ||||
-rw-r--r-- | contrib/minizip/miniunz.c | 54 | ||||
-rw-r--r-- | contrib/minizip/minizip.c | 48 | ||||
-rw-r--r-- | contrib/minizip/mztools.c | 8 | ||||
-rw-r--r-- | contrib/minizip/unzip.c | 294 | ||||
-rw-r--r-- | contrib/minizip/unzip.h | 124 | ||||
-rw-r--r-- | contrib/minizip/zip.c | 274 | ||||
-rw-r--r-- | contrib/minizip/zip.h | 297 |
12 files changed, 514 insertions, 759 deletions
diff --git a/contrib/minizip/crypt.h b/contrib/minizip/crypt.h index 1cc41f1..f4b93b7 100644 --- a/contrib/minizip/crypt.h +++ b/contrib/minizip/crypt.h | |||
@@ -32,8 +32,7 @@ | |||
32 | /*********************************************************************** | 32 | /*********************************************************************** |
33 | * Return the next byte in the pseudo-random sequence | 33 | * Return the next byte in the pseudo-random sequence |
34 | */ | 34 | */ |
35 | static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) | 35 | static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) { |
36 | { | ||
37 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an | 36 | unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an |
38 | * unpredictable manner on 16-bit systems; not a problem | 37 | * unpredictable manner on 16-bit systems; not a problem |
39 | * with any known compiler so far, though */ | 38 | * with any known compiler so far, though */ |
@@ -46,8 +45,7 @@ static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab) | |||
46 | /*********************************************************************** | 45 | /*********************************************************************** |
47 | * Update the encryption keys with the next byte of plain text | 46 | * Update the encryption keys with the next byte of plain text |
48 | */ | 47 | */ |
49 | static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c) | 48 | static int update_keys(unsigned long* pkeys, const z_crc_t* pcrc_32_tab, int c) { |
50 | { | ||
51 | (*(pkeys+0)) = CRC32((*(pkeys+0)), c); | 49 | (*(pkeys+0)) = CRC32((*(pkeys+0)), c); |
52 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff; | 50 | (*(pkeys+1)) += (*(pkeys+0)) & 0xff; |
53 | (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; | 51 | (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; |
@@ -63,8 +61,7 @@ static int update_keys(unsigned long* pkeys,const z_crc_t* pcrc_32_tab,int c) | |||
63 | * Initialize the encryption keys and the random header according to | 61 | * Initialize the encryption keys and the random header according to |
64 | * the given password. | 62 | * the given password. |
65 | */ | 63 | */ |
66 | static void init_keys(const char* passwd,unsigned long* pkeys,const z_crc_t* pcrc_32_tab) | 64 | static void init_keys(const char* passwd, unsigned long* pkeys, const z_crc_t* pcrc_32_tab) { |
67 | { | ||
68 | *(pkeys+0) = 305419896L; | 65 | *(pkeys+0) = 305419896L; |
69 | *(pkeys+1) = 591751049L; | 66 | *(pkeys+1) = 591751049L; |
70 | *(pkeys+2) = 878082192L; | 67 | *(pkeys+2) = 878082192L; |
@@ -93,8 +90,7 @@ static unsigned crypthead(const char* passwd, /* password string */ | |||
93 | int bufSize, | 90 | int bufSize, |
94 | unsigned long* pkeys, | 91 | unsigned long* pkeys, |
95 | const z_crc_t* pcrc_32_tab, | 92 | const z_crc_t* pcrc_32_tab, |
96 | unsigned long crcForCrypting) | 93 | unsigned long crcForCrypting) { |
97 | { | ||
98 | unsigned n; /* index in random header */ | 94 | unsigned n; /* index in random header */ |
99 | int t; /* temporary */ | 95 | int t; /* temporary */ |
100 | int c; /* random byte */ | 96 | int c; /* random byte */ |
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; |
diff --git a/contrib/minizip/ioapi.h b/contrib/minizip/ioapi.h index ae9ca7e..f6cc81b 100644 --- a/contrib/minizip/ioapi.h +++ b/contrib/minizip/ioapi.h | |||
@@ -134,14 +134,14 @@ extern "C" { | |||
134 | 134 | ||
135 | 135 | ||
136 | 136 | ||
137 | typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); | 137 | typedef voidpf (ZCALLBACK *open_file_func) (voidpf opaque, const char* filename, int mode); |
138 | typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); | 138 | typedef uLong (ZCALLBACK *read_file_func) (voidpf opaque, voidpf stream, void* buf, uLong size); |
139 | typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); | 139 | typedef uLong (ZCALLBACK *write_file_func) (voidpf opaque, voidpf stream, const void* buf, uLong size); |
140 | typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); | 140 | typedef int (ZCALLBACK *close_file_func) (voidpf opaque, voidpf stream); |
141 | typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); | 141 | typedef int (ZCALLBACK *testerror_file_func) (voidpf opaque, voidpf stream); |
142 | 142 | ||
143 | typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); | 143 | typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream); |
144 | typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); | 144 | typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin); |
145 | 145 | ||
146 | 146 | ||
147 | /* here is the "old" 32 bits structure structure */ | 147 | /* here is the "old" 32 bits structure structure */ |
@@ -157,9 +157,9 @@ typedef struct zlib_filefunc_def_s | |||
157 | voidpf opaque; | 157 | voidpf opaque; |
158 | } zlib_filefunc_def; | 158 | } zlib_filefunc_def; |
159 | 159 | ||
160 | typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream)); | 160 | typedef ZPOS64_T (ZCALLBACK *tell64_file_func) (voidpf opaque, voidpf stream); |
161 | typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); | 161 | typedef long (ZCALLBACK *seek64_file_func) (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin); |
162 | typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode)); | 162 | typedef voidpf (ZCALLBACK *open64_file_func) (voidpf opaque, const void* filename, int mode); |
163 | 163 | ||
164 | typedef struct zlib_filefunc64_def_s | 164 | typedef struct zlib_filefunc64_def_s |
165 | { | 165 | { |
@@ -173,8 +173,8 @@ typedef struct zlib_filefunc64_def_s | |||
173 | voidpf opaque; | 173 | voidpf opaque; |
174 | } zlib_filefunc64_def; | 174 | } zlib_filefunc64_def; |
175 | 175 | ||
176 | void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def)); | 176 | void fill_fopen64_filefunc(zlib_filefunc64_def* pzlib_filefunc_def); |
177 | void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); | 177 | void fill_fopen_filefunc(zlib_filefunc_def* pzlib_filefunc_def); |
178 | 178 | ||
179 | /* now internal definition, only for zip.c and unzip.h */ | 179 | /* now internal definition, only for zip.c and unzip.h */ |
180 | typedef struct zlib_filefunc64_32_def_s | 180 | typedef struct zlib_filefunc64_32_def_s |
@@ -193,11 +193,11 @@ typedef struct zlib_filefunc64_32_def_s | |||
193 | #define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream)) | 193 | #define ZCLOSE64(filefunc,filestream) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream)) |
194 | #define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream)) | 194 | #define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream)) |
195 | 195 | ||
196 | voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)); | 196 | voidpf call_zopen64(const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode); |
197 | long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)); | 197 | long call_zseek64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin); |
198 | ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream)); | 198 | ZPOS64_T call_ztell64(const zlib_filefunc64_32_def* pfilefunc,voidpf filestream); |
199 | 199 | ||
200 | void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32); | 200 | void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filefunc64_32,const zlib_filefunc_def* p_filefunc32); |
201 | 201 | ||
202 | #define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode))) | 202 | #define ZOPEN64(filefunc,filename,mode) (call_zopen64((&(filefunc)),(filename),(mode))) |
203 | #define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream))) | 203 | #define ZTELL64(filefunc,filestream) (call_ztell64((&(filefunc)),(filestream))) |
diff --git a/contrib/minizip/iowin32.c b/contrib/minizip/iowin32.c index 7df5251..08536e9 100644 --- a/contrib/minizip/iowin32.c +++ b/contrib/minizip/iowin32.c | |||
@@ -38,14 +38,6 @@ | |||
38 | #endif | 38 | #endif |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode)); | ||
42 | uLong ZCALLBACK win32_read_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); | ||
43 | uLong ZCALLBACK win32_write_file_func OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); | ||
44 | ZPOS64_T ZCALLBACK win32_tell64_file_func OF((voidpf opaque, voidpf stream)); | ||
45 | long ZCALLBACK win32_seek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); | ||
46 | int ZCALLBACK win32_close_file_func OF((voidpf opaque, voidpf stream)); | ||
47 | int ZCALLBACK win32_error_file_func OF((voidpf opaque, voidpf stream)); | ||
48 | |||
49 | typedef struct | 41 | typedef struct |
50 | { | 42 | { |
51 | HANDLE hf; | 43 | HANDLE hf; |
@@ -57,8 +49,7 @@ static void win32_translate_open_mode(int mode, | |||
57 | DWORD* lpdwDesiredAccess, | 49 | DWORD* lpdwDesiredAccess, |
58 | DWORD* lpdwCreationDisposition, | 50 | DWORD* lpdwCreationDisposition, |
59 | DWORD* lpdwShareMode, | 51 | DWORD* lpdwShareMode, |
60 | DWORD* lpdwFlagsAndAttributes) | 52 | DWORD* lpdwFlagsAndAttributes) { |
61 | { | ||
62 | *lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0; | 53 | *lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0; |
63 | 54 | ||
64 | if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) | 55 | if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) |
@@ -79,8 +70,7 @@ static void win32_translate_open_mode(int mode, | |||
79 | } | 70 | } |
80 | } | 71 | } |
81 | 72 | ||
82 | static voidpf win32_build_iowin(HANDLE hFile) | 73 | static voidpf win32_build_iowin(HANDLE hFile) { |
83 | { | ||
84 | voidpf ret=NULL; | 74 | voidpf ret=NULL; |
85 | 75 | ||
86 | if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE)) | 76 | if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE)) |
@@ -98,8 +88,7 @@ static voidpf win32_build_iowin(HANDLE hFile) | |||
98 | return ret; | 88 | return ret; |
99 | } | 89 | } |
100 | 90 | ||
101 | voidpf ZCALLBACK win32_open64_file_func (voidpf opaque,const void* filename,int mode) | 91 | voidpf ZCALLBACK win32_open64_file_func(voidpf opaque, const void* filename, int mode) { |
102 | { | ||
103 | const char* mode_fopen = NULL; | 92 | const char* mode_fopen = NULL; |
104 | DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; | 93 | DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; |
105 | HANDLE hFile = NULL; | 94 | HANDLE hFile = NULL; |
@@ -127,8 +116,7 @@ voidpf ZCALLBACK win32_open64_file_func (voidpf opaque,const void* filename,int | |||
127 | } | 116 | } |
128 | 117 | ||
129 | 118 | ||
130 | voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque,const void* filename,int mode) | 119 | voidpf ZCALLBACK win32_open64_file_funcA(voidpf opaque, const void* filename, int mode) { |
131 | { | ||
132 | const char* mode_fopen = NULL; | 120 | const char* mode_fopen = NULL; |
133 | DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; | 121 | DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; |
134 | HANDLE hFile = NULL; | 122 | HANDLE hFile = NULL; |
@@ -151,8 +139,7 @@ voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque,const void* filename,int | |||
151 | } | 139 | } |
152 | 140 | ||
153 | 141 | ||
154 | voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int mode) | 142 | voidpf ZCALLBACK win32_open64_file_funcW(voidpf opaque, const void* filename, int mode) { |
155 | { | ||
156 | const char* mode_fopen = NULL; | 143 | const char* mode_fopen = NULL; |
157 | DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; | 144 | DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; |
158 | HANDLE hFile = NULL; | 145 | HANDLE hFile = NULL; |
@@ -171,8 +158,7 @@ voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int | |||
171 | } | 158 | } |
172 | 159 | ||
173 | 160 | ||
174 | voidpf ZCALLBACK win32_open_file_func (voidpf opaque,const char* filename,int mode) | 161 | voidpf ZCALLBACK win32_open_file_func(voidpf opaque, const char* filename, int mode) { |
175 | { | ||
176 | const char* mode_fopen = NULL; | 162 | const char* mode_fopen = NULL; |
177 | DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; | 163 | DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; |
178 | HANDLE hFile = NULL; | 164 | HANDLE hFile = NULL; |
@@ -200,8 +186,7 @@ voidpf ZCALLBACK win32_open_file_func (voidpf opaque,const char* filename,int mo | |||
200 | } | 186 | } |
201 | 187 | ||
202 | 188 | ||
203 | uLong ZCALLBACK win32_read_file_func (voidpf opaque, voidpf stream, void* buf,uLong size) | 189 | uLong ZCALLBACK win32_read_file_func(voidpf opaque, voidpf stream, void* buf,uLong size) { |
204 | { | ||
205 | uLong ret=0; | 190 | uLong ret=0; |
206 | HANDLE hFile = NULL; | 191 | HANDLE hFile = NULL; |
207 | if (stream!=NULL) | 192 | if (stream!=NULL) |
@@ -222,8 +207,7 @@ uLong ZCALLBACK win32_read_file_func (voidpf opaque, voidpf stream, void* buf,uL | |||
222 | } | 207 | } |
223 | 208 | ||
224 | 209 | ||
225 | uLong ZCALLBACK win32_write_file_func (voidpf opaque,voidpf stream,const void* buf,uLong size) | 210 | uLong ZCALLBACK win32_write_file_func(voidpf opaque, voidpf stream, const void* buf, uLong size) { |
226 | { | ||
227 | uLong ret=0; | 211 | uLong ret=0; |
228 | HANDLE hFile = NULL; | 212 | HANDLE hFile = NULL; |
229 | if (stream!=NULL) | 213 | if (stream!=NULL) |
@@ -243,8 +227,7 @@ uLong ZCALLBACK win32_write_file_func (voidpf opaque,voidpf stream,const void* b | |||
243 | return ret; | 227 | return ret; |
244 | } | 228 | } |
245 | 229 | ||
246 | static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod) | 230 | static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod) { |
247 | { | ||
248 | #ifdef IOWIN32_USING_WINRT_API | 231 | #ifdef IOWIN32_USING_WINRT_API |
249 | return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod); | 232 | return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod); |
250 | #else | 233 | #else |
@@ -263,8 +246,7 @@ static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *n | |||
263 | #endif | 246 | #endif |
264 | } | 247 | } |
265 | 248 | ||
266 | long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream) | 249 | long ZCALLBACK win32_tell_file_func(voidpf opaque, voidpf stream) { |
267 | { | ||
268 | long ret=-1; | 250 | long ret=-1; |
269 | HANDLE hFile = NULL; | 251 | HANDLE hFile = NULL; |
270 | if (stream!=NULL) | 252 | if (stream!=NULL) |
@@ -286,8 +268,7 @@ long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream) | |||
286 | return ret; | 268 | return ret; |
287 | } | 269 | } |
288 | 270 | ||
289 | ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream) | 271 | ZPOS64_T ZCALLBACK win32_tell64_file_func(voidpf opaque, voidpf stream) { |
290 | { | ||
291 | ZPOS64_T ret= (ZPOS64_T)-1; | 272 | ZPOS64_T ret= (ZPOS64_T)-1; |
292 | HANDLE hFile = NULL; | 273 | HANDLE hFile = NULL; |
293 | if (stream!=NULL) | 274 | if (stream!=NULL) |
@@ -311,8 +292,7 @@ ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream) | |||
311 | } | 292 | } |
312 | 293 | ||
313 | 294 | ||
314 | long ZCALLBACK win32_seek_file_func (voidpf opaque,voidpf stream,uLong offset,int origin) | 295 | long ZCALLBACK win32_seek_file_func(voidpf opaque, voidpf stream, uLong offset, int origin) { |
315 | { | ||
316 | DWORD dwMoveMethod=0xFFFFFFFF; | 296 | DWORD dwMoveMethod=0xFFFFFFFF; |
317 | HANDLE hFile = NULL; | 297 | HANDLE hFile = NULL; |
318 | 298 | ||
@@ -349,8 +329,7 @@ long ZCALLBACK win32_seek_file_func (voidpf opaque,voidpf stream,uLong offset,in | |||
349 | return ret; | 329 | return ret; |
350 | } | 330 | } |
351 | 331 | ||
352 | long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T offset,int origin) | 332 | long ZCALLBACK win32_seek64_file_func(voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) { |
353 | { | ||
354 | DWORD dwMoveMethod=0xFFFFFFFF; | 333 | DWORD dwMoveMethod=0xFFFFFFFF; |
355 | HANDLE hFile = NULL; | 334 | HANDLE hFile = NULL; |
356 | long ret=-1; | 335 | long ret=-1; |
@@ -388,8 +367,7 @@ long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T off | |||
388 | return ret; | 367 | return ret; |
389 | } | 368 | } |
390 | 369 | ||
391 | int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream) | 370 | int ZCALLBACK win32_close_file_func(voidpf opaque, voidpf stream) { |
392 | { | ||
393 | int ret=-1; | 371 | int ret=-1; |
394 | 372 | ||
395 | if (stream!=NULL) | 373 | if (stream!=NULL) |
@@ -406,8 +384,7 @@ int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream) | |||
406 | return ret; | 384 | return ret; |
407 | } | 385 | } |
408 | 386 | ||
409 | int ZCALLBACK win32_error_file_func (voidpf opaque,voidpf stream) | 387 | int ZCALLBACK win32_error_file_func(voidpf opaque, voidpf stream) { |
410 | { | ||
411 | int ret=-1; | 388 | int ret=-1; |
412 | if (stream!=NULL) | 389 | if (stream!=NULL) |
413 | { | 390 | { |
@@ -416,8 +393,7 @@ int ZCALLBACK win32_error_file_func (voidpf opaque,voidpf stream) | |||
416 | return ret; | 393 | return ret; |
417 | } | 394 | } |
418 | 395 | ||
419 | void fill_win32_filefunc (zlib_filefunc_def* pzlib_filefunc_def) | 396 | void fill_win32_filefunc(zlib_filefunc_def* pzlib_filefunc_def) { |
420 | { | ||
421 | pzlib_filefunc_def->zopen_file = win32_open_file_func; | 397 | pzlib_filefunc_def->zopen_file = win32_open_file_func; |
422 | pzlib_filefunc_def->zread_file = win32_read_file_func; | 398 | pzlib_filefunc_def->zread_file = win32_read_file_func; |
423 | pzlib_filefunc_def->zwrite_file = win32_write_file_func; | 399 | pzlib_filefunc_def->zwrite_file = win32_write_file_func; |
@@ -428,8 +404,7 @@ void fill_win32_filefunc (zlib_filefunc_def* pzlib_filefunc_def) | |||
428 | pzlib_filefunc_def->opaque = NULL; | 404 | pzlib_filefunc_def->opaque = NULL; |
429 | } | 405 | } |
430 | 406 | ||
431 | void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def) | 407 | void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def) { |
432 | { | ||
433 | pzlib_filefunc_def->zopen64_file = win32_open64_file_func; | 408 | pzlib_filefunc_def->zopen64_file = win32_open64_file_func; |
434 | pzlib_filefunc_def->zread_file = win32_read_file_func; | 409 | pzlib_filefunc_def->zread_file = win32_read_file_func; |
435 | pzlib_filefunc_def->zwrite_file = win32_write_file_func; | 410 | pzlib_filefunc_def->zwrite_file = win32_write_file_func; |
@@ -441,8 +416,7 @@ void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def) | |||
441 | } | 416 | } |
442 | 417 | ||
443 | 418 | ||
444 | void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def) | 419 | void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def) { |
445 | { | ||
446 | pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA; | 420 | pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA; |
447 | pzlib_filefunc_def->zread_file = win32_read_file_func; | 421 | pzlib_filefunc_def->zread_file = win32_read_file_func; |
448 | pzlib_filefunc_def->zwrite_file = win32_write_file_func; | 422 | pzlib_filefunc_def->zwrite_file = win32_write_file_func; |
@@ -454,8 +428,7 @@ void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def) | |||
454 | } | 428 | } |
455 | 429 | ||
456 | 430 | ||
457 | void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def) | 431 | void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def) { |
458 | { | ||
459 | pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW; | 432 | pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW; |
460 | pzlib_filefunc_def->zread_file = win32_read_file_func; | 433 | pzlib_filefunc_def->zread_file = win32_read_file_func; |
461 | pzlib_filefunc_def->zwrite_file = win32_write_file_func; | 434 | pzlib_filefunc_def->zwrite_file = win32_write_file_func; |
diff --git a/contrib/minizip/iowin32.h b/contrib/minizip/iowin32.h index 0ca0969..a23a65d 100644 --- a/contrib/minizip/iowin32.h +++ b/contrib/minizip/iowin32.h | |||
@@ -18,10 +18,10 @@ | |||
18 | extern "C" { | 18 | extern "C" { |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); | 21 | void fill_win32_filefunc(zlib_filefunc_def* pzlib_filefunc_def); |
22 | void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def)); | 22 | void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def); |
23 | void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def)); | 23 | void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def); |
24 | void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def)); | 24 | void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def); |
25 | 25 | ||
26 | #ifdef __cplusplus | 26 | #ifdef __cplusplus |
27 | } | 27 | } |
diff --git a/contrib/minizip/miniunz.c b/contrib/minizip/miniunz.c index 0dc9b50..52b0909 100644 --- a/contrib/minizip/miniunz.c +++ b/contrib/minizip/miniunz.c | |||
@@ -81,11 +81,7 @@ | |||
81 | filename : the filename of the file where date/time must be modified | 81 | filename : the filename of the file where date/time must be modified |
82 | dosdate : the new date at the MSDos format (4 bytes) | 82 | dosdate : the new date at the MSDos format (4 bytes) |
83 | tmu_date : the SAME new date at the tm_unz format */ | 83 | tmu_date : the SAME new date at the tm_unz format */ |
84 | static void change_file_date(filename,dosdate,tmu_date) | 84 | static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) { |
85 | const char *filename; | ||
86 | uLong dosdate; | ||
87 | tm_unz tmu_date; | ||
88 | { | ||
89 | #ifdef _WIN32 | 85 | #ifdef _WIN32 |
90 | HANDLE hFile; | 86 | HANDLE hFile; |
91 | FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite; | 87 | FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite; |
@@ -123,9 +119,7 @@ static void change_file_date(filename,dosdate,tmu_date) | |||
123 | /* mymkdir and change_file_date are not 100 % portable | 119 | /* mymkdir and change_file_date are not 100 % portable |
124 | As I don't know well Unix, I wait feedback for the unix portion */ | 120 | As I don't know well Unix, I wait feedback for the unix portion */ |
125 | 121 | ||
126 | static int mymkdir(dirname) | 122 | static int mymkdir(const char* dirname) { |
127 | const char* dirname; | ||
128 | { | ||
129 | int ret=0; | 123 | int ret=0; |
130 | #ifdef _WIN32 | 124 | #ifdef _WIN32 |
131 | ret = _mkdir(dirname); | 125 | ret = _mkdir(dirname); |
@@ -137,9 +131,7 @@ static int mymkdir(dirname) | |||
137 | return ret; | 131 | return ret; |
138 | } | 132 | } |
139 | 133 | ||
140 | static int makedir (newdir) | 134 | static int makedir(const char *newdir) { |
141 | const char *newdir; | ||
142 | { | ||
143 | char *buffer ; | 135 | char *buffer ; |
144 | char *p; | 136 | char *p; |
145 | size_t len = strlen(newdir); | 137 | size_t len = strlen(newdir); |
@@ -187,14 +179,12 @@ static int makedir (newdir) | |||
187 | return 1; | 179 | return 1; |
188 | } | 180 | } |
189 | 181 | ||
190 | static void do_banner() | 182 | static void do_banner(void) { |
191 | { | ||
192 | printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); | 183 | printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); |
193 | printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); | 184 | printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); |
194 | } | 185 | } |
195 | 186 | ||
196 | static void do_help() | 187 | static void do_help(void) { |
197 | { | ||
198 | printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \ | 188 | printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \ |
199 | " -e Extract without pathname (junk paths)\n" \ | 189 | " -e Extract without pathname (junk paths)\n" \ |
200 | " -x Extract with pathname\n" \ | 190 | " -x Extract with pathname\n" \ |
@@ -205,8 +195,7 @@ static void do_help() | |||
205 | " -p extract crypted file using password\n\n"); | 195 | " -p extract crypted file using password\n\n"); |
206 | } | 196 | } |
207 | 197 | ||
208 | static void Display64BitsSize(ZPOS64_T n, int size_char) | 198 | static void Display64BitsSize(ZPOS64_T n, int size_char) { |
209 | { | ||
210 | /* to avoid compatibility problem , we do here the conversion */ | 199 | /* to avoid compatibility problem , we do here the conversion */ |
211 | char number[21]; | 200 | char number[21]; |
212 | int offset=19; | 201 | int offset=19; |
@@ -233,9 +222,7 @@ static void Display64BitsSize(ZPOS64_T n, int size_char) | |||
233 | printf("%s",&number[pos_string]); | 222 | printf("%s",&number[pos_string]); |
234 | } | 223 | } |
235 | 224 | ||
236 | static int do_list(uf) | 225 | static int do_list(unzFile uf) { |
237 | unzFile uf; | ||
238 | { | ||
239 | uLong i; | 226 | uLong i; |
240 | unz_global_info64 gi; | 227 | unz_global_info64 gi; |
241 | int err; | 228 | int err; |
@@ -311,12 +298,7 @@ static int do_list(uf) | |||
311 | } | 298 | } |
312 | 299 | ||
313 | 300 | ||
314 | static int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password) | 301 | static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_path, int* popt_overwrite, const char* password) { |
315 | unzFile uf; | ||
316 | const int* popt_extract_without_path; | ||
317 | int* popt_overwrite; | ||
318 | const char* password; | ||
319 | { | ||
320 | char filename_inzip[256]; | 302 | char filename_inzip[256]; |
321 | char* filename_withoutpath; | 303 | char* filename_withoutpath; |
322 | char* p; | 304 | char* p; |
@@ -473,12 +455,7 @@ static int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,pa | |||
473 | } | 455 | } |
474 | 456 | ||
475 | 457 | ||
476 | static int do_extract(uf,opt_extract_without_path,opt_overwrite,password) | 458 | static int do_extract(unzFile uf, int opt_extract_without_path, int opt_overwrite, const char* password) { |
477 | unzFile uf; | ||
478 | int opt_extract_without_path; | ||
479 | int opt_overwrite; | ||
480 | const char* password; | ||
481 | { | ||
482 | uLong i; | 459 | uLong i; |
483 | unz_global_info64 gi; | 460 | unz_global_info64 gi; |
484 | int err; | 461 | int err; |
@@ -508,13 +485,7 @@ static int do_extract(uf,opt_extract_without_path,opt_overwrite,password) | |||
508 | return 0; | 485 | return 0; |
509 | } | 486 | } |
510 | 487 | ||
511 | static int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password) | 488 | static int do_extract_onefile(unzFile uf, const char* filename, int opt_extract_without_path, int opt_overwrite, const char* password) { |
512 | unzFile uf; | ||
513 | const char* filename; | ||
514 | int opt_extract_without_path; | ||
515 | int opt_overwrite; | ||
516 | const char* password; | ||
517 | { | ||
518 | if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK) | 489 | if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK) |
519 | { | 490 | { |
520 | printf("file %s not found in the zipfile\n",filename); | 491 | printf("file %s not found in the zipfile\n",filename); |
@@ -530,10 +501,7 @@ static int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite | |||
530 | } | 501 | } |
531 | 502 | ||
532 | 503 | ||
533 | int main(argc,argv) | 504 | int main(int argc, char *argv[]) { |
534 | int argc; | ||
535 | char *argv[]; | ||
536 | { | ||
537 | const char *zipfilename=NULL; | 505 | const char *zipfilename=NULL; |
538 | const char *filename_to_extract=NULL; | 506 | const char *filename_to_extract=NULL; |
539 | const char *password=NULL; | 507 | const char *password=NULL; |
diff --git a/contrib/minizip/minizip.c b/contrib/minizip/minizip.c index e8561b1..f0480f2 100644 --- a/contrib/minizip/minizip.c +++ b/contrib/minizip/minizip.c | |||
@@ -71,11 +71,9 @@ | |||
71 | #define MAXFILENAME (256) | 71 | #define MAXFILENAME (256) |
72 | 72 | ||
73 | #ifdef _WIN32 | 73 | #ifdef _WIN32 |
74 | static int filetime(f, tmzip, dt) | 74 | /* f: name of file to get info on, tmzip: return value: access, |
75 | const char *f; /* name of file to get info on */ | 75 | modification and creation times, dt: dostime */ |
76 | tm_zip *tmzip; /* return value: access, modific. and creation times */ | 76 | static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { |
77 | uLong *dt; /* dostime */ | ||
78 | { | ||
79 | int ret = 0; | 77 | int ret = 0; |
80 | { | 78 | { |
81 | FILETIME ftLocal; | 79 | FILETIME ftLocal; |
@@ -95,11 +93,9 @@ static int filetime(f, tmzip, dt) | |||
95 | } | 93 | } |
96 | #else | 94 | #else |
97 | #if defined(unix) || defined(__APPLE__) | 95 | #if defined(unix) || defined(__APPLE__) |
98 | static int filetime(f, tmzip, dt) | 96 | /* f: name of file to get info on, tmzip: return value: access, |
99 | const char *f; /* name of file to get info on */ | 97 | modification and creation times, dt: dostime */ |
100 | tm_zip *tmzip; /* return value: access, modific. and creation times */ | 98 | static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { |
101 | uLong *dt; /* dostime */ | ||
102 | { | ||
103 | (void)dt; | 99 | (void)dt; |
104 | int ret=0; | 100 | int ret=0; |
105 | struct stat s; /* results of stat() */ | 101 | struct stat s; /* results of stat() */ |
@@ -138,11 +134,12 @@ static int filetime(f, tmzip, dt) | |||
138 | return ret; | 134 | return ret; |
139 | } | 135 | } |
140 | #else | 136 | #else |
141 | uLong filetime(f, tmzip, dt) | 137 | /* f: name of file to get info on, tmzip: return value: access, |
142 | const char *f; /* name of file to get info on */ | 138 | modification and creation times, dt: dostime */ |
143 | tm_zip *tmzip; /* return value: access, modific. and creation times */ | 139 | uLong filetime(const char *f, tm_zip *tmzip, uLong *dt) { |
144 | uLong *dt; /* dostime */ | 140 | (void)f; |
145 | { | 141 | (void)tmzip; |
142 | (void)dt; | ||
146 | return 0; | 143 | return 0; |
147 | } | 144 | } |
148 | #endif | 145 | #endif |
@@ -151,9 +148,7 @@ uLong filetime(f, tmzip, dt) | |||
151 | 148 | ||
152 | 149 | ||
153 | 150 | ||
154 | static int check_exist_file(filename) | 151 | static int check_exist_file(const char* filename) { |
155 | const char* filename; | ||
156 | { | ||
157 | FILE* ftestexist; | 152 | FILE* ftestexist; |
158 | int ret = 1; | 153 | int ret = 1; |
159 | ftestexist = FOPEN_FUNC(filename,"rb"); | 154 | ftestexist = FOPEN_FUNC(filename,"rb"); |
@@ -164,14 +159,12 @@ static int check_exist_file(filename) | |||
164 | return ret; | 159 | return ret; |
165 | } | 160 | } |
166 | 161 | ||
167 | static void do_banner() | 162 | static void do_banner(void) { |
168 | { | ||
169 | printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n"); | 163 | printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n"); |
170 | printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n"); | 164 | printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n"); |
171 | } | 165 | } |
172 | 166 | ||
173 | static void do_help() | 167 | static void do_help(void) { |
174 | { | ||
175 | printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \ | 168 | printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \ |
176 | " -o Overwrite existing file.zip\n" \ | 169 | " -o Overwrite existing file.zip\n" \ |
177 | " -a Append to existing file.zip\n" \ | 170 | " -a Append to existing file.zip\n" \ |
@@ -183,8 +176,7 @@ static void do_help() | |||
183 | 176 | ||
184 | /* calculate the CRC32 of a file, | 177 | /* calculate the CRC32 of a file, |
185 | because to encrypt a file, we need known the CRC32 of the file before */ | 178 | because to encrypt a file, we need known the CRC32 of the file before */ |
186 | static int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc) | 179 | static int getFileCrc(const char* filenameinzip, void* buf, unsigned long size_buf, unsigned long* result_crc) { |
187 | { | ||
188 | unsigned long calculate_crc=0; | 180 | unsigned long calculate_crc=0; |
189 | int err=ZIP_OK; | 181 | int err=ZIP_OK; |
190 | FILE * fin = FOPEN_FUNC(filenameinzip,"rb"); | 182 | FILE * fin = FOPEN_FUNC(filenameinzip,"rb"); |
@@ -222,8 +214,7 @@ static int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf, | |||
222 | return err; | 214 | return err; |
223 | } | 215 | } |
224 | 216 | ||
225 | static int isLargeFile(const char* filename) | 217 | static int isLargeFile(const char* filename) { |
226 | { | ||
227 | int largeFile = 0; | 218 | int largeFile = 0; |
228 | ZPOS64_T pos = 0; | 219 | ZPOS64_T pos = 0; |
229 | FILE* pFile = FOPEN_FUNC(filename, "rb"); | 220 | FILE* pFile = FOPEN_FUNC(filename, "rb"); |
@@ -244,10 +235,7 @@ static int isLargeFile(const char* filename) | |||
244 | return largeFile; | 235 | return largeFile; |
245 | } | 236 | } |
246 | 237 | ||
247 | int main(argc,argv) | 238 | int main(int argc, char *argv[]) { |
248 | int argc; | ||
249 | char *argv[]; | ||
250 | { | ||
251 | int i; | 239 | int i; |
252 | int opt_overwrite=0; | 240 | int opt_overwrite=0; |
253 | int opt_compress_level=Z_DEFAULT_COMPRESSION; | 241 | int opt_compress_level=Z_DEFAULT_COMPRESSION; |
diff --git a/contrib/minizip/mztools.c b/contrib/minizip/mztools.c index 96891c2..c8d2375 100644 --- a/contrib/minizip/mztools.c +++ b/contrib/minizip/mztools.c | |||
@@ -27,13 +27,7 @@ | |||
27 | WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \ | 27 | WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \ |
28 | } while(0) | 28 | } while(0) |
29 | 29 | ||
30 | extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered) | 30 | extern int ZEXPORT unzRepair(const char* file, const char* fileOut, const char* fileOutTmp, uLong* nRecovered, uLong* bytesRecovered) { |
31 | const char* file; | ||
32 | const char* fileOut; | ||
33 | const char* fileOutTmp; | ||
34 | uLong* nRecovered; | ||
35 | uLong* bytesRecovered; | ||
36 | { | ||
37 | int err = Z_OK; | 31 | int err = Z_OK; |
38 | FILE* fpZip = fopen(file, "rb"); | 32 | FILE* fpZip = fopen(file, "rb"); |
39 | FILE* fpOut = fopen(fileOut, "wb"); | 33 | FILE* fpOut = fopen(fileOut, "wb"); |
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c index 3036b47..ad2eb3b 100644 --- a/contrib/minizip/unzip.c +++ b/contrib/minizip/unzip.c | |||
@@ -204,13 +204,7 @@ typedef struct | |||
204 | */ | 204 | */ |
205 | 205 | ||
206 | 206 | ||
207 | local int unz64local_getByte OF(( | 207 | local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi) { |
208 | const zlib_filefunc64_32_def* pzlib_filefunc_def, | ||
209 | voidpf filestream, | ||
210 | int *pi)); | ||
211 | |||
212 | local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi) | ||
213 | { | ||
214 | unsigned char c; | 208 | unsigned char c; |
215 | int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1); | 209 | int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1); |
216 | if (err==1) | 210 | if (err==1) |
@@ -231,15 +225,10 @@ local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, v | |||
231 | /* =========================================================================== | 225 | /* =========================================================================== |
232 | Reads a long in LSB order from the given gz_stream. Sets | 226 | Reads a long in LSB order from the given gz_stream. Sets |
233 | */ | 227 | */ |
234 | local int unz64local_getShort OF(( | ||
235 | const zlib_filefunc64_32_def* pzlib_filefunc_def, | ||
236 | voidpf filestream, | ||
237 | uLong *pX)); | ||
238 | 228 | ||
239 | local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, | 229 | local int unz64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def, |
240 | voidpf filestream, | 230 | voidpf filestream, |
241 | uLong *pX) | 231 | uLong *pX) { |
242 | { | ||
243 | uLong x ; | 232 | uLong x ; |
244 | int i = 0; | 233 | int i = 0; |
245 | int err; | 234 | int err; |
@@ -258,15 +247,9 @@ local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, | |||
258 | return err; | 247 | return err; |
259 | } | 248 | } |
260 | 249 | ||
261 | local int unz64local_getLong OF(( | 250 | local int unz64local_getLong(const zlib_filefunc64_32_def* pzlib_filefunc_def, |
262 | const zlib_filefunc64_32_def* pzlib_filefunc_def, | 251 | voidpf filestream, |
263 | voidpf filestream, | 252 | uLong *pX) { |
264 | uLong *pX)); | ||
265 | |||
266 | local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, | ||
267 | voidpf filestream, | ||
268 | uLong *pX) | ||
269 | { | ||
270 | uLong x ; | 253 | uLong x ; |
271 | int i = 0; | 254 | int i = 0; |
272 | int err; | 255 | int err; |
@@ -293,16 +276,10 @@ local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, | |||
293 | return err; | 276 | return err; |
294 | } | 277 | } |
295 | 278 | ||
296 | local int unz64local_getLong64 OF(( | ||
297 | const zlib_filefunc64_32_def* pzlib_filefunc_def, | ||
298 | voidpf filestream, | ||
299 | ZPOS64_T *pX)); | ||
300 | 279 | ||
301 | 280 | local int unz64local_getLong64(const zlib_filefunc64_32_def* pzlib_filefunc_def, | |
302 | local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, | 281 | voidpf filestream, |
303 | voidpf filestream, | 282 | ZPOS64_T *pX) { |
304 | ZPOS64_T *pX) | ||
305 | { | ||
306 | ZPOS64_T x ; | 283 | ZPOS64_T x ; |
307 | int i = 0; | 284 | int i = 0; |
308 | int err; | 285 | int err; |
@@ -346,8 +323,7 @@ local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def | |||
346 | } | 323 | } |
347 | 324 | ||
348 | /* My own strcmpi / strcasecmp */ | 325 | /* My own strcmpi / strcasecmp */ |
349 | local int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2) | 326 | local int strcmpcasenosensitive_internal(const char* fileName1, const char* fileName2) { |
350 | { | ||
351 | for (;;) | 327 | for (;;) |
352 | { | 328 | { |
353 | char c1=*(fileName1++); | 329 | char c1=*(fileName1++); |
@@ -388,10 +364,8 @@ local int strcmpcasenosensitive_internal (const char* fileName1, const char* fil | |||
388 | 364 | ||
389 | */ | 365 | */ |
390 | extern int ZEXPORT unzStringFileNameCompare (const char* fileName1, | 366 | extern int ZEXPORT unzStringFileNameCompare (const char* fileName1, |
391 | const char* fileName2, | 367 | const char* fileName2, |
392 | int iCaseSensitivity) | 368 | int iCaseSensitivity) { |
393 | |||
394 | { | ||
395 | if (iCaseSensitivity==0) | 369 | if (iCaseSensitivity==0) |
396 | iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; | 370 | iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; |
397 | 371 | ||
@@ -409,9 +383,7 @@ extern int ZEXPORT unzStringFileNameCompare (const char* fileName1, | |||
409 | Locate the Central directory of a zipfile (at the end, just before | 383 | Locate the Central directory of a zipfile (at the end, just before |
410 | the global comment) | 384 | the global comment) |
411 | */ | 385 | */ |
412 | local ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)); | 386 | local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) { |
413 | local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) | ||
414 | { | ||
415 | unsigned char* buf; | 387 | unsigned char* buf; |
416 | ZPOS64_T uSizeFile; | 388 | ZPOS64_T uSizeFile; |
417 | ZPOS64_T uBackRead; | 389 | ZPOS64_T uBackRead; |
@@ -471,13 +443,8 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f | |||
471 | Locate the Central directory 64 of a zipfile (at the end, just before | 443 | Locate the Central directory 64 of a zipfile (at the end, just before |
472 | the global comment) | 444 | the global comment) |
473 | */ | 445 | */ |
474 | local ZPOS64_T unz64local_SearchCentralDir64 OF(( | ||
475 | const zlib_filefunc64_32_def* pzlib_filefunc_def, | ||
476 | voidpf filestream)); | ||
477 | |||
478 | local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, | 446 | local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, |
479 | voidpf filestream) | 447 | voidpf filestream) { |
480 | { | ||
481 | unsigned char* buf; | 448 | unsigned char* buf; |
482 | ZPOS64_T uSizeFile; | 449 | ZPOS64_T uSizeFile; |
483 | ZPOS64_T uBackRead; | 450 | ZPOS64_T uBackRead; |
@@ -581,10 +548,9 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib | |||
581 | Else, the return value is a unzFile Handle, usable with other function | 548 | Else, the return value is a unzFile Handle, usable with other function |
582 | of this unzip package. | 549 | of this unzip package. |
583 | */ | 550 | */ |
584 | local unzFile unzOpenInternal (const void *path, | 551 | local unzFile unzOpenInternal(const void *path, |
585 | zlib_filefunc64_32_def* pzlib_filefunc64_32_def, | 552 | zlib_filefunc64_32_def* pzlib_filefunc64_32_def, |
586 | int is64bitOpenFunction) | 553 | int is64bitOpenFunction) { |
587 | { | ||
588 | unz64_s us; | 554 | unz64_s us; |
589 | unz64_s *s; | 555 | unz64_s *s; |
590 | ZPOS64_T central_pos; | 556 | ZPOS64_T central_pos; |
@@ -762,9 +728,8 @@ local unzFile unzOpenInternal (const void *path, | |||
762 | } | 728 | } |
763 | 729 | ||
764 | 730 | ||
765 | extern unzFile ZEXPORT unzOpen2 (const char *path, | 731 | extern unzFile ZEXPORT unzOpen2(const char *path, |
766 | zlib_filefunc_def* pzlib_filefunc32_def) | 732 | zlib_filefunc_def* pzlib_filefunc32_def) { |
767 | { | ||
768 | if (pzlib_filefunc32_def != NULL) | 733 | if (pzlib_filefunc32_def != NULL) |
769 | { | 734 | { |
770 | zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; | 735 | zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; |
@@ -775,9 +740,8 @@ extern unzFile ZEXPORT unzOpen2 (const char *path, | |||
775 | return unzOpenInternal(path, NULL, 0); | 740 | return unzOpenInternal(path, NULL, 0); |
776 | } | 741 | } |
777 | 742 | ||
778 | extern unzFile ZEXPORT unzOpen2_64 (const void *path, | 743 | extern unzFile ZEXPORT unzOpen2_64(const void *path, |
779 | zlib_filefunc64_def* pzlib_filefunc_def) | 744 | zlib_filefunc64_def* pzlib_filefunc_def) { |
780 | { | ||
781 | if (pzlib_filefunc_def != NULL) | 745 | if (pzlib_filefunc_def != NULL) |
782 | { | 746 | { |
783 | zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; | 747 | zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; |
@@ -790,13 +754,11 @@ extern unzFile ZEXPORT unzOpen2_64 (const void *path, | |||
790 | return unzOpenInternal(path, NULL, 1); | 754 | return unzOpenInternal(path, NULL, 1); |
791 | } | 755 | } |
792 | 756 | ||
793 | extern unzFile ZEXPORT unzOpen (const char *path) | 757 | extern unzFile ZEXPORT unzOpen(const char *path) { |
794 | { | ||
795 | return unzOpenInternal(path, NULL, 0); | 758 | return unzOpenInternal(path, NULL, 0); |
796 | } | 759 | } |
797 | 760 | ||
798 | extern unzFile ZEXPORT unzOpen64 (const void *path) | 761 | extern unzFile ZEXPORT unzOpen64(const void *path) { |
799 | { | ||
800 | return unzOpenInternal(path, NULL, 1); | 762 | return unzOpenInternal(path, NULL, 1); |
801 | } | 763 | } |
802 | 764 | ||
@@ -805,8 +767,7 @@ extern unzFile ZEXPORT unzOpen64 (const void *path) | |||
805 | If there is files inside the .Zip opened with unzOpenCurrentFile (see later), | 767 | If there is files inside the .Zip opened with unzOpenCurrentFile (see later), |
806 | these files MUST be closed with unzCloseCurrentFile before call unzClose. | 768 | these files MUST be closed with unzCloseCurrentFile before call unzClose. |
807 | return UNZ_OK if there is no problem. */ | 769 | return UNZ_OK if there is no problem. */ |
808 | extern int ZEXPORT unzClose (unzFile file) | 770 | extern int ZEXPORT unzClose(unzFile file) { |
809 | { | ||
810 | unz64_s* s; | 771 | unz64_s* s; |
811 | if (file==NULL) | 772 | if (file==NULL) |
812 | return UNZ_PARAMERROR; | 773 | return UNZ_PARAMERROR; |
@@ -825,8 +786,7 @@ extern int ZEXPORT unzClose (unzFile file) | |||
825 | Write info about the ZipFile in the *pglobal_info structure. | 786 | Write info about the ZipFile in the *pglobal_info structure. |
826 | No preparation of the structure is needed | 787 | No preparation of the structure is needed |
827 | return UNZ_OK if there is no problem. */ | 788 | return UNZ_OK if there is no problem. */ |
828 | extern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_info) | 789 | extern int ZEXPORT unzGetGlobalInfo64(unzFile file, unz_global_info64* pglobal_info) { |
829 | { | ||
830 | unz64_s* s; | 790 | unz64_s* s; |
831 | if (file==NULL) | 791 | if (file==NULL) |
832 | return UNZ_PARAMERROR; | 792 | return UNZ_PARAMERROR; |
@@ -835,8 +795,7 @@ extern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_ | |||
835 | return UNZ_OK; | 795 | return UNZ_OK; |
836 | } | 796 | } |
837 | 797 | ||
838 | extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info32) | 798 | extern int ZEXPORT unzGetGlobalInfo(unzFile file, unz_global_info* pglobal_info32) { |
839 | { | ||
840 | unz64_s* s; | 799 | unz64_s* s; |
841 | if (file==NULL) | 800 | if (file==NULL) |
842 | return UNZ_PARAMERROR; | 801 | return UNZ_PARAMERROR; |
@@ -849,8 +808,7 @@ extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info | |||
849 | /* | 808 | /* |
850 | Translate date/time from Dos format to tm_unz (readable more easilty) | 809 | Translate date/time from Dos format to tm_unz (readable more easilty) |
851 | */ | 810 | */ |
852 | local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm) | 811 | local void unz64local_DosDateToTmuDate(ZPOS64_T ulDosDate, tm_unz* ptm) { |
853 | { | ||
854 | ZPOS64_T uDate; | 812 | ZPOS64_T uDate; |
855 | uDate = (ZPOS64_T)(ulDosDate>>16); | 813 | uDate = (ZPOS64_T)(ulDosDate>>16); |
856 | ptm->tm_mday = (int)(uDate&0x1f) ; | 814 | ptm->tm_mday = (int)(uDate&0x1f) ; |
@@ -865,28 +823,16 @@ local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm) | |||
865 | /* | 823 | /* |
866 | Get Info about the current file in the zipfile, with internal only info | 824 | Get Info about the current file in the zipfile, with internal only info |
867 | */ | 825 | */ |
868 | local int unz64local_GetCurrentFileInfoInternal OF((unzFile file, | 826 | local int unz64local_GetCurrentFileInfoInternal(unzFile file, |
869 | unz_file_info64 *pfile_info, | 827 | unz_file_info64 *pfile_info, |
870 | unz_file_info64_internal | 828 | unz_file_info64_internal |
871 | *pfile_info_internal, | 829 | *pfile_info_internal, |
872 | char *szFileName, | 830 | char *szFileName, |
873 | uLong fileNameBufferSize, | 831 | uLong fileNameBufferSize, |
874 | void *extraField, | 832 | void *extraField, |
875 | uLong extraFieldBufferSize, | 833 | uLong extraFieldBufferSize, |
876 | char *szComment, | 834 | char *szComment, |
877 | uLong commentBufferSize)); | 835 | uLong commentBufferSize) { |
878 | |||
879 | local int unz64local_GetCurrentFileInfoInternal (unzFile file, | ||
880 | unz_file_info64 *pfile_info, | ||
881 | unz_file_info64_internal | ||
882 | *pfile_info_internal, | ||
883 | char *szFileName, | ||
884 | uLong fileNameBufferSize, | ||
885 | void *extraField, | ||
886 | uLong extraFieldBufferSize, | ||
887 | char *szComment, | ||
888 | uLong commentBufferSize) | ||
889 | { | ||
890 | unz64_s* s; | 836 | unz64_s* s; |
891 | unz_file_info64 file_info; | 837 | unz_file_info64 file_info; |
892 | unz_file_info64_internal file_info_internal; | 838 | unz_file_info64_internal file_info_internal; |
@@ -1038,33 +984,33 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, | |||
1038 | /* ZIP64 extra fields */ | 984 | /* ZIP64 extra fields */ |
1039 | if (headerId == 0x0001) | 985 | if (headerId == 0x0001) |
1040 | { | 986 | { |
1041 | uLong uL; | 987 | uLong uL; |
1042 | 988 | ||
1043 | if(file_info.uncompressed_size == MAXU32) | 989 | if(file_info.uncompressed_size == MAXU32) |
1044 | { | 990 | { |
1045 | if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK) | 991 | if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK) |
1046 | err=UNZ_ERRNO; | 992 | err=UNZ_ERRNO; |
1047 | } | 993 | } |
1048 | 994 | ||
1049 | if(file_info.compressed_size == MAXU32) | 995 | if(file_info.compressed_size == MAXU32) |
1050 | { | 996 | { |
1051 | if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK) | 997 | if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK) |
1052 | err=UNZ_ERRNO; | 998 | err=UNZ_ERRNO; |
1053 | } | 999 | } |
1054 | 1000 | ||
1055 | if(file_info_internal.offset_curfile == MAXU32) | 1001 | if(file_info_internal.offset_curfile == MAXU32) |
1056 | { | 1002 | { |
1057 | /* Relative Header offset */ | 1003 | /* Relative Header offset */ |
1058 | if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK) | 1004 | if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK) |
1059 | err=UNZ_ERRNO; | 1005 | err=UNZ_ERRNO; |
1060 | } | 1006 | } |
1061 | 1007 | ||
1062 | if(file_info.disk_num_start == MAXU32) | 1008 | if(file_info.disk_num_start == MAXU32) |
1063 | { | 1009 | { |
1064 | /* Disk Start Number */ | 1010 | /* Disk Start Number */ |
1065 | if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) | 1011 | if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) |
1066 | err=UNZ_ERRNO; | 1012 | err=UNZ_ERRNO; |
1067 | } | 1013 | } |
1068 | 1014 | ||
1069 | } | 1015 | } |
1070 | else | 1016 | else |
@@ -1121,24 +1067,22 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, | |||
1121 | No preparation of the structure is needed | 1067 | No preparation of the structure is needed |
1122 | return UNZ_OK if there is no problem. | 1068 | return UNZ_OK if there is no problem. |
1123 | */ | 1069 | */ |
1124 | extern int ZEXPORT unzGetCurrentFileInfo64 (unzFile file, | 1070 | extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file, |
1125 | unz_file_info64 * pfile_info, | 1071 | unz_file_info64 * pfile_info, |
1126 | char * szFileName, uLong fileNameBufferSize, | 1072 | char * szFileName, uLong fileNameBufferSize, |
1127 | void *extraField, uLong extraFieldBufferSize, | 1073 | void *extraField, uLong extraFieldBufferSize, |
1128 | char* szComment, uLong commentBufferSize) | 1074 | char* szComment, uLong commentBufferSize) { |
1129 | { | ||
1130 | return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL, | 1075 | return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL, |
1131 | szFileName,fileNameBufferSize, | 1076 | szFileName,fileNameBufferSize, |
1132 | extraField,extraFieldBufferSize, | 1077 | extraField,extraFieldBufferSize, |
1133 | szComment,commentBufferSize); | 1078 | szComment,commentBufferSize); |
1134 | } | 1079 | } |
1135 | 1080 | ||
1136 | extern int ZEXPORT unzGetCurrentFileInfo (unzFile file, | 1081 | extern int ZEXPORT unzGetCurrentFileInfo(unzFile file, |
1137 | unz_file_info * pfile_info, | 1082 | unz_file_info * pfile_info, |
1138 | char * szFileName, uLong fileNameBufferSize, | 1083 | char * szFileName, uLong fileNameBufferSize, |
1139 | void *extraField, uLong extraFieldBufferSize, | 1084 | void *extraField, uLong extraFieldBufferSize, |
1140 | char* szComment, uLong commentBufferSize) | 1085 | char* szComment, uLong commentBufferSize) { |
1141 | { | ||
1142 | int err; | 1086 | int err; |
1143 | unz_file_info64 file_info64; | 1087 | unz_file_info64 file_info64; |
1144 | err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL, | 1088 | err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL, |
@@ -1175,8 +1119,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file, | |||
1175 | Set the current file of the zipfile to the first file. | 1119 | Set the current file of the zipfile to the first file. |
1176 | return UNZ_OK if there is no problem | 1120 | return UNZ_OK if there is no problem |
1177 | */ | 1121 | */ |
1178 | extern int ZEXPORT unzGoToFirstFile (unzFile file) | 1122 | extern int ZEXPORT unzGoToFirstFile(unzFile file) { |
1179 | { | ||
1180 | int err=UNZ_OK; | 1123 | int err=UNZ_OK; |
1181 | unz64_s* s; | 1124 | unz64_s* s; |
1182 | if (file==NULL) | 1125 | if (file==NULL) |
@@ -1196,8 +1139,7 @@ extern int ZEXPORT unzGoToFirstFile (unzFile file) | |||
1196 | return UNZ_OK if there is no problem | 1139 | return UNZ_OK if there is no problem |
1197 | return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. | 1140 | return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. |
1198 | */ | 1141 | */ |
1199 | extern int ZEXPORT unzGoToNextFile (unzFile file) | 1142 | extern int ZEXPORT unzGoToNextFile(unzFile file) { |
1200 | { | ||
1201 | unz64_s* s; | 1143 | unz64_s* s; |
1202 | int err; | 1144 | int err; |
1203 | 1145 | ||
@@ -1229,8 +1171,7 @@ extern int ZEXPORT unzGoToNextFile (unzFile file) | |||
1229 | UNZ_OK if the file is found. It becomes the current file. | 1171 | UNZ_OK if the file is found. It becomes the current file. |
1230 | UNZ_END_OF_LIST_OF_FILE if the file is not found | 1172 | UNZ_END_OF_LIST_OF_FILE if the file is not found |
1231 | */ | 1173 | */ |
1232 | extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity) | 1174 | extern int ZEXPORT unzLocateFile(unzFile file, const char *szFileName, int iCaseSensitivity) { |
1233 | { | ||
1234 | unz64_s* s; | 1175 | unz64_s* s; |
1235 | int err; | 1176 | int err; |
1236 | 1177 | ||
@@ -1305,8 +1246,7 @@ typedef struct unz_file_pos_s | |||
1305 | } unz_file_pos; | 1246 | } unz_file_pos; |
1306 | */ | 1247 | */ |
1307 | 1248 | ||
1308 | extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos) | 1249 | extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos) { |
1309 | { | ||
1310 | unz64_s* s; | 1250 | unz64_s* s; |
1311 | 1251 | ||
1312 | if (file==NULL || file_pos==NULL) | 1252 | if (file==NULL || file_pos==NULL) |
@@ -1321,10 +1261,7 @@ extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos) | |||
1321 | return UNZ_OK; | 1261 | return UNZ_OK; |
1322 | } | 1262 | } |
1323 | 1263 | ||
1324 | extern int ZEXPORT unzGetFilePos( | 1264 | extern int ZEXPORT unzGetFilePos(unzFile file, unz_file_pos* file_pos) { |
1325 | unzFile file, | ||
1326 | unz_file_pos* file_pos) | ||
1327 | { | ||
1328 | unz64_file_pos file_pos64; | 1265 | unz64_file_pos file_pos64; |
1329 | int err = unzGetFilePos64(file,&file_pos64); | 1266 | int err = unzGetFilePos64(file,&file_pos64); |
1330 | if (err==UNZ_OK) | 1267 | if (err==UNZ_OK) |
@@ -1335,8 +1272,7 @@ extern int ZEXPORT unzGetFilePos( | |||
1335 | return err; | 1272 | return err; |
1336 | } | 1273 | } |
1337 | 1274 | ||
1338 | extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos) | 1275 | extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos) { |
1339 | { | ||
1340 | unz64_s* s; | 1276 | unz64_s* s; |
1341 | int err; | 1277 | int err; |
1342 | 1278 | ||
@@ -1357,10 +1293,7 @@ extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos | |||
1357 | return err; | 1293 | return err; |
1358 | } | 1294 | } |
1359 | 1295 | ||
1360 | extern int ZEXPORT unzGoToFilePos( | 1296 | extern int ZEXPORT unzGoToFilePos(unzFile file, unz_file_pos* file_pos) { |
1361 | unzFile file, | ||
1362 | unz_file_pos* file_pos) | ||
1363 | { | ||
1364 | unz64_file_pos file_pos64; | 1297 | unz64_file_pos file_pos64; |
1365 | if (file_pos == NULL) | 1298 | if (file_pos == NULL) |
1366 | return UNZ_PARAMERROR; | 1299 | return UNZ_PARAMERROR; |
@@ -1382,10 +1315,9 @@ extern int ZEXPORT unzGoToFilePos( | |||
1382 | store in *piSizeVar the size of extra info in local header | 1315 | store in *piSizeVar the size of extra info in local header |
1383 | (filename and size of extra field data) | 1316 | (filename and size of extra field data) |
1384 | */ | 1317 | */ |
1385 | local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVar, | 1318 | local int unz64local_CheckCurrentFileCoherencyHeader(unz64_s* s, uInt* piSizeVar, |
1386 | ZPOS64_T * poffset_local_extrafield, | 1319 | ZPOS64_T * poffset_local_extrafield, |
1387 | uInt * psize_local_extrafield) | 1320 | uInt * psize_local_extrafield) { |
1388 | { | ||
1389 | uLong uMagic,uData,uFlags; | 1321 | uLong uMagic,uData,uFlags; |
1390 | uLong size_filename; | 1322 | uLong size_filename; |
1391 | uLong size_extra_field; | 1323 | uLong size_extra_field; |
@@ -1469,9 +1401,8 @@ local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVa | |||
1469 | Open for reading data the current file in the zipfile. | 1401 | Open for reading data the current file in the zipfile. |
1470 | If there is no error and the file is opened, the return value is UNZ_OK. | 1402 | If there is no error and the file is opened, the return value is UNZ_OK. |
1471 | */ | 1403 | */ |
1472 | extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, | 1404 | extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method, |
1473 | int* level, int raw, const char* password) | 1405 | int* level, int raw, const char* password) { |
1474 | { | ||
1475 | int err=UNZ_OK; | 1406 | int err=UNZ_OK; |
1476 | uInt iSizeVar; | 1407 | uInt iSizeVar; |
1477 | unz64_s* s; | 1408 | unz64_s* s; |
@@ -1640,25 +1571,21 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, | |||
1640 | return UNZ_OK; | 1571 | return UNZ_OK; |
1641 | } | 1572 | } |
1642 | 1573 | ||
1643 | extern int ZEXPORT unzOpenCurrentFile (unzFile file) | 1574 | extern int ZEXPORT unzOpenCurrentFile(unzFile file) { |
1644 | { | ||
1645 | return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL); | 1575 | return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL); |
1646 | } | 1576 | } |
1647 | 1577 | ||
1648 | extern int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char* password) | 1578 | extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file, const char* password) { |
1649 | { | ||
1650 | return unzOpenCurrentFile3(file, NULL, NULL, 0, password); | 1579 | return unzOpenCurrentFile3(file, NULL, NULL, 0, password); |
1651 | } | 1580 | } |
1652 | 1581 | ||
1653 | extern int ZEXPORT unzOpenCurrentFile2 (unzFile file, int* method, int* level, int raw) | 1582 | extern int ZEXPORT unzOpenCurrentFile2(unzFile file, int* method, int* level, int raw) { |
1654 | { | ||
1655 | return unzOpenCurrentFile3(file, method, level, raw, NULL); | 1583 | return unzOpenCurrentFile3(file, method, level, raw, NULL); |
1656 | } | 1584 | } |
1657 | 1585 | ||
1658 | /** Addition for GDAL : START */ | 1586 | /** Addition for GDAL : START */ |
1659 | 1587 | ||
1660 | extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file) | 1588 | extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file) { |
1661 | { | ||
1662 | unz64_s* s; | 1589 | unz64_s* s; |
1663 | file_in_zip64_read_info_s* pfile_in_zip_read_info; | 1590 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
1664 | s=(unz64_s*)file; | 1591 | s=(unz64_s*)file; |
@@ -1683,8 +1610,7 @@ extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file) | |||
1683 | return <0 with error code if there is an error | 1610 | return <0 with error code if there is an error |
1684 | (UNZ_ERRNO for IO error, or zLib error for uncompress error) | 1611 | (UNZ_ERRNO for IO error, or zLib error for uncompress error) |
1685 | */ | 1612 | */ |
1686 | extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) | 1613 | extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) { |
1687 | { | ||
1688 | int err=UNZ_OK; | 1614 | int err=UNZ_OK; |
1689 | uInt iRead = 0; | 1615 | uInt iRead = 0; |
1690 | unz64_s* s; | 1616 | unz64_s* s; |
@@ -1891,8 +1817,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) | |||
1891 | /* | 1817 | /* |
1892 | Give the current position in uncompressed data | 1818 | Give the current position in uncompressed data |
1893 | */ | 1819 | */ |
1894 | extern z_off_t ZEXPORT unztell (unzFile file) | 1820 | extern z_off_t ZEXPORT unztell(unzFile file) { |
1895 | { | ||
1896 | unz64_s* s; | 1821 | unz64_s* s; |
1897 | file_in_zip64_read_info_s* pfile_in_zip_read_info; | 1822 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
1898 | if (file==NULL) | 1823 | if (file==NULL) |
@@ -1906,8 +1831,7 @@ extern z_off_t ZEXPORT unztell (unzFile file) | |||
1906 | return (z_off_t)pfile_in_zip_read_info->stream.total_out; | 1831 | return (z_off_t)pfile_in_zip_read_info->stream.total_out; |
1907 | } | 1832 | } |
1908 | 1833 | ||
1909 | extern ZPOS64_T ZEXPORT unztell64 (unzFile file) | 1834 | extern ZPOS64_T ZEXPORT unztell64(unzFile file) { |
1910 | { | ||
1911 | 1835 | ||
1912 | unz64_s* s; | 1836 | unz64_s* s; |
1913 | file_in_zip64_read_info_s* pfile_in_zip_read_info; | 1837 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
@@ -1926,8 +1850,7 @@ extern ZPOS64_T ZEXPORT unztell64 (unzFile file) | |||
1926 | /* | 1850 | /* |
1927 | return 1 if the end of file was reached, 0 elsewhere | 1851 | return 1 if the end of file was reached, 0 elsewhere |
1928 | */ | 1852 | */ |
1929 | extern int ZEXPORT unzeof (unzFile file) | 1853 | extern int ZEXPORT unzeof(unzFile file) { |
1930 | { | ||
1931 | unz64_s* s; | 1854 | unz64_s* s; |
1932 | file_in_zip64_read_info_s* pfile_in_zip_read_info; | 1855 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
1933 | if (file==NULL) | 1856 | if (file==NULL) |
@@ -1958,8 +1881,7 @@ more info in the local-header version than in the central-header) | |||
1958 | the return value is the number of bytes copied in buf, or (if <0) | 1881 | the return value is the number of bytes copied in buf, or (if <0) |
1959 | the error code | 1882 | the error code |
1960 | */ | 1883 | */ |
1961 | extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len) | 1884 | extern int ZEXPORT unzGetLocalExtrafield(unzFile file, voidp buf, unsigned len) { |
1962 | { | ||
1963 | unz64_s* s; | 1885 | unz64_s* s; |
1964 | file_in_zip64_read_info_s* pfile_in_zip_read_info; | 1886 | file_in_zip64_read_info_s* pfile_in_zip_read_info; |
1965 | uInt read_now; | 1887 | uInt read_now; |
@@ -2006,8 +1928,7 @@ extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len) | |||
2006 | Close the file in zip opened with unzOpenCurrentFile | 1928 | Close the file in zip opened with unzOpenCurrentFile |
2007 | Return UNZ_CRCERROR if all the file was read but the CRC is not good | 1929 | Return UNZ_CRCERROR if all the file was read but the CRC is not good |
2008 | */ | 1930 | */ |
2009 | extern int ZEXPORT unzCloseCurrentFile (unzFile file) | 1931 | extern int ZEXPORT unzCloseCurrentFile(unzFile file) { |
2010 | { | ||
2011 | int err=UNZ_OK; | 1932 | int err=UNZ_OK; |
2012 | 1933 | ||
2013 | unz64_s* s; | 1934 | unz64_s* s; |
@@ -2053,8 +1974,7 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file) | |||
2053 | uSizeBuf is the size of the szComment buffer. | 1974 | uSizeBuf is the size of the szComment buffer. |
2054 | return the number of byte copied or an error code <0 | 1975 | return the number of byte copied or an error code <0 |
2055 | */ | 1976 | */ |
2056 | extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uSizeBuf) | 1977 | extern int ZEXPORT unzGetGlobalComment(unzFile file, char * szComment, uLong uSizeBuf) { |
2057 | { | ||
2058 | unz64_s* s; | 1978 | unz64_s* s; |
2059 | uLong uReadThis ; | 1979 | uLong uReadThis ; |
2060 | if (file==NULL) | 1980 | if (file==NULL) |
@@ -2081,8 +2001,7 @@ extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uS | |||
2081 | } | 2001 | } |
2082 | 2002 | ||
2083 | /* Additions by RX '2004 */ | 2003 | /* Additions by RX '2004 */ |
2084 | extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) | 2004 | extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) { |
2085 | { | ||
2086 | unz64_s* s; | 2005 | unz64_s* s; |
2087 | 2006 | ||
2088 | if (file==NULL) | 2007 | if (file==NULL) |
@@ -2096,8 +2015,7 @@ extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) | |||
2096 | return s->pos_in_central_dir; | 2015 | return s->pos_in_central_dir; |
2097 | } | 2016 | } |
2098 | 2017 | ||
2099 | extern uLong ZEXPORT unzGetOffset (unzFile file) | 2018 | extern uLong ZEXPORT unzGetOffset(unzFile file) { |
2100 | { | ||
2101 | ZPOS64_T offset64; | 2019 | ZPOS64_T offset64; |
2102 | 2020 | ||
2103 | if (file==NULL) | 2021 | if (file==NULL) |
@@ -2106,8 +2024,7 @@ extern uLong ZEXPORT unzGetOffset (unzFile file) | |||
2106 | return (uLong)offset64; | 2024 | return (uLong)offset64; |
2107 | } | 2025 | } |
2108 | 2026 | ||
2109 | extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) | 2027 | extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) { |
2110 | { | ||
2111 | unz64_s* s; | 2028 | unz64_s* s; |
2112 | int err; | 2029 | int err; |
2113 | 2030 | ||
@@ -2124,7 +2041,6 @@ extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) | |||
2124 | return err; | 2041 | return err; |
2125 | } | 2042 | } |
2126 | 2043 | ||
2127 | extern int ZEXPORT unzSetOffset (unzFile file, uLong pos) | 2044 | extern int ZEXPORT unzSetOffset (unzFile file, uLong pos) { |
2128 | { | ||
2129 | return unzSetOffset64(file,pos); | 2045 | return unzSetOffset64(file,pos); |
2130 | } | 2046 | } |
diff --git a/contrib/minizip/unzip.h b/contrib/minizip/unzip.h index 6f95e94..7b9884d 100644 --- a/contrib/minizip/unzip.h +++ b/contrib/minizip/unzip.h | |||
@@ -150,9 +150,9 @@ typedef struct unz_file_info_s | |||
150 | tm_unz tmu_date; | 150 | tm_unz tmu_date; |
151 | } unz_file_info; | 151 | } unz_file_info; |
152 | 152 | ||
153 | extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, | 153 | extern int ZEXPORT unzStringFileNameCompare(const char* fileName1, |
154 | const char* fileName2, | 154 | const char* fileName2, |
155 | int iCaseSensitivity)); | 155 | int iCaseSensitivity); |
156 | /* | 156 | /* |
157 | Compare two filename (fileName1,fileName2). | 157 | Compare two filename (fileName1,fileName2). |
158 | If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) | 158 | If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) |
@@ -163,8 +163,8 @@ extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, | |||
163 | */ | 163 | */ |
164 | 164 | ||
165 | 165 | ||
166 | extern unzFile ZEXPORT unzOpen OF((const char *path)); | 166 | extern unzFile ZEXPORT unzOpen(const char *path); |
167 | extern unzFile ZEXPORT unzOpen64 OF((const void *path)); | 167 | extern unzFile ZEXPORT unzOpen64(const void *path); |
168 | /* | 168 | /* |
169 | Open a Zip file. path contain the full pathname (by example, | 169 | Open a Zip file. path contain the full pathname (by example, |
170 | on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer | 170 | on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer |
@@ -181,41 +181,41 @@ extern unzFile ZEXPORT unzOpen64 OF((const void *path)); | |||
181 | */ | 181 | */ |
182 | 182 | ||
183 | 183 | ||
184 | extern unzFile ZEXPORT unzOpen2 OF((const char *path, | 184 | extern unzFile ZEXPORT unzOpen2(const char *path, |
185 | zlib_filefunc_def* pzlib_filefunc_def)); | 185 | zlib_filefunc_def* pzlib_filefunc_def); |
186 | /* | 186 | /* |
187 | Open a Zip file, like unzOpen, but provide a set of file low level API | 187 | Open a Zip file, like unzOpen, but provide a set of file low level API |
188 | for read/write the zip file (see ioapi.h) | 188 | for read/write the zip file (see ioapi.h) |
189 | */ | 189 | */ |
190 | 190 | ||
191 | extern unzFile ZEXPORT unzOpen2_64 OF((const void *path, | 191 | extern unzFile ZEXPORT unzOpen2_64(const void *path, |
192 | zlib_filefunc64_def* pzlib_filefunc_def)); | 192 | zlib_filefunc64_def* pzlib_filefunc_def); |
193 | /* | 193 | /* |
194 | Open a Zip file, like unz64Open, but provide a set of file low level API | 194 | Open a Zip file, like unz64Open, but provide a set of file low level API |
195 | for read/write the zip file (see ioapi.h) | 195 | for read/write the zip file (see ioapi.h) |
196 | */ | 196 | */ |
197 | 197 | ||
198 | extern int ZEXPORT unzClose OF((unzFile file)); | 198 | extern int ZEXPORT unzClose(unzFile file); |
199 | /* | 199 | /* |
200 | Close a ZipFile opened with unzOpen. | 200 | Close a ZipFile opened with unzOpen. |
201 | If there is files inside the .Zip opened with unzOpenCurrentFile (see later), | 201 | If there is files inside the .Zip opened with unzOpenCurrentFile (see later), |
202 | these files MUST be closed with unzCloseCurrentFile before call unzClose. | 202 | these files MUST be closed with unzCloseCurrentFile before call unzClose. |
203 | return UNZ_OK if there is no problem. */ | 203 | return UNZ_OK if there is no problem. */ |
204 | 204 | ||
205 | extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, | 205 | extern int ZEXPORT unzGetGlobalInfo(unzFile file, |
206 | unz_global_info *pglobal_info)); | 206 | unz_global_info *pglobal_info); |
207 | 207 | ||
208 | extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file, | 208 | extern int ZEXPORT unzGetGlobalInfo64(unzFile file, |
209 | unz_global_info64 *pglobal_info)); | 209 | unz_global_info64 *pglobal_info); |
210 | /* | 210 | /* |
211 | Write info about the ZipFile in the *pglobal_info structure. | 211 | Write info about the ZipFile in the *pglobal_info structure. |
212 | No preparation of the structure is needed | 212 | No preparation of the structure is needed |
213 | return UNZ_OK if there is no problem. */ | 213 | return UNZ_OK if there is no problem. */ |
214 | 214 | ||
215 | 215 | ||
216 | extern int ZEXPORT unzGetGlobalComment OF((unzFile file, | 216 | extern int ZEXPORT unzGetGlobalComment(unzFile file, |
217 | char *szComment, | 217 | char *szComment, |
218 | uLong uSizeBuf)); | 218 | uLong uSizeBuf); |
219 | /* | 219 | /* |
220 | Get the global comment string of the ZipFile, in the szComment buffer. | 220 | Get the global comment string of the ZipFile, in the szComment buffer. |
221 | uSizeBuf is the size of the szComment buffer. | 221 | uSizeBuf is the size of the szComment buffer. |
@@ -226,22 +226,22 @@ extern int ZEXPORT unzGetGlobalComment OF((unzFile file, | |||
226 | /***************************************************************************/ | 226 | /***************************************************************************/ |
227 | /* Unzip package allow you browse the directory of the zipfile */ | 227 | /* Unzip package allow you browse the directory of the zipfile */ |
228 | 228 | ||
229 | extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); | 229 | extern int ZEXPORT unzGoToFirstFile(unzFile file); |
230 | /* | 230 | /* |
231 | Set the current file of the zipfile to the first file. | 231 | Set the current file of the zipfile to the first file. |
232 | return UNZ_OK if there is no problem | 232 | return UNZ_OK if there is no problem |
233 | */ | 233 | */ |
234 | 234 | ||
235 | extern int ZEXPORT unzGoToNextFile OF((unzFile file)); | 235 | extern int ZEXPORT unzGoToNextFile(unzFile file); |
236 | /* | 236 | /* |
237 | Set the current file of the zipfile to the next file. | 237 | Set the current file of the zipfile to the next file. |
238 | return UNZ_OK if there is no problem | 238 | return UNZ_OK if there is no problem |
239 | return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. | 239 | return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. |
240 | */ | 240 | */ |
241 | 241 | ||
242 | extern int ZEXPORT unzLocateFile OF((unzFile file, | 242 | extern int ZEXPORT unzLocateFile(unzFile file, |
243 | const char *szFileName, | 243 | const char *szFileName, |
244 | int iCaseSensitivity)); | 244 | int iCaseSensitivity); |
245 | /* | 245 | /* |
246 | Try locate the file szFileName in the zipfile. | 246 | Try locate the file szFileName in the zipfile. |
247 | For the iCaseSensitivity signification, see unzStringFileNameCompare | 247 | For the iCaseSensitivity signification, see unzStringFileNameCompare |
@@ -285,23 +285,23 @@ extern int ZEXPORT unzGoToFilePos64( | |||
285 | 285 | ||
286 | /* ****************************************** */ | 286 | /* ****************************************** */ |
287 | 287 | ||
288 | extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file, | 288 | extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file, |
289 | unz_file_info64 *pfile_info, | 289 | unz_file_info64 *pfile_info, |
290 | char *szFileName, | 290 | char *szFileName, |
291 | uLong fileNameBufferSize, | 291 | uLong fileNameBufferSize, |
292 | void *extraField, | 292 | void *extraField, |
293 | uLong extraFieldBufferSize, | 293 | uLong extraFieldBufferSize, |
294 | char *szComment, | 294 | char *szComment, |
295 | uLong commentBufferSize)); | 295 | uLong commentBufferSize); |
296 | 296 | ||
297 | extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, | 297 | extern int ZEXPORT unzGetCurrentFileInfo(unzFile file, |
298 | unz_file_info *pfile_info, | 298 | unz_file_info *pfile_info, |
299 | char *szFileName, | 299 | char *szFileName, |
300 | uLong fileNameBufferSize, | 300 | uLong fileNameBufferSize, |
301 | void *extraField, | 301 | void *extraField, |
302 | uLong extraFieldBufferSize, | 302 | uLong extraFieldBufferSize, |
303 | char *szComment, | 303 | char *szComment, |
304 | uLong commentBufferSize)); | 304 | uLong commentBufferSize); |
305 | /* | 305 | /* |
306 | Get Info about the current file | 306 | Get Info about the current file |
307 | if pfile_info!=NULL, the *pfile_info structure will contain somes info about | 307 | if pfile_info!=NULL, the *pfile_info structure will contain somes info about |
@@ -318,7 +318,7 @@ extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, | |||
318 | 318 | ||
319 | /** Addition for GDAL : START */ | 319 | /** Addition for GDAL : START */ |
320 | 320 | ||
321 | extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file)); | 321 | extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file); |
322 | 322 | ||
323 | /** Addition for GDAL : END */ | 323 | /** Addition for GDAL : END */ |
324 | 324 | ||
@@ -328,24 +328,24 @@ extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file)); | |||
328 | from it, and close it (you can close it before reading all the file) | 328 | from it, and close it (you can close it before reading all the file) |
329 | */ | 329 | */ |
330 | 330 | ||
331 | extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); | 331 | extern int ZEXPORT unzOpenCurrentFile(unzFile file); |
332 | /* | 332 | /* |
333 | Open for reading data the current file in the zipfile. | 333 | Open for reading data the current file in the zipfile. |
334 | If there is no error, the return value is UNZ_OK. | 334 | If there is no error, the return value is UNZ_OK. |
335 | */ | 335 | */ |
336 | 336 | ||
337 | extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file, | 337 | extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file, |
338 | const char* password)); | 338 | const char* password); |
339 | /* | 339 | /* |
340 | Open for reading data the current file in the zipfile. | 340 | Open for reading data the current file in the zipfile. |
341 | password is a crypting password | 341 | password is a crypting password |
342 | If there is no error, the return value is UNZ_OK. | 342 | If there is no error, the return value is UNZ_OK. |
343 | */ | 343 | */ |
344 | 344 | ||
345 | extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file, | 345 | extern int ZEXPORT unzOpenCurrentFile2(unzFile file, |
346 | int* method, | 346 | int* method, |
347 | int* level, | 347 | int* level, |
348 | int raw)); | 348 | int raw); |
349 | /* | 349 | /* |
350 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) | 350 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) |
351 | if raw==1 | 351 | if raw==1 |
@@ -355,11 +355,11 @@ extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file, | |||
355 | but you CANNOT set method parameter as NULL | 355 | but you CANNOT set method parameter as NULL |
356 | */ | 356 | */ |
357 | 357 | ||
358 | extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file, | 358 | extern int ZEXPORT unzOpenCurrentFile3(unzFile file, |
359 | int* method, | 359 | int* method, |
360 | int* level, | 360 | int* level, |
361 | int raw, | 361 | int raw, |
362 | const char* password)); | 362 | const char* password); |
363 | /* | 363 | /* |
364 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) | 364 | Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) |
365 | if raw==1 | 365 | if raw==1 |
@@ -370,15 +370,15 @@ extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file, | |||
370 | */ | 370 | */ |
371 | 371 | ||
372 | 372 | ||
373 | extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); | 373 | extern int ZEXPORT unzCloseCurrentFile(unzFile file); |
374 | /* | 374 | /* |
375 | Close the file in zip opened with unzOpenCurrentFile | 375 | Close the file in zip opened with unzOpenCurrentFile |
376 | Return UNZ_CRCERROR if all the file was read but the CRC is not good | 376 | Return UNZ_CRCERROR if all the file was read but the CRC is not good |
377 | */ | 377 | */ |
378 | 378 | ||
379 | extern int ZEXPORT unzReadCurrentFile OF((unzFile file, | 379 | extern int ZEXPORT unzReadCurrentFile(unzFile file, |
380 | voidp buf, | 380 | voidp buf, |
381 | unsigned len)); | 381 | unsigned len); |
382 | /* | 382 | /* |
383 | Read bytes from the current file (opened by unzOpenCurrentFile) | 383 | Read bytes from the current file (opened by unzOpenCurrentFile) |
384 | buf contain buffer where data must be copied | 384 | buf contain buffer where data must be copied |
@@ -390,21 +390,21 @@ extern int ZEXPORT unzReadCurrentFile OF((unzFile file, | |||
390 | (UNZ_ERRNO for IO error, or zLib error for uncompress error) | 390 | (UNZ_ERRNO for IO error, or zLib error for uncompress error) |
391 | */ | 391 | */ |
392 | 392 | ||
393 | extern z_off_t ZEXPORT unztell OF((unzFile file)); | 393 | extern z_off_t ZEXPORT unztell(unzFile file); |
394 | 394 | ||
395 | extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file)); | 395 | extern ZPOS64_T ZEXPORT unztell64(unzFile file); |
396 | /* | 396 | /* |
397 | Give the current position in uncompressed data | 397 | Give the current position in uncompressed data |
398 | */ | 398 | */ |
399 | 399 | ||
400 | extern int ZEXPORT unzeof OF((unzFile file)); | 400 | extern int ZEXPORT unzeof(unzFile file); |
401 | /* | 401 | /* |
402 | return 1 if the end of file was reached, 0 elsewhere | 402 | return 1 if the end of file was reached, 0 elsewhere |
403 | */ | 403 | */ |
404 | 404 | ||
405 | extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, | 405 | extern int ZEXPORT unzGetLocalExtrafield(unzFile file, |
406 | voidp buf, | 406 | voidp buf, |
407 | unsigned len)); | 407 | unsigned len); |
408 | /* | 408 | /* |
409 | Read extra field from the current file (opened by unzOpenCurrentFile) | 409 | Read extra field from the current file (opened by unzOpenCurrentFile) |
410 | This is the local-header version of the extra field (sometimes, there is | 410 | This is the local-header version of the extra field (sometimes, there is |
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c index 66d693f..7b559b7 100644 --- a/contrib/minizip/zip.c +++ b/contrib/minizip/zip.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <stdio.h> | 25 | #include <stdio.h> |
26 | #include <stdlib.h> | 26 | #include <stdlib.h> |
27 | #include <string.h> | 27 | #include <string.h> |
28 | #include <stdint.h> | ||
28 | #include <time.h> | 29 | #include <time.h> |
29 | #include "zlib.h" | 30 | #include "zlib.h" |
30 | #include "zip.h" | 31 | #include "zip.h" |
@@ -186,8 +187,7 @@ typedef struct | |||
186 | #include "crypt.h" | 187 | #include "crypt.h" |
187 | #endif | 188 | #endif |
188 | 189 | ||
189 | local linkedlist_datablock_internal* allocate_new_datablock() | 190 | local linkedlist_datablock_internal* allocate_new_datablock(void) { |
190 | { | ||
191 | linkedlist_datablock_internal* ldi; | 191 | linkedlist_datablock_internal* ldi; |
192 | ldi = (linkedlist_datablock_internal*) | 192 | ldi = (linkedlist_datablock_internal*) |
193 | ALLOC(sizeof(linkedlist_datablock_internal)); | 193 | ALLOC(sizeof(linkedlist_datablock_internal)); |
@@ -200,8 +200,7 @@ local linkedlist_datablock_internal* allocate_new_datablock() | |||
200 | return ldi; | 200 | return ldi; |
201 | } | 201 | } |
202 | 202 | ||
203 | local void free_datablock(linkedlist_datablock_internal* ldi) | 203 | local void free_datablock(linkedlist_datablock_internal* ldi) { |
204 | { | ||
205 | while (ldi!=NULL) | 204 | while (ldi!=NULL) |
206 | { | 205 | { |
207 | linkedlist_datablock_internal* ldinext = ldi->next_datablock; | 206 | linkedlist_datablock_internal* ldinext = ldi->next_datablock; |
@@ -210,20 +209,17 @@ local void free_datablock(linkedlist_datablock_internal* ldi) | |||
210 | } | 209 | } |
211 | } | 210 | } |
212 | 211 | ||
213 | local void init_linkedlist(linkedlist_data* ll) | 212 | local void init_linkedlist(linkedlist_data* ll) { |
214 | { | ||
215 | ll->first_block = ll->last_block = NULL; | 213 | ll->first_block = ll->last_block = NULL; |
216 | } | 214 | } |
217 | 215 | ||
218 | local void free_linkedlist(linkedlist_data* ll) | 216 | local void free_linkedlist(linkedlist_data* ll) { |
219 | { | ||
220 | free_datablock(ll->first_block); | 217 | free_datablock(ll->first_block); |
221 | ll->first_block = ll->last_block = NULL; | 218 | ll->first_block = ll->last_block = NULL; |
222 | } | 219 | } |
223 | 220 | ||
224 | 221 | ||
225 | local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) | 222 | local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) { |
226 | { | ||
227 | linkedlist_datablock_internal* ldi; | 223 | linkedlist_datablock_internal* ldi; |
228 | const unsigned char* from_copy; | 224 | const unsigned char* from_copy; |
229 | 225 | ||
@@ -238,7 +234,7 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) | |||
238 | } | 234 | } |
239 | 235 | ||
240 | ldi = ll->last_block; | 236 | ldi = ll->last_block; |
241 | from_copy = (unsigned char*)buf; | 237 | from_copy = (const unsigned char*)buf; |
242 | 238 | ||
243 | while (len>0) | 239 | while (len>0) |
244 | { | 240 | { |
@@ -283,9 +279,7 @@ local int add_data_in_datablock(linkedlist_data* ll, const void* buf, uLong len) | |||
283 | nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T) | 279 | nbByte == 1, 2 ,4 or 8 (byte, short or long, ZPOS64_T) |
284 | */ | 280 | */ |
285 | 281 | ||
286 | local int zip64local_putValue OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte)); | 282 | local int zip64local_putValue(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte) { |
287 | local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T x, int nbByte) | ||
288 | { | ||
289 | unsigned char buf[8]; | 283 | unsigned char buf[8]; |
290 | int n; | 284 | int n; |
291 | for (n = 0; n < nbByte; n++) | 285 | for (n = 0; n < nbByte; n++) |
@@ -307,9 +301,7 @@ local int zip64local_putValue (const zlib_filefunc64_32_def* pzlib_filefunc_def, | |||
307 | return ZIP_OK; | 301 | return ZIP_OK; |
308 | } | 302 | } |
309 | 303 | ||
310 | local void zip64local_putValue_inmemory OF((void* dest, ZPOS64_T x, int nbByte)); | 304 | local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte) { |
311 | local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte) | ||
312 | { | ||
313 | unsigned char* buf=(unsigned char*)dest; | 305 | unsigned char* buf=(unsigned char*)dest; |
314 | int n; | 306 | int n; |
315 | for (n = 0; n < nbByte; n++) { | 307 | for (n = 0; n < nbByte; n++) { |
@@ -329,8 +321,7 @@ local void zip64local_putValue_inmemory (void* dest, ZPOS64_T x, int nbByte) | |||
329 | /****************************************************************************/ | 321 | /****************************************************************************/ |
330 | 322 | ||
331 | 323 | ||
332 | local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) | 324 | local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) { |
333 | { | ||
334 | uLong year = (uLong)ptm->tm_year; | 325 | uLong year = (uLong)ptm->tm_year; |
335 | if (year>=1980) | 326 | if (year>=1980) |
336 | year-=1980; | 327 | year-=1980; |
@@ -344,10 +335,7 @@ local uLong zip64local_TmzDateToDosDate(const tm_zip* ptm) | |||
344 | 335 | ||
345 | /****************************************************************************/ | 336 | /****************************************************************************/ |
346 | 337 | ||
347 | local int zip64local_getByte OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)); | 338 | local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int* pi) { |
348 | |||
349 | local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,voidpf filestream,int* pi) | ||
350 | { | ||
351 | unsigned char c; | 339 | unsigned char c; |
352 | int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1); | 340 | int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1); |
353 | if (err==1) | 341 | if (err==1) |
@@ -368,10 +356,7 @@ local int zip64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def,vo | |||
368 | /* =========================================================================== | 356 | /* =========================================================================== |
369 | Reads a long in LSB order from the given gz_stream. Sets | 357 | Reads a long in LSB order from the given gz_stream. Sets |
370 | */ | 358 | */ |
371 | local int zip64local_getShort OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX)); | 359 | local int zip64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) { |
372 | |||
373 | local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) | ||
374 | { | ||
375 | uLong x ; | 360 | uLong x ; |
376 | int i = 0; | 361 | int i = 0; |
377 | int err; | 362 | int err; |
@@ -390,10 +375,7 @@ local int zip64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, | |||
390 | return err; | 375 | return err; |
391 | } | 376 | } |
392 | 377 | ||
393 | local int zip64local_getLong OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong *pX)); | 378 | local int zip64local_getLong(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) { |
394 | |||
395 | local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, uLong* pX) | ||
396 | { | ||
397 | uLong x ; | 379 | uLong x ; |
398 | int i = 0; | 380 | int i = 0; |
399 | int err; | 381 | int err; |
@@ -420,11 +402,8 @@ local int zip64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, | |||
420 | return err; | 402 | return err; |
421 | } | 403 | } |
422 | 404 | ||
423 | local int zip64local_getLong64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX)); | ||
424 | |||
425 | 405 | ||
426 | local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) | 406 | local int zip64local_getLong64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) { |
427 | { | ||
428 | ZPOS64_T x; | 407 | ZPOS64_T x; |
429 | int i = 0; | 408 | int i = 0; |
430 | int err; | 409 | int err; |
@@ -475,10 +454,7 @@ local int zip64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def | |||
475 | Locate the Central directory of a zipfile (at the end, just before | 454 | Locate the Central directory of a zipfile (at the end, just before |
476 | the global comment) | 455 | the global comment) |
477 | */ | 456 | */ |
478 | local ZPOS64_T zip64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)); | 457 | local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) { |
479 | |||
480 | local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) | ||
481 | { | ||
482 | unsigned char* buf; | 458 | unsigned char* buf; |
483 | ZPOS64_T uSizeFile; | 459 | ZPOS64_T uSizeFile; |
484 | ZPOS64_T uBackRead; | 460 | ZPOS64_T uBackRead; |
@@ -537,10 +513,7 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f | |||
537 | Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before | 513 | Locate the End of Zip64 Central directory locator and from there find the CD of a zipfile (at the end, just before |
538 | the global comment) | 514 | the global comment) |
539 | */ | 515 | */ |
540 | local ZPOS64_T zip64local_SearchCentralDir64 OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)); | 516 | local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) { |
541 | |||
542 | local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) | ||
543 | { | ||
544 | unsigned char* buf; | 517 | unsigned char* buf; |
545 | ZPOS64_T uSizeFile; | 518 | ZPOS64_T uSizeFile; |
546 | ZPOS64_T uBackRead; | 519 | ZPOS64_T uBackRead; |
@@ -637,8 +610,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib | |||
637 | return relativeOffset; | 610 | return relativeOffset; |
638 | } | 611 | } |
639 | 612 | ||
640 | local int LoadCentralDirectoryRecord(zip64_internal* pziinit) | 613 | local int LoadCentralDirectoryRecord(zip64_internal* pziinit) { |
641 | { | ||
642 | int err=ZIP_OK; | 614 | int err=ZIP_OK; |
643 | ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ | 615 | ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ |
644 | 616 | ||
@@ -846,8 +818,7 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit) | |||
846 | 818 | ||
847 | 819 | ||
848 | /************************************************************/ | 820 | /************************************************************/ |
849 | extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) | 821 | extern zipFile ZEXPORT zipOpen3(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def) { |
850 | { | ||
851 | zip64_internal ziinit; | 822 | zip64_internal ziinit; |
852 | zip64_internal* zi; | 823 | zip64_internal* zi; |
853 | int err=ZIP_OK; | 824 | int err=ZIP_OK; |
@@ -917,8 +888,7 @@ extern zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* gl | |||
917 | } | 888 | } |
918 | } | 889 | } |
919 | 890 | ||
920 | extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def) | 891 | extern zipFile ZEXPORT zipOpen2(const char *pathname, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc32_def) { |
921 | { | ||
922 | if (pzlib_filefunc32_def != NULL) | 892 | if (pzlib_filefunc32_def != NULL) |
923 | { | 893 | { |
924 | zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; | 894 | zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; |
@@ -929,8 +899,7 @@ extern zipFile ZEXPORT zipOpen2 (const char *pathname, int append, zipcharpc* gl | |||
929 | return zipOpen3(pathname, append, globalcomment, NULL); | 899 | return zipOpen3(pathname, append, globalcomment, NULL); |
930 | } | 900 | } |
931 | 901 | ||
932 | extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def) | 902 | extern zipFile ZEXPORT zipOpen2_64(const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_def* pzlib_filefunc_def) { |
933 | { | ||
934 | if (pzlib_filefunc_def != NULL) | 903 | if (pzlib_filefunc_def != NULL) |
935 | { | 904 | { |
936 | zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; | 905 | zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; |
@@ -945,18 +914,15 @@ extern zipFile ZEXPORT zipOpen2_64 (const void *pathname, int append, zipcharpc* | |||
945 | 914 | ||
946 | 915 | ||
947 | 916 | ||
948 | extern zipFile ZEXPORT zipOpen (const char* pathname, int append) | 917 | extern zipFile ZEXPORT zipOpen(const char* pathname, int append) { |
949 | { | ||
950 | return zipOpen3((const void*)pathname,append,NULL,NULL); | 918 | return zipOpen3((const void*)pathname,append,NULL,NULL); |
951 | } | 919 | } |
952 | 920 | ||
953 | extern zipFile ZEXPORT zipOpen64 (const void* pathname, int append) | 921 | extern zipFile ZEXPORT zipOpen64(const void* pathname, int append) { |
954 | { | ||
955 | return zipOpen3(pathname,append,NULL,NULL); | 922 | return zipOpen3(pathname,append,NULL,NULL); |
956 | } | 923 | } |
957 | 924 | ||
958 | local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local) | 925 | local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local) { |
959 | { | ||
960 | /* write the local header */ | 926 | /* write the local header */ |
961 | int err; | 927 | int err; |
962 | uInt size_filename = (uInt)strlen(filename); | 928 | uInt size_filename = (uInt)strlen(filename); |
@@ -1052,14 +1018,13 @@ local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt s | |||
1052 | It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize | 1018 | It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize |
1053 | unnecessary allocations. | 1019 | unnecessary allocations. |
1054 | */ | 1020 | */ |
1055 | extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, const zip_fileinfo* zipfi, | 1021 | extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, const zip_fileinfo* zipfi, |
1056 | const void* extrafield_local, uInt size_extrafield_local, | 1022 | const void* extrafield_local, uInt size_extrafield_local, |
1057 | const void* extrafield_global, uInt size_extrafield_global, | 1023 | const void* extrafield_global, uInt size_extrafield_global, |
1058 | const char* comment, int method, int level, int raw, | 1024 | const char* comment, int method, int level, int raw, |
1059 | int windowBits,int memLevel, int strategy, | 1025 | int windowBits,int memLevel, int strategy, |
1060 | const char* password, uLong crcForCrypting, | 1026 | const char* password, uLong crcForCrypting, |
1061 | uLong versionMadeBy, uLong flagBase, int zip64) | 1027 | uLong versionMadeBy, uLong flagBase, int zip64) { |
1062 | { | ||
1063 | zip64_internal* zi; | 1028 | zip64_internal* zi; |
1064 | uInt size_filename; | 1029 | uInt size_filename; |
1065 | uInt size_comment; | 1030 | uInt size_comment; |
@@ -1262,35 +1227,33 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, | |||
1262 | return err; | 1227 | return err; |
1263 | } | 1228 | } |
1264 | 1229 | ||
1265 | extern int ZEXPORT zipOpenNewFileInZip4 (zipFile file, const char* filename, const zip_fileinfo* zipfi, | 1230 | extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, const char* filename, const zip_fileinfo* zipfi, |
1266 | const void* extrafield_local, uInt size_extrafield_local, | 1231 | const void* extrafield_local, uInt size_extrafield_local, |
1267 | const void* extrafield_global, uInt size_extrafield_global, | 1232 | const void* extrafield_global, uInt size_extrafield_global, |
1268 | const char* comment, int method, int level, int raw, | 1233 | const char* comment, int method, int level, int raw, |
1269 | int windowBits,int memLevel, int strategy, | 1234 | int windowBits,int memLevel, int strategy, |
1270 | const char* password, uLong crcForCrypting, | 1235 | const char* password, uLong crcForCrypting, |
1271 | uLong versionMadeBy, uLong flagBase) | 1236 | uLong versionMadeBy, uLong flagBase) { |
1272 | { | 1237 | return zipOpenNewFileInZip4_64(file, filename, zipfi, |
1273 | return zipOpenNewFileInZip4_64 (file, filename, zipfi, | 1238 | extrafield_local, size_extrafield_local, |
1274 | extrafield_local, size_extrafield_local, | 1239 | extrafield_global, size_extrafield_global, |
1275 | extrafield_global, size_extrafield_global, | 1240 | comment, method, level, raw, |
1276 | comment, method, level, raw, | 1241 | windowBits, memLevel, strategy, |
1277 | windowBits, memLevel, strategy, | 1242 | password, crcForCrypting, versionMadeBy, flagBase, 0); |
1278 | password, crcForCrypting, versionMadeBy, flagBase, 0); | ||
1279 | } | 1243 | } |
1280 | 1244 | ||
1281 | extern int ZEXPORT zipOpenNewFileInZip3 (zipFile file, const char* filename, const zip_fileinfo* zipfi, | 1245 | extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, const char* filename, const zip_fileinfo* zipfi, |
1282 | const void* extrafield_local, uInt size_extrafield_local, | 1246 | const void* extrafield_local, uInt size_extrafield_local, |
1283 | const void* extrafield_global, uInt size_extrafield_global, | 1247 | const void* extrafield_global, uInt size_extrafield_global, |
1284 | const char* comment, int method, int level, int raw, | 1248 | const char* comment, int method, int level, int raw, |
1285 | int windowBits,int memLevel, int strategy, | 1249 | int windowBits,int memLevel, int strategy, |
1286 | const char* password, uLong crcForCrypting) | 1250 | const char* password, uLong crcForCrypting) { |
1287 | { | 1251 | return zipOpenNewFileInZip4_64(file, filename, zipfi, |
1288 | return zipOpenNewFileInZip4_64 (file, filename, zipfi, | 1252 | extrafield_local, size_extrafield_local, |
1289 | extrafield_local, size_extrafield_local, | 1253 | extrafield_global, size_extrafield_global, |
1290 | extrafield_global, size_extrafield_global, | 1254 | comment, method, level, raw, |
1291 | comment, method, level, raw, | 1255 | windowBits, memLevel, strategy, |
1292 | windowBits, memLevel, strategy, | 1256 | password, crcForCrypting, VERSIONMADEBY, 0, 0); |
1293 | password, crcForCrypting, VERSIONMADEBY, 0, 0); | ||
1294 | } | 1257 | } |
1295 | 1258 | ||
1296 | extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi, | 1259 | extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, const zip_fileinfo* zipfi, |
@@ -1298,70 +1261,64 @@ extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, c | |||
1298 | const void* extrafield_global, uInt size_extrafield_global, | 1261 | const void* extrafield_global, uInt size_extrafield_global, |
1299 | const char* comment, int method, int level, int raw, | 1262 | const char* comment, int method, int level, int raw, |
1300 | int windowBits,int memLevel, int strategy, | 1263 | int windowBits,int memLevel, int strategy, |
1301 | const char* password, uLong crcForCrypting, int zip64) | 1264 | const char* password, uLong crcForCrypting, int zip64) { |
1302 | { | 1265 | return zipOpenNewFileInZip4_64(file, filename, zipfi, |
1303 | return zipOpenNewFileInZip4_64 (file, filename, zipfi, | 1266 | extrafield_local, size_extrafield_local, |
1304 | extrafield_local, size_extrafield_local, | 1267 | extrafield_global, size_extrafield_global, |
1305 | extrafield_global, size_extrafield_global, | 1268 | comment, method, level, raw, |
1306 | comment, method, level, raw, | 1269 | windowBits, memLevel, strategy, |
1307 | windowBits, memLevel, strategy, | 1270 | password, crcForCrypting, VERSIONMADEBY, 0, zip64); |
1308 | password, crcForCrypting, VERSIONMADEBY, 0, zip64); | ||
1309 | } | 1271 | } |
1310 | 1272 | ||
1311 | extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi, | 1273 | extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi, |
1312 | const void* extrafield_local, uInt size_extrafield_local, | 1274 | const void* extrafield_local, uInt size_extrafield_local, |
1313 | const void* extrafield_global, uInt size_extrafield_global, | 1275 | const void* extrafield_global, uInt size_extrafield_global, |
1314 | const char* comment, int method, int level, int raw) | 1276 | const char* comment, int method, int level, int raw) { |
1315 | { | 1277 | return zipOpenNewFileInZip4_64(file, filename, zipfi, |
1316 | return zipOpenNewFileInZip4_64 (file, filename, zipfi, | 1278 | extrafield_local, size_extrafield_local, |
1317 | extrafield_local, size_extrafield_local, | 1279 | extrafield_global, size_extrafield_global, |
1318 | extrafield_global, size_extrafield_global, | 1280 | comment, method, level, raw, |
1319 | comment, method, level, raw, | 1281 | -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, |
1320 | -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, | 1282 | NULL, 0, VERSIONMADEBY, 0, 0); |
1321 | NULL, 0, VERSIONMADEBY, 0, 0); | ||
1322 | } | 1283 | } |
1323 | 1284 | ||
1324 | extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi, | 1285 | extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, const char* filename, const zip_fileinfo* zipfi, |
1325 | const void* extrafield_local, uInt size_extrafield_local, | 1286 | const void* extrafield_local, uInt size_extrafield_local, |
1326 | const void* extrafield_global, uInt size_extrafield_global, | 1287 | const void* extrafield_global, uInt size_extrafield_global, |
1327 | const char* comment, int method, int level, int raw, int zip64) | 1288 | const char* comment, int method, int level, int raw, int zip64) { |
1328 | { | 1289 | return zipOpenNewFileInZip4_64(file, filename, zipfi, |
1329 | return zipOpenNewFileInZip4_64 (file, filename, zipfi, | 1290 | extrafield_local, size_extrafield_local, |
1330 | extrafield_local, size_extrafield_local, | 1291 | extrafield_global, size_extrafield_global, |
1331 | extrafield_global, size_extrafield_global, | 1292 | comment, method, level, raw, |
1332 | comment, method, level, raw, | 1293 | -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, |
1333 | -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, | 1294 | NULL, 0, VERSIONMADEBY, 0, zip64); |
1334 | NULL, 0, VERSIONMADEBY, 0, zip64); | ||
1335 | } | 1295 | } |
1336 | 1296 | ||
1337 | extern int ZEXPORT zipOpenNewFileInZip64 (zipFile file, const char* filename, const zip_fileinfo* zipfi, | 1297 | extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, const char* filename, const zip_fileinfo* zipfi, |
1338 | const void* extrafield_local, uInt size_extrafield_local, | 1298 | const void* extrafield_local, uInt size_extrafield_local, |
1339 | const void*extrafield_global, uInt size_extrafield_global, | 1299 | const void*extrafield_global, uInt size_extrafield_global, |
1340 | const char* comment, int method, int level, int zip64) | 1300 | const char* comment, int method, int level, int zip64) { |
1341 | { | 1301 | return zipOpenNewFileInZip4_64(file, filename, zipfi, |
1342 | return zipOpenNewFileInZip4_64 (file, filename, zipfi, | 1302 | extrafield_local, size_extrafield_local, |
1343 | extrafield_local, size_extrafield_local, | 1303 | extrafield_global, size_extrafield_global, |
1344 | extrafield_global, size_extrafield_global, | 1304 | comment, method, level, 0, |
1345 | comment, method, level, 0, | 1305 | -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, |
1346 | -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, | 1306 | NULL, 0, VERSIONMADEBY, 0, zip64); |
1347 | NULL, 0, VERSIONMADEBY, 0, zip64); | ||
1348 | } | 1307 | } |
1349 | 1308 | ||
1350 | extern int ZEXPORT zipOpenNewFileInZip (zipFile file, const char* filename, const zip_fileinfo* zipfi, | 1309 | extern int ZEXPORT zipOpenNewFileInZip(zipFile file, const char* filename, const zip_fileinfo* zipfi, |
1351 | const void* extrafield_local, uInt size_extrafield_local, | 1310 | const void* extrafield_local, uInt size_extrafield_local, |
1352 | const void*extrafield_global, uInt size_extrafield_global, | 1311 | const void*extrafield_global, uInt size_extrafield_global, |
1353 | const char* comment, int method, int level) | 1312 | const char* comment, int method, int level) { |
1354 | { | 1313 | return zipOpenNewFileInZip4_64(file, filename, zipfi, |
1355 | return zipOpenNewFileInZip4_64 (file, filename, zipfi, | 1314 | extrafield_local, size_extrafield_local, |
1356 | extrafield_local, size_extrafield_local, | 1315 | extrafield_global, size_extrafield_global, |
1357 | extrafield_global, size_extrafield_global, | 1316 | comment, method, level, 0, |
1358 | comment, method, level, 0, | 1317 | -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, |
1359 | -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, | 1318 | NULL, 0, VERSIONMADEBY, 0, 0); |
1360 | NULL, 0, VERSIONMADEBY, 0, 0); | ||
1361 | } | 1319 | } |
1362 | 1320 | ||
1363 | local int zip64FlushWriteBuffer(zip64_internal* zi) | 1321 | local int zip64FlushWriteBuffer(zip64_internal* zi) { |
1364 | { | ||
1365 | int err=ZIP_OK; | 1322 | int err=ZIP_OK; |
1366 | 1323 | ||
1367 | if (zi->ci.encrypt != 0) | 1324 | if (zi->ci.encrypt != 0) |
@@ -1399,8 +1356,7 @@ local int zip64FlushWriteBuffer(zip64_internal* zi) | |||
1399 | return err; | 1356 | return err; |
1400 | } | 1357 | } |
1401 | 1358 | ||
1402 | extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned int len) | 1359 | extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void* buf, unsigned int len) { |
1403 | { | ||
1404 | zip64_internal* zi; | 1360 | zip64_internal* zi; |
1405 | int err=ZIP_OK; | 1361 | int err=ZIP_OK; |
1406 | 1362 | ||
@@ -1450,7 +1406,7 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in | |||
1450 | else | 1406 | else |
1451 | #endif | 1407 | #endif |
1452 | { | 1408 | { |
1453 | zi->ci.stream.next_in = (Bytef*)buf; | 1409 | zi->ci.stream.next_in = (Bytef*)(uintptr_t)buf; |
1454 | zi->ci.stream.avail_in = len; | 1410 | zi->ci.stream.avail_in = len; |
1455 | 1411 | ||
1456 | while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0)) | 1412 | while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0)) |
@@ -1501,13 +1457,11 @@ extern int ZEXPORT zipWriteInFileInZip (zipFile file,const void* buf,unsigned in | |||
1501 | return err; | 1457 | return err; |
1502 | } | 1458 | } |
1503 | 1459 | ||
1504 | extern int ZEXPORT zipCloseFileInZipRaw (zipFile file, uLong uncompressed_size, uLong crc32) | 1460 | extern int ZEXPORT zipCloseFileInZipRaw(zipFile file, uLong uncompressed_size, uLong crc32) { |
1505 | { | ||
1506 | return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32); | 1461 | return zipCloseFileInZipRaw64 (file, uncompressed_size, crc32); |
1507 | } | 1462 | } |
1508 | 1463 | ||
1509 | extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_size, uLong crc32) | 1464 | extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_size, uLong crc32) { |
1510 | { | ||
1511 | zip64_internal* zi; | 1465 | zip64_internal* zi; |
1512 | ZPOS64_T compressed_size; | 1466 | ZPOS64_T compressed_size; |
1513 | uLong invalidValue = 0xffffffff; | 1467 | uLong invalidValue = 0xffffffff; |
@@ -1742,13 +1696,11 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s | |||
1742 | return err; | 1696 | return err; |
1743 | } | 1697 | } |
1744 | 1698 | ||
1745 | extern int ZEXPORT zipCloseFileInZip (zipFile file) | 1699 | extern int ZEXPORT zipCloseFileInZip(zipFile file) { |
1746 | { | ||
1747 | return zipCloseFileInZipRaw (file,0,0); | 1700 | return zipCloseFileInZipRaw (file,0,0); |
1748 | } | 1701 | } |
1749 | 1702 | ||
1750 | local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip) | 1703 | local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip) { |
1751 | { | ||
1752 | int err = ZIP_OK; | 1704 | int err = ZIP_OK; |
1753 | ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset; | 1705 | ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writing_offset; |
1754 | 1706 | ||
@@ -1769,8 +1721,7 @@ local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T z | |||
1769 | return err; | 1721 | return err; |
1770 | } | 1722 | } |
1771 | 1723 | ||
1772 | local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) | 1724 | local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) { |
1773 | { | ||
1774 | int err = ZIP_OK; | 1725 | int err = ZIP_OK; |
1775 | 1726 | ||
1776 | uLong Zip64DataSize = 44; | 1727 | uLong Zip64DataSize = 44; |
@@ -1808,8 +1759,8 @@ local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_ | |||
1808 | } | 1759 | } |
1809 | return err; | 1760 | return err; |
1810 | } | 1761 | } |
1811 | local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) | 1762 | |
1812 | { | 1763 | local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) { |
1813 | int err = ZIP_OK; | 1764 | int err = ZIP_OK; |
1814 | 1765 | ||
1815 | /*signature*/ | 1766 | /*signature*/ |
@@ -1856,8 +1807,7 @@ local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centr | |||
1856 | return err; | 1807 | return err; |
1857 | } | 1808 | } |
1858 | 1809 | ||
1859 | local int Write_GlobalComment(zip64_internal* zi, const char* global_comment) | 1810 | local int Write_GlobalComment(zip64_internal* zi, const char* global_comment) { |
1860 | { | ||
1861 | int err = ZIP_OK; | 1811 | int err = ZIP_OK; |
1862 | uInt size_global_comment = 0; | 1812 | uInt size_global_comment = 0; |
1863 | 1813 | ||
@@ -1874,8 +1824,7 @@ local int Write_GlobalComment(zip64_internal* zi, const char* global_comment) | |||
1874 | return err; | 1824 | return err; |
1875 | } | 1825 | } |
1876 | 1826 | ||
1877 | extern int ZEXPORT zipClose (zipFile file, const char* global_comment) | 1827 | extern int ZEXPORT zipClose(zipFile file, const char* global_comment) { |
1878 | { | ||
1879 | zip64_internal* zi; | 1828 | zip64_internal* zi; |
1880 | int err = 0; | 1829 | int err = 0; |
1881 | uLong size_centraldir = 0; | 1830 | uLong size_centraldir = 0; |
@@ -1943,8 +1892,7 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment) | |||
1943 | return err; | 1892 | return err; |
1944 | } | 1893 | } |
1945 | 1894 | ||
1946 | extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHeader) | 1895 | extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader) { |
1947 | { | ||
1948 | char* p = pData; | 1896 | char* p = pData; |
1949 | int size = 0; | 1897 | int size = 0; |
1950 | char* pNewHeader; | 1898 | char* pNewHeader; |
diff --git a/contrib/minizip/zip.h b/contrib/minizip/zip.h index 7e4509d..259efd2 100644 --- a/contrib/minizip/zip.h +++ b/contrib/minizip/zip.h | |||
@@ -113,8 +113,8 @@ typedef const char* zipcharpc; | |||
113 | #define APPEND_STATUS_CREATEAFTER (1) | 113 | #define APPEND_STATUS_CREATEAFTER (1) |
114 | #define APPEND_STATUS_ADDINZIP (2) | 114 | #define APPEND_STATUS_ADDINZIP (2) |
115 | 115 | ||
116 | extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); | 116 | extern zipFile ZEXPORT zipOpen(const char *pathname, int append); |
117 | extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append)); | 117 | extern zipFile ZEXPORT zipOpen64(const void *pathname, int append); |
118 | /* | 118 | /* |
119 | Create a zipfile. | 119 | Create a zipfile. |
120 | pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on | 120 | pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on |
@@ -134,43 +134,43 @@ extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append)); | |||
134 | Of couse, you can use RAW reading and writing to copy the file you did not want delte | 134 | Of couse, you can use RAW reading and writing to copy the file you did not want delte |
135 | */ | 135 | */ |
136 | 136 | ||
137 | extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, | 137 | extern zipFile ZEXPORT zipOpen2(const char *pathname, |
138 | int append, | 138 | int append, |
139 | zipcharpc* globalcomment, | 139 | zipcharpc* globalcomment, |
140 | zlib_filefunc_def* pzlib_filefunc_def)); | 140 | zlib_filefunc_def* pzlib_filefunc_def); |
141 | 141 | ||
142 | extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname, | 142 | extern zipFile ZEXPORT zipOpen2_64(const void *pathname, |
143 | int append, | 143 | int append, |
144 | zipcharpc* globalcomment, | 144 | zipcharpc* globalcomment, |
145 | zlib_filefunc64_def* pzlib_filefunc_def)); | 145 | zlib_filefunc64_def* pzlib_filefunc_def); |
146 | 146 | ||
147 | extern zipFile ZEXPORT zipOpen3 OF((const void *pathname, | 147 | extern zipFile ZEXPORT zipOpen3(const void *pathname, |
148 | int append, | 148 | int append, |
149 | zipcharpc* globalcomment, | 149 | zipcharpc* globalcomment, |
150 | zlib_filefunc64_32_def* pzlib_filefunc64_32_def)); | 150 | zlib_filefunc64_32_def* pzlib_filefunc64_32_def); |
151 | 151 | ||
152 | extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, | 152 | extern int ZEXPORT zipOpenNewFileInZip(zipFile file, |
153 | const char* filename, | 153 | const char* filename, |
154 | const zip_fileinfo* zipfi, | 154 | const zip_fileinfo* zipfi, |
155 | const void* extrafield_local, | 155 | const void* extrafield_local, |
156 | uInt size_extrafield_local, | 156 | uInt size_extrafield_local, |
157 | const void* extrafield_global, | 157 | const void* extrafield_global, |
158 | uInt size_extrafield_global, | 158 | uInt size_extrafield_global, |
159 | const char* comment, | 159 | const char* comment, |
160 | int method, | 160 | int method, |
161 | int level)); | 161 | int level); |
162 | 162 | ||
163 | extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file, | 163 | extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, |
164 | const char* filename, | 164 | const char* filename, |
165 | const zip_fileinfo* zipfi, | 165 | const zip_fileinfo* zipfi, |
166 | const void* extrafield_local, | 166 | const void* extrafield_local, |
167 | uInt size_extrafield_local, | 167 | uInt size_extrafield_local, |
168 | const void* extrafield_global, | 168 | const void* extrafield_global, |
169 | uInt size_extrafield_global, | 169 | uInt size_extrafield_global, |
170 | const char* comment, | 170 | const char* comment, |
171 | int method, | 171 | int method, |
172 | int level, | 172 | int level, |
173 | int zip64)); | 173 | int zip64); |
174 | 174 | ||
175 | /* | 175 | /* |
176 | Open a file in the ZIP for writing. | 176 | Open a file in the ZIP for writing. |
@@ -189,70 +189,69 @@ extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file, | |||
189 | */ | 189 | */ |
190 | 190 | ||
191 | 191 | ||
192 | extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, | 192 | extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, |
193 | const char* filename, | 193 | const char* filename, |
194 | const zip_fileinfo* zipfi, | 194 | const zip_fileinfo* zipfi, |
195 | const void* extrafield_local, | 195 | const void* extrafield_local, |
196 | uInt size_extrafield_local, | 196 | uInt size_extrafield_local, |
197 | const void* extrafield_global, | 197 | const void* extrafield_global, |
198 | uInt size_extrafield_global, | 198 | uInt size_extrafield_global, |
199 | const char* comment, | 199 | const char* comment, |
200 | int method, | 200 | int method, |
201 | int level, | 201 | int level, |
202 | int raw)); | 202 | int raw); |
203 | 203 | ||
204 | 204 | ||
205 | extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file, | 205 | extern int ZEXPORT zipOpenNewFileInZip2_64(zipFile file, |
206 | const char* filename, | 206 | const char* filename, |
207 | const zip_fileinfo* zipfi, | 207 | const zip_fileinfo* zipfi, |
208 | const void* extrafield_local, | 208 | const void* extrafield_local, |
209 | uInt size_extrafield_local, | 209 | uInt size_extrafield_local, |
210 | const void* extrafield_global, | 210 | const void* extrafield_global, |
211 | uInt size_extrafield_global, | 211 | uInt size_extrafield_global, |
212 | const char* comment, | 212 | const char* comment, |
213 | int method, | 213 | int method, |
214 | int level, | 214 | int level, |
215 | int raw, | 215 | int raw, |
216 | int zip64)); | 216 | int zip64); |
217 | /* | 217 | /* |
218 | Same than zipOpenNewFileInZip, except if raw=1, we write raw file | 218 | Same than zipOpenNewFileInZip, except if raw=1, we write raw file |
219 | */ | 219 | */ |
220 | 220 | ||
221 | extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file, | 221 | extern int ZEXPORT zipOpenNewFileInZip3(zipFile file, |
222 | const char* filename, | 222 | const char* filename, |
223 | const zip_fileinfo* zipfi, | 223 | const zip_fileinfo* zipfi, |
224 | const void* extrafield_local, | 224 | const void* extrafield_local, |
225 | uInt size_extrafield_local, | 225 | uInt size_extrafield_local, |
226 | const void* extrafield_global, | 226 | const void* extrafield_global, |
227 | uInt size_extrafield_global, | 227 | uInt size_extrafield_global, |
228 | const char* comment, | 228 | const char* comment, |
229 | int method, | 229 | int method, |
230 | int level, | 230 | int level, |
231 | int raw, | 231 | int raw, |
232 | int windowBits, | 232 | int windowBits, |
233 | int memLevel, | 233 | int memLevel, |
234 | int strategy, | 234 | int strategy, |
235 | const char* password, | 235 | const char* password, |
236 | uLong crcForCrypting)); | 236 | uLong crcForCrypting); |
237 | 237 | ||
238 | extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file, | 238 | extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, |
239 | const char* filename, | 239 | const char* filename, |
240 | const zip_fileinfo* zipfi, | 240 | const zip_fileinfo* zipfi, |
241 | const void* extrafield_local, | 241 | const void* extrafield_local, |
242 | uInt size_extrafield_local, | 242 | uInt size_extrafield_local, |
243 | const void* extrafield_global, | 243 | const void* extrafield_global, |
244 | uInt size_extrafield_global, | 244 | uInt size_extrafield_global, |
245 | const char* comment, | 245 | const char* comment, |
246 | int method, | 246 | int method, |
247 | int level, | 247 | int level, |
248 | int raw, | 248 | int raw, |
249 | int windowBits, | 249 | int windowBits, |
250 | int memLevel, | 250 | int memLevel, |
251 | int strategy, | 251 | int strategy, |
252 | const char* password, | 252 | const char* password, |
253 | uLong crcForCrypting, | 253 | uLong crcForCrypting, |
254 | int zip64 | 254 | int zip64); |
255 | )); | ||
256 | 255 | ||
257 | /* | 256 | /* |
258 | Same than zipOpenNewFileInZip2, except | 257 | Same than zipOpenNewFileInZip2, except |
@@ -261,47 +260,45 @@ extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file, | |||
261 | crcForCrypting : crc of file to compress (needed for crypting) | 260 | crcForCrypting : crc of file to compress (needed for crypting) |
262 | */ | 261 | */ |
263 | 262 | ||
264 | extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file, | 263 | extern int ZEXPORT zipOpenNewFileInZip4(zipFile file, |
265 | const char* filename, | 264 | const char* filename, |
266 | const zip_fileinfo* zipfi, | 265 | const zip_fileinfo* zipfi, |
267 | const void* extrafield_local, | 266 | const void* extrafield_local, |
268 | uInt size_extrafield_local, | 267 | uInt size_extrafield_local, |
269 | const void* extrafield_global, | 268 | const void* extrafield_global, |
270 | uInt size_extrafield_global, | 269 | uInt size_extrafield_global, |
271 | const char* comment, | 270 | const char* comment, |
272 | int method, | 271 | int method, |
273 | int level, | 272 | int level, |
274 | int raw, | 273 | int raw, |
275 | int windowBits, | 274 | int windowBits, |
276 | int memLevel, | 275 | int memLevel, |
277 | int strategy, | 276 | int strategy, |
278 | const char* password, | 277 | const char* password, |
279 | uLong crcForCrypting, | 278 | uLong crcForCrypting, |
280 | uLong versionMadeBy, | 279 | uLong versionMadeBy, |
281 | uLong flagBase | 280 | uLong flagBase); |
282 | )); | 281 | |
283 | 282 | ||
284 | 283 | extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, | |
285 | extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file, | 284 | const char* filename, |
286 | const char* filename, | 285 | const zip_fileinfo* zipfi, |
287 | const zip_fileinfo* zipfi, | 286 | const void* extrafield_local, |
288 | const void* extrafield_local, | 287 | uInt size_extrafield_local, |
289 | uInt size_extrafield_local, | 288 | const void* extrafield_global, |
290 | const void* extrafield_global, | 289 | uInt size_extrafield_global, |
291 | uInt size_extrafield_global, | 290 | const char* comment, |
292 | const char* comment, | 291 | int method, |
293 | int method, | 292 | int level, |
294 | int level, | 293 | int raw, |
295 | int raw, | 294 | int windowBits, |
296 | int windowBits, | 295 | int memLevel, |
297 | int memLevel, | 296 | int strategy, |
298 | int strategy, | 297 | const char* password, |
299 | const char* password, | 298 | uLong crcForCrypting, |
300 | uLong crcForCrypting, | 299 | uLong versionMadeBy, |
301 | uLong versionMadeBy, | 300 | uLong flagBase, |
302 | uLong flagBase, | 301 | int zip64); |
303 | int zip64 | ||
304 | )); | ||
305 | /* | 302 | /* |
306 | Same than zipOpenNewFileInZip4, except | 303 | Same than zipOpenNewFileInZip4, except |
307 | versionMadeBy : value for Version made by field | 304 | versionMadeBy : value for Version made by field |
@@ -309,25 +306,25 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file, | |||
309 | */ | 306 | */ |
310 | 307 | ||
311 | 308 | ||
312 | extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, | 309 | extern int ZEXPORT zipWriteInFileInZip(zipFile file, |
313 | const void* buf, | 310 | const void* buf, |
314 | unsigned len)); | 311 | unsigned len); |
315 | /* | 312 | /* |
316 | Write data in the zipfile | 313 | Write data in the zipfile |
317 | */ | 314 | */ |
318 | 315 | ||
319 | extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); | 316 | extern int ZEXPORT zipCloseFileInZip(zipFile file); |
320 | /* | 317 | /* |
321 | Close the current file in the zipfile | 318 | Close the current file in the zipfile |
322 | */ | 319 | */ |
323 | 320 | ||
324 | extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, | 321 | extern int ZEXPORT zipCloseFileInZipRaw(zipFile file, |
325 | uLong uncompressed_size, | 322 | uLong uncompressed_size, |
326 | uLong crc32)); | 323 | uLong crc32); |
327 | 324 | ||
328 | extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file, | 325 | extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, |
329 | ZPOS64_T uncompressed_size, | 326 | ZPOS64_T uncompressed_size, |
330 | uLong crc32)); | 327 | uLong crc32); |
331 | 328 | ||
332 | /* | 329 | /* |
333 | Close the current file in the zipfile, for file opened with | 330 | Close the current file in the zipfile, for file opened with |
@@ -335,14 +332,14 @@ extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file, | |||
335 | uncompressed_size and crc32 are value for the uncompressed size | 332 | uncompressed_size and crc32 are value for the uncompressed size |
336 | */ | 333 | */ |
337 | 334 | ||
338 | extern int ZEXPORT zipClose OF((zipFile file, | 335 | extern int ZEXPORT zipClose(zipFile file, |
339 | const char* global_comment)); | 336 | const char* global_comment); |
340 | /* | 337 | /* |
341 | Close the zipfile | 338 | Close the zipfile |
342 | */ | 339 | */ |
343 | 340 | ||
344 | 341 | ||
345 | extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader)); | 342 | extern int ZEXPORT zipRemoveExtraInfoBlock(char* pData, int* dataLen, short sHeader); |
346 | /* | 343 | /* |
347 | zipRemoveExtraInfoBlock - Added by Mathias Svensson | 344 | zipRemoveExtraInfoBlock - Added by Mathias Svensson |
348 | 345 | ||