annotate src/zlib-1.2.7/contrib/minizip/zip.h @ 89:8a15ff55d9af

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