diff options
Diffstat (limited to 'rbutil/rbutilqt/quazip/unzip.h')
-rw-r--r-- | rbutil/rbutilqt/quazip/unzip.h | 154 |
1 files changed, 129 insertions, 25 deletions
diff --git a/rbutil/rbutilqt/quazip/unzip.h b/rbutil/rbutilqt/quazip/unzip.h index b247937c80..da7b062845 100644 --- a/rbutil/rbutilqt/quazip/unzip.h +++ b/rbutil/rbutilqt/quazip/unzip.h | |||
@@ -1,20 +1,20 @@ | |||
1 | /* unzip.h -- IO for uncompress .zip files using zlib | 1 | /* unzip.h -- IO for uncompress .zip files using zlib |
2 | Version 1.01e, February 12th, 2005 | 2 | Version 1.1, February 14h, 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 extract file from .ZIP file, compatible with PKZip 2.04g | 7 | Modifications of Unzip for Zip64 |
7 | WinZip, InfoZip tools and compatible. | 8 | Copyright (C) 2007-2008 Even Rouault |
8 | 9 | ||
9 | Multi volume ZipFile (span) are not supported. | 10 | Modifications for Zip64 support on both zip and unzip |
10 | Encryption compatible with pkzip 2.04g only supported | 11 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) |
11 | Old compressions used by old PKZip 1.x are not supported | ||
12 | 12 | ||
13 | For more info read MiniZip_info.txt | ||
13 | 14 | ||
14 | I WAIT FEEDBACK at mail info@winimage.com | 15 | --------------------------------------------------------------------------------- |
15 | Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution | ||
16 | 16 | ||
17 | Condition of use and distribution are the same than zlib : | 17 | Condition of use and distribution are the same than zlib : |
18 | 18 | ||
19 | This software is provided 'as-is', without any express or implied | 19 | This software is provided 'as-is', without any express or implied |
20 | warranty. In no event will the authors be held liable for any damages | 20 | warranty. In no event will the authors be held liable for any damages |
@@ -32,18 +32,21 @@ | |||
32 | misrepresented as being the original software. | 32 | misrepresented as being the original software. |
33 | 3. This notice may not be removed or altered from any source distribution. | 33 | 3. This notice may not be removed or altered from any source distribution. |
34 | 34 | ||
35 | --------------------------------------------------------------------------------- | ||
35 | 36 | ||
36 | */ | 37 | Changes |
38 | |||
39 | See header of unzip64.c | ||
37 | 40 | ||
38 | /* for more info about .ZIP format, see | 41 | --------------------------------------------------------------------------- |
39 | http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip | 42 | |
40 | http://www.info-zip.org/pub/infozip/doc/ | 43 | As per the requirement above, this file is plainly marked as modified |
41 | PkWare has also a specification at : | 44 | by Sergey A. Tachenov. Most modifications include the I/O API redesign |
42 | ftp://ftp.pkware.com/probdesc.zip | 45 | to support QIODevice interface. Some improvements and small fixes were also made. |
43 | */ | 46 | */ |
44 | 47 | ||
45 | #ifndef _unz_H | 48 | #ifndef _unz64_H |
46 | #define _unz_H | 49 | #define _unz64_H |
47 | 50 | ||
48 | #ifdef __cplusplus | 51 | #ifdef __cplusplus |
49 | extern "C" { | 52 | extern "C" { |
@@ -53,10 +56,16 @@ extern "C" { | |||
53 | #include "zlib.h" | 56 | #include "zlib.h" |
54 | #endif | 57 | #endif |
55 | 58 | ||
56 | #ifndef _ZLIBIOAPI_H | 59 | #ifndef _ZLIBIOAPI_H |
57 | #include "ioapi.h" | 60 | #include "ioapi.h" |
58 | #endif | 61 | #endif |
59 | 62 | ||
63 | #ifdef HAVE_BZIP2 | ||
64 | #include "bzlib.h" | ||
65 | #endif | ||
66 | |||
67 | #define Z_BZIP2ED 12 | ||
68 | |||
60 | #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) | 69 | #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) |
61 | /* like the STRICT of WIN32, we define a pointer that cannot be converted | 70 | /* like the STRICT of WIN32, we define a pointer that cannot be converted |
62 | from (void*) without cast */ | 71 | from (void*) without cast */ |
@@ -76,6 +85,9 @@ typedef voidp unzFile; | |||
76 | #define UNZ_INTERNALERROR (-104) | 85 | #define UNZ_INTERNALERROR (-104) |
77 | #define UNZ_CRCERROR (-105) | 86 | #define UNZ_CRCERROR (-105) |
78 | 87 | ||
88 | #define UNZ_AUTO_CLOSE 0x01u | ||
89 | #define UNZ_DEFAULT_FLAGS UNZ_AUTO_CLOSE | ||
90 | |||
79 | /* tm_unz contain date/time info */ | 91 | /* tm_unz contain date/time info */ |
80 | typedef struct tm_unz_s | 92 | typedef struct tm_unz_s |
81 | { | 93 | { |
@@ -89,15 +101,42 @@ typedef struct tm_unz_s | |||
89 | 101 | ||
90 | /* unz_global_info structure contain global data about the ZIPfile | 102 | /* unz_global_info structure contain global data about the ZIPfile |
91 | These data comes from the end of central dir */ | 103 | These data comes from the end of central dir */ |
104 | typedef struct unz_global_info64_s | ||
105 | { | ||
106 | ZPOS64_T number_entry; /* total number of entries in | ||
107 | the central dir on this disk */ | ||
108 | uLong size_comment; /* size of the global comment of the zipfile */ | ||
109 | } unz_global_info64; | ||
110 | |||
92 | typedef struct unz_global_info_s | 111 | typedef struct unz_global_info_s |
93 | { | 112 | { |
94 | uLong number_entry; /* total number of entries in | 113 | uLong number_entry; /* total number of entries in |
95 | the central dir on this disk */ | 114 | the central dir on this disk */ |
96 | uLong size_comment; /* size of the global comment of the zipfile */ | 115 | uLong size_comment; /* size of the global comment of the zipfile */ |
97 | } unz_global_info; | 116 | } unz_global_info; |
98 | 117 | ||
99 | |||
100 | /* unz_file_info contain information about a file in the zipfile */ | 118 | /* unz_file_info contain information about a file in the zipfile */ |
119 | typedef struct unz_file_info64_s | ||
120 | { | ||
121 | uLong version; /* version made by 2 bytes */ | ||
122 | uLong version_needed; /* version needed to extract 2 bytes */ | ||
123 | uLong flag; /* general purpose bit flag 2 bytes */ | ||
124 | uLong compression_method; /* compression method 2 bytes */ | ||
125 | uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ | ||
126 | uLong crc; /* crc-32 4 bytes */ | ||
127 | ZPOS64_T compressed_size; /* compressed size 8 bytes */ | ||
128 | ZPOS64_T uncompressed_size; /* uncompressed size 8 bytes */ | ||
129 | uLong size_filename; /* filename length 2 bytes */ | ||
130 | uLong size_file_extra; /* extra field length 2 bytes */ | ||
131 | uLong size_file_comment; /* file comment length 2 bytes */ | ||
132 | |||
133 | uLong disk_num_start; /* disk number start 2 bytes */ | ||
134 | uLong internal_fa; /* internal file attributes 2 bytes */ | ||
135 | uLong external_fa; /* external file attributes 4 bytes */ | ||
136 | |||
137 | tm_unz tmu_date; | ||
138 | } unz_file_info64; | ||
139 | |||
101 | typedef struct unz_file_info_s | 140 | typedef struct unz_file_info_s |
102 | { | 141 | { |
103 | uLong version; /* version made by 2 bytes */ | 142 | uLong version; /* version made by 2 bytes */ |
@@ -132,7 +171,8 @@ extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, | |||
132 | */ | 171 | */ |
133 | 172 | ||
134 | 173 | ||
135 | extern unzFile ZEXPORT unzOpen OF((const char *path)); | 174 | extern unzFile ZEXPORT unzOpen OF((voidpf file)); |
175 | extern unzFile ZEXPORT unzOpen64 OF((voidpf file)); | ||
136 | /* | 176 | /* |
137 | Open a Zip file. path contain the full pathname (by example, | 177 | Open a Zip file. path contain the full pathname (by example, |
138 | on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer | 178 | on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer |
@@ -141,15 +181,40 @@ extern unzFile ZEXPORT unzOpen OF((const char *path)); | |||
141 | return value is NULL. | 181 | return value is NULL. |
142 | Else, the return value is a unzFile Handle, usable with other function | 182 | Else, the return value is a unzFile Handle, usable with other function |
143 | of this unzip package. | 183 | of this unzip package. |
184 | the "64" function take a const void* pointer, because the path is just the | ||
185 | value passed to the open64_file_func callback. | ||
186 | Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path | ||
187 | is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char* | ||
188 | does not describe the reality | ||
144 | */ | 189 | */ |
145 | 190 | ||
146 | extern unzFile ZEXPORT unzOpen2 OF((const char *path, | 191 | |
192 | extern unzFile ZEXPORT unzOpen2 OF((voidpf file, | ||
147 | zlib_filefunc_def* pzlib_filefunc_def)); | 193 | zlib_filefunc_def* pzlib_filefunc_def)); |
148 | /* | 194 | /* |
149 | Open a Zip file, like unzOpen, but provide a set of file low level API | 195 | Open a Zip file, like unzOpen, but provide a set of file low level API |
150 | for read/write the zip file (see ioapi.h) | 196 | for read/write the zip file (see ioapi.h) |
151 | */ | 197 | */ |
152 | 198 | ||
199 | extern unzFile ZEXPORT unzOpen2_64 OF((voidpf file, | ||
200 | zlib_filefunc64_def* pzlib_filefunc_def)); | ||
201 | /* | ||
202 | Open a Zip file, like unz64Open, but provide a set of file low level API | ||
203 | for read/write the zip file (see ioapi.h) | ||
204 | */ | ||
205 | |||
206 | |||
207 | /* | ||
208 | * Exported by Sergey A. Tachenov to implement some QuaZIP features. This | ||
209 | * function MAY change signature in order to implement even more features. | ||
210 | * You have been warned! | ||
211 | * */ | ||
212 | extern unzFile unzOpenInternal (voidpf file, | ||
213 | zlib_filefunc64_32_def* pzlib_filefunc64_32_def, | ||
214 | int is64bitOpenFunction, unsigned flags); | ||
215 | |||
216 | |||
217 | |||
153 | extern int ZEXPORT unzClose OF((unzFile file)); | 218 | extern int ZEXPORT unzClose OF((unzFile file)); |
154 | /* | 219 | /* |
155 | Close a ZipFile opened with unzipOpen. | 220 | Close a ZipFile opened with unzipOpen. |
@@ -159,6 +224,9 @@ extern int ZEXPORT unzClose OF((unzFile file)); | |||
159 | 224 | ||
160 | extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, | 225 | extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, |
161 | unz_global_info *pglobal_info)); | 226 | unz_global_info *pglobal_info)); |
227 | |||
228 | extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file, | ||
229 | unz_global_info64 *pglobal_info)); | ||
162 | /* | 230 | /* |
163 | Write info about the ZipFile in the *pglobal_info structure. | 231 | Write info about the ZipFile in the *pglobal_info structure. |
164 | No preparation of the structure is needed | 232 | No preparation of the structure is needed |
@@ -221,8 +289,31 @@ extern int ZEXPORT unzGoToFilePos( | |||
221 | unzFile file, | 289 | unzFile file, |
222 | unz_file_pos* file_pos); | 290 | unz_file_pos* file_pos); |
223 | 291 | ||
292 | typedef struct unz64_file_pos_s | ||
293 | { | ||
294 | ZPOS64_T pos_in_zip_directory; /* offset in zip file directory */ | ||
295 | ZPOS64_T num_of_file; /* # of file */ | ||
296 | } unz64_file_pos; | ||
297 | |||
298 | extern int ZEXPORT unzGetFilePos64( | ||
299 | unzFile file, | ||
300 | unz64_file_pos* file_pos); | ||
301 | |||
302 | extern int ZEXPORT unzGoToFilePos64( | ||
303 | unzFile file, | ||
304 | const unz64_file_pos* file_pos); | ||
305 | |||
224 | /* ****************************************** */ | 306 | /* ****************************************** */ |
225 | 307 | ||
308 | extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file, | ||
309 | unz_file_info64 *pfile_info, | ||
310 | char *szFileName, | ||
311 | uLong fileNameBufferSize, | ||
312 | void *extraField, | ||
313 | uLong extraFieldBufferSize, | ||
314 | char *szComment, | ||
315 | uLong commentBufferSize)); | ||
316 | |||
226 | extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, | 317 | extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, |
227 | unz_file_info *pfile_info, | 318 | unz_file_info *pfile_info, |
228 | char *szFileName, | 319 | char *szFileName, |
@@ -244,6 +335,14 @@ extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, | |||
244 | (commentBufferSize is the size of the buffer) | 335 | (commentBufferSize is the size of the buffer) |
245 | */ | 336 | */ |
246 | 337 | ||
338 | |||
339 | /** Addition for GDAL : START */ | ||
340 | |||
341 | extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file)); | ||
342 | |||
343 | /** Addition for GDAL : END */ | ||
344 | |||
345 | |||
247 | /***************************************************************************/ | 346 | /***************************************************************************/ |
248 | /* for reading the content of the current zipfile, you can open it, read data | 347 | /* for reading the content of the current zipfile, you can open it, read data |
249 | from it, and close it (you can close it before reading all the file) | 348 | from it, and close it (you can close it before reading all the file) |
@@ -312,6 +411,8 @@ extern int ZEXPORT unzReadCurrentFile OF((unzFile file, | |||
312 | */ | 411 | */ |
313 | 412 | ||
314 | extern z_off_t ZEXPORT unztell OF((unzFile file)); | 413 | extern z_off_t ZEXPORT unztell OF((unzFile file)); |
414 | |||
415 | extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file)); | ||
315 | /* | 416 | /* |
316 | Give the current position in uncompressed data | 417 | Give the current position in uncompressed data |
317 | */ | 418 | */ |
@@ -340,15 +441,18 @@ extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, | |||
340 | /***************************************************************************/ | 441 | /***************************************************************************/ |
341 | 442 | ||
342 | /* Get the current file offset */ | 443 | /* Get the current file offset */ |
444 | extern ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file); | ||
343 | extern uLong ZEXPORT unzGetOffset (unzFile file); | 445 | extern uLong ZEXPORT unzGetOffset (unzFile file); |
344 | 446 | ||
345 | /* Set the current file offset */ | 447 | /* Set the current file offset */ |
448 | extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos); | ||
346 | extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); | 449 | extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); |
347 | 450 | ||
348 | 451 | extern int ZEXPORT unzSetFlags(unzFile file, unsigned flags); | |
452 | extern int ZEXPORT unzClearFlags(unzFile file, unsigned flags); | ||
349 | 453 | ||
350 | #ifdef __cplusplus | 454 | #ifdef __cplusplus |
351 | } | 455 | } |
352 | #endif | 456 | #endif |
353 | 457 | ||
354 | #endif /* _unz_H */ | 458 | #endif /* _unz64_H */ |