|
7ef7284…
|
drh
|
1 |
/* unzip.h -- IO for uncompress .zip files using zlib |
|
6ea30fb…
|
florian
|
2 |
part of the MiniZip project - ( https://www.winimage.com/zLibDll/minizip.html ) |
|
7ef7284…
|
drh
|
3 |
|
|
6ea30fb…
|
florian
|
4 |
Copyright (C) 1998-2026 Gilles Vollant (minizip) ( https://www.winimage.com/zLibDll/minizip.html ) |
|
7ef7284…
|
drh
|
5 |
|
|
7ef7284…
|
drh
|
6 |
Modifications of Unzip for Zip64 |
|
7ef7284…
|
drh
|
7 |
Copyright (C) 2007-2008 Even Rouault |
|
7ef7284…
|
drh
|
8 |
|
|
7ef7284…
|
drh
|
9 |
Modifications for Zip64 support on both zip and unzip |
|
6ea30fb…
|
florian
|
10 |
Copyright (C) 2009-2010 Mathias Svensson ( https://result42.com ) |
|
7ef7284…
|
drh
|
11 |
|
|
7ef7284…
|
drh
|
12 |
For more info read MiniZip_info.txt |
|
7ef7284…
|
drh
|
13 |
|
|
7ef7284…
|
drh
|
14 |
--------------------------------------------------------------------------------- |
|
7ef7284…
|
drh
|
15 |
|
|
7ef7284…
|
drh
|
16 |
Condition of use and distribution are the same than zlib : |
|
7ef7284…
|
drh
|
17 |
|
|
7ef7284…
|
drh
|
18 |
This software is provided 'as-is', without any express or implied |
|
7ef7284…
|
drh
|
19 |
warranty. In no event will the authors be held liable for any damages |
|
7ef7284…
|
drh
|
20 |
arising from the use of this software. |
|
7ef7284…
|
drh
|
21 |
|
|
7ef7284…
|
drh
|
22 |
Permission is granted to anyone to use this software for any purpose, |
|
7ef7284…
|
drh
|
23 |
including commercial applications, and to alter it and redistribute it |
|
7ef7284…
|
drh
|
24 |
freely, subject to the following restrictions: |
|
7ef7284…
|
drh
|
25 |
|
|
7ef7284…
|
drh
|
26 |
1. The origin of this software must not be misrepresented; you must not |
|
7ef7284…
|
drh
|
27 |
claim that you wrote the original software. If you use this software |
|
7ef7284…
|
drh
|
28 |
in a product, an acknowledgment in the product documentation would be |
|
7ef7284…
|
drh
|
29 |
appreciated but is not required. |
|
7ef7284…
|
drh
|
30 |
2. Altered source versions must be plainly marked as such, and must not be |
|
7ef7284…
|
drh
|
31 |
misrepresented as being the original software. |
|
7ef7284…
|
drh
|
32 |
3. This notice may not be removed or altered from any source distribution. |
|
7ef7284…
|
drh
|
33 |
|
|
7ef7284…
|
drh
|
34 |
--------------------------------------------------------------------------------- |
|
7ef7284…
|
drh
|
35 |
|
|
7ef7284…
|
drh
|
36 |
Changes |
|
7ef7284…
|
drh
|
37 |
|
|
7ef7284…
|
drh
|
38 |
See header of unzip64.c |
|
7ef7284…
|
drh
|
39 |
|
|
7ef7284…
|
drh
|
40 |
*/ |
|
7ef7284…
|
drh
|
41 |
|
|
7ef7284…
|
drh
|
42 |
#ifndef _unz64_H |
|
7ef7284…
|
drh
|
43 |
#define _unz64_H |
|
7ef7284…
|
drh
|
44 |
|
|
7ef7284…
|
drh
|
45 |
#ifdef __cplusplus |
|
7ef7284…
|
drh
|
46 |
extern "C" { |
|
7ef7284…
|
drh
|
47 |
#endif |
|
7ef7284…
|
drh
|
48 |
|
|
7ef7284…
|
drh
|
49 |
#ifndef _ZLIB_H |
|
7ef7284…
|
drh
|
50 |
#include "zlib.h" |
|
7ef7284…
|
drh
|
51 |
#endif |
|
7ef7284…
|
drh
|
52 |
|
|
7ef7284…
|
drh
|
53 |
#ifndef _ZLIBIOAPI_H |
|
7ef7284…
|
drh
|
54 |
#include "ioapi.h" |
|
7ef7284…
|
drh
|
55 |
#endif |
|
7ef7284…
|
drh
|
56 |
|
|
7ef7284…
|
drh
|
57 |
#ifdef HAVE_BZIP2 |
|
7ef7284…
|
drh
|
58 |
#include "bzlib.h" |
|
7ef7284…
|
drh
|
59 |
#endif |
|
7ef7284…
|
drh
|
60 |
|
|
7ef7284…
|
drh
|
61 |
#define Z_BZIP2ED 12 |
|
7ef7284…
|
drh
|
62 |
|
|
7ef7284…
|
drh
|
63 |
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) |
|
7ef7284…
|
drh
|
64 |
/* like the STRICT of WIN32, we define a pointer that cannot be converted |
|
7ef7284…
|
drh
|
65 |
from (void*) without cast */ |
|
7ef7284…
|
drh
|
66 |
typedef struct TagunzFile__ { int unused; } unzFile__; |
|
7ef7284…
|
drh
|
67 |
typedef unzFile__ *unzFile; |
|
7ef7284…
|
drh
|
68 |
#else |
|
7ef7284…
|
drh
|
69 |
typedef voidp unzFile; |
|
7ef7284…
|
drh
|
70 |
#endif |
|
6ea30fb…
|
florian
|
71 |
|
|
6ea30fb…
|
florian
|
72 |
extern const char unz_copyright[]; |
|
adb9e8e…
|
drh
|
73 |
|
|
7ef7284…
|
drh
|
74 |
|
|
7ef7284…
|
drh
|
75 |
#define UNZ_OK (0) |
|
7ef7284…
|
drh
|
76 |
#define UNZ_END_OF_LIST_OF_FILE (-100) |
|
7ef7284…
|
drh
|
77 |
#define UNZ_ERRNO (Z_ERRNO) |
|
7ef7284…
|
drh
|
78 |
#define UNZ_EOF (0) |
|
7ef7284…
|
drh
|
79 |
#define UNZ_PARAMERROR (-102) |
|
7ef7284…
|
drh
|
80 |
#define UNZ_BADZIPFILE (-103) |
|
7ef7284…
|
drh
|
81 |
#define UNZ_INTERNALERROR (-104) |
|
7ef7284…
|
drh
|
82 |
#define UNZ_CRCERROR (-105) |
|
7ef7284…
|
drh
|
83 |
|
|
7ef7284…
|
drh
|
84 |
/* tm_unz contain date/time info */ |
|
7ef7284…
|
drh
|
85 |
typedef struct tm_unz_s |
|
7ef7284…
|
drh
|
86 |
{ |
|
adb9e8e…
|
drh
|
87 |
int tm_sec; /* seconds after the minute - [0,59] */ |
|
adb9e8e…
|
drh
|
88 |
int tm_min; /* minutes after the hour - [0,59] */ |
|
adb9e8e…
|
drh
|
89 |
int tm_hour; /* hours since midnight - [0,23] */ |
|
adb9e8e…
|
drh
|
90 |
int tm_mday; /* day of the month - [1,31] */ |
|
adb9e8e…
|
drh
|
91 |
int tm_mon; /* months since January - [0,11] */ |
|
adb9e8e…
|
drh
|
92 |
int tm_year; /* years - [1980..2044] */ |
|
7ef7284…
|
drh
|
93 |
} tm_unz; |
|
7ef7284…
|
drh
|
94 |
|
|
7ef7284…
|
drh
|
95 |
/* unz_global_info structure contain global data about the ZIPfile |
|
7ef7284…
|
drh
|
96 |
These data comes from the end of central dir */ |
|
7ef7284…
|
drh
|
97 |
typedef struct unz_global_info64_s |
|
7ef7284…
|
drh
|
98 |
{ |
|
7ef7284…
|
drh
|
99 |
ZPOS64_T number_entry; /* total number of entries in |
|
7ef7284…
|
drh
|
100 |
the central dir on this disk */ |
|
7ef7284…
|
drh
|
101 |
uLong size_comment; /* size of the global comment of the zipfile */ |
|
7ef7284…
|
drh
|
102 |
} unz_global_info64; |
|
7ef7284…
|
drh
|
103 |
|
|
7ef7284…
|
drh
|
104 |
typedef struct unz_global_info_s |
|
7ef7284…
|
drh
|
105 |
{ |
|
7ef7284…
|
drh
|
106 |
uLong number_entry; /* total number of entries in |
|
7ef7284…
|
drh
|
107 |
the central dir on this disk */ |
|
7ef7284…
|
drh
|
108 |
uLong size_comment; /* size of the global comment of the zipfile */ |
|
7ef7284…
|
drh
|
109 |
} unz_global_info; |
|
7ef7284…
|
drh
|
110 |
|
|
7ef7284…
|
drh
|
111 |
/* unz_file_info contain information about a file in the zipfile */ |
|
7ef7284…
|
drh
|
112 |
typedef struct unz_file_info64_s |
|
7ef7284…
|
drh
|
113 |
{ |
|
7ef7284…
|
drh
|
114 |
uLong version; /* version made by 2 bytes */ |
|
7ef7284…
|
drh
|
115 |
uLong version_needed; /* version needed to extract 2 bytes */ |
|
7ef7284…
|
drh
|
116 |
uLong flag; /* general purpose bit flag 2 bytes */ |
|
7ef7284…
|
drh
|
117 |
uLong compression_method; /* compression method 2 bytes */ |
|
7ef7284…
|
drh
|
118 |
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ |
|
7ef7284…
|
drh
|
119 |
uLong crc; /* crc-32 4 bytes */ |
|
7ef7284…
|
drh
|
120 |
ZPOS64_T compressed_size; /* compressed size 8 bytes */ |
|
7ef7284…
|
drh
|
121 |
ZPOS64_T uncompressed_size; /* uncompressed size 8 bytes */ |
|
7ef7284…
|
drh
|
122 |
uLong size_filename; /* filename length 2 bytes */ |
|
7ef7284…
|
drh
|
123 |
uLong size_file_extra; /* extra field length 2 bytes */ |
|
7ef7284…
|
drh
|
124 |
uLong size_file_comment; /* file comment length 2 bytes */ |
|
7ef7284…
|
drh
|
125 |
|
|
7ef7284…
|
drh
|
126 |
uLong disk_num_start; /* disk number start 2 bytes */ |
|
7ef7284…
|
drh
|
127 |
uLong internal_fa; /* internal file attributes 2 bytes */ |
|
7ef7284…
|
drh
|
128 |
uLong external_fa; /* external file attributes 4 bytes */ |
|
7ef7284…
|
drh
|
129 |
|
|
7ef7284…
|
drh
|
130 |
tm_unz tmu_date; |
|
7ef7284…
|
drh
|
131 |
} unz_file_info64; |
|
7ef7284…
|
drh
|
132 |
|
|
7ef7284…
|
drh
|
133 |
typedef struct unz_file_info_s |
|
7ef7284…
|
drh
|
134 |
{ |
|
7ef7284…
|
drh
|
135 |
uLong version; /* version made by 2 bytes */ |
|
7ef7284…
|
drh
|
136 |
uLong version_needed; /* version needed to extract 2 bytes */ |
|
7ef7284…
|
drh
|
137 |
uLong flag; /* general purpose bit flag 2 bytes */ |
|
7ef7284…
|
drh
|
138 |
uLong compression_method; /* compression method 2 bytes */ |
|
7ef7284…
|
drh
|
139 |
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ |
|
7ef7284…
|
drh
|
140 |
uLong crc; /* crc-32 4 bytes */ |
|
7ef7284…
|
drh
|
141 |
uLong compressed_size; /* compressed size 4 bytes */ |
|
7ef7284…
|
drh
|
142 |
uLong uncompressed_size; /* uncompressed size 4 bytes */ |
|
7ef7284…
|
drh
|
143 |
uLong size_filename; /* filename length 2 bytes */ |
|
7ef7284…
|
drh
|
144 |
uLong size_file_extra; /* extra field length 2 bytes */ |
|
7ef7284…
|
drh
|
145 |
uLong size_file_comment; /* file comment length 2 bytes */ |
|
7ef7284…
|
drh
|
146 |
|
|
7ef7284…
|
drh
|
147 |
uLong disk_num_start; /* disk number start 2 bytes */ |
|
7ef7284…
|
drh
|
148 |
uLong internal_fa; /* internal file attributes 2 bytes */ |
|
7ef7284…
|
drh
|
149 |
uLong external_fa; /* external file attributes 4 bytes */ |
|
7ef7284…
|
drh
|
150 |
|
|
7ef7284…
|
drh
|
151 |
tm_unz tmu_date; |
|
7ef7284…
|
drh
|
152 |
} unz_file_info; |
|
7ef7284…
|
drh
|
153 |
|
|
f1f1d6c…
|
drh
|
154 |
extern int ZEXPORT unzStringFileNameCompare(const char* fileName1, |
|
f1f1d6c…
|
drh
|
155 |
const char* fileName2, |
|
f1f1d6c…
|
drh
|
156 |
int iCaseSensitivity); |
|
7ef7284…
|
drh
|
157 |
/* |
|
f1f1d6c…
|
drh
|
158 |
Compare two filenames (fileName1,fileName2). |
|
f1f1d6c…
|
drh
|
159 |
If iCaseSensitivity = 1, comparison is case sensitive (like strcmp) |
|
f1f1d6c…
|
drh
|
160 |
If iCaseSensitivity = 2, comparison is not case sensitive (like strcmpi |
|
7ef7284…
|
drh
|
161 |
or strcasecmp) |
|
f1f1d6c…
|
drh
|
162 |
If iCaseSensitivity = 0, case sensitivity is default of your operating system |
|
7ef7284…
|
drh
|
163 |
(like 1 on Unix, 2 on Windows) |
|
7ef7284…
|
drh
|
164 |
*/ |
|
7ef7284…
|
drh
|
165 |
|
|
7ef7284…
|
drh
|
166 |
|
|
f1f1d6c…
|
drh
|
167 |
extern unzFile ZEXPORT unzOpen(const char *path); |
|
f1f1d6c…
|
drh
|
168 |
extern unzFile ZEXPORT unzOpen64(const void *path); |
|
7ef7284…
|
drh
|
169 |
/* |
|
7ef7284…
|
drh
|
170 |
Open a Zip file. path contain the full pathname (by example, |
|
7ef7284…
|
drh
|
171 |
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer |
|
7ef7284…
|
drh
|
172 |
"zlib/zlib113.zip". |
|
7ef7284…
|
drh
|
173 |
If the zipfile cannot be opened (file don't exist or in not valid), the |
|
7ef7284…
|
drh
|
174 |
return value is NULL. |
|
7ef7284…
|
drh
|
175 |
Else, the return value is a unzFile Handle, usable with other function |
|
7ef7284…
|
drh
|
176 |
of this unzip package. |
|
7ef7284…
|
drh
|
177 |
the "64" function take a const void* pointer, because the path is just the |
|
7ef7284…
|
drh
|
178 |
value passed to the open64_file_func callback. |
|
7ef7284…
|
drh
|
179 |
Under Windows, if UNICODE is defined, using fill_fopen64_filefunc, the path |
|
7ef7284…
|
drh
|
180 |
is a pointer to a wide unicode string (LPCTSTR is LPCWSTR), so const char* |
|
7ef7284…
|
drh
|
181 |
does not describe the reality |
|
7ef7284…
|
drh
|
182 |
*/ |
|
7ef7284…
|
drh
|
183 |
|
|
7ef7284…
|
drh
|
184 |
|
|
f1f1d6c…
|
drh
|
185 |
extern unzFile ZEXPORT unzOpen2(const char *path, |
|
f1f1d6c…
|
drh
|
186 |
zlib_filefunc_def* pzlib_filefunc_def); |
|
7ef7284…
|
drh
|
187 |
/* |
|
7ef7284…
|
drh
|
188 |
Open a Zip file, like unzOpen, but provide a set of file low level API |
|
7ef7284…
|
drh
|
189 |
for read/write the zip file (see ioapi.h) |
|
7ef7284…
|
drh
|
190 |
*/ |
|
7ef7284…
|
drh
|
191 |
|
|
f1f1d6c…
|
drh
|
192 |
extern unzFile ZEXPORT unzOpen2_64(const void *path, |
|
f1f1d6c…
|
drh
|
193 |
zlib_filefunc64_def* pzlib_filefunc_def); |
|
7ef7284…
|
drh
|
194 |
/* |
|
7ef7284…
|
drh
|
195 |
Open a Zip file, like unz64Open, but provide a set of file low level API |
|
7ef7284…
|
drh
|
196 |
for read/write the zip file (see ioapi.h) |
|
7ef7284…
|
drh
|
197 |
*/ |
|
7ef7284…
|
drh
|
198 |
|
|
f1f1d6c…
|
drh
|
199 |
extern int ZEXPORT unzClose(unzFile file); |
|
7ef7284…
|
drh
|
200 |
/* |
|
bb4776e…
|
jan.nijtmans
|
201 |
Close a ZipFile opened with unzOpen. |
|
7ef7284…
|
drh
|
202 |
If there is files inside the .Zip opened with unzOpenCurrentFile (see later), |
|
bb4776e…
|
jan.nijtmans
|
203 |
these files MUST be closed with unzCloseCurrentFile before call unzClose. |
|
7ef7284…
|
drh
|
204 |
return UNZ_OK if there is no problem. */ |
|
7ef7284…
|
drh
|
205 |
|
|
f1f1d6c…
|
drh
|
206 |
extern int ZEXPORT unzGetGlobalInfo(unzFile file, |
|
f1f1d6c…
|
drh
|
207 |
unz_global_info *pglobal_info); |
|
7ef7284…
|
drh
|
208 |
|
|
f1f1d6c…
|
drh
|
209 |
extern int ZEXPORT unzGetGlobalInfo64(unzFile file, |
|
f1f1d6c…
|
drh
|
210 |
unz_global_info64 *pglobal_info); |
|
7ef7284…
|
drh
|
211 |
/* |
|
7ef7284…
|
drh
|
212 |
Write info about the ZipFile in the *pglobal_info structure. |
|
7ef7284…
|
drh
|
213 |
No preparation of the structure is needed |
|
7ef7284…
|
drh
|
214 |
return UNZ_OK if there is no problem. */ |
|
7ef7284…
|
drh
|
215 |
|
|
7ef7284…
|
drh
|
216 |
|
|
f1f1d6c…
|
drh
|
217 |
extern int ZEXPORT unzGetGlobalComment(unzFile file, |
|
f1f1d6c…
|
drh
|
218 |
char *szComment, |
|
f1f1d6c…
|
drh
|
219 |
uLong uSizeBuf); |
|
7ef7284…
|
drh
|
220 |
/* |
|
7ef7284…
|
drh
|
221 |
Get the global comment string of the ZipFile, in the szComment buffer. |
|
7ef7284…
|
drh
|
222 |
uSizeBuf is the size of the szComment buffer. |
|
7ef7284…
|
drh
|
223 |
return the number of byte copied or an error code <0 |
|
7ef7284…
|
drh
|
224 |
*/ |
|
7ef7284…
|
drh
|
225 |
|
|
7ef7284…
|
drh
|
226 |
|
|
7ef7284…
|
drh
|
227 |
/***************************************************************************/ |
|
7ef7284…
|
drh
|
228 |
/* Unzip package allow you browse the directory of the zipfile */ |
|
7ef7284…
|
drh
|
229 |
|
|
f1f1d6c…
|
drh
|
230 |
extern int ZEXPORT unzGoToFirstFile(unzFile file); |
|
7ef7284…
|
drh
|
231 |
/* |
|
7ef7284…
|
drh
|
232 |
Set the current file of the zipfile to the first file. |
|
7ef7284…
|
drh
|
233 |
return UNZ_OK if there is no problem |
|
7ef7284…
|
drh
|
234 |
*/ |
|
7ef7284…
|
drh
|
235 |
|
|
f1f1d6c…
|
drh
|
236 |
extern int ZEXPORT unzGoToNextFile(unzFile file); |
|
7ef7284…
|
drh
|
237 |
/* |
|
7ef7284…
|
drh
|
238 |
Set the current file of the zipfile to the next file. |
|
7ef7284…
|
drh
|
239 |
return UNZ_OK if there is no problem |
|
7ef7284…
|
drh
|
240 |
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. |
|
7ef7284…
|
drh
|
241 |
*/ |
|
7ef7284…
|
drh
|
242 |
|
|
f1f1d6c…
|
drh
|
243 |
extern int ZEXPORT unzLocateFile(unzFile file, |
|
f1f1d6c…
|
drh
|
244 |
const char *szFileName, |
|
f1f1d6c…
|
drh
|
245 |
int iCaseSensitivity); |
|
7ef7284…
|
drh
|
246 |
/* |
|
7ef7284…
|
drh
|
247 |
Try locate the file szFileName in the zipfile. |
|
7ef7284…
|
drh
|
248 |
For the iCaseSensitivity signification, see unzStringFileNameCompare |
|
7ef7284…
|
drh
|
249 |
|
|
7ef7284…
|
drh
|
250 |
return value : |
|
7ef7284…
|
drh
|
251 |
UNZ_OK if the file is found. It becomes the current file. |
|
7ef7284…
|
drh
|
252 |
UNZ_END_OF_LIST_OF_FILE if the file is not found |
|
7ef7284…
|
drh
|
253 |
*/ |
|
7ef7284…
|
drh
|
254 |
|
|
7ef7284…
|
drh
|
255 |
|
|
7ef7284…
|
drh
|
256 |
/* ****************************************** */ |
|
7ef7284…
|
drh
|
257 |
/* Ryan supplied functions */ |
|
7ef7284…
|
drh
|
258 |
/* unz_file_info contain information about a file in the zipfile */ |
|
7ef7284…
|
drh
|
259 |
typedef struct unz_file_pos_s |
|
7ef7284…
|
drh
|
260 |
{ |
|
7ef7284…
|
drh
|
261 |
uLong pos_in_zip_directory; /* offset in zip file directory */ |
|
7ef7284…
|
drh
|
262 |
uLong num_of_file; /* # of file */ |
|
7ef7284…
|
drh
|
263 |
} unz_file_pos; |
|
7ef7284…
|
drh
|
264 |
|
|
7ef7284…
|
drh
|
265 |
extern int ZEXPORT unzGetFilePos( |
|
7ef7284…
|
drh
|
266 |
unzFile file, |
|
7ef7284…
|
drh
|
267 |
unz_file_pos* file_pos); |
|
7ef7284…
|
drh
|
268 |
|
|
7ef7284…
|
drh
|
269 |
extern int ZEXPORT unzGoToFilePos( |
|
7ef7284…
|
drh
|
270 |
unzFile file, |
|
7ef7284…
|
drh
|
271 |
unz_file_pos* file_pos); |
|
7ef7284…
|
drh
|
272 |
|
|
7ef7284…
|
drh
|
273 |
typedef struct unz64_file_pos_s |
|
7ef7284…
|
drh
|
274 |
{ |
|
7ef7284…
|
drh
|
275 |
ZPOS64_T pos_in_zip_directory; /* offset in zip file directory */ |
|
7ef7284…
|
drh
|
276 |
ZPOS64_T num_of_file; /* # of file */ |
|
7ef7284…
|
drh
|
277 |
} unz64_file_pos; |
|
7ef7284…
|
drh
|
278 |
|
|
7ef7284…
|
drh
|
279 |
extern int ZEXPORT unzGetFilePos64( |
|
7ef7284…
|
drh
|
280 |
unzFile file, |
|
7ef7284…
|
drh
|
281 |
unz64_file_pos* file_pos); |
|
7ef7284…
|
drh
|
282 |
|
|
7ef7284…
|
drh
|
283 |
extern int ZEXPORT unzGoToFilePos64( |
|
7ef7284…
|
drh
|
284 |
unzFile file, |
|
7ef7284…
|
drh
|
285 |
const unz64_file_pos* file_pos); |
|
7ef7284…
|
drh
|
286 |
|
|
7ef7284…
|
drh
|
287 |
/* ****************************************** */ |
|
7ef7284…
|
drh
|
288 |
|
|
f1f1d6c…
|
drh
|
289 |
extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file, |
|
f1f1d6c…
|
drh
|
290 |
unz_file_info64 *pfile_info, |
|
f1f1d6c…
|
drh
|
291 |
char *szFileName, |
|
f1f1d6c…
|
drh
|
292 |
uLong fileNameBufferSize, |
|
f1f1d6c…
|
drh
|
293 |
void *extraField, |
|
f1f1d6c…
|
drh
|
294 |
uLong extraFieldBufferSize, |
|
f1f1d6c…
|
drh
|
295 |
char *szComment, |
|
f1f1d6c…
|
drh
|
296 |
uLong commentBufferSize); |
|
f1f1d6c…
|
drh
|
297 |
|
|
f1f1d6c…
|
drh
|
298 |
extern int ZEXPORT unzGetCurrentFileInfo(unzFile file, |
|
f1f1d6c…
|
drh
|
299 |
unz_file_info *pfile_info, |
|
f1f1d6c…
|
drh
|
300 |
char *szFileName, |
|
f1f1d6c…
|
drh
|
301 |
uLong fileNameBufferSize, |
|
f1f1d6c…
|
drh
|
302 |
void *extraField, |
|
f1f1d6c…
|
drh
|
303 |
uLong extraFieldBufferSize, |
|
f1f1d6c…
|
drh
|
304 |
char *szComment, |
|
f1f1d6c…
|
drh
|
305 |
uLong commentBufferSize); |
|
7ef7284…
|
drh
|
306 |
/* |
|
7ef7284…
|
drh
|
307 |
Get Info about the current file |
|
f1f1d6c…
|
drh
|
308 |
if pfile_info!=NULL, the *pfile_info structure will contain some info about |
|
7ef7284…
|
drh
|
309 |
the current file |
|
64ce68d…
|
drh
|
310 |
if szFileName!=NULL, the filename string will be copied in szFileName |
|
7ef7284…
|
drh
|
311 |
(fileNameBufferSize is the size of the buffer) |
|
7ef7284…
|
drh
|
312 |
if extraField!=NULL, the extra field information will be copied in extraField |
|
7ef7284…
|
drh
|
313 |
(extraFieldBufferSize is the size of the buffer). |
|
7ef7284…
|
drh
|
314 |
This is the Central-header version of the extra field |
|
7ef7284…
|
drh
|
315 |
if szComment!=NULL, the comment string of the file will be copied in szComment |
|
7ef7284…
|
drh
|
316 |
(commentBufferSize is the size of the buffer) |
|
6ea30fb…
|
florian
|
317 |
The file name and comment will be zero-terminated if there is room in the |
|
6ea30fb…
|
florian
|
318 |
provided buffer. Otherwise the buffer will contain as much as will fit. If at |
|
6ea30fb…
|
florian
|
319 |
least 65537 bytes of room is provided, then the result will always be |
|
6ea30fb…
|
florian
|
320 |
complete and zero-terminated. |
|
7ef7284…
|
drh
|
321 |
*/ |
|
7ef7284…
|
drh
|
322 |
|
|
7ef7284…
|
drh
|
323 |
|
|
7ef7284…
|
drh
|
324 |
/** Addition for GDAL : START */ |
|
7ef7284…
|
drh
|
325 |
|
|
f1f1d6c…
|
drh
|
326 |
extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file); |
|
7ef7284…
|
drh
|
327 |
|
|
7ef7284…
|
drh
|
328 |
/** Addition for GDAL : END */ |
|
7ef7284…
|
drh
|
329 |
|
|
7ef7284…
|
drh
|
330 |
|
|
7ef7284…
|
drh
|
331 |
/***************************************************************************/ |
|
7ef7284…
|
drh
|
332 |
/* for reading the content of the current zipfile, you can open it, read data |
|
7ef7284…
|
drh
|
333 |
from it, and close it (you can close it before reading all the file) |
|
7ef7284…
|
drh
|
334 |
*/ |
|
7ef7284…
|
drh
|
335 |
|
|
f1f1d6c…
|
drh
|
336 |
extern int ZEXPORT unzOpenCurrentFile(unzFile file); |
|
7ef7284…
|
drh
|
337 |
/* |
|
7ef7284…
|
drh
|
338 |
Open for reading data the current file in the zipfile. |
|
7ef7284…
|
drh
|
339 |
If there is no error, the return value is UNZ_OK. |
|
7ef7284…
|
drh
|
340 |
*/ |
|
7ef7284…
|
drh
|
341 |
|
|
f1f1d6c…
|
drh
|
342 |
extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file, |
|
f1f1d6c…
|
drh
|
343 |
const char* password); |
|
7ef7284…
|
drh
|
344 |
/* |
|
7ef7284…
|
drh
|
345 |
Open for reading data the current file in the zipfile. |
|
7ef7284…
|
drh
|
346 |
password is a crypting password |
|
7ef7284…
|
drh
|
347 |
If there is no error, the return value is UNZ_OK. |
|
7ef7284…
|
drh
|
348 |
*/ |
|
7ef7284…
|
drh
|
349 |
|
|
f1f1d6c…
|
drh
|
350 |
extern int ZEXPORT unzOpenCurrentFile2(unzFile file, |
|
f1f1d6c…
|
drh
|
351 |
int* method, |
|
f1f1d6c…
|
drh
|
352 |
int* level, |
|
f1f1d6c…
|
drh
|
353 |
int raw); |
|
7ef7284…
|
drh
|
354 |
/* |
|
7ef7284…
|
drh
|
355 |
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) |
|
7ef7284…
|
drh
|
356 |
if raw==1 |
|
7ef7284…
|
drh
|
357 |
*method will receive method of compression, *level will receive level of |
|
7ef7284…
|
drh
|
358 |
compression |
|
7ef7284…
|
drh
|
359 |
note : you can set level parameter as NULL (if you did not want known level, |
|
7ef7284…
|
drh
|
360 |
but you CANNOT set method parameter as NULL |
|
7ef7284…
|
drh
|
361 |
*/ |
|
7ef7284…
|
drh
|
362 |
|
|
f1f1d6c…
|
drh
|
363 |
extern int ZEXPORT unzOpenCurrentFile3(unzFile file, |
|
f1f1d6c…
|
drh
|
364 |
int* method, |
|
f1f1d6c…
|
drh
|
365 |
int* level, |
|
f1f1d6c…
|
drh
|
366 |
int raw, |
|
f1f1d6c…
|
drh
|
367 |
const char* password); |
|
7ef7284…
|
drh
|
368 |
/* |
|
7ef7284…
|
drh
|
369 |
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) |
|
7ef7284…
|
drh
|
370 |
if raw==1 |
|
7ef7284…
|
drh
|
371 |
*method will receive method of compression, *level will receive level of |
|
7ef7284…
|
drh
|
372 |
compression |
|
7ef7284…
|
drh
|
373 |
note : you can set level parameter as NULL (if you did not want known level, |
|
7ef7284…
|
drh
|
374 |
but you CANNOT set method parameter as NULL |
|
7ef7284…
|
drh
|
375 |
*/ |
|
7ef7284…
|
drh
|
376 |
|
|
7ef7284…
|
drh
|
377 |
|
|
f1f1d6c…
|
drh
|
378 |
extern int ZEXPORT unzCloseCurrentFile(unzFile file); |
|
7ef7284…
|
drh
|
379 |
/* |
|
7ef7284…
|
drh
|
380 |
Close the file in zip opened with unzOpenCurrentFile |
|
7ef7284…
|
drh
|
381 |
Return UNZ_CRCERROR if all the file was read but the CRC is not good |
|
7ef7284…
|
drh
|
382 |
*/ |
|
7ef7284…
|
drh
|
383 |
|
|
f1f1d6c…
|
drh
|
384 |
extern int ZEXPORT unzReadCurrentFile(unzFile file, |
|
f1f1d6c…
|
drh
|
385 |
voidp buf, |
|
f1f1d6c…
|
drh
|
386 |
unsigned len); |
|
7ef7284…
|
drh
|
387 |
/* |
|
7ef7284…
|
drh
|
388 |
Read bytes from the current file (opened by unzOpenCurrentFile) |
|
7ef7284…
|
drh
|
389 |
buf contain buffer where data must be copied |
|
7ef7284…
|
drh
|
390 |
len the size of buf. |
|
7ef7284…
|
drh
|
391 |
|
|
f1f1d6c…
|
drh
|
392 |
return the number of byte copied if some bytes are copied |
|
7ef7284…
|
drh
|
393 |
return 0 if the end of file was reached |
|
7ef7284…
|
drh
|
394 |
return <0 with error code if there is an error |
|
7ef7284…
|
drh
|
395 |
(UNZ_ERRNO for IO error, or zLib error for uncompress error) |
|
7ef7284…
|
drh
|
396 |
*/ |
|
7ef7284…
|
drh
|
397 |
|
|
f1f1d6c…
|
drh
|
398 |
extern z_off_t ZEXPORT unztell(unzFile file); |
|
7ef7284…
|
drh
|
399 |
|
|
f1f1d6c…
|
drh
|
400 |
extern ZPOS64_T ZEXPORT unztell64(unzFile file); |
|
7ef7284…
|
drh
|
401 |
/* |
|
7ef7284…
|
drh
|
402 |
Give the current position in uncompressed data |
|
7ef7284…
|
drh
|
403 |
*/ |
|
7ef7284…
|
drh
|
404 |
|
|
f1f1d6c…
|
drh
|
405 |
extern int ZEXPORT unzeof(unzFile file); |
|
7ef7284…
|
drh
|
406 |
/* |
|
7ef7284…
|
drh
|
407 |
return 1 if the end of file was reached, 0 elsewhere |
|
7ef7284…
|
drh
|
408 |
*/ |
|
7ef7284…
|
drh
|
409 |
|
|
f1f1d6c…
|
drh
|
410 |
extern int ZEXPORT unzGetLocalExtrafield(unzFile file, |
|
f1f1d6c…
|
drh
|
411 |
voidp buf, |
|
f1f1d6c…
|
drh
|
412 |
unsigned len); |
|
7ef7284…
|
drh
|
413 |
/* |
|
7ef7284…
|
drh
|
414 |
Read extra field from the current file (opened by unzOpenCurrentFile) |
|
7ef7284…
|
drh
|
415 |
This is the local-header version of the extra field (sometimes, there is |
|
7ef7284…
|
drh
|
416 |
more info in the local-header version than in the central-header) |
|
7ef7284…
|
drh
|
417 |
|
|
7ef7284…
|
drh
|
418 |
if buf==NULL, it return the size of the local extra field |
|
7ef7284…
|
drh
|
419 |
|
|
7ef7284…
|
drh
|
420 |
if buf!=NULL, len is the size of the buffer, the extra header is copied in |
|
7ef7284…
|
drh
|
421 |
buf. |
|
7ef7284…
|
drh
|
422 |
the return value is the number of bytes copied in buf, or (if <0) |
|
7ef7284…
|
drh
|
423 |
the error code |
|
7ef7284…
|
drh
|
424 |
*/ |
|
7ef7284…
|
drh
|
425 |
|
|
7ef7284…
|
drh
|
426 |
/***************************************************************************/ |
|
7ef7284…
|
drh
|
427 |
|
|
7ef7284…
|
drh
|
428 |
/* Get the current file offset */ |
|
7ef7284…
|
drh
|
429 |
extern ZPOS64_T ZEXPORT unzGetOffset64 (unzFile file); |
|
7ef7284…
|
drh
|
430 |
extern uLong ZEXPORT unzGetOffset (unzFile file); |
|
7ef7284…
|
drh
|
431 |
|
|
7ef7284…
|
drh
|
432 |
/* Set the current file offset */ |
|
7ef7284…
|
drh
|
433 |
extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos); |
|
7ef7284…
|
drh
|
434 |
extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); |
|
7ef7284…
|
drh
|
435 |
|
|
7ef7284…
|
drh
|
436 |
|
|
7ef7284…
|
drh
|
437 |
|
|
7ef7284…
|
drh
|
438 |
#ifdef __cplusplus |
|
7ef7284…
|
drh
|
439 |
} |
|
7ef7284…
|
drh
|
440 |
#endif |
|
7ef7284…
|
drh
|
441 |
|
|
7ef7284…
|
drh
|
442 |
#endif /* _unz64_H */ |