diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:26:49 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:26:49 -0700 |
commit | d004b047838a7e803818b4973a2e39e0ff8c1fa2 (patch) | |
tree | 9e8c804f78d73152c70d4ff24c6a7531a0d46782 /contrib/minizip/unzip.h | |
parent | f6194ef39af5864f792412460c354cc339dde7d1 (diff) | |
download | zlib-1.2.3.5.tar.gz zlib-1.2.3.5.tar.bz2 zlib-1.2.3.5.zip |
zlib 1.2.3.5v1.2.3.5
Diffstat (limited to 'contrib/minizip/unzip.h')
-rw-r--r-- | contrib/minizip/unzip.h | 129 |
1 files changed, 106 insertions, 23 deletions
diff --git a/contrib/minizip/unzip.h b/contrib/minizip/unzip.h index b247937..a2e698f 100644 --- a/contrib/minizip/unzip.h +++ b/contrib/minizip/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, 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 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,16 @@ | |||
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 | ||
39 | http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip | ||
40 | http://www.info-zip.org/pub/infozip/doc/ | ||
41 | PkWare has also a specification at : | ||
42 | ftp://ftp.pkware.com/probdesc.zip | ||
43 | */ | 41 | */ |
44 | 42 | ||
45 | #ifndef _unz_H | 43 | #ifndef _unz64_H |
46 | #define _unz_H | 44 | #define _unz64_H |
47 | 45 | ||
48 | #ifdef __cplusplus | 46 | #ifdef __cplusplus |
49 | extern "C" { | 47 | extern "C" { |
@@ -53,10 +51,16 @@ extern "C" { | |||
53 | #include "zlib.h" | 51 | #include "zlib.h" |
54 | #endif | 52 | #endif |
55 | 53 | ||
56 | #ifndef _ZLIBIOAPI_H | 54 | #ifndef _ZLIBIOAPI_H |
57 | #include "ioapi.h" | 55 | #include "ioapi.h" |
58 | #endif | 56 | #endif |
59 | 57 | ||
58 | #ifdef HAVE_BZIP2 | ||
59 | #include "bzlib.h" | ||
60 | #endif | ||
61 | |||
62 | #define Z_BZIP2ED 12 | ||
63 | |||
60 | #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) | 64 | #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) |
61 | /* like the STRICT of WIN32, we define a pointer that cannot be converted | 65 | /* like the STRICT of WIN32, we define a pointer that cannot be converted |
62 | from (void*) without cast */ | 66 | from (void*) without cast */ |
@@ -89,15 +93,42 @@ typedef struct tm_unz_s | |||
89 | 93 | ||
90 | /* unz_global_info structure contain global data about the ZIPfile | 94 | /* unz_global_info structure contain global data about the ZIPfile |
91 | These data comes from the end of central dir */ | 95 | These data comes from the end of central dir */ |
96 | typedef struct unz_global_info64_s | ||
97 | { | ||
98 | ZPOS64_T number_entry; /* total number of entries in | ||
99 | the central dir on this disk */ | ||
100 | uLong size_comment; /* size of the global comment of the zipfile */ | ||
101 | } unz_global_info64; | ||
102 | |||
92 | typedef struct unz_global_info_s | 103 | typedef struct unz_global_info_s |
93 | { | 104 | { |
94 | uLong number_entry; /* total number of entries in | 105 | uLong number_entry; /* total number of entries in |
95 | the central dir on this disk */ | 106 | the central dir on this disk */ |
96 | uLong size_comment; /* size of the global comment of the zipfile */ | 107 | uLong size_comment; /* size of the global comment of the zipfile */ |
97 | } unz_global_info; | 108 | } unz_global_info; |
98 | 109 | ||
99 | |||
100 | /* unz_file_info contain information about a file in the zipfile */ | 110 | /* unz_file_info contain information about a file in the zipfile */ |
111 | typedef struct unz_file_info64_s | ||
112 | { | ||
113 | uLong version; /* version made by 2 bytes */ | ||
114 | uLong version_needed; /* version needed to extract 2 bytes */ | ||
115 | uLong flag; /* general purpose bit flag 2 bytes */ | ||
116 | uLong compression_method; /* compression method 2 bytes */ | ||
117 | uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ | ||
118 | uLong crc; /* crc-32 4 bytes */ | ||
119 | ZPOS64_T compressed_size; /* compressed size 8 bytes */ | ||
120 | ZPOS64_T uncompressed_size; /* uncompressed size 8 bytes */ | ||
121 | uLong size_filename; /* filename length 2 bytes */ | ||
122 | uLong size_file_extra; /* extra field length 2 bytes */ | ||
123 | uLong size_file_comment; /* file comment length 2 bytes */ | ||
124 | |||
125 | uLong disk_num_start; /* disk number start 2 bytes */ | ||
126 | uLong internal_fa; /* internal file attributes 2 bytes */ | ||
127 | uLong external_fa; /* external file attributes 4 bytes */ | ||
128 | |||
129 | tm_unz tmu_date; | ||
130 | } unz_file_info64; | ||
131 | |||
101 | typedef struct unz_file_info_s | 132 | typedef struct unz_file_info_s |
102 | { | 133 | { |
103 | uLong version; /* version made by 2 bytes */ | 134 | uLong version; /* version made by 2 bytes */ |
@@ -133,6 +164,7 @@ extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, | |||
133 | 164 | ||
134 | 165 | ||
135 | extern unzFile ZEXPORT unzOpen OF((const char *path)); | 166 | extern unzFile ZEXPORT unzOpen OF((const char *path)); |
167 | extern unzFile ZEXPORT unzOpen64 OF((const void *path)); | ||
136 | /* | 168 | /* |
137 | Open a Zip file. path contain the full pathname (by example, | 169 | 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 | 170 | on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer |
@@ -141,8 +173,14 @@ extern unzFile ZEXPORT unzOpen OF((const char *path)); | |||
141 | return value is NULL. | 173 | return value is NULL. |
142 | Else, the return value is a unzFile Handle, usable with other function | 174 | Else, the return value is a unzFile Handle, usable with other function |
143 | of this unzip package. | 175 | of this unzip package. |
176 | the "64" function take a const void* pointer, because the path is just the | ||
177 | value passed to the open64_file_func callback. | ||
178 | Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path | ||
179 | is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char* | ||
180 | does not describe the reality | ||
144 | */ | 181 | */ |
145 | 182 | ||
183 | |||
146 | extern unzFile ZEXPORT unzOpen2 OF((const char *path, | 184 | extern unzFile ZEXPORT unzOpen2 OF((const char *path, |
147 | zlib_filefunc_def* pzlib_filefunc_def)); | 185 | zlib_filefunc_def* pzlib_filefunc_def)); |
148 | /* | 186 | /* |
@@ -150,6 +188,13 @@ extern unzFile ZEXPORT unzOpen2 OF((const char *path, | |||
150 | for read/write the zip file (see ioapi.h) | 188 | for read/write the zip file (see ioapi.h) |
151 | */ | 189 | */ |
152 | 190 | ||
191 | extern unzFile ZEXPORT unzOpen2_64 OF((const void *path, | ||
192 | zlib_filefunc64_def* pzlib_filefunc_def)); | ||
193 | /* | ||
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) | ||
196 | */ | ||
197 | |||
153 | extern int ZEXPORT unzClose OF((unzFile file)); | 198 | extern int ZEXPORT unzClose OF((unzFile file)); |
154 | /* | 199 | /* |
155 | Close a ZipFile opened with unzipOpen. | 200 | Close a ZipFile opened with unzipOpen. |
@@ -159,6 +204,9 @@ extern int ZEXPORT unzClose OF((unzFile file)); | |||
159 | 204 | ||
160 | extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, | 205 | extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, |
161 | unz_global_info *pglobal_info)); | 206 | unz_global_info *pglobal_info)); |
207 | |||
208 | extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file, | ||
209 | unz_global_info64 *pglobal_info)); | ||
162 | /* | 210 | /* |
163 | Write info about the ZipFile in the *pglobal_info structure. | 211 | Write info about the ZipFile in the *pglobal_info structure. |
164 | No preparation of the structure is needed | 212 | No preparation of the structure is needed |
@@ -221,8 +269,31 @@ extern int ZEXPORT unzGoToFilePos( | |||
221 | unzFile file, | 269 | unzFile file, |
222 | unz_file_pos* file_pos); | 270 | unz_file_pos* file_pos); |
223 | 271 | ||
272 | typedef struct unz64_file_pos_s | ||
273 | { | ||
274 | ZPOS64_T pos_in_zip_directory; /* offset in zip file directory */ | ||
275 | ZPOS64_T num_of_file; /* # of file */ | ||
276 | } unz64_file_pos; | ||
277 | |||
278 | extern int ZEXPORT unzGetFilePos64( | ||
279 | unzFile file, | ||
280 | unz64_file_pos* file_pos); | ||
281 | |||
282 | extern int ZEXPORT unzGoToFilePos64( | ||
283 | unzFile file, | ||
284 | const unz64_file_pos* file_pos); | ||
285 | |||
224 | /* ****************************************** */ | 286 | /* ****************************************** */ |
225 | 287 | ||
288 | extern int ZEXPORT unzGetCurrentFileInfo64 OF((unzFile file, | ||
289 | unz_file_info64 *pfile_info, | ||
290 | char *szFileName, | ||
291 | uLong fileNameBufferSize, | ||
292 | void *extraField, | ||
293 | uLong extraFieldBufferSize, | ||
294 | char *szComment, | ||
295 | uLong commentBufferSize)); | ||
296 | |||
226 | extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, | 297 | extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, |
227 | unz_file_info *pfile_info, | 298 | unz_file_info *pfile_info, |
228 | char *szFileName, | 299 | char *szFileName, |
@@ -244,6 +315,14 @@ extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, | |||
244 | (commentBufferSize is the size of the buffer) | 315 | (commentBufferSize is the size of the buffer) |
245 | */ | 316 | */ |
246 | 317 | ||
318 | |||
319 | /** Addition for GDAL : START */ | ||
320 | |||
321 | extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file)); | ||
322 | |||
323 | /** Addition for GDAL : END */ | ||
324 | |||
325 | |||
247 | /***************************************************************************/ | 326 | /***************************************************************************/ |
248 | /* for reading the content of the current zipfile, you can open it, read data | 327 | /* 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) | 328 | from it, and close it (you can close it before reading all the file) |
@@ -312,6 +391,8 @@ extern int ZEXPORT unzReadCurrentFile OF((unzFile file, | |||
312 | */ | 391 | */ |
313 | 392 | ||
314 | extern z_off_t ZEXPORT unztell OF((unzFile file)); | 393 | extern z_off_t ZEXPORT unztell OF((unzFile file)); |
394 | |||
395 | extern ZPOS64_T ZEXPORT unztell64 OF((unzFile file)); | ||
315 | /* | 396 | /* |
316 | Give the current position in uncompressed data | 397 | Give the current position in uncompressed data |
317 | */ | 398 | */ |
@@ -340,9 +421,11 @@ extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, | |||
340 | /***************************************************************************/ | 421 | /***************************************************************************/ |
341 | 422 | ||
342 | /* Get the current file offset */ | 423 | /* Get the current file offset */ |
424 | extern ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file); | ||
343 | extern uLong ZEXPORT unzGetOffset (unzFile file); | 425 | extern uLong ZEXPORT unzGetOffset (unzFile file); |
344 | 426 | ||
345 | /* Set the current file offset */ | 427 | /* Set the current file offset */ |
428 | extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos); | ||
346 | extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); | 429 | extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); |
347 | 430 | ||
348 | 431 | ||
@@ -351,4 +434,4 @@ extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); | |||
351 | } | 434 | } |
352 | #endif | 435 | #endif |
353 | 436 | ||
354 | #endif /* _unz_H */ | 437 | #endif /* _unz64_H */ |