Ignite Tools
Shared/Airship/External/UA_ZipFile-OC/UA_minizip/UA_zip.h
00001 /* zip.h -- IO for compress .zip files using zlib
00002    Version 1.01e, February 12th, 2005
00003 
00004    Copyright (C) 1998-2005 Gilles Vollant
00005 
00006    This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
00007      WinZip, InfoZip tools and compatible.
00008    Multi volume ZipFile (span) are not supported.
00009    Encryption compatible with pkzip 2.04g only supported
00010    Old compressions used by old PKZip 1.x are not supported
00011 
00012   For uncompress .zip file, look at unzip.h
00013 
00014 
00015    I WAIT FEEDBACK at mail info@winimage.com
00016    Visit also http://www.winimage.com/zLibDll/unzip.html for evolution
00017 
00018    Condition of use and distribution are the same than zlib :
00019 
00020   This software is provided 'as-is', without any express or implied
00021   warranty.  In no event will the authors be held liable for any damages
00022   arising from the use of this software.
00023 
00024   Permission is granted to anyone to use this software for any purpose,
00025   including commercial applications, and to alter it and redistribute it
00026   freely, subject to the following restrictions:
00027 
00028   1. The origin of this software must not be misrepresented; you must not
00029      claim that you wrote the original software. If you use this software
00030      in a product, an acknowledgment in the product documentation would be
00031      appreciated but is not required.
00032   2. Altered source versions must be plainly marked as such, and must not be
00033      misrepresented as being the original software.
00034   3. This notice may not be removed or altered from any source distribution.
00035 
00036 
00037 */
00038 
00039 /* for more info about .ZIP format, see
00040       http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
00041       http://www.info-zip.org/pub/infozip/doc/
00042    PkWare has also a specification at :
00043       ftp://ftp.pkware.com/probdesc.zip
00044 */
00045 
00046 #ifndef _zip_H
00047 #define _zip_H
00048 
00049 #ifdef __cplusplus
00050 extern "C" {
00051 #endif
00052 
00053 #ifndef _ZLIB_H
00054 #include "zlib.h"
00055 #endif
00056 
00057 #ifndef _ZLIBIOAPI_H
00058 #include "UA_ioapi.h"
00059 #endif
00060 
00061 #if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
00062 /* like the STRICT of WIN32, we define a pointer that cannot be converted
00063     from (void*) without cast */
00064 typedef struct TagzipFile__ { int unused; } zipFile__;
00065 typedef zipFile__ *zipFile;
00066 #else
00067 typedef voidp zipFile;
00068 #endif
00069 
00070 #define ZIP_OK                          (0)
00071 #define ZIP_EOF                         (0)
00072 #define ZIP_ERRNO                       (Z_ERRNO)
00073 #define ZIP_PARAMERROR                  (-102)
00074 #define ZIP_BADZIPFILE                  (-103)
00075 #define ZIP_INTERNALERROR               (-104)
00076 
00077 #ifndef DEF_MEM_LEVEL
00078 #  if MAX_MEM_LEVEL >= 8
00079 #    define DEF_MEM_LEVEL 8
00080 #  else
00081 #    define DEF_MEM_LEVEL  MAX_MEM_LEVEL
00082 #  endif
00083 #endif
00084 /* default memLevel */
00085 
00086 /* tm_zip contain date/time info */
00087 typedef struct tm_zip_s
00088 {
00089     uInt tm_sec;            /* seconds after the minute - [0,59] */
00090     uInt tm_min;            /* minutes after the hour - [0,59] */
00091     uInt tm_hour;           /* hours since midnight - [0,23] */
00092     uInt tm_mday;           /* day of the month - [1,31] */
00093     uInt tm_mon;            /* months since January - [0,11] */
00094     uInt tm_year;           /* years - [1980..2044] */
00095 } tm_zip;
00096 
00097 typedef struct
00098 {
00099     tm_zip      tmz_date;       /* date in understandable format           */
00100     uLong       dosDate;       /* if dos_date == 0, tmu_date is used      */
00101 /*    uLong       flag;        */   /* general purpose bit flag        2 bytes */
00102 
00103     uLong       internal_fa;    /* internal file attributes        2 bytes */
00104     uLong       external_fa;    /* external file attributes        4 bytes */
00105 } zip_fileinfo;
00106 
00107 typedef const char* zipcharpc;
00108 
00109 
00110 #define APPEND_STATUS_CREATE        (0)
00111 #define APPEND_STATUS_CREATEAFTER   (1)
00112 #define APPEND_STATUS_ADDINZIP      (2)
00113 
00114 extern zipFile ZEXPORT UA_zipOpen OF((const char *pathname, int append));
00115 /*
00116   Create a zipfile.
00117      pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
00118        an Unix computer "zlib/zlib113.zip".
00119      if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
00120        will be created at the end of the file.
00121          (useful if the file contain a self extractor code)
00122      if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
00123        add files in existing zip (be sure you don't add file that doesn't exist)
00124      If the zipfile cannot be opened, the return value is NULL.
00125      Else, the return value is a zipFile Handle, usable with other function
00126        of this zip package.
00127 */
00128 
00129 /* Note : there is no delete function into a zipfile.
00130    If you want delete file into a zipfile, you must open a zipfile, and create another
00131    Of couse, you can use RAW reading and writing to copy the file you did not want delte
00132 */
00133 
00134 extern zipFile ZEXPORT UA_zipOpen2 OF((const char *pathname,
00135                                    int append,
00136                                    zipcharpc* globalcomment,
00137                                    zlib_filefunc_def* pzlib_filefunc_def));
00138 
00139 extern int ZEXPORT UA_zipOpenNewFileInZip OF((zipFile file,
00140                        const char* filename,
00141                        const zip_fileinfo* zipfi,
00142                        const void* extrafield_local,
00143                        uInt size_extrafield_local,
00144                        const void* extrafield_global,
00145                        uInt size_extrafield_global,
00146                        const char* comment,
00147                        int method,
00148                        int level));
00149 /*
00150   Open a file in the ZIP for writing.
00151   filename : the filename in zip (if NULL, '-' without quote will be used
00152   *zipfi contain supplemental information
00153   if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
00154     contains the extrafield data the the local header
00155   if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
00156     contains the extrafield data the the local header
00157   if comment != NULL, comment contain the comment string
00158   method contain the compression method (0 for store, Z_DEFLATED for deflate)
00159   level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
00160 */
00161 
00162 
00163 extern int ZEXPORT UA_zipOpenNewFileInZip2 OF((zipFile file,
00164                                             const char* filename,
00165                                             const zip_fileinfo* zipfi,
00166                                             const void* extrafield_local,
00167                                             uInt size_extrafield_local,
00168                                             const void* extrafield_global,
00169                                             uInt size_extrafield_global,
00170                                             const char* comment,
00171                                             int method,
00172                                             int level,
00173                                             int raw));
00174 
00175 /*
00176   Same than UA_zipOpenNewFileInZip, except if raw=1, we write raw file
00177  */
00178 
00179 extern int ZEXPORT UA_zipOpenNewFileInZip3 OF((zipFile file,
00180                                             const char* filename,
00181                                             const zip_fileinfo* zipfi,
00182                                             const void* extrafield_local,
00183                                             uInt size_extrafield_local,
00184                                             const void* extrafield_global,
00185                                             uInt size_extrafield_global,
00186                                             const char* comment,
00187                                             int method,
00188                                             int level,
00189                                             int raw,
00190                                             int windowBits,
00191                                             int memLevel,
00192                                             int strategy,
00193                                             const char* password,
00194                                             uLong crcForCtypting));
00195 
00196 /*
00197   Same than UA_zipOpenNewFileInZip2, except
00198     windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
00199     password : crypting password (NULL for no crypting)
00200     crcForCtypting : crc of file to compress (needed for crypting)
00201  */
00202 
00203 
00204 extern int ZEXPORT UA_zipWriteInFileInZip OF((zipFile file,
00205                        const void* buf,
00206                        unsigned len));
00207 /*
00208   Write data in the zipfile
00209 */
00210 
00211 extern int ZEXPORT UA_zipCloseFileInZip OF((zipFile file));
00212 /*
00213   Close the current file in the zipfile
00214 */
00215 
00216 extern int ZEXPORT UA_zipCloseFileInZipRaw OF((zipFile file,
00217                                             uLong uncompressed_size,
00218                                             uLong crc32));
00219 /*
00220   Close the current file in the zipfile, for fiel opened with
00221     parameter raw=1 in UA_zipOpenNewFileInZip2
00222   uncompressed_size and crc32 are value for the uncompressed size
00223 */
00224 
00225 extern int ZEXPORT UA_zipClose OF((zipFile file,
00226                 const char* global_comment));
00227 /*
00228   Close the zipfile
00229 */
00230 
00231 #ifdef __cplusplus
00232 }
00233 #endif
00234 
00235 #endif /* _zip_H */
 All Classes Functions Variables Properties