GDAL

- Main Page
- Related Pages
- Classes
- Files
- Download
- Issue Tracker

- File List
- File Members

cpl_minizip_zip.h
1 /******************************************************************************
2 * $Id: cpl_minizip_zip.h 35921 2016-10-25 02:28:29Z goatbar $
3 *
4 * Project: CPL - Common Portability Library
5 * Author: Frank Warmerdam, warmerdam@pobox.com
6 * Purpose: Adjusted minizip "zip.h" include file for zip services.
7 *
8 * Modified version by Even Rouault. :
9 * - Decoration of symbol names unz* -> cpl_unz*
10 * - Undef EXPORT so that we are sure the symbols are not exported
11 * - Remove old C style function prototypes
12 * - Added CPL* simplified API at bottom.
13 *
14 * Original licence available in port/LICENCE_minizip
15 *
16 *****************************************************************************/
17
18 /* zip.h -- IO for compress .zip files using zlib
19 Version 1.01e, February 12th, 2005
20
21 Copyright (C) 1998-2005 Gilles Vollant
22
23 This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
24 WinZip, InfoZip tools and compatible.
25 Multi volume ZipFile (span) are not supported.
26 Encryption compatible with pkzip 2.04g only supported
27 Old compressions used by old PKZip 1.x are not supported
28
29 For uncompress .zip file, look at unzip.h
30
31 I WAIT FEEDBACK at mail info@winimage.com
32 Visit also http://www.winimage.com/zLibDll/unzip.html for evolution
33
34 Condition of use and distribution are the same than zlib :
35
36 This software is provided 'as-is', without any express or implied
37 warranty. In no event will the authors be held liable for any damages
38 arising from the use of this software.
39
40 Permission is granted to anyone to use this software for any purpose,
41 including commercial applications, and to alter it and redistribute it
42 freely, subject to the following restrictions:
43
44 1. The origin of this software must not be misrepresented; you must not
45 claim that you wrote the original software. If you use this software
46 in a product, an acknowledgment in the product documentation would be
47 appreciated but is not required.
48 2. Altered source versions must be plainly marked as such, and must not be
49 misrepresented as being the original software.
50 3. This notice may not be removed or altered from any source distribution.
51 */
52
53 /* for more info about .ZIP format, see
54 http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
55 http://www.info-zip.org/pub/infozip/doc/
56 PkWare has also a specification at :
57 ftp://ftp.pkware.com/probdesc.zip
58 */
59
60 #ifndef CPL_MINIZIP_ZIP_H_INCLUDED
61 #define CPL_MINIZIP_ZIP_H_INCLUDED
62
63 #ifndef DOXYGEN_SKIP
64
65 #include "cpl_vsi.h"
66 #define uLong64 vsi_l_offset
67
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71
72 #ifndef _ZLIB_H
73 #include "zlib.h"
74 #endif
75
76 #ifndef CPL_MINIZIP_IOAPI_H_INCLUDED
77 #include "cpl_minizip_ioapi.h"
78 #endif
79
80 #define NOCRYPT
81 #undef ZEXPORT
82 #define ZEXPORT
83
84 #if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
85 /* like the STRICT of WIN32, we define a pointer that cannot be converted
86 from (void*) without cast */
87 typedef struct TagzipFile__ { int unused; } zipFile__;
88 typedef zipFile__ *zipFile;
89 #else
90 typedef voidp zipFile;
91 #endif
92
93 #define ZIP_OK (0)
94 #define ZIP_EOF (0)
95 #define ZIP_ERRNO (Z_ERRNO)
96 #define ZIP_PARAMERROR (-102)
97 #define ZIP_BADZIPFILE (-103)
98 #define ZIP_INTERNALERROR (-104)
99
100 #ifndef DEF_MEM_LEVEL
101 # if MAX_MEM_LEVEL >= 8
102 # define DEF_MEM_LEVEL 8
103 # else
104 # define DEF_MEM_LEVEL MAX_MEM_LEVEL
105 # endif
106 #endif
107 /* default memLevel */
108
109 /* tm_zip contain date/time info */
110 typedef struct tm_zip_s
111 {
112 uInt tm_sec; /* seconds after the minute - [0,59] */
113 uInt tm_min; /* minutes after the hour - [0,59] */
114 uInt tm_hour; /* hours since midnight - [0,23] */
115 uInt tm_mday; /* day of the month - [1,31] */
116 uInt tm_mon; /* months since January - [0,11] */
117 uInt tm_year; /* years - [1980..2044] */
118 } tm_zip;
119
120 typedef struct
121 {
122 tm_zip tmz_date; /* date in understandable format */
123 uLong dosDate; /* if dos_date == 0, tmu_date is used */
124 /* uLong flag; */ /* general purpose bit flag 2 bytes */
125
126 uLong internal_fa; /* internal file attributes 2 bytes */
127 uLong external_fa; /* external file attributes 4 bytes */
128 } zip_fileinfo;
129
130 typedef const char* zipcharpc;
131
132 #define APPEND_STATUS_CREATE (0)
133 #define APPEND_STATUS_CREATEAFTER (1)
134 #define APPEND_STATUS_ADDINZIP (2)
135
136 extern zipFile ZEXPORT cpl_zipOpen (const char *pathname, int append);
137 /*
138 Create a zipfile.
139 pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
140 an Unix computer "zlib/zlib113.zip".
141 if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
142 will be created at the end of the file.
143 (useful if the file contain a self extractor code)
144 if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
145 add files in existing zip (be sure you don't add file that doesn't exist)
146 If the zipfile cannot be opened, the return value is NULL.
147 Else, the return value is a zipFile Handle, usable with other function
148 of this zip package.
149 */
150
151 /* Note : there is no delete function for a zipfile.
152 If you want delete file in a zipfile, you must open a zipfile, and create another.
153 Of course, you can use RAW reading and writing to copy the file you did not want delete.
154 */
155
156 extern zipFile ZEXPORT cpl_zipOpen2 (const char *pathname,
157 int append,
158 zipcharpc* globalcomment,
159 zlib_filefunc_def* pzlib_filefunc_def);
160
161 extern int ZEXPORT cpl_zipOpenNewFileInZip (zipFile file,
162 const char* filename,
163 const zip_fileinfo* zipfi,
164 const void* extrafield_local,
165 uInt size_extrafield_local,
166 const void* extrafield_global,
167 uInt size_extrafield_global,
168 const char* comment,
169 int method,
170 int level);
171 /*
172 Open a file in the ZIP for writing.
173 filename : the filename in zip (if NULL, '-' without quote will be used
174 *zipfi contain supplemental information
175 if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
176 contains the extrafield data the local header
177 if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
178 contains the extrafield data the local header
179 if comment != NULL, comment contain the comment string
180 method contain the compression method (0 for store, Z_DEFLATED for deflate)
181 level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
182 */
183
184 extern int ZEXPORT cpl_zipOpenNewFileInZip2 (zipFile file,
185 const char* filename,
186 const zip_fileinfo* zipfi,
187 const void* extrafield_local,
188 uInt size_extrafield_local,
189 const void* extrafield_global,
190 uInt size_extrafield_global,
191 const char* comment,
192 int method,
193 int level,
194 int raw);
195
196 /*
197 Same than zipOpenNewFileInZip, except if raw=1, we write raw file
198 */
199
200 extern int ZEXPORT cpl_zipOpenNewFileInZip3 (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 windowBits,
212 int memLevel,
213 int strategy,
214 const char* password,
215 uLong crcForCtypting);
216
217 /*
218 Same than zipOpenNewFileInZip2, except
219 windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
220 password : crypting password (NULL for no crypting)
221 crcForCtypting : crc of file to compress (needed for crypting)
222 */
223
224 extern int ZEXPORT cpl_zipWriteInFileInZip (zipFile file,
225 const void* buf,
226 unsigned len);
227 /*
228 Write data in the zipfile
229 */
230
231 extern int ZEXPORT cpl_zipCloseFileInZip (zipFile file);
232 /*
233 Close the current file in the zipfile
234 */
235
236 extern int ZEXPORT cpl_zipCloseFileInZipRaw (zipFile file,
237 uLong uncompressed_size,
238 uLong crc32);
239 /*
240 Close the current file in the zipfile, for file opened with
241 parameter raw=1 in zipOpenNewFileInZip2
242 uncompressed_size and crc32 are value for the uncompressed size
243 */
244
245 extern int ZEXPORT cpl_zipClose (zipFile file,
246 const char* global_comment);
247 /*
248 Close the zipfile
249 */
250
251 #ifdef __cplusplus
252 }
253 #endif
254
255 #endif /* #ifndef DOXYGEN_SKIP */
256
257 #endif /* _zip_H */
cpl_vsi.h
Standard C Covers.

Generated for GDAL by 1.8.9.1.