1/* unzip.h -- IO for uncompress .zip files using zlib
2 Version 1.01e, February 12th, 2005
3
4 Copyright (C) 1998-2005 Gilles Vollant
5
6 This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
7 WinZip, InfoZip tools and compatible.
8
9 Multi volume ZipFile (span) are not supported.
10 Encryption compatible with pkzip 2.04g only supported
11 Old compressions used by old PKZip 1.x are not supported
12
13
14 I WAIT FEEDBACK at mail info@winimage.com
15 Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
16
17 Condition of use and distribution are the same than zlib :
18
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
21 arising from the use of this software.
22
23 Permission is granted to anyone to use this software for any purpose,
24 including commercial applications, and to alter it and redistribute it
25 freely, subject to the following restrictions:
26
27 1. The origin of this software must not be misrepresented; you must not
28 claim that you wrote the original software. If you use this software
29 in a product, an acknowledgment in the product documentation would be
30 appreciated but is not required.
31 2. Altered source versions must be plainly marked as such, and must not be
32 misrepresented as being the original software.
33 3. This notice may not be removed or altered from any source distribution.
34
35
36*/
37
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*/
44
45#ifndef _unz_H
46#define _unz_H
47
48// This needs to be outside of the extern "C" when using Qt's zlib
49#ifndef _ZLIB_H
50#include "zlib.h"
51#endif
52
53#ifdef __cplusplus
54extern "C" {
55#endif
56
57#ifndef _ZLIBIOAPI_H
58#include <contrib/unzip/ioapi.h>
59#endif
60
61#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
62/* like the STRICT of WIN32, we define a pointer that cannot be converted
63 from (void*) without cast */
64typedef struct TagunzFile__ { int unused; } unzFile__;
65typedef unzFile__ *unzFile;
66#else
67typedef voidp unzFile;
68#endif
69
70
71#define UNZ_OK (0)
72#define UNZ_END_OF_LIST_OF_FILE (-100)
73#define UNZ_ERRNO (Z_ERRNO)
74#define UNZ_EOF (0)
75#define UNZ_PARAMERROR (-102)
76#define UNZ_BADZIPFILE (-103)
77#define UNZ_INTERNALERROR (-104)
78#define UNZ_CRCERROR (-105)
79
80/* tm_unz contain date/time info */
81typedef struct tm_unz_s
82{
83 uInt tm_sec; /* seconds after the minute - [0,59] */
84 uInt tm_min; /* minutes after the hour - [0,59] */
85 uInt tm_hour; /* hours since midnight - [0,23] */
86 uInt tm_mday; /* day of the month - [1,31] */
87 uInt tm_mon; /* months since January - [0,11] */
88 uInt tm_year; /* years - [1980..2044] */
89} tm_unz;
90
91/* unz_global_info structure contain global data about the ZIPfile
92 These data comes from the end of central dir */
93typedef struct unz_global_info_s
94{
95 uLong number_entry; /* total number of entries in
96 the central dir on this disk */
97 uLong size_comment; /* size of the global comment of the zipfile */
98} unz_global_info;
99
100
101/* unz_file_info contain information about a file in the zipfile */
102typedef struct unz_file_info_s
103{
104 uLong version; /* version made by 2 bytes */
105 uLong version_needed; /* version needed to extract 2 bytes */
106 uLong flag; /* general purpose bit flag 2 bytes */
107 uLong compression_method; /* compression method 2 bytes */
108 uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
109 uLong crc; /* crc-32 4 bytes */
110 uLong compressed_size; /* compressed size 4 bytes */
111 uLong uncompressed_size; /* uncompressed size 4 bytes */
112 uLong size_filename; /* filename length 2 bytes */
113 uLong size_file_extra; /* extra field length 2 bytes */
114 uLong size_file_comment; /* file comment length 2 bytes */
115
116 uLong disk_num_start; /* disk number start 2 bytes */
117 uLong internal_fa; /* internal file attributes 2 bytes */
118 uLong external_fa; /* external file attributes 4 bytes */
119
120 tm_unz tmu_date;
121} unz_file_info;
122
123extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
124 const char* fileName2,
125 int iCaseSensitivity));
126/*
127 Compare two filename (fileName1,fileName2).
128 If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
129 If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
130 or strcasecmp)
131 If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
132 (like 1 on Unix, 2 on Windows)
133*/
134
135
136extern unzFile ZEXPORT unzOpen OF((const char *path));
137/*
138 Open a Zip file. path contain the full pathname (by example,
139 on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
140 "zlib/zlib113.zip".
141 If the zipfile cannot be opened (file don't exist or in not valid), the
142 return value is NULL.
143 Else, the return value is a unzFile Handle, usable with other function
144 of this unzip package.
145*/
146
147extern unzFile ZEXPORT unzOpen2 OF((const char *path,
148 zlib_filefunc_def* pzlib_filefunc_def));
149/*
150 Open a Zip file, like unzOpen, but provide a set of file low level API
151 for read/write the zip file (see ioapi.h)
152*/
153
154extern int ZEXPORT unzClose OF((unzFile file));
155/*
156 Close a ZipFile opened with unzipOpen.
157 If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
158 these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
159 return UNZ_OK if there is no problem. */
160
161extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
162 unz_global_info *pglobal_info));
163/*
164 Write info about the ZipFile in the *pglobal_info structure.
165 No preparation of the structure is needed
166 return UNZ_OK if there is no problem. */
167
168
169extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
170 char *szComment,
171 uLong uSizeBuf));
172/*
173 Get the global comment string of the ZipFile, in the szComment buffer.
174 uSizeBuf is the size of the szComment buffer.
175 return the number of byte copied or an error code <0
176*/
177
178
179/***************************************************************************/
180/* Unzip package allow you browse the directory of the zipfile */
181
182extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
183/*
184 Set the current file of the zipfile to the first file.
185 return UNZ_OK if there is no problem
186*/
187
188extern int ZEXPORT unzGoToNextFile OF((unzFile file));
189/*
190 Set the current file of the zipfile to the next file.
191 return UNZ_OK if there is no problem
192 return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
193*/
194
195extern int ZEXPORT unzLocateFile OF((unzFile file,
196 const char *szFileName,
197 int iCaseSensitivity));
198/*
199 Try locate the file szFileName in the zipfile.
200 For the iCaseSensitivity signification, see unzStringFileNameCompare
201
202 return value :
203 UNZ_OK if the file is found. It becomes the current file.
204 UNZ_END_OF_LIST_OF_FILE if the file is not found
205*/
206
207
208/* ****************************************** */
209/* Ryan supplied functions */
210/* unz_file_info contain information about a file in the zipfile */
211typedef struct unz_file_pos_s
212{
213 uLong pos_in_zip_directory; /* offset in zip file directory */
214 uLong num_of_file; /* # of file */
215} unz_file_pos;
216
217extern int ZEXPORT unzGetFilePos(
218 unzFile file,
219 unz_file_pos* file_pos);
220
221extern int ZEXPORT unzGoToFilePos(
222 unzFile file,
223 unz_file_pos* file_pos);
224
225/* ****************************************** */
226
227extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
228 unz_file_info *pfile_info,
229 char *szFileName,
230 uLong fileNameBufferSize,
231 void *extraField,
232 uLong extraFieldBufferSize,
233 char *szComment,
234 uLong commentBufferSize));
235/*
236 Get Info about the current file
237 if pfile_info!=NULL, the *pfile_info structure will contain somes info about
238 the current file
239 if szFileName!=NULL, the filemane string will be copied in szFileName
240 (fileNameBufferSize is the size of the buffer)
241 if extraField!=NULL, the extra field information will be copied in extraField
242 (extraFieldBufferSize is the size of the buffer).
243 This is the Central-header version of the extra field
244 if szComment!=NULL, the comment string of the file will be copied in szComment
245 (commentBufferSize is the size of the buffer)
246*/
247
248/***************************************************************************/
249/* for reading the content of the current zipfile, you can open it, read data
250 from it, and close it (you can close it before reading all the file)
251 */
252
253extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
254/*
255 Open for reading data the current file in the zipfile.
256 If there is no error, the return value is UNZ_OK.
257*/
258
259extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
260 const char* password));
261/*
262 Open for reading data the current file in the zipfile.
263 password is a crypting password
264 If there is no error, the return value is UNZ_OK.
265*/
266
267extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
268 int* method,
269 int* level,
270 int raw));
271/*
272 Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
273 if raw==1
274 *method will receive method of compression, *level will receive level of
275 compression
276 note : you can set level parameter as NULL (if you did not want known level,
277 but you CANNOT set method parameter as NULL
278*/
279
280extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
281 int* method,
282 int* level,
283 int raw,
284 const char* password));
285/*
286 Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
287 if raw==1
288 *method will receive method of compression, *level will receive level of
289 compression
290 note : you can set level parameter as NULL (if you did not want known level,
291 but you CANNOT set method parameter as NULL
292*/
293
294
295extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
296/*
297 Close the file in zip opened with unzOpenCurrentFile
298 Return UNZ_CRCERROR if all the file was read but the CRC is not good
299*/
300
301extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
302 voidp buf,
303 unsigned len));
304/*
305 Read bytes from the current file (opened by unzOpenCurrentFile)
306 buf contain buffer where data must be copied
307 len the size of buf.
308
309 return the number of byte copied if somes bytes are copied
310 return 0 if the end of file was reached
311 return <0 with error code if there is an error
312 (UNZ_ERRNO for IO error, or zLib error for uncompress error)
313*/
314
315extern z_off_t ZEXPORT unztell OF((unzFile file));
316/*
317 Give the current position in uncompressed data
318*/
319
320extern int ZEXPORT unzeof OF((unzFile file));
321/*
322 return 1 if the end of file was reached, 0 elsewhere
323*/
324
325extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
326 voidp buf,
327 unsigned len));
328/*
329 Read extra field from the current file (opened by unzOpenCurrentFile)
330 This is the local-header version of the extra field (sometimes, there is
331 more info in the local-header version than in the central-header)
332
333 if buf==NULL, it return the size of the local extra field
334
335 if buf!=NULL, len is the size of the buffer, the extra header is copied in
336 buf.
337 the return value is the number of bytes copied in buf, or (if <0)
338 the error code
339*/
340
341/***************************************************************************/
342
343/* Get the current file offset */
344extern uLong ZEXPORT unzGetOffset (unzFile file);
345
346/* Set the current file offset */
347extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
348
349
350
351#ifdef __cplusplus
352}
353#endif
354
355#endif /* _unz_H */
356

source code of qt3d/src/3rdparty/assimp/unzip/unzip.h