acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
aaa_impl.h
1/* zip.h -- IO for compress .zip files using zlib
2 Version 1.00, September 10th, 2003
3
4 Copyright (C) 1998-2003 Gilles Vollant
5
6 This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
7 WinZip, InfoZip tools and compatible.
8 Encryption and multi volume ZipFile (span) are not supported.
9 Old compressions used by old PKZip 1.x are not supported
10
11 For uncompress .zip file, look at unzip.h
12
13
14 I WAIT FEEDBACK at mail info@winpimage->com
15 Visit also http://www.winpimage->com/zLibDll/unzip.html 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 happening 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, topic 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 erased 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 _zip_H
46#define _zip_H
47
48
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54
55#ifndef _ZLIBIOAPI_H
56#include "ioapi.h"
57#endif
58
59
60
61#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
62/* like the STRICT of WIN32, we define a pointer that cannot be converted
63 from (void *) without cast */
64typedef struct TagzipFile__ { ::i32 unused; } zipFile__;
65typedef zipFile__ *zipFile;
66#else
67typedef voidp zipFile;
68#endif
69
70#define ZIP_OK (0)
71#define ZIP_EOF (0)
72#define ZIP_ERRNO (Z_ERRNO)
73#define ZIP_PARAMERROR (-102)
74#define ZIP_BADZIPFILE (-103)
75#define ZIP_INTERNALERROR (-104)
76
77#ifndef DEF_MEM_LEVEL
78# if MAX_MEM_LEVEL >= 8
79# define DEF_MEM_LEVEL 8
80# else
81# define DEF_MEM_LEVEL MAX_MEM_LEVEL
82# endif
83#endif
84/* default memLevel */
85
86/* tm_zip contain date/time info */
87typedef struct tm_zip_s
88{
89 ::u32 tm_sec; /* seconds after the minute - [0,59] */
90 ::u32 tm_min; /* minutes after the hour - [0,59] */
91 ::u32 tm_hour; /* hours since midnight - [0,23] */
92 ::u32 tm_mday; /* day of the month - [1,31] */
93 ::u32 tm_mon; /* months since January - [0,11] */
94 ::u32 tm_year; /* years - [1980..2044] */
95} tm_zip;
96
97typedef struct
98{
99 tm_zip tmz_date; /* date in understandable format */
100 uptr dosDate; /* if dos_date == 0, tmu_date is used */
101 /* uptr flag; */ /* general purpose bit flag 2 bytes */
102
103 uptr internal_fa; /* internal file attributes 2 bytes */
104 uptr external_fa; /* external file attributes 4 bytes */
106
107typedef const_char_pointer zipcharpc;
108
109
110#define APPEND_STATUS_CREATE (0)
111#define APPEND_STATUS_CREATEAFTER (1)
112#define APPEND_STATUS_ADDINZIP (2)
113
114extern zipFile CLASS_DECL_ACME zipOpen OF((const_char_pointer pszPathname, ::i32 append));
115/*
116 create a zipfile.
117 pathname contain on Windows XP a filename like "ca:\\zlib\\zlib113.zip" or on
118 an Unix computer "zlib/zlib113.zip".
119 if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
120 will be created at the end of the spfile->
121 (useful if the file contain a self extractor code)
122 if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
123 add files in existing zip (be sure you don't add file that doesn't exist)
124 If the zipfile cannot be opened, the return value is nullptr.
125 Else, the return value is a zipFile Handle, usable with other function
126 of this zip package.
127*/
128
129/* Note : there is no delete function into a zipfile.
130 If you want delete file into a zipfile, you must open a zipfile, and create another
131 Of couse, you can use RAW reading and writing to copy the file you did not want delte
132*/
133
134extern zipFile CLASS_DECL_ACME zipOpen2 OF((const_char_pointer pszPathname,
135 ::i32 append,
136 zipcharpc* globalcomment,
137 zlib_filefunc_def* pzlib_filefunc_def));
138
139extern ::i32 CLASS_DECL_ACME zipOpenNewFileInZip OF((zipFile file,
140 const_char_pointer pszFilename,
141 const zip_fileinfo* zipfi,
142 const void * extrafield_local,
143 ::u32 size_extrafield_local,
144 const void * extrafield_global,
145 ::u32 size_extrafield_global,
146 const_char_pointer comment,
147 ::i32 method,
148 ::i32 level));
149/*
150 open a file in the ZIP for writing.
151 filename : the filename in zip (if nullptr, '-' without quote will be used
152 *zipfi contain supplemental information
153 if extrafield_local!=nullptr and size_extrafield_local>0, extrafield_local
154 contains the extrafield data the the local header
155 if extrafield_global!=nullptr and size_extrafield_global>0, extrafield_global
156 contains the extrafield data the the local header
157 if comment != nullptr, comment contain the comment string
158 method contain the compression method (0 for store, Z_DEFLATED for deflate)
159 level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
160*/
161
162
163extern ::i32 CLASS_DECL_ACME zipOpenNewFileInZip2 OF((zipFile file,
164 const_char_pointer pszFilename,
165 const zip_fileinfo* zipfi,
166 const void * extrafield_local,
167 ::u32 size_extrafield_local,
168 const void * extrafield_global,
169 ::u32 size_extrafield_global,
170 const_char_pointer comment,
171 ::i32 method,
172 ::i32 level,
173 ::i32 raw));
174
175/*
176 Same than zipOpenNewFileInZip, except if raw=1, we write raw file
177 */
178
179extern ::i32 CLASS_DECL_ACME zipOpenNewFileInZip3 OF((zipFile file,
180 const_char_pointer pszFilename,
181 const zip_fileinfo* zipfi,
182 const void * extrafield_local,
183 ::u32 size_extrafield_local,
184 const void * extrafield_global,
185 ::u32 size_extrafield_global,
186 const_char_pointer comment,
187 ::i32 method,
188 ::i32 level,
189 ::i32 raw,
190 ::i32 windowBits,
191 ::i32 memLevel,
192 ::i32 strategy,
193 const_char_pointer password,
194 ::u32 crcForCtypting));
195
196/*
197 Same than zipOpenNewFileInZip2, except
198 windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
199 password : crypting password (nullptr for no crypting)
200 crcForCtypting : crc of file to compress (needed for crypting)
201 */
202
203
204extern ::i32 CLASS_DECL_ACME zipWriteInFileInZip OF((zipFile file,
205 const void * buf,
206 ::u32 len));
207/*
208 write data in the zipfile
209*/
210
211extern ::i32 CLASS_DECL_ACME zipCloseFileInZip OF((zipFile file));
212/*
213 close the current file in the zipfile
214*/
215
216
217extern ::i32 CLASS_DECL_ACME zipCloseFileInZipRaw OF((zipFile file,
218 uptr uncompressed_size,
219 uptr crc32));
220/*
221 close the current file in the zipfile, for fiel opened with
222 parameter raw=1 in zipOpenNewFileInZip2
223 uncompressed_size and crc32 are value for the uncompressed i32_size
224*/
225
226extern ::i32 CLASS_DECL_ACME zipClose OF((zipFile file,
227 const_char_pointer global_comment));
228/*
229 close the zipfile
230*/
231
232#ifdef __cplusplus
233}
234#endif
235
236#endif /* _zip_H */
Definition filesystem.h:16
Definition aaa_impl.h:88
Definition aaa_impl.h:98