diff options
Diffstat (limited to 'contrib/minizip/zip.h')
-rw-r--r-- | contrib/minizip/zip.h | 175 |
1 files changed, 151 insertions, 24 deletions
diff --git a/contrib/minizip/zip.h b/contrib/minizip/zip.h index acacce8..a33a52d 100644 --- a/contrib/minizip/zip.h +++ b/contrib/minizip/zip.h | |||
@@ -1,19 +1,15 @@ | |||
1 | /* zip.h -- IO for compress .zip files using zlib | 1 | /* zip.h -- IO on .zip files using zlib |
2 | Version 1.01e, February 12th, 2005 | 2 | Version 1.1, January 7th, 2010 |
3 | part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) | ||
3 | 4 | ||
4 | Copyright (C) 1998-2005 Gilles Vollant | 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) |
5 | 6 | ||
6 | This unzip package allow creates .ZIP file, compatible with PKZip 2.04g | 7 | Modifications for Zip64 support |
7 | WinZip, InfoZip tools and compatible. | 8 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) |
8 | Multi volume ZipFile (span) are not supported. | ||
9 | Encryption compatible with pkzip 2.04g only supported | ||
10 | Old compressions used by old PKZip 1.x are not supported | ||
11 | 9 | ||
12 | For uncompress .zip file, look at unzip.h | 10 | For more info read MiniZip_info.txt |
13 | 11 | ||
14 | 12 | --------------------------------------------------------------------------- | |
15 | I WAIT FEEDBACK at mail info@winimage.com | ||
16 | Visit also http://www.winimage.com/zLibDll/unzip.html for evolution | ||
17 | 13 | ||
18 | Condition of use and distribution are the same than zlib : | 14 | Condition of use and distribution are the same than zlib : |
19 | 15 | ||
@@ -33,23 +29,23 @@ | |||
33 | misrepresented as being the original software. | 29 | misrepresented as being the original software. |
34 | 3. This notice may not be removed or altered from any source distribution. | 30 | 3. This notice may not be removed or altered from any source distribution. |
35 | 31 | ||
32 | --------------------------------------------------------------------------- | ||
36 | 33 | ||
37 | */ | 34 | Changes |
35 | |||
36 | See header of zip.h | ||
38 | 37 | ||
39 | /* for more info about .ZIP format, see | ||
40 | http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip | ||
41 | http://www.info-zip.org/pub/infozip/doc/ | ||
42 | PkWare has also a specification at : | ||
43 | ftp://ftp.pkware.com/probdesc.zip | ||
44 | */ | 38 | */ |
45 | 39 | ||
46 | #ifndef _zip_H | 40 | #ifndef _zip12_H |
47 | #define _zip_H | 41 | #define _zip12_H |
48 | 42 | ||
49 | #ifdef __cplusplus | 43 | #ifdef __cplusplus |
50 | extern "C" { | 44 | extern "C" { |
51 | #endif | 45 | #endif |
52 | 46 | ||
47 | //#define HAVE_BZIP2 | ||
48 | |||
53 | #ifndef _ZLIB_H | 49 | #ifndef _ZLIB_H |
54 | #include "zlib.h" | 50 | #include "zlib.h" |
55 | #endif | 51 | #endif |
@@ -58,6 +54,12 @@ extern "C" { | |||
58 | #include "ioapi.h" | 54 | #include "ioapi.h" |
59 | #endif | 55 | #endif |
60 | 56 | ||
57 | #ifdef HAVE_BZIP2 | ||
58 | #include "bzlib.h" | ||
59 | #endif | ||
60 | |||
61 | #define Z_BZIP2ED 12 | ||
62 | |||
61 | #if defined(STRICTZIP) || defined(STRICTZIPUNZIP) | 63 | #if defined(STRICTZIP) || defined(STRICTZIPUNZIP) |
62 | /* like the STRICT of WIN32, we define a pointer that cannot be converted | 64 | /* like the STRICT of WIN32, we define a pointer that cannot be converted |
63 | from (void*) without cast */ | 65 | from (void*) without cast */ |
@@ -112,6 +114,7 @@ typedef const char* zipcharpc; | |||
112 | #define APPEND_STATUS_ADDINZIP (2) | 114 | #define APPEND_STATUS_ADDINZIP (2) |
113 | 115 | ||
114 | extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); | 116 | extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); |
117 | extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append)); | ||
115 | /* | 118 | /* |
116 | Create a zipfile. | 119 | Create a zipfile. |
117 | 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 |
@@ -136,6 +139,11 @@ extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, | |||
136 | zipcharpc* globalcomment, | 139 | zipcharpc* globalcomment, |
137 | zlib_filefunc_def* pzlib_filefunc_def)); | 140 | zlib_filefunc_def* pzlib_filefunc_def)); |
138 | 141 | ||
142 | extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname, | ||
143 | int append, | ||
144 | zipcharpc* globalcomment, | ||
145 | zlib_filefunc64_def* pzlib_filefunc_def)); | ||
146 | |||
139 | extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, | 147 | extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, |
140 | const char* filename, | 148 | const char* filename, |
141 | const zip_fileinfo* zipfi, | 149 | const zip_fileinfo* zipfi, |
@@ -146,6 +154,19 @@ extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, | |||
146 | const char* comment, | 154 | const char* comment, |
147 | int method, | 155 | int method, |
148 | int level)); | 156 | int level)); |
157 | |||
158 | extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file, | ||
159 | const char* filename, | ||
160 | const zip_fileinfo* zipfi, | ||
161 | const void* extrafield_local, | ||
162 | uInt size_extrafield_local, | ||
163 | const void* extrafield_global, | ||
164 | uInt size_extrafield_global, | ||
165 | const char* comment, | ||
166 | int method, | ||
167 | int level, | ||
168 | int zip64)); | ||
169 | |||
149 | /* | 170 | /* |
150 | Open a file in the ZIP for writing. | 171 | Open a file in the ZIP for writing. |
151 | filename : the filename in zip (if NULL, '-' without quote will be used | 172 | filename : the filename in zip (if NULL, '-' without quote will be used |
@@ -157,6 +178,9 @@ extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, | |||
157 | if comment != NULL, comment contain the comment string | 178 | if comment != NULL, comment contain the comment string |
158 | method contain the compression method (0 for store, Z_DEFLATED for deflate) | 179 | method contain the compression method (0 for store, Z_DEFLATED for deflate) |
159 | level contain the level of compression (can be Z_DEFAULT_COMPRESSION) | 180 | level contain the level of compression (can be Z_DEFAULT_COMPRESSION) |
181 | zip64 is set to 1 if a zip64 extended information block should be added to the local file header. | ||
182 | this MUST be '1' if the uncompressed size is >= 0xffffffff. | ||
183 | |||
160 | */ | 184 | */ |
161 | 185 | ||
162 | 186 | ||
@@ -172,6 +196,19 @@ extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, | |||
172 | int level, | 196 | int level, |
173 | int raw)); | 197 | int raw)); |
174 | 198 | ||
199 | |||
200 | extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file, | ||
201 | const char* filename, | ||
202 | const zip_fileinfo* zipfi, | ||
203 | const void* extrafield_local, | ||
204 | uInt size_extrafield_local, | ||
205 | const void* extrafield_global, | ||
206 | uInt size_extrafield_global, | ||
207 | const char* comment, | ||
208 | int method, | ||
209 | int level, | ||
210 | int raw, | ||
211 | int zip64)); | ||
175 | /* | 212 | /* |
176 | Same than zipOpenNewFileInZip, except if raw=1, we write raw file | 213 | Same than zipOpenNewFileInZip, except if raw=1, we write raw file |
177 | */ | 214 | */ |
@@ -191,13 +228,79 @@ extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file, | |||
191 | int memLevel, | 228 | int memLevel, |
192 | int strategy, | 229 | int strategy, |
193 | const char* password, | 230 | const char* password, |
194 | uLong crcForCtypting)); | 231 | uLong crcForCrypting)); |
232 | |||
233 | extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file, | ||
234 | const char* filename, | ||
235 | const zip_fileinfo* zipfi, | ||
236 | const void* extrafield_local, | ||
237 | uInt size_extrafield_local, | ||
238 | const void* extrafield_global, | ||
239 | uInt size_extrafield_global, | ||
240 | const char* comment, | ||
241 | int method, | ||
242 | int level, | ||
243 | int raw, | ||
244 | int windowBits, | ||
245 | int memLevel, | ||
246 | int strategy, | ||
247 | const char* password, | ||
248 | uLong crcForCrypting, | ||
249 | int zip64 | ||
250 | )); | ||
195 | 251 | ||
196 | /* | 252 | /* |
197 | Same than zipOpenNewFileInZip2, except | 253 | Same than zipOpenNewFileInZip2, except |
198 | windowBits,memLevel,,strategy : see parameter strategy in deflateInit2 | 254 | windowBits,memLevel,,strategy : see parameter strategy in deflateInit2 |
199 | password : crypting password (NULL for no crypting) | 255 | password : crypting password (NULL for no crypting) |
200 | crcForCtypting : crc of file to compress (needed for crypting) | 256 | crcForCrypting : crc of file to compress (needed for crypting) |
257 | */ | ||
258 | |||
259 | extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file, | ||
260 | const char* filename, | ||
261 | const zip_fileinfo* zipfi, | ||
262 | const void* extrafield_local, | ||
263 | uInt size_extrafield_local, | ||
264 | const void* extrafield_global, | ||
265 | uInt size_extrafield_global, | ||
266 | const char* comment, | ||
267 | int method, | ||
268 | int level, | ||
269 | int raw, | ||
270 | int windowBits, | ||
271 | int memLevel, | ||
272 | int strategy, | ||
273 | const char* password, | ||
274 | uLong crcForCrypting, | ||
275 | uLong versionMadeBy, | ||
276 | uLong flagBase | ||
277 | )); | ||
278 | |||
279 | |||
280 | extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file, | ||
281 | const char* filename, | ||
282 | const zip_fileinfo* zipfi, | ||
283 | const void* extrafield_local, | ||
284 | uInt size_extrafield_local, | ||
285 | const void* extrafield_global, | ||
286 | uInt size_extrafield_global, | ||
287 | const char* comment, | ||
288 | int method, | ||
289 | int level, | ||
290 | int raw, | ||
291 | int windowBits, | ||
292 | int memLevel, | ||
293 | int strategy, | ||
294 | const char* password, | ||
295 | uLong crcForCrypting, | ||
296 | uLong versionMadeBy, | ||
297 | uLong flagBase, | ||
298 | int zip64 | ||
299 | )); | ||
300 | /* | ||
301 | Same than zipOpenNewFileInZip4, except | ||
302 | versionMadeBy : value for Version made by field | ||
303 | flag : value for flag field (compression level info will be added) | ||
201 | */ | 304 | */ |
202 | 305 | ||
203 | 306 | ||
@@ -216,8 +319,13 @@ extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); | |||
216 | extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, | 319 | extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, |
217 | uLong uncompressed_size, | 320 | uLong uncompressed_size, |
218 | uLong crc32)); | 321 | uLong crc32)); |
322 | |||
323 | extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file, | ||
324 | ZPOS64_T uncompressed_size, | ||
325 | uLong crc32)); | ||
326 | |||
219 | /* | 327 | /* |
220 | Close the current file in the zipfile, for fiel opened with | 328 | Close the current file in the zipfile, for file opened with |
221 | parameter raw=1 in zipOpenNewFileInZip2 | 329 | parameter raw=1 in zipOpenNewFileInZip2 |
222 | uncompressed_size and crc32 are value for the uncompressed size | 330 | uncompressed_size and crc32 are value for the uncompressed size |
223 | */ | 331 | */ |
@@ -228,8 +336,27 @@ extern int ZEXPORT zipClose OF((zipFile file, | |||
228 | Close the zipfile | 336 | Close the zipfile |
229 | */ | 337 | */ |
230 | 338 | ||
339 | |||
340 | extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader)); | ||
341 | /* | ||
342 | zipRemoveExtraInfoBlock - Added by Mathias Svensson | ||
343 | |||
344 | Remove extra information block from a extra information data for the local file header or central directory header | ||
345 | |||
346 | It is needed to remove ZIP64 extra information blocks when before data is written if using RAW mode. | ||
347 | |||
348 | 0x0001 is the signature header for the ZIP64 extra information blocks | ||
349 | |||
350 | usage. | ||
351 | Remove ZIP64 Extra information from a central director extra field data | ||
352 | zipRemoveExtraInfoBlock(pCenDirExtraFieldData, &nCenDirExtraFieldDataLen, 0x0001); | ||
353 | |||
354 | Remove ZIP64 Extra information from a Local File Header extra field data | ||
355 | zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001); | ||
356 | */ | ||
357 | |||
231 | #ifdef __cplusplus | 358 | #ifdef __cplusplus |
232 | } | 359 | } |
233 | #endif | 360 | #endif |
234 | 361 | ||
235 | #endif /* _zip_H */ | 362 | #endif /* _zip64_H */ |