annotate src/zlib-1.2.7/contrib/minizip/zip.h @ 4:e13257ea84a4

Add bzip2, zlib, liblo, portaudio sources
author Chris Cannam
date Wed, 20 Mar 2013 13:59:52 +0000
parents
children
rev   line source
Chris@4 1 /* zip.h -- IO on .zip files using zlib
Chris@4 2 Version 1.1, February 14h, 2010
Chris@4 3 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
Chris@4 4
Chris@4 5 Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
Chris@4 6
Chris@4 7 Modifications for Zip64 support
Chris@4 8 Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
Chris@4 9
Chris@4 10 For more info read MiniZip_info.txt
Chris@4 11
Chris@4 12 ---------------------------------------------------------------------------
Chris@4 13
Chris@4 14 Condition of use and distribution are the same than zlib :
Chris@4 15
Chris@4 16 This software is provided 'as-is', without any express or implied
Chris@4 17 warranty. In no event will the authors be held liable for any damages
Chris@4 18 arising from the use of this software.
Chris@4 19
Chris@4 20 Permission is granted to anyone to use this software for any purpose,
Chris@4 21 including commercial applications, and to alter it and redistribute it
Chris@4 22 freely, subject to the following restrictions:
Chris@4 23
Chris@4 24 1. The origin of this software must not be misrepresented; you must not
Chris@4 25 claim that you wrote the original software. If you use this software
Chris@4 26 in a product, an acknowledgment in the product documentation would be
Chris@4 27 appreciated but is not required.
Chris@4 28 2. Altered source versions must be plainly marked as such, and must not be
Chris@4 29 misrepresented as being the original software.
Chris@4 30 3. This notice may not be removed or altered from any source distribution.
Chris@4 31
Chris@4 32 ---------------------------------------------------------------------------
Chris@4 33
Chris@4 34 Changes
Chris@4 35
Chris@4 36 See header of zip.h
Chris@4 37
Chris@4 38 */
Chris@4 39
Chris@4 40 #ifndef _zip12_H
Chris@4 41 #define _zip12_H
Chris@4 42
Chris@4 43 #ifdef __cplusplus
Chris@4 44 extern "C" {
Chris@4 45 #endif
Chris@4 46
Chris@4 47 //#define HAVE_BZIP2
Chris@4 48
Chris@4 49 #ifndef _ZLIB_H
Chris@4 50 #include "zlib.h"
Chris@4 51 #endif
Chris@4 52
Chris@4 53 #ifndef _ZLIBIOAPI_H
Chris@4 54 #include "ioapi.h"
Chris@4 55 #endif
Chris@4 56
Chris@4 57 #ifdef HAVE_BZIP2
Chris@4 58 #include "bzlib.h"
Chris@4 59 #endif
Chris@4 60
Chris@4 61 #define Z_BZIP2ED 12
Chris@4 62
Chris@4 63 #if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
Chris@4 64 /* like the STRICT of WIN32, we define a pointer that cannot be converted
Chris@4 65 from (void*) without cast */
Chris@4 66 typedef struct TagzipFile__ { int unused; } zipFile__;
Chris@4 67 typedef zipFile__ *zipFile;
Chris@4 68 #else
Chris@4 69 typedef voidp zipFile;
Chris@4 70 #endif
Chris@4 71
Chris@4 72 #define ZIP_OK (0)
Chris@4 73 #define ZIP_EOF (0)
Chris@4 74 #define ZIP_ERRNO (Z_ERRNO)
Chris@4 75 #define ZIP_PARAMERROR (-102)
Chris@4 76 #define ZIP_BADZIPFILE (-103)
Chris@4 77 #define ZIP_INTERNALERROR (-104)
Chris@4 78
Chris@4 79 #ifndef DEF_MEM_LEVEL
Chris@4 80 # if MAX_MEM_LEVEL >= 8
Chris@4 81 # define DEF_MEM_LEVEL 8
Chris@4 82 # else
Chris@4 83 # define DEF_MEM_LEVEL MAX_MEM_LEVEL
Chris@4 84 # endif
Chris@4 85 #endif
Chris@4 86 /* default memLevel */
Chris@4 87
Chris@4 88 /* tm_zip contain date/time info */
Chris@4 89 typedef struct tm_zip_s
Chris@4 90 {
Chris@4 91 uInt tm_sec; /* seconds after the minute - [0,59] */
Chris@4 92 uInt tm_min; /* minutes after the hour - [0,59] */
Chris@4 93 uInt tm_hour; /* hours since midnight - [0,23] */
Chris@4 94 uInt tm_mday; /* day of the month - [1,31] */
Chris@4 95 uInt tm_mon; /* months since January - [0,11] */
Chris@4 96 uInt tm_year; /* years - [1980..2044] */
Chris@4 97 } tm_zip;
Chris@4 98
Chris@4 99 typedef struct
Chris@4 100 {
Chris@4 101 tm_zip tmz_date; /* date in understandable format */
Chris@4 102 uLong dosDate; /* if dos_date == 0, tmu_date is used */
Chris@4 103 /* uLong flag; */ /* general purpose bit flag 2 bytes */
Chris@4 104
Chris@4 105 uLong internal_fa; /* internal file attributes 2 bytes */
Chris@4 106 uLong external_fa; /* external file attributes 4 bytes */
Chris@4 107 } zip_fileinfo;
Chris@4 108
Chris@4 109 typedef const char* zipcharpc;
Chris@4 110
Chris@4 111
Chris@4 112 #define APPEND_STATUS_CREATE (0)
Chris@4 113 #define APPEND_STATUS_CREATEAFTER (1)
Chris@4 114 #define APPEND_STATUS_ADDINZIP (2)
Chris@4 115
Chris@4 116 extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
Chris@4 117 extern zipFile ZEXPORT zipOpen64 OF((const void *pathname, int append));
Chris@4 118 /*
Chris@4 119 Create a zipfile.
Chris@4 120 pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
Chris@4 121 an Unix computer "zlib/zlib113.zip".
Chris@4 122 if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
Chris@4 123 will be created at the end of the file.
Chris@4 124 (useful if the file contain a self extractor code)
Chris@4 125 if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
Chris@4 126 add files in existing zip (be sure you don't add file that doesn't exist)
Chris@4 127 If the zipfile cannot be opened, the return value is NULL.
Chris@4 128 Else, the return value is a zipFile Handle, usable with other function
Chris@4 129 of this zip package.
Chris@4 130 */
Chris@4 131
Chris@4 132 /* Note : there is no delete function into a zipfile.
Chris@4 133 If you want delete file into a zipfile, you must open a zipfile, and create another
Chris@4 134 Of couse, you can use RAW reading and writing to copy the file you did not want delte
Chris@4 135 */
Chris@4 136
Chris@4 137 extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
Chris@4 138 int append,
Chris@4 139 zipcharpc* globalcomment,
Chris@4 140 zlib_filefunc_def* pzlib_filefunc_def));
Chris@4 141
Chris@4 142 extern zipFile ZEXPORT zipOpen2_64 OF((const void *pathname,
Chris@4 143 int append,
Chris@4 144 zipcharpc* globalcomment,
Chris@4 145 zlib_filefunc64_def* pzlib_filefunc_def));
Chris@4 146
Chris@4 147 extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
Chris@4 148 const char* filename,
Chris@4 149 const zip_fileinfo* zipfi,
Chris@4 150 const void* extrafield_local,
Chris@4 151 uInt size_extrafield_local,
Chris@4 152 const void* extrafield_global,
Chris@4 153 uInt size_extrafield_global,
Chris@4 154 const char* comment,
Chris@4 155 int method,
Chris@4 156 int level));
Chris@4 157
Chris@4 158 extern int ZEXPORT zipOpenNewFileInZip64 OF((zipFile file,
Chris@4 159 const char* filename,
Chris@4 160 const zip_fileinfo* zipfi,
Chris@4 161 const void* extrafield_local,
Chris@4 162 uInt size_extrafield_local,
Chris@4 163 const void* extrafield_global,
Chris@4 164 uInt size_extrafield_global,
Chris@4 165 const char* comment,
Chris@4 166 int method,
Chris@4 167 int level,
Chris@4 168 int zip64));
Chris@4 169
Chris@4 170 /*
Chris@4 171 Open a file in the ZIP for writing.
Chris@4 172 filename : the filename in zip (if NULL, '-' without quote will be used
Chris@4 173 *zipfi contain supplemental information
Chris@4 174 if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
Chris@4 175 contains the extrafield data the the local header
Chris@4 176 if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
Chris@4 177 contains the extrafield data the the local header
Chris@4 178 if comment != NULL, comment contain the comment string
Chris@4 179 method contain the compression method (0 for store, Z_DEFLATED for deflate)
Chris@4 180 level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
Chris@4 181 zip64 is set to 1 if a zip64 extended information block should be added to the local file header.
Chris@4 182 this MUST be '1' if the uncompressed size is >= 0xffffffff.
Chris@4 183
Chris@4 184 */
Chris@4 185
Chris@4 186
Chris@4 187 extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
Chris@4 188 const char* filename,
Chris@4 189 const zip_fileinfo* zipfi,
Chris@4 190 const void* extrafield_local,
Chris@4 191 uInt size_extrafield_local,
Chris@4 192 const void* extrafield_global,
Chris@4 193 uInt size_extrafield_global,
Chris@4 194 const char* comment,
Chris@4 195 int method,
Chris@4 196 int level,
Chris@4 197 int raw));
Chris@4 198
Chris@4 199
Chris@4 200 extern int ZEXPORT zipOpenNewFileInZip2_64 OF((zipFile file,
Chris@4 201 const char* filename,
Chris@4 202 const zip_fileinfo* zipfi,
Chris@4 203 const void* extrafield_local,
Chris@4 204 uInt size_extrafield_local,
Chris@4 205 const void* extrafield_global,
Chris@4 206 uInt size_extrafield_global,
Chris@4 207 const char* comment,
Chris@4 208 int method,
Chris@4 209 int level,
Chris@4 210 int raw,
Chris@4 211 int zip64));
Chris@4 212 /*
Chris@4 213 Same than zipOpenNewFileInZip, except if raw=1, we write raw file
Chris@4 214 */
Chris@4 215
Chris@4 216 extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
Chris@4 217 const char* filename,
Chris@4 218 const zip_fileinfo* zipfi,
Chris@4 219 const void* extrafield_local,
Chris@4 220 uInt size_extrafield_local,
Chris@4 221 const void* extrafield_global,
Chris@4 222 uInt size_extrafield_global,
Chris@4 223 const char* comment,
Chris@4 224 int method,
Chris@4 225 int level,
Chris@4 226 int raw,
Chris@4 227 int windowBits,
Chris@4 228 int memLevel,
Chris@4 229 int strategy,
Chris@4 230 const char* password,
Chris@4 231 uLong crcForCrypting));
Chris@4 232
Chris@4 233 extern int ZEXPORT zipOpenNewFileInZip3_64 OF((zipFile file,
Chris@4 234 const char* filename,
Chris@4 235 const zip_fileinfo* zipfi,
Chris@4 236 const void* extrafield_local,
Chris@4 237 uInt size_extrafield_local,
Chris@4 238 const void* extrafield_global,
Chris@4 239 uInt size_extrafield_global,
Chris@4 240 const char* comment,
Chris@4 241 int method,
Chris@4 242 int level,
Chris@4 243 int raw,
Chris@4 244 int windowBits,
Chris@4 245 int memLevel,
Chris@4 246 int strategy,
Chris@4 247 const char* password,
Chris@4 248 uLong crcForCrypting,
Chris@4 249 int zip64
Chris@4 250 ));
Chris@4 251
Chris@4 252 /*
Chris@4 253 Same than zipOpenNewFileInZip2, except
Chris@4 254 windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
Chris@4 255 password : crypting password (NULL for no crypting)
Chris@4 256 crcForCrypting : crc of file to compress (needed for crypting)
Chris@4 257 */
Chris@4 258
Chris@4 259 extern int ZEXPORT zipOpenNewFileInZip4 OF((zipFile file,
Chris@4 260 const char* filename,
Chris@4 261 const zip_fileinfo* zipfi,
Chris@4 262 const void* extrafield_local,
Chris@4 263 uInt size_extrafield_local,
Chris@4 264 const void* extrafield_global,
Chris@4 265 uInt size_extrafield_global,
Chris@4 266 const char* comment,
Chris@4 267 int method,
Chris@4 268 int level,
Chris@4 269 int raw,
Chris@4 270 int windowBits,
Chris@4 271 int memLevel,
Chris@4 272 int strategy,
Chris@4 273 const char* password,
Chris@4 274 uLong crcForCrypting,
Chris@4 275 uLong versionMadeBy,
Chris@4 276 uLong flagBase
Chris@4 277 ));
Chris@4 278
Chris@4 279
Chris@4 280 extern int ZEXPORT zipOpenNewFileInZip4_64 OF((zipFile file,
Chris@4 281 const char* filename,
Chris@4 282 const zip_fileinfo* zipfi,
Chris@4 283 const void* extrafield_local,
Chris@4 284 uInt size_extrafield_local,
Chris@4 285 const void* extrafield_global,
Chris@4 286 uInt size_extrafield_global,
Chris@4 287 const char* comment,
Chris@4 288 int method,
Chris@4 289 int level,
Chris@4 290 int raw,
Chris@4 291 int windowBits,
Chris@4 292 int memLevel,
Chris@4 293 int strategy,
Chris@4 294 const char* password,
Chris@4 295 uLong crcForCrypting,
Chris@4 296 uLong versionMadeBy,
Chris@4 297 uLong flagBase,
Chris@4 298 int zip64
Chris@4 299 ));
Chris@4 300 /*
Chris@4 301 Same than zipOpenNewFileInZip4, except
Chris@4 302 versionMadeBy : value for Version made by field
Chris@4 303 flag : value for flag field (compression level info will be added)
Chris@4 304 */
Chris@4 305
Chris@4 306
Chris@4 307 extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
Chris@4 308 const void* buf,
Chris@4 309 unsigned len));
Chris@4 310 /*
Chris@4 311 Write data in the zipfile
Chris@4 312 */
Chris@4 313
Chris@4 314 extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
Chris@4 315 /*
Chris@4 316 Close the current file in the zipfile
Chris@4 317 */
Chris@4 318
Chris@4 319 extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
Chris@4 320 uLong uncompressed_size,
Chris@4 321 uLong crc32));
Chris@4 322
Chris@4 323 extern int ZEXPORT zipCloseFileInZipRaw64 OF((zipFile file,
Chris@4 324 ZPOS64_T uncompressed_size,
Chris@4 325 uLong crc32));
Chris@4 326
Chris@4 327 /*
Chris@4 328 Close the current file in the zipfile, for file opened with
Chris@4 329 parameter raw=1 in zipOpenNewFileInZip2
Chris@4 330 uncompressed_size and crc32 are value for the uncompressed size
Chris@4 331 */
Chris@4 332
Chris@4 333 extern int ZEXPORT zipClose OF((zipFile file,
Chris@4 334 const char* global_comment));
Chris@4 335 /*
Chris@4 336 Close the zipfile
Chris@4 337 */
Chris@4 338
Chris@4 339
Chris@4 340 extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader));
Chris@4 341 /*
Chris@4 342 zipRemoveExtraInfoBlock - Added by Mathias Svensson
Chris@4 343
Chris@4 344 Remove extra information block from a extra information data for the local file header or central directory header
Chris@4 345
Chris@4 346 It is needed to remove ZIP64 extra information blocks when before data is written if using RAW mode.
Chris@4 347
Chris@4 348 0x0001 is the signature header for the ZIP64 extra information blocks
Chris@4 349
Chris@4 350 usage.
Chris@4 351 Remove ZIP64 Extra information from a central director extra field data
Chris@4 352 zipRemoveExtraInfoBlock(pCenDirExtraFieldData, &nCenDirExtraFieldDataLen, 0x0001);
Chris@4 353
Chris@4 354 Remove ZIP64 Extra information from a Local File Header extra field data
Chris@4 355 zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001);
Chris@4 356 */
Chris@4 357
Chris@4 358 #ifdef __cplusplus
Chris@4 359 }
Chris@4 360 #endif
Chris@4 361
Chris@4 362 #endif /* _zip64_H */