zip.h

Go to the documentation of this file.
00001 /* zip.h -- IO for compress .zip files using zlib 
00002    Version 0.15 alpha, Mar 19th, 1998,
00003 
00004    Copyright (C) 1998 Gilles Vollant
00005 
00006    Modified by Ryan Nunn. Nov 9th 2001
00007 
00008    This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
00009      WinZip, InfoZip tools and compatible.
00010    Encryption and multi volume ZipFile (span) are not supported.
00011    Old compressions used by old PKZip 1.x are not supported
00012 
00013   For uncompress .zip file, look at unzip.h
00014 
00015    THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE
00016    CAN CHANGE IN FUTURE VERSION !!
00017    I WAIT FEEDBACK at mail info@winimage.com
00018    Visit also http://www.winimage.com/zLibDll/unzip.html for evolution
00019 
00020    Condition of use and distribution are the same than zlib :
00021 
00022   This software is provided 'as-is', without any express or implied
00023   warranty.  In no event will the authors be held liable for any damages
00024   arising from the use of this software.
00025 
00026   Permission is granted to anyone to use this software for any purpose,
00027   including commercial applications, and to alter it and redistribute it
00028   freely, subject to the following restrictions:
00029 
00030   1. The origin of this software must not be misrepresented; you must not
00031      claim that you wrote the original software. If you use this software
00032      in a product, an acknowledgment in the product documentation would be
00033      appreciated but is not required.
00034   2. Altered source versions must be plainly marked as such, and must not be
00035      misrepresented as being the original software.
00036   3. This notice may not be removed or altered from any source distribution.
00037 
00038 
00039 */
00040 
00041 /* for more info about .ZIP format, see 
00042       ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
00043    PkWare has also a specification at :
00044       ftp://ftp.pkware.com/probdesc.zip
00045 */
00046 
00047 #ifndef _zip_H
00048 #define _zip_H
00049 
00050 /* Added by Ryan Nunn */
00051 #ifdef HAVE_ZIP_SUPPORT
00052 
00053 #ifdef __cplusplus
00054 extern "C" {
00055 #endif
00056 
00057 #ifndef _ZLIB_H
00058 #include "zlib.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_ERRNO               (Z_ERRNO)
00072 #define ZIP_PARAMERROR                  (-102)
00073 #define ZIP_INTERNALERROR               (-104)
00074 
00075 /* tm_zip contain date/time info */
00076 typedef struct tm_zip_s 
00077 {
00078   uInt tm_sec;            /* seconds after the minute - [0,59] */
00079   uInt tm_min;            /* minutes after the hour - [0,59] */
00080   uInt tm_hour;           /* hours since midnight - [0,23] */
00081   uInt tm_mday;           /* day of the month - [1,31] */
00082   uInt tm_mon;            /* months since January - [0,11] */
00083   uInt tm_year;           /* years - [1980..2044] */
00084 } tm_zip;
00085 
00086 typedef struct
00087 {
00088   tm_zip      tmz_date;       /* date in understandable format           */
00089     uLong       dosDate;       /* if dos_date == 0, tmu_date is used      */
00090 /*    uLong       flag;        */   /* general purpose bit flag        2 bytes */
00091 
00092     uLong       internal_fa;    /* internal file attributes        2 bytes */
00093     uLong       external_fa;    /* external file attributes        4 bytes */
00094 } zip_fileinfo;
00095 
00096 extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
00097 /*
00098   Create a zipfile.
00099    pathname contain on Windows NT a filename like "c:\\zlib\\zlib111.zip" or on
00100      an Unix computer "zlib/zlib111.zip".
00101    if the file pathname exist and append=1, the zip will be created at the end
00102      of the file. (useful if the file contain a self extractor code)
00103    If the zipfile cannot be opened, the return value is NULL.
00104      Else, the return value is a zipFile Handle, usable with other function
00105      of this zip package.
00106 
00107 
00108 */
00109 
00110 extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
00111              const char* filename,
00112              const zip_fileinfo* zipfi,
00113              const void* extrafield_local,
00114              uInt size_extrafield_local,
00115              const void* extrafield_global,
00116              uInt size_extrafield_global,
00117              const char* comment,
00118              int method,
00119              int level));
00120 /*
00121   Open a file in the ZIP for writing.
00122   filename : the filename in zip (if NULL, '-' without quote will be used
00123   *zipfi contain supplemental information
00124   if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
00125     contains the extrafield data the the local header
00126   if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
00127     contains the extrafield data the the local header
00128   if comment != NULL, comment contain the comment string
00129   method contain the compression method (0 for store, Z_DEFLATED for deflate)
00130   level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
00131 */
00132 
00133 extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
00134              const voidp buf,
00135              unsigned len));
00136 /*
00137   Write data in the zipfile
00138 */
00139 
00140 extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
00141 /*
00142   Close the current file in the zipfile
00143 */
00144 
00145 extern int ZEXPORT zipClose OF((zipFile file,
00146         const char* global_comment));
00147 /*
00148   Close the zipfile
00149 */
00150 
00151 #ifdef __cplusplus
00152 }
00153 #endif
00154 
00155 /* Added by Ryan Nunn */
00156 #endif /*HAVE_ZIP_SUPPORT*/
00157 
00158 #endif /* _zip_H */

Generated on Mon Jul 9 14:42:45 2007 for ExultEngine by  doxygen 1.5.1