]> git.lizzy.rs Git - zlib.git/blobdiff - contrib/minizip/zip.h
zlib 1.2.0.5
[zlib.git] / contrib / minizip / zip.h
index d863e1aca5691ad44ea14d50a791fa47efdd986e..5a75fc6f5196cc1ad536c7f224a5a449d197cbdf 100644 (file)
-/* zip.h -- IO for compress .zip files using zlib\r
-   Version 0.22, May 19th, 2003\r
-\r
-   Copyright (C) 1998-2003 Gilles Vollant\r
-\r
-   This unzip package allow creates .ZIP file, compatible with PKZip 2.04g\r
-     WinZip, InfoZip tools and compatible.\r
-   Encryption and multi volume ZipFile (span) are not supported.\r
-   Old compressions used by old PKZip 1.x are not supported\r
-\r
-  For uncompress .zip file, look at unzip.h\r
-\r
-\r
-   I WAIT FEEDBACK at mail info@winimage.com\r
-   Visit also http://www.winimage.com/zLibDll/unzip.html for evolution\r
-\r
-   Condition of use and distribution are the same than zlib :\r
-\r
-  This software is provided 'as-is', without any express or implied\r
-  warranty.  In no event will the authors be held liable for any damages\r
-  arising from the use of this software.\r
-\r
-  Permission is granted to anyone to use this software for any purpose,\r
-  including commercial applications, and to alter it and redistribute it\r
-  freely, subject to the following restrictions:\r
-\r
-  1. The origin of this software must not be misrepresented; you must not\r
-     claim that you wrote the original software. If you use this software\r
-     in a product, an acknowledgment in the product documentation would be\r
-     appreciated but is not required.\r
-  2. Altered source versions must be plainly marked as such, and must not be\r
-     misrepresented as being the original software.\r
-  3. This notice may not be removed or altered from any source distribution.\r
-\r
-\r
-*/\r
-\r
-/* for more info about .ZIP format, see\r
-      http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip\r
-      http://www.info-zip.org/pub/infozip/doc/\r
-   PkWare has also a specification at :\r
-      ftp://ftp.pkware.com/probdesc.zip\r
-*/\r
-\r
-#ifndef _zip_H\r
-#define _zip_H\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-#ifndef _ZLIB_H\r
-#include "zlib.h"\r
-#endif\r
-\r
-#ifndef _ZLIBIOAPI_H\r
-#include "ioapi.h"\r
-#endif\r
-\r
-#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)\r
-/* like the STRICT of WIN32, we define a pointer that cannot be converted\r
-    from (void*) without cast */\r
-typedef struct TagzipFile__ { int unused; } zipFile__;\r
-typedef zipFile__ *zipFile;\r
-#else\r
-typedef voidp zipFile;\r
-#endif\r
-\r
-#define ZIP_OK                          (0)\r
-#define ZIP_EOF                         (0)\r
-#define ZIP_ERRNO                       (Z_ERRNO)\r
-#define ZIP_PARAMERROR                  (-102)\r
-#define ZIP_BADZIPFILE                  (-103)\r
-#define ZIP_INTERNALERROR               (-104)\r
-\r
-#ifndef DEF_MEM_LEVEL\r
-#  if MAX_MEM_LEVEL >= 8\r
-#    define DEF_MEM_LEVEL 8\r
-#  else\r
-#    define DEF_MEM_LEVEL  MAX_MEM_LEVEL\r
-#  endif\r
-#endif\r
-/* default memLevel */\r
-\r
-/* tm_zip contain date/time info */\r
-typedef struct tm_zip_s\r
-{\r
-    uInt tm_sec;            /* seconds after the minute - [0,59] */\r
-    uInt tm_min;            /* minutes after the hour - [0,59] */\r
-    uInt tm_hour;           /* hours since midnight - [0,23] */\r
-    uInt tm_mday;           /* day of the month - [1,31] */\r
-    uInt tm_mon;            /* months since January - [0,11] */\r
-    uInt tm_year;           /* years - [1980..2044] */\r
-} tm_zip;\r
-\r
-typedef struct\r
-{\r
-    tm_zip      tmz_date;       /* date in understandable format           */\r
-    uLong       dosDate;       /* if dos_date == 0, tmu_date is used      */\r
-/*    uLong       flag;        */   /* general purpose bit flag        2 bytes */\r
-\r
-    uLong       internal_fa;    /* internal file attributes        2 bytes */\r
-    uLong       external_fa;    /* external file attributes        4 bytes */\r
-} zip_fileinfo;\r
-\r
-typedef const char* zipcharpc;\r
-\r
-\r
-#define APPEND_STATUS_CREATE        (0)\r
-#define APPEND_STATUS_CREATEAFTER   (1)\r
-#define APPEND_STATUS_ADDINZIP      (2)\r
-\r
-extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));\r
-/*\r
-  Create a zipfile.\r
-     pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on\r
-       an Unix computer "zlib/zlib113.zip".\r
-     if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip\r
-       will be created at the end of the file.\r
-         (useful if the file contain a self extractor code)\r
-     if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will\r
-       add files in existing zip (be sure you don't add file that doesn't exist)\r
-     If the zipfile cannot be opened, the return value is NULL.\r
-     Else, the return value is a zipFile Handle, usable with other function\r
-       of this zip package.\r
-*/\r
-\r
-/* Note : there is no delete function into a zipfile.\r
-   If you want delete file into a zipfile, you must open a zipfile, and create another\r
-   Of couse, you can use RAW reading and writing to copy the file you did not want delte\r
-*/\r
-\r
-extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,\r
-                                   int append,\r
-                                   zipcharpc* globalcomment,\r
-                                   zlib_filefunc_def* pzlib_filefunc_def));\r
-\r
-extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,\r
-                       const char* filename,\r
-                       const zip_fileinfo* zipfi,\r
-                       const void* extrafield_local,\r
-                       uInt size_extrafield_local,\r
-                       const void* extrafield_global,\r
-                       uInt size_extrafield_global,\r
-                       const char* comment,\r
-                       int method,\r
-                       int level));\r
-/*\r
-  Open a file in the ZIP for writing.\r
-  filename : the filename in zip (if NULL, '-' without quote will be used\r
-  *zipfi contain supplemental information\r
-  if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local\r
-    contains the extrafield data the the local header\r
-  if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global\r
-    contains the extrafield data the the local header\r
-  if comment != NULL, comment contain the comment string\r
-  method contain the compression method (0 for store, Z_DEFLATED for deflate)\r
-  level contain the level of compression (can be Z_DEFAULT_COMPRESSION)\r
-*/\r
-\r
-\r
-extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,\r
-                                            const char* filename,\r
-                                            const zip_fileinfo* zipfi,\r
-                                            const void* extrafield_local,\r
-                                            uInt size_extrafield_local,\r
-                                            const void* extrafield_global,\r
-                                            uInt size_extrafield_global,\r
-                                            const char* comment,\r
-                                            int method,\r
-                                            int level,\r
-                                            int raw));\r
-\r
-/*\r
-  Same than zipOpenNewFileInZip, except if raw=1, we write raw file\r
- */\r
-\r
-extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,\r
-                                            const char* filename,\r
-                                            const zip_fileinfo* zipfi,\r
-                                            const void* extrafield_local,\r
-                                            uInt size_extrafield_local,\r
-                                            const void* extrafield_global,\r
-                                            uInt size_extrafield_global,\r
-                                            const char* comment,\r
-                                            int method,\r
-                                            int level,\r
-                                            int raw,\r
-                                            int windowBits,\r
-                                            int memLevel,\r
-                                            int strategy,\r
-                                            const char* password,\r
-                                            uLong crcForCtypting));\r
-\r
-/*\r
-  Same than zipOpenNewFileInZip2, except\r
-    windowBits,memLevel,,strategy : see parameter strategy in deflateInit2\r
-    password : crypting password (NULL for no crypting)\r
-    crcForCtypting : crc of file to compress (needed for crypting)\r
- */\r
-\r
-\r
-extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,\r
-                       const void* buf,\r
-                       unsigned len));\r
-/*\r
-  Write data in the zipfile\r
-*/\r
-\r
-extern int ZEXPORT zipCloseFileInZip OF((zipFile file));\r
-/*\r
-  Close the current file in the zipfile\r
-*/\r
-\r
-\r
-extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,\r
-                                            uLong uncompressed_size,\r
-                                            uLong crc32));\r
-/*\r
-  Close the current file in the zipfile, for fiel opened with\r
-    parameter raw=1 in zipOpenNewFileInZip2\r
-  uncompressed_size and crc32 are value for the uncompressed size\r
-*/\r
-\r
-extern int ZEXPORT zipClose OF((zipFile file,\r
-                const char* global_comment));\r
-/*\r
-  Close the zipfile\r
-*/\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* _zip_H */\r
+/* zip.h -- IO for compress .zip files using zlib
+   Version 0.22, May 19th, 2003
+
+   Copyright (C) 1998-2003 Gilles Vollant
+
+   This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
+     WinZip, InfoZip tools and compatible.
+   Encryption and multi volume ZipFile (span) are not supported.
+   Old compressions used by old PKZip 1.x are not supported
+
+  For uncompress .zip file, look at unzip.h
+
+
+   I WAIT FEEDBACK at mail info@winimage.com
+   Visit also http://www.winimage.com/zLibDll/unzip.html for evolution
+
+   Condition of use and distribution are the same than zlib :
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+
+*/
+
+/* for more info about .ZIP format, see
+      http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
+      http://www.info-zip.org/pub/infozip/doc/
+   PkWare has also a specification at :
+      ftp://ftp.pkware.com/probdesc.zip
+*/
+
+#ifndef _zip_H
+#define _zip_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _ZLIB_H
+#include "zlib.h"
+#endif
+
+#ifndef _ZLIBIOAPI_H
+#include "ioapi.h"
+#endif
+
+#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
+/* like the STRICT of WIN32, we define a pointer that cannot be converted
+    from (void*) without cast */
+typedef struct TagzipFile__ { int unused; } zipFile__;
+typedef zipFile__ *zipFile;
+#else
+typedef voidp zipFile;
+#endif
+
+#define ZIP_OK                          (0)
+#define ZIP_EOF                         (0)
+#define ZIP_ERRNO                       (Z_ERRNO)
+#define ZIP_PARAMERROR                  (-102)
+#define ZIP_BADZIPFILE                  (-103)
+#define ZIP_INTERNALERROR               (-104)
+
+#ifndef DEF_MEM_LEVEL
+#  if MAX_MEM_LEVEL >= 8
+#    define DEF_MEM_LEVEL 8
+#  else
+#    define DEF_MEM_LEVEL  MAX_MEM_LEVEL
+#  endif
+#endif
+/* default memLevel */
+
+/* tm_zip contain date/time info */
+typedef struct tm_zip_s
+{
+    uInt tm_sec;            /* seconds after the minute - [0,59] */
+    uInt tm_min;            /* minutes after the hour - [0,59] */
+    uInt tm_hour;           /* hours since midnight - [0,23] */
+    uInt tm_mday;           /* day of the month - [1,31] */
+    uInt tm_mon;            /* months since January - [0,11] */
+    uInt tm_year;           /* years - [1980..2044] */
+} tm_zip;
+
+typedef struct
+{
+    tm_zip      tmz_date;       /* date in understandable format           */
+    uLong       dosDate;       /* if dos_date == 0, tmu_date is used      */
+/*    uLong       flag;        */   /* general purpose bit flag        2 bytes */
+
+    uLong       internal_fa;    /* internal file attributes        2 bytes */
+    uLong       external_fa;    /* external file attributes        4 bytes */
+} zip_fileinfo;
+
+typedef const char* zipcharpc;
+
+
+#define APPEND_STATUS_CREATE        (0)
+#define APPEND_STATUS_CREATEAFTER   (1)
+#define APPEND_STATUS_ADDINZIP      (2)
+
+extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
+/*
+  Create a zipfile.
+     pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
+       an Unix computer "zlib/zlib113.zip".
+     if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
+       will be created at the end of the file.
+         (useful if the file contain a self extractor code)
+     if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
+       add files in existing zip (be sure you don't add file that doesn't exist)
+     If the zipfile cannot be opened, the return value is NULL.
+     Else, the return value is a zipFile Handle, usable with other function
+       of this zip package.
+*/
+
+/* Note : there is no delete function into a zipfile.
+   If you want delete file into a zipfile, you must open a zipfile, and create another
+   Of couse, you can use RAW reading and writing to copy the file you did not want delte
+*/
+
+extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
+                                   int append,
+                                   zipcharpc* globalcomment,
+                                   zlib_filefunc_def* pzlib_filefunc_def));
+
+extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
+                       const char* filename,
+                       const zip_fileinfo* zipfi,
+                       const void* extrafield_local,
+                       uInt size_extrafield_local,
+                       const void* extrafield_global,
+                       uInt size_extrafield_global,
+                       const char* comment,
+                       int method,
+                       int level));
+/*
+  Open a file in the ZIP for writing.
+  filename : the filename in zip (if NULL, '-' without quote will be used
+  *zipfi contain supplemental information
+  if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
+    contains the extrafield data the the local header
+  if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
+    contains the extrafield data the the local header
+  if comment != NULL, comment contain the comment string
+  method contain the compression method (0 for store, Z_DEFLATED for deflate)
+  level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
+*/
+
+
+extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
+                                            const char* filename,
+                                            const zip_fileinfo* zipfi,
+                                            const void* extrafield_local,
+                                            uInt size_extrafield_local,
+                                            const void* extrafield_global,
+                                            uInt size_extrafield_global,
+                                            const char* comment,
+                                            int method,
+                                            int level,
+                                            int raw));
+
+/*
+  Same than zipOpenNewFileInZip, except if raw=1, we write raw file
+ */
+
+extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
+                                            const char* filename,
+                                            const zip_fileinfo* zipfi,
+                                            const void* extrafield_local,
+                                            uInt size_extrafield_local,
+                                            const void* extrafield_global,
+                                            uInt size_extrafield_global,
+                                            const char* comment,
+                                            int method,
+                                            int level,
+                                            int raw,
+                                            int windowBits,
+                                            int memLevel,
+                                            int strategy,
+                                            const char* password,
+                                            uLong crcForCtypting));
+
+/*
+  Same than zipOpenNewFileInZip2, except
+    windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
+    password : crypting password (NULL for no crypting)
+    crcForCtypting : crc of file to compress (needed for crypting)
+ */
+
+
+extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
+                       const void* buf,
+                       unsigned len));
+/*
+  Write data in the zipfile
+*/
+
+extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
+/*
+  Close the current file in the zipfile
+*/
+
+
+extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
+                                            uLong uncompressed_size,
+                                            uLong crc32));
+/*
+  Close the current file in the zipfile, for fiel opened with
+    parameter raw=1 in zipOpenNewFileInZip2
+  uncompressed_size and crc32 are value for the uncompressed size
+*/
+
+extern int ZEXPORT zipClose OF((zipFile file,
+                const char* global_comment));
+/*
+  Close the zipfile
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _zip_H */