diff options
Diffstat (limited to 'Build/source')
113 files changed, 4535 insertions, 3128 deletions
diff --git a/Build/source/libs/README b/Build/source/libs/README index f40a56be3b8..41ed82d98f2 100644 --- a/Build/source/libs/README +++ b/Build/source/libs/README @@ -66,5 +66,5 @@ xpdf 4.00 - checked 13aug17 zlib 1.2.11 - checked 15jan17 http://www.zlib.net/ - used by many -zziplib 0.13.66 - checked 20jun17 +zziplib 0.13.68 - checked 06feb18 http://zziplib.sourceforge.net/ - used by luatex diff --git a/Build/source/libs/zziplib/ChangeLog b/Build/source/libs/zziplib/ChangeLog index 9da2623a86a..764d6ae6676 100644 --- a/Build/source/libs/zziplib/ChangeLog +++ b/Build/source/libs/zziplib/ChangeLog @@ -1,3 +1,8 @@ +2018-02-06 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * Import zziplib 0.13.68. + version.ac: Adapted. + 2017-06-20 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * Import zziplib 0.13.66. diff --git a/Build/source/libs/zziplib/README b/Build/source/libs/zziplib/README index 3f9f5f84261..e53e159b942 100644 --- a/Build/source/libs/zziplib/README +++ b/Build/source/libs/zziplib/README @@ -1,4 +1,4 @@ - Building zziplib-0.13.66 as part of the TL tree + Building zziplib-0.13.68 as part of the TL tree =============================================== This directory libs/zziplib/ uses a proxy Makefile.am to build the zziplib @@ -14,4 +14,4 @@ copied to libs/zziplib/configure.ac. ============================= 2010-01-30 Peter Breitenlohner <peb@mppmu.mpg.de> -2017-??-?? Akira Kakuto <kakuto@fuk.kindai.ac.jp> +2018-02-06 Akira Kakuto <kakuto@fuk.kindai.ac.jp> diff --git a/Build/source/libs/zziplib/TLpatches/ChangeLog b/Build/source/libs/zziplib/TLpatches/ChangeLog index 26fb88d57a4..0412cc0bfae 100644 --- a/Build/source/libs/zziplib/TLpatches/ChangeLog +++ b/Build/source/libs/zziplib/TLpatches/ChangeLog @@ -1,3 +1,8 @@ +2018-02-06 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * Import zziplib-0.13.68. + * patch-01-binary, patch-02-bugfix, patch-03-w64-ptr: Adapted. + 2017-06-20 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * Import zziplib-0.13.66. diff --git a/Build/source/libs/zziplib/TLpatches/TL-Changes b/Build/source/libs/zziplib/TLpatches/TL-Changes index 0fd56e3ab7b..b0b5549a54a 100644 --- a/Build/source/libs/zziplib/TLpatches/TL-Changes +++ b/Build/source/libs/zziplib/TLpatches/TL-Changes @@ -1,4 +1,4 @@ -Changes applied to the zziplib-0.13.66/ tree as obtained from: +Changes applied to the zziplib-0.13.68/ tree as obtained from: http://zziplib.sourceforge.net/ Copied: @@ -6,13 +6,10 @@ Copied: m4/ac_sys_largefile_sensitive.m4 -> ../m4/ Removed: - .cdtproject - .gitignore - .pydevproject aclocal.m4 - msvc/ uses/ zzip/_msvc.h + zzip/_config.h Converted Dos/Win line ends to native: docs/README.MSVC6 diff --git a/Build/source/libs/zziplib/TLpatches/patch-01-binary b/Build/source/libs/zziplib/TLpatches/patch-01-binary index 6b5f4f77f76..a5779974392 100644 --- a/Build/source/libs/zziplib/TLpatches/patch-01-binary +++ b/Build/source/libs/zziplib/TLpatches/patch-01-binary @@ -1,7 +1,7 @@ -diff -ur zziplib-0.13.66.orig/bins/unzip-mem.c zziplib-0.13.66/bins/unzip-mem.c ---- zziplib-0.13.66.orig/bins/unzip-mem.c Mon Apr 24 08:46:28 2017 -+++ zziplib-0.13.66/bins/unzip-mem.c Tue Jun 20 09:49:08 2017 -@@ -100,7 +100,7 @@ +diff -ur zziplib-0.13.68.orig/bins/unzip-mem.c zziplib-0.13.68/bins/unzip-mem.c +--- zziplib-0.13.68.orig/bins/unzip-mem.c Tue Feb 06 05:00:56 2018 ++++ zziplib-0.13.68/bins/unzip-mem.c Tue Feb 06 08:07:16 2018 +@@ -96,7 +96,7 @@ static void zzip_mem_entry_make(ZZIP_MEM_DISK* disk, ZZIP_MEM_ENTRY* entry) { @@ -10,32 +10,10 @@ diff -ur zziplib-0.13.66.orig/bins/unzip-mem.c zziplib-0.13.66/bins/unzip-mem.c if (file) { zzip_mem_entry_pipe (disk, entry, file); fclose (file); } perror (entry->zz_name); if (status < EXIT_WARNINGS) status = EXIT_WARNINGS; -diff -ur zziplib-0.13.66.orig/bins/unzzipcat-big.c zziplib-0.13.66/bins/unzzipcat-big.c ---- zziplib-0.13.66.orig/bins/unzzipcat-big.c Mon Apr 24 08:46:28 2017 -+++ zziplib-0.13.66/bins/unzzipcat-big.c Thu Jun 22 07:38:57 2017 -@@ -62,6 +62,21 @@ - } - } - -+#if !defined(ZZIP_HAVE_STRNDUP) -+static char * -+strndup(char *p, size_t maxlen) -+{ -+ char *r; -+ if (!p) -+ return NULL; -+ r = malloc(maxlen + 1); -+ if (!r) -+ return NULL; -+ strncpy(r, p, maxlen); -+ r[maxlen] = '\0'; -+ return r; -+} -+#endif - - static FILE* create_fopen(char* name, char* mode, int subdirs) - { -@@ -83,7 +98,7 @@ +diff -ur zziplib-0.13.68.orig/bins/unzzipcat-big.c zziplib-0.13.68/bins/unzzipcat-big.c +--- zziplib-0.13.68.orig/bins/unzzipcat-big.c Tue Feb 06 05:00:56 2018 ++++ zziplib-0.13.68/bins/unzzipcat-big.c Tue Feb 06 09:58:56 2018 +@@ -89,7 +89,7 @@ int argn; FILE* disk; @@ -43,73 +21,50 @@ diff -ur zziplib-0.13.66.orig/bins/unzzipcat-big.c zziplib-0.13.66/bins/unzzipca + disk = fopen (argv[1], "rb"); if (! disk) { perror(argv[1]); - return -1; -@@ -96,7 +111,7 @@ - { - char* name = zzip_entry_strdup_name (entry); - FILE* out = stdout; + return exitcode(errno); +@@ -106,7 +106,7 @@ + done = EXIT_WARNINGS; + continue; + } - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); - unzzip_cat_file (disk, name, out); - if (extract) fclose(out); - free (name); -@@ -125,7 +140,7 @@ - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + if (! out) { + if (errno != EISDIR) done = EXIT_ERRORS; + continue; +@@ -139,7 +139,7 @@ + FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) { FILE* out = stdout; - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); - unzzip_cat_file (disk, name, out); - if (extract) fclose(out); - break; /* match loop */ -diff -ur zziplib-0.13.66.orig/bins/unzzipcat-mem.c zziplib-0.13.66/bins/unzzipcat-mem.c ---- zziplib-0.13.66.orig/bins/unzzipcat-mem.c Mon Apr 24 08:46:28 2017 -+++ zziplib-0.13.66/bins/unzzipcat-mem.c Thu Jun 22 07:39:23 2017 -@@ -57,6 +57,22 @@ - } - } - -+#if !defined(ZZIP_HAVE_STRNDUP) -+static char * -+strndup(char *p, size_t maxlen) -+{ -+ char *r; -+ if (!p) -+ return NULL; -+ r = malloc(maxlen + 1); -+ if (!r) -+ return NULL; -+ strncpy(r, p, maxlen); -+ r[maxlen] = '\0'; -+ return r; -+} -+#endif -+ - static FILE* create_fopen(char* name, char* mode, int subdirs) - { - if (subdirs) -@@ -97,7 +113,7 @@ + if (! out) { + if (errno != EISDIR) done = EXIT_ERRORS; + continue; +diff -ur zziplib-0.13.68.orig/bins/unzzipcat-mem.c zziplib-0.13.68/bins/unzzipcat-mem.c +--- zziplib-0.13.68.orig/bins/unzzipcat-mem.c Tue Feb 06 05:00:56 2018 ++++ zziplib-0.13.68/bins/unzzipcat-mem.c Tue Feb 06 09:59:22 2018 +@@ -114,7 +114,7 @@ { char* name = zzip_mem_entry_to_name (entry); FILE* out = stdout; - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); - unzzip_mem_disk_cat_file (disk, name, out); - if (extract) fclose(out); - } -@@ -125,7 +141,7 @@ - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + if (! out) { + if (errno != EISDIR) done = EXIT_ERRORS; + continue; +@@ -146,7 +146,7 @@ + FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) { FILE* out = stdout; - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); - unzzip_mem_disk_cat_file (disk, name, out); - if (extract) fclose(out); - break; /* match loop */ -diff -ur zziplib-0.13.66.orig/bins/unzzipcat-mix.c zziplib-0.13.66/bins/unzzipcat-mix.c ---- zziplib-0.13.66.orig/bins/unzzipcat-mix.c Mon Apr 24 08:46:28 2017 -+++ zziplib-0.13.66/bins/unzzipcat-mix.c Thu Jun 22 07:39:54 2017 -@@ -30,7 +30,7 @@ + if (! out) { + if (errno != EISDIR) done = EXIT_ERRORS; + continue; +diff -ur zziplib-0.13.68.orig/bins/unzzipcat-mix.c zziplib-0.13.68/bins/unzzipcat-mix.c +--- zziplib-0.13.68.orig/bins/unzzipcat-mix.c Tue Feb 06 05:00:56 2018 ++++ zziplib-0.13.68/bins/unzzipcat-mix.c Tue Feb 06 09:59:45 2018 +@@ -56,7 +56,7 @@ static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out) { @@ -118,94 +73,48 @@ diff -ur zziplib-0.13.66.orig/bins/unzzipcat-mix.c zziplib-0.13.66/bins/unzzipca if (file) { char buffer[1024]; int len; -@@ -43,6 +43,22 @@ - } - } - -+#if !defined(ZZIP_HAVE_STRNDUP) -+static char * -+strndup(char *p, size_t maxlen) -+{ -+ char *r; -+ if (!p) -+ return NULL; -+ r = malloc(maxlen + 1); -+ if (!r) -+ return NULL; -+ strncpy(r, p, maxlen); -+ r[maxlen] = '\0'; -+ return r; -+} -+#endif -+ - static FILE* create_fopen(char* name, char* mode, int subdirs) - { - if (subdirs) -@@ -82,7 +98,7 @@ +@@ -124,7 +124,7 @@ { char* name = entry->d_name; FILE* out = stdout; - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); - unzzip_cat_file (disk, name, out); - if (extract) fclose(out); - } -@@ -108,7 +124,7 @@ + if (! out) { + if (errno != EISDIR) done = EXIT_ERRORS; + continue; +@@ -155,7 +155,7 @@ memcpy(mix_name, zip_name, zip_name_len); mix_name[zip_name_len] = '/'; strcpy(mix_name + zip_name_len + 1, name); - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); - fprintf(stderr, "%s %s -> %s\n", zip_name, name, mix_name); - /* 'test1.zip' 'README' -> 'test1/README' */ - unzzip_cat_file (disk, mix_name, out); -diff -ur zziplib-0.13.66.orig/bins/unzzipcat-zip.c zziplib-0.13.66/bins/unzzipcat-zip.c ---- zziplib-0.13.66.orig/bins/unzzipcat-zip.c Mon Apr 24 08:46:28 2017 -+++ zziplib-0.13.66/bins/unzzipcat-zip.c Thu Jun 22 07:40:29 2017 -@@ -43,6 +43,22 @@ - } - } - -+#if !defined(ZZIP_HAVE_STRNDUP) -+static char * -+strndup(char *p, size_t maxlen) -+{ -+ char *r; -+ if (!p) -+ return NULL; -+ r = malloc(maxlen + 1); -+ if (!r) -+ return NULL; -+ strncpy(r, p, maxlen); -+ r[maxlen] = '\0'; -+ return r; -+} -+#endif -+ - static FILE* create_fopen(char* name, char* mode, int subdirs) - { - if (subdirs) -@@ -83,7 +99,7 @@ + if (! out) { + if (errno != EISDIR) done = EXIT_ERRORS; + continue; +diff -ur zziplib-0.13.68.orig/bins/unzzipcat-zip.c zziplib-0.13.68/bins/unzzipcat-zip.c +--- zziplib-0.13.68.orig/bins/unzzipcat-zip.c Tue Feb 06 05:00:56 2018 ++++ zziplib-0.13.68/bins/unzzipcat-zip.c Tue Feb 06 10:00:14 2018 +@@ -124,7 +124,7 @@ { char* name = entry.d_name; FILE* out = stdout; - if (extract) out = create_fopen(name, "w", 1); + if (extract) out = create_fopen(name, "wb", 1); - unzzip_cat_file (disk, name, out); - if (extract) fclose(out); - } -@@ -100,7 +116,7 @@ - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + if (! out) { + DBG3("fopen' %s : %s", name, strerror(errno)); + if (errno != EISDIR) done = EXIT_ERRORS; +@@ -146,7 +146,7 @@ + FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) { - FILE* out = stdout; -- if (extract) out = create_fopen(name, "w", 1); -+ if (extract) out = create_fopen(name, "wb", 1); - unzzip_cat_file (disk, name, out); - if (extract) fclose(out); - break; /* match loop */ -diff -ur zziplib-0.13.66.orig/bins/unzzipdir-big.c zziplib-0.13.66/bins/unzzipdir-big.c ---- zziplib-0.13.66.orig/bins/unzzipdir-big.c Mon Apr 24 08:46:28 2017 -+++ zziplib-0.13.66/bins/unzzipdir-big.c Thu Jun 22 07:32:13 2017 + FILE* out = stdout; +- if (extract) out = create_fopen(name, "w", 1); ++ if (extract) out = create_fopen(name, "wb", 1); + if (! out) { + DBG3("fopen. %s : %s", name, strerror(errno)); + if (errno != EISDIR) done = EXIT_ERRORS; +diff -ur zziplib-0.13.68.orig/bins/unzzipdir-big.c zziplib-0.13.68/bins/unzzipdir-big.c +--- zziplib-0.13.68.orig/bins/unzzipdir-big.c Tue Feb 06 05:00:56 2018 ++++ zziplib-0.13.68/bins/unzzipdir-big.c Tue Feb 06 08:20:44 2018 @@ -35,7 +35,7 @@ int argn; FILE* disk; @@ -214,16 +123,4 @@ diff -ur zziplib-0.13.66.orig/bins/unzzipdir-big.c zziplib-0.13.66/bins/unzzipdi + disk = fopen (argv[1], "rb"); if (! disk) { perror(argv[1]); - return -1; -diff -ur zziplib-0.13.66.orig/bins/unzzipshow.c zziplib-0.13.66/bins/unzzipshow.c ---- zziplib-0.13.66.orig/bins/unzzipshow.c Mon Apr 24 08:46:28 2017 -+++ zziplib-0.13.66/bins/unzzipshow.c Thu Jun 22 07:32:44 2017 -@@ -68,7 +68,7 @@ - return 0; - } - -- disk = fopen (argv[1], "r"); -+ disk = fopen (argv[1], "rb"); - if (! disk) { - perror(argv[1]); - return -1; + return exitcode(errno); diff --git a/Build/source/libs/zziplib/TLpatches/patch-02-bugfix b/Build/source/libs/zziplib/TLpatches/patch-02-bugfix index 35830145acf..a9bbbf3169e 100644 --- a/Build/source/libs/zziplib/TLpatches/patch-02-bugfix +++ b/Build/source/libs/zziplib/TLpatches/patch-02-bugfix @@ -1,6 +1,24 @@ -diff -ur zziplib-0.13.66.orig/zzip/__mmap.h zziplib-0.13.66/zzip/__mmap.h ---- zziplib-0.13.66.orig/zzip/__mmap.h Mon Apr 24 08:46:28 2017 -+++ zziplib-0.13.66/zzip/__mmap.h Wed May 24 21:14:48 2017 +diff -ur zziplib-0.13.68.orig/zzip/__fnmatch.h zziplib-0.13.68/zzip/__fnmatch.h +--- zziplib-0.13.68.orig/zzip/__fnmatch.h Tue Feb 06 05:00:56 2018 ++++ zziplib-0.13.68/zzip/__fnmatch.h Tue Feb 06 10:35:33 2018 +@@ -20,13 +20,7 @@ + #else + # define _zzip_FNM_CASEFOLD 0 + /* if your system does not have fnmatch, we fall back to strcmp: */ +-static int _zzip_fnmatch(char* pattern, char* string, int flags) +-{ +-# ifdef DBG2 +- DBG1("<zzip:mmapped:strcmp>"); +-# endif +- return strcmp (pattern, string); +-} ++#define _zzip_fnmatch(x,y,z) strcmp ((x),(y)) + #endif + + #endif +diff -ur zziplib-0.13.68.orig/zzip/__mmap.h zziplib-0.13.68/zzip/__mmap.h +--- zziplib-0.13.68.orig/zzip/__mmap.h Tue Feb 06 05:00:56 2018 ++++ zziplib-0.13.68/zzip/__mmap.h Tue Feb 06 08:37:50 2018 @@ -45,43 +45,61 @@ #define MAP_FAILED 0 #endif @@ -67,9 +85,9 @@ diff -ur zziplib-0.13.66.orig/zzip/__mmap.h zziplib-0.13.66/zzip/__mmap.h #else /* disable */ #define USE_MMAP 0 /* USE_MAP is intentional: we expect the compiler to do some "code removal" -diff -ur zziplib-0.13.66.orig/zzip/mmapped.h zziplib-0.13.66/zzip/mmapped.h ---- zziplib-0.13.66.orig/zzip/mmapped.h Mon Apr 24 08:46:28 2017 -+++ zziplib-0.13.66/zzip/mmapped.h Wed May 24 21:14:48 2017 +diff -ur zziplib-0.13.68.orig/zzip/mmapped.h zziplib-0.13.68/zzip/mmapped.h +--- zziplib-0.13.68.orig/zzip/mmapped.h Tue Feb 06 05:00:56 2018 ++++ zziplib-0.13.68/zzip/mmapped.h Tue Feb 06 08:39:00 2018 @@ -37,7 +37,11 @@ void* reserved; /* - for later extensions (might be renamed) */ void* user; /* - free for applications (use this!) */ @@ -82,9 +100,9 @@ diff -ur zziplib-0.13.66.orig/zzip/mmapped.h zziplib-0.13.66/zzip/mmapped.h long unused; /* - for later extensions (might be renamed) */ long code; /* - free for applications (use this!) */ }; -diff -ur zziplib-0.13.66.orig/zzip/plugin.c zziplib-0.13.66/zzip/plugin.c ---- zziplib-0.13.66.orig/zzip/plugin.c Mon Apr 24 08:46:28 2017 -+++ zziplib-0.13.66/zzip/plugin.c Wed May 24 21:14:48 2017 +diff -ur zziplib-0.13.68.orig/zzip/plugin.c zziplib-0.13.68/zzip/plugin.c +--- zziplib-0.13.68.orig/zzip/plugin.c Tue Feb 06 05:00:56 2018 ++++ zziplib-0.13.68/zzip/plugin.c Tue Feb 06 08:40:30 2018 @@ -38,7 +38,7 @@ return st.st_size; } @@ -94,9 +112,9 @@ diff -ur zziplib-0.13.66.orig/zzip/plugin.c zziplib-0.13.66/zzip/plugin.c &open, &close, &_zzip_read, -diff -ur zziplib-0.13.66.orig/zzip/plugin.h zziplib-0.13.66/zzip/plugin.h ---- zziplib-0.13.66.orig/zzip/plugin.h Mon Apr 24 08:46:28 2017 -+++ zziplib-0.13.66/zzip/plugin.h Wed May 24 21:14:48 2017 +diff -ur zziplib-0.13.68.orig/zzip/plugin.h zziplib-0.13.68/zzip/plugin.h +--- zziplib-0.13.68.orig/zzip/plugin.h Tue Feb 06 05:00:56 2018 ++++ zziplib-0.13.68/zzip/plugin.h Tue Feb 06 08:41:43 2018 @@ -42,7 +42,11 @@ zzip_ssize_t (*read)(int fd, void* buf, zzip_size_t len); zzip_off_t (*seeks)(int fd, zzip_off_t offset, int whence); diff --git a/Build/source/libs/zziplib/TLpatches/patch-03-w64-ptr b/Build/source/libs/zziplib/TLpatches/patch-03-w64-ptr index 3ea18dd71e4..d671c0b5eea 100644 --- a/Build/source/libs/zziplib/TLpatches/patch-03-w64-ptr +++ b/Build/source/libs/zziplib/TLpatches/patch-03-w64-ptr @@ -1,7 +1,7 @@ -diff -ur zziplib-0.13.66.orig/zzip/zip.c zziplib-0.13.66/zzip/zip.c ---- zziplib-0.13.66.orig/zzip/zip.c Mon Apr 24 08:46:28 2017 -+++ zziplib-0.13.66/zzip/zip.c Wed May 24 21:14:48 2017 -@@ -369,15 +369,19 @@ +diff -ur zziplib-0.13.68.orig/zzip/zip.c zziplib-0.13.68/zzip/zip.c +--- zziplib-0.13.68.orig/zzip/zip.c Tue Feb 06 05:00:56 2018 ++++ zziplib-0.13.68/zzip/zip.c Tue Feb 06 08:29:37 2018 +@@ -381,15 +381,19 @@ * making pointer alignments to values that can be handled as structures * is tricky. We assume here that an align(4) is sufficient even for * 64 bit machines. Note that binary operations are not usually allowed diff --git a/Build/source/libs/zziplib/configure b/Build/source/libs/zziplib/configure index 694fa96c464..5aba5f6e0d5 100755 --- a/Build/source/libs/zziplib/configure +++ b/Build/source/libs/zziplib/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for zziplib (TeX Live) 0.13.66. +# Generated by GNU Autoconf 2.69 for zziplib (TeX Live) 0.13.68. # # Report bugs to <tex-k@tug.org>. # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='zziplib (TeX Live)' PACKAGE_TARNAME='zziplib--tex-live-' -PACKAGE_VERSION='0.13.66' -PACKAGE_STRING='zziplib (TeX Live) 0.13.66' +PACKAGE_VERSION='0.13.68' +PACKAGE_STRING='zziplib (TeX Live) 0.13.68' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1295,7 +1295,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures zziplib (TeX Live) 0.13.66 to adapt to many kinds of systems. +\`configure' configures zziplib (TeX Live) 0.13.68 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1366,7 +1366,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of zziplib (TeX Live) 0.13.66:";; + short | recursive ) echo "Configuration of zziplib (TeX Live) 0.13.68:";; esac cat <<\_ACEOF @@ -1472,7 +1472,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -zziplib (TeX Live) configure 0.13.66 +zziplib (TeX Live) configure 0.13.68 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2078,7 +2078,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by zziplib (TeX Live) $as_me 0.13.66, which was +It was created by zziplib (TeX Live) $as_me 0.13.68, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4001,7 +4001,7 @@ fi # Define the identity of the package. PACKAGE='zziplib--tex-live-' - VERSION='0.13.66' + VERSION='0.13.68' cat >>confdefs.h <<_ACEOF @@ -7366,7 +7366,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by zziplib (TeX Live) $as_me 0.13.66, which was +This file was extended by zziplib (TeX Live) $as_me 0.13.68, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -7432,7 +7432,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -zziplib (TeX Live) config.status 0.13.66 +zziplib (TeX Live) config.status 0.13.68 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/zziplib/m4/ac_sys_largefile_sensitive.m4 b/Build/source/libs/zziplib/m4/ac_sys_largefile_sensitive.m4 index 235c7f9acaa..6a296df5278 100644 --- a/Build/source/libs/zziplib/m4/ac_sys_largefile_sensitive.m4 +++ b/Build/source/libs/zziplib/m4/ac_sys_largefile_sensitive.m4 @@ -8,7 +8,7 @@ dnl dnl This macro builds on top of AC_SYS_LARGEFILE to detect whether dnl special options are neede to make the code use 64bit off_t - in dnl many setups this will also make the code use 64bit off_t -dnl immediatly. +dnl immediately. dnl dnl The common use of a LARGEFILE_SENSITIVE config.h-define is to dnl rename exported functions, usually adding a 64 to the original diff --git a/Build/source/libs/zziplib/version.ac b/Build/source/libs/zziplib/version.ac index e584f359599..4c43b2704ac 100644 --- a/Build/source/libs/zziplib/version.ac +++ b/Build/source/libs/zziplib/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current zziplib version -m4_define([zziplib_version], [0.13.66]) +m4_define([zziplib_version], [0.13.68]) diff --git a/Build/source/libs/zziplib/zziplib-src/ChangeLog b/Build/source/libs/zziplib/zziplib-src/ChangeLog index bb4ec6af079..cde096b936b 100644 --- a/Build/source/libs/zziplib/zziplib-src/ChangeLog +++ b/Build/source/libs/zziplib/zziplib-src/ChangeLog @@ -1,3 +1,15 @@ +2018-02-02 guidod <guidod@gmx.de> + * fix a number of CVEs reported with special *.zip files + * the testsuite has been expanded to cover all the CVEs + * some minor doc updates referencing GitHub instead of sf.net + * release v0.13.68 + +2017-06-11 guidod <guidod@gmx.de> + * fix portability issues by introducing <zzip/__errno.h> + * fix portability issues by introducing <zzip/__mkdir.h> + * fix portability issues by introducing <zzip/__string.h> for strndup + * reuse portability header <zzip/__fnmatch.h> in bins/*.c + * release v0.13.67 2017-04-24 guidod <guidod@gmx.de> * common frontend 'unzzip.c' for example code in unzzip*-xx.c @@ -228,7 +240,7 @@ * zzip/file.c: errornous usage of currentfp before setting it to the new fp value in zzip_seek(). In the good case it would seek on the wrong file and in the bad case it goes off on sigbus/NPE. - The problem occurs only if two+ zips are accessed simultanously. + The problem occurs only if two+ zips are accessed simultaneously. (problem reported and patch kindly provided by Evgeniy Muhin) * docs/Makefile.am: fixup for newer xmlto may be to generate a subdirectory "man3" inside of our output directory "man3" @@ -435,7 +447,7 @@ * fixing some compilation problems related to zip64 support in win32 2005-12-08 - * cut acinclude.m4 into seperated aclocal macros in m4/ subdirectory + * cut acinclude.m4 into separated aclocal macros in m4/ subdirectory 2005-10-14 * testing on sourceforge compilefarm, cleaning away any compiler warnings @@ -783,7 +795,7 @@ within plugin.h for io->read() calls. That makes for a little bit of portability - it seems some platforms (dot-net f.e.) do not `typedef unsigned int size_t;`, perhaps because int is 16bit - and a 32bit or even 64bit entitity is needed. + and a 32bit or even 64bit entity is needed. * now we do not need to AC_COMPILE_CHECK_SIZEOF(size_t) anymore, perhaps even stand io-wrap is not needed anymore. Let's see. * both changes need update of zzip/conf.h for _zzip_size_t plus @@ -854,7 +866,7 @@ a backslash as well. That should be handled better, we add some alternative implementations for dirsep_strrchr and dirsep_casecmp but the default is OFF!! even on WINDOWS !! - * thereby seen another problem: we did deliberatly use strcasecmp but + * thereby seen another problem: we did deliberately use strcasecmp but this symbol is not available on all unix systems - the manual says its a BSD4.3 addition. Some other systems call it strcmpi or stricmp instead, or they do not have it at all. Here we add @@ -942,7 +954,7 @@ * fix some problems of make-doc.pl with the current project * make a standard inlude info referring to zziplib.h as well * unpack htmpages.ar on SFNET and register it on the frontpage - * dont forget to modify includes of internal headers + * don't forget to modify includes of internal headers * ... * fixed an annoying bug in make-doc.pl * include htmpages.ar into the tarball @@ -951,7 +963,7 @@ * completed new directory structure - the library is called 0.12.22 as to match 0.10.72, it's the same C source in its content * install-headers modified - the new structure is now compatible both - as a shared libary (binary compatible) and for the include headers + as a shared library (binary compatible) and for the include headers too - source compatible not only for function names but also for the #include lines * 0.12.23 fixes a bug in make doc: the xmlto html was never done. @@ -1096,7 +1108,7 @@ * Michael-dot-Fink-at-asamnet-dot-de did some code review while going after a specialty he wanted to do with the libs, and therefore.. * PREFERZIP did never test real file - stupid bug, inverted logic.... - * add ZIPONLY zzipmode - we have plenty of options availabe... on 32bit + * add ZIPONLY zzipmode - we have plenty of options available... on 32bit platforms however, since I want to keep with the access-bits in the lower parts. @@ -1155,7 +1167,7 @@ and two fixes * put the updated MSVC6 files into the project, again Mike Nordell * me, add new zzwrap.dsp to DIST in Makefile.am, following Mike's addition - * me, modify some typecasts to use off_t/size_t where apropriate + * me, modify some typecasts to use off_t/size_t where appropriate * modified COPYING.ZZIP to be a bit more general than just for ZZIPLIB as noted by Tomi Olilla * zzipwrap demo_callback, how can we do void* and char* at the same time... @@ -1173,7 +1185,7 @@ * add a new file COPYING for new less-strictly license after Tomi Ollila has transferred full copyright to me * remove Tomi Ollila from all copyright entries in the sources - but honour his name where apropriate + but honour his name where appropriate * modify LGPL hints in sources and point to COPYING.ZZIP as well and change copyright year info * create COPYING.ZZIP with some general LGPL exceptions. @@ -1395,7 +1407,7 @@ * two new functions, zzip_dir_real and zzip_file_real to check if the ZZIP_XX structures are wrapping a real file or directory. Otherwise it is a zip-archive - or a zip-contained file respectivly. + or a zip-contained file respectively. * zzip_compr_str does now know about stat-types and will return names for S_ISTYPE bits. * remove zzip_fd. It was identical to zzip_dirfd @@ -1503,7 +1515,7 @@ Tomi did. * bugfixes for zzip_open, it did not always set errno(2) to the value of zzip_errno. - * The zzip_read is now seperate from + * The zzip_read is now separate from zzip_fp_read, so that setting errno(2) is only done in zzip_read, not in the zzip-touching function. diff --git a/Build/source/libs/zziplib/zziplib-src/Makefile.am b/Build/source/libs/zziplib/zziplib-src/Makefile.am index d77f5f812ca..c54b2ccb462 100644 --- a/Build/source/libs/zziplib/zziplib-src/Makefile.am +++ b/Build/source/libs/zziplib/zziplib-src/Makefile.am @@ -77,6 +77,8 @@ check-zzxor check-zzxordir check-zzxorcat \ check-sfx check-readme check-tests tests: (cd test && $(MAKE) `basename $@`) +test_%: ; cd test && $(MAKE) `basename $@` + MSVC8 = msvc8/README.TXT msvc8/zip.exe msvc8/test1.zip msvc8/test.zip \ msvc8/zzdir.vcproj msvc8/zzipself.vcproj msvc8/zzip.vcproj \ msvc8/zziplib.sln msvc8/zzipsetstub.sln msvc8/zzobfuscated.sln \ diff --git a/Build/source/libs/zziplib/zziplib-src/Makefile.in b/Build/source/libs/zziplib/zziplib-src/Makefile.in index cd3632a355b..9e9fd870b09 100644 --- a/Build/source/libs/zziplib/zziplib-src/Makefile.in +++ b/Build/source/libs/zziplib/zziplib-src/Makefile.in @@ -951,6 +951,8 @@ check-test0 check-test1 check-zzdir check-zzcat \ check-zzxor check-zzxordir check-zzxorcat \ check-sfx check-readme check-tests tests: (cd test && $(MAKE) `basename $@`) + +test_%: ; cd test && $(MAKE) `basename $@` # ------------------------------------------------------------------------ test-comp: diff --git a/Build/source/libs/zziplib/zziplib-src/README b/Build/source/libs/zziplib/zziplib-src/README index 5668eda043a..22868fa9516 100644 --- a/Build/source/libs/zziplib/zziplib-src/README +++ b/Build/source/libs/zziplib/zziplib-src/README @@ -24,11 +24,12 @@ LICENSING special (paid) licenses can be negotiated with the copyright holder. HOMEPAGE - The zziplib project is hosted at SourceForge, the complete - documentation can be found at http://zziplib.sf.net - the - SourceForge servers are also used to distribute the sources - of the zziplib project. Releases are announced via the - freshmeat services on http://freshmeat.net/projects/zziplib + The zziplib project has moved to GitHub where you can find the + last release tags now => https://github.com/gdraheim/zziplib + The zziplib project was originally hosted at SourceForge with + the documentation at http://zziplib.sf.net - this is a bit + outdated but the API has not changed much since then. To get + the latest release announcements, watch the GitHub project. INSTALLATION The zziplib sources are built with gnu autotools and they should @@ -39,7 +40,7 @@ INSTALLATION VisualC series of compilers. There should be no problem either when crosscompiling the zziplib for a third host platform. -MAINTAINANCE +MAINTENANCE The zziplib library is intentionally a lightweight interface to zip files. The author take patches but please consider to put complex extensions into separate modules rather than implanting them diff --git a/Build/source/libs/zziplib/zziplib-src/SDL/SDL_rwops_zzip.c b/Build/source/libs/zziplib/zziplib-src/SDL/SDL_rwops_zzip.c new file mode 100644 index 00000000000..b273a811470 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/SDL/SDL_rwops_zzip.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2001 Guido Draheim <guidod@gmx.de> + * Use freely under the restrictions of the ZLIB License + * + * (this example uses errno which might not be multithreaded everywhere) + */ + +#include <SDL_rwops_zzip.h> +#include <zzip/zzip.h> +#include <string.h> /* strchr */ + +/* MSVC can not take a casted variable as an lvalue ! */ +#define SDL_RWOPS_ZZIP_DATA(_context) \ + ((_context)->hidden.unknown.data1) +#define SDL_RWOPS_ZZIP_FILE(_context) (ZZIP_FILE*) \ + ((_context)->hidden.unknown.data1) + +static int _zzip_seek(SDL_RWops *context, int offset, int whence) +{ + return zzip_seek(SDL_RWOPS_ZZIP_FILE(context), offset, whence); +} + +static int _zzip_read(SDL_RWops *context, void *ptr, int size, int maxnum) +{ + return zzip_read(SDL_RWOPS_ZZIP_FILE(context), ptr, size*maxnum) / size; +} + +static int _zzip_write(SDL_RWops *context, const void *ptr, int size, int num) +{ + return 0; /* ignored */ +} + +static int _zzip_close(SDL_RWops *context) +{ + if (! context) return 0; /* may be SDL_RWclose is called by atexit */ + + zzip_close (SDL_RWOPS_ZZIP_FILE(context)); + SDL_FreeRW (context); + return 0; +} + +SDL_RWops *SDL_RWFromZZIP(const char* file, const char* mode) +{ + register SDL_RWops* rwops; + register ZZIP_FILE* zzip_file; + + if (! strchr (mode, 'r')) + return SDL_RWFromFile(file, mode); + + zzip_file = zzip_fopen (file, mode); + if (! zzip_file) return 0; + + rwops = SDL_AllocRW (); + if (! rwops) { errno=ENOMEM; zzip_close (zzip_file); return 0; } + + SDL_RWOPS_ZZIP_DATA(rwops) = zzip_file; + rwops->read = _zzip_read; + rwops->write = _zzip_write; + rwops->seek = _zzip_seek; + rwops->close = _zzip_close; + return rwops; +} diff --git a/Build/source/libs/zziplib/zziplib-src/SDL/SDL_rwops_zzip.pc b/Build/source/libs/zziplib/zziplib-src/SDL/SDL_rwops_zzip.pc index 7570e01e625..823944ef603 100644 --- a/Build/source/libs/zziplib/zziplib-src/SDL/SDL_rwops_zzip.pc +++ b/Build/source/libs/zziplib/zziplib-src/SDL/SDL_rwops_zzip.pc @@ -2,7 +2,7 @@ prefix=/usr/local zzipsdldir=/usr/local/include/SDL_rwops_zzip Name: SDL_rwops_zzip -Version: 0.13.62 +Version: 0.13.68 Description: SDL_rwops for ZZipLib Requires: sdl, zziplib Cflags: -I${zzipsdldir} diff --git a/Build/source/libs/zziplib/zziplib-src/SDL/zzip-sdl-config.pc b/Build/source/libs/zziplib/zziplib-src/SDL/zzip-sdl-config.pc deleted file mode 100644 index 46a06a97c58..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/SDL/zzip-sdl-config.pc +++ /dev/null @@ -1,10 +0,0 @@ -prefix=/usr -sdl_static_libs=-L/usr/lib -lSDL -lpthread -lm -ldl -lasound -laudio -lXt -L/usr/X11R6/lib -lX11 -lXext -sdl_libs=-L/usr/lib -lSDL -lpthread -sdl_cflags=-I/usr/include/SDL -D_REENTRANT - -Name: zzip-sdl-config -Version: 1.2.5 -Description: SDL Config (for ZZipLib) -Libs: ${sdl_libs} -Cflags: ${sdl_cflags} diff --git a/Build/source/libs/zziplib/zziplib-src/SDL/zzip-sdl-rwops.pc b/Build/source/libs/zziplib/zziplib-src/SDL/zzip-sdl-rwops.pc deleted file mode 100644 index 6a4b1d04377..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/SDL/zzip-sdl-rwops.pc +++ /dev/null @@ -1,8 +0,0 @@ -zzipdatadir=/usr/local/share/zziplib -zzipsdlrwops=${zzipdatadir}/SDL - -Name: zzip-sdl-rwops -Version: 0.13.24 -Description: SDL_rwops for ZZipLib -Requires: zzip-sdl-config, zziplib -Cflags: -I${zzipsdlrwops} diff --git a/Build/source/libs/zziplib/zziplib-src/TODO b/Build/source/libs/zziplib/zziplib-src/TODO index bda20cdc46d..c7da3bcaeed 100644 --- a/Build/source/libs/zziplib/zziplib-src/TODO +++ b/Build/source/libs/zziplib/zziplib-src/TODO @@ -45,7 +45,7 @@ libtool package, the libtool 1.4 is dated 2001/04/24 There are reports of misaligned access to some zip fields that I would guess to be on little-endian non-x86 platforms. The current -bytewise access of multibyte fields is targetted towards the +bytewise access of multibyte fields is targeted towards the bigendian unix machines. The fix would need to go to fetch.h but so far no response came about as that one could test a solution. diff --git a/Build/source/libs/zziplib/zziplib-src/bins/Makefile.am b/Build/source/libs/zziplib/zziplib-src/bins/Makefile.am index f88c52b4269..9483dc9c97f 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/Makefile.am +++ b/Build/source/libs/zziplib/zziplib-src/bins/Makefile.am @@ -16,10 +16,10 @@ THREAD_SAFE=@THREAD_SAFE@ WCC10_CLEAN = *.obj *.lk1 *.mk1 *.mk *.sym *.tgt -EXTRA_DIST = $(aclocal_DATA) unzzip.h +noinst_HEADERS = unzzipdir-zip.h unzzipcat-zip.h unzzip-states.h zzipmake-zip.h +EXTRA_DIST = $(aclocal_DATA) $(noinst_HEADERS) CLEANFILES = $(WCC10_CLEAN) -zzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz zziptest_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz zzcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz zzdir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @@ -27,6 +27,9 @@ zzxorcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz zzxordir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz zzobfuscated_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz +zzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz +zzip_SOURCES = zzip.c zzipmake-zip.c + unzzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz unzzip_SOURCES = unzzip.c unzzipcat-zip.c unzzipdir-zip.c unzzip_mix_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz diff --git a/Build/source/libs/zziplib/zziplib-src/bins/Makefile.in b/Build/source/libs/zziplib/zziplib-src/bins/Makefile.in index a2ce8069dce..a37d61184a9 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/Makefile.in +++ b/Build/source/libs/zziplib/zziplib-src/bins/Makefile.in @@ -15,6 +15,7 @@ @SET_MAKE@ + VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ @@ -88,7 +89,8 @@ noinst_PROGRAMS = zziptest$(EXEEXT) zzobfuscated$(EXEEXT) \ zzip$(EXEEXT) subdir = bins DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/uses/mkinstalldirs $(top_srcdir)/uses/depcomp + $(top_srcdir)/uses/mkinstalldirs $(top_srcdir)/uses/depcomp \ + $(noinst_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_compile_check_sizeof.m4 \ $(top_srcdir)/m4/ac_set_default_paths_system.m4 \ @@ -156,8 +158,8 @@ zzcat_DEPENDENCIES = ../zzip/libzzip.la zzdir_SOURCES = zzdir.c zzdir_OBJECTS = zzdir.$(OBJEXT) zzdir_DEPENDENCIES = ../zzip/libzzip.la -zzip_SOURCES = zzip.c -zzip_OBJECTS = zzip.$(OBJEXT) +am_zzip_OBJECTS = zzip.$(OBJEXT) zzipmake-zip.$(OBJEXT) +zzip_OBJECTS = $(am_zzip_OBJECTS) zzip_DEPENDENCIES = ../zzip/libzzip.la zziptest_SOURCES = zziptest.c zziptest_OBJECTS = zziptest.$(OBJEXT) @@ -209,12 +211,12 @@ am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = unzip-mem.c $(unzzip_SOURCES) $(unzzip_big_SOURCES) \ $(unzzip_mem_SOURCES) $(unzzip_mix_SOURCES) zzcat.c zzdir.c \ - zzip.c zziptest.c zzobfuscated.c zzxorcat.c zzxorcopy.c \ - zzxordir.c + $(zzip_SOURCES) zziptest.c zzobfuscated.c zzxorcat.c \ + zzxorcopy.c zzxordir.c DIST_SOURCES = unzip-mem.c $(unzzip_SOURCES) $(unzzip_big_SOURCES) \ $(unzzip_mem_SOURCES) $(unzzip_mix_SOURCES) zzcat.c zzdir.c \ - zzip.c zziptest.c zzobfuscated.c zzxorcat.c zzxorcopy.c \ - zzxordir.c + $(zzip_SOURCES) zziptest.c zzobfuscated.c zzxorcat.c \ + zzxorcopy.c zzxordir.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -248,6 +250,7 @@ am__uninstall_files_from_dir = { \ $(am__cd) "$$dir" && rm -f $$files; }; \ } DATA = $(aclocal_DATA) +HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is @@ -423,15 +426,17 @@ DEFAULT_INCLUDES = # nothing - no default of -I. -I$(srcdir) aclocal_DATA = zziplib.m4 # WCC10_CLEAN = *.obj *.lk1 *.mk1 *.mk *.sym *.tgt -EXTRA_DIST = $(aclocal_DATA) unzzip.h +noinst_HEADERS = unzzipdir-zip.h unzzipcat-zip.h unzzip-states.h zzipmake-zip.h +EXTRA_DIST = $(aclocal_DATA) $(noinst_HEADERS) CLEANFILES = $(WCC10_CLEAN) -zzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz zziptest_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz zzcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz zzdir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz zzxorcat_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz zzxordir_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz zzobfuscated_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz +zzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz +zzip_SOURCES = zzip.c zzipmake-zip.c unzzip_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz unzzip_SOURCES = unzzip.c unzzipcat-zip.c unzzipdir-zip.c unzzip_mix_LDADD = ../zzip/libzzip.la @RESOLVES@ -lz @@ -605,6 +610,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zzcat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zzdir.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zzip.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zzipmake-zip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zziptest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zzobfuscated.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zzxorcat.Po@am__quote@ @@ -743,7 +749,7 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(PROGRAMS) $(DATA) +all-am: Makefile $(PROGRAMS) $(DATA) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(aclocaldir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzip-mem.c b/Build/source/libs/zziplib/zziplib-src/bins/unzip-mem.c index 2660d3d6f95..b20bf37d6c5 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzip-mem.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzip-mem.c @@ -27,10 +27,6 @@ #define fnmatch(x,y,z) strcmp(x,y) #endif -#ifndef O_BINARY -#define O_BINARY 0 -#endif - #define ___ { #define ____ } diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzip-states.h b/Build/source/libs/zziplib/zziplib-src/bins/unzzip-states.h new file mode 100644 index 00000000000..55ea8c09387 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzip-states.h @@ -0,0 +1,24 @@ +#ifndef UNZZIP_STATES_H +#define UNZZIP_STATES_H + +/* DIAGNOSTICS according to the unzip(1) manpage */ + +#define EXIT_OK 0 +#define EXIT_WARNINGS 1 +#define EXIT_ERRORS 2 +#define EXIT_FILEFORMAT 3 +#define EXIT_ENOMEM 4 +#define EXIT_ENOTTY_FOR_PASSWORD 5 +#define EXIT_ENOMEM_ZIP_TO_DISK 6 +#define EXIT_ENOMEM_ZIP_TO_MEM 7 +#define EXIT_ZIP_NOT_FOUND 9 +#define EXIT_INVALID_OPTION 10 +#define EXIT_FILE_NOT_FOUND 11 +#define EXIT_DISKFULL 50 +#define EXIT_EARLY_END_OF_FILE 51 +#define EXIT_SIGTERM 80 +#define EXIT_UNSUPPORTED_COMPRESSION 81 +#define EXIT_WRONG_PASSWORD 82 + +#endif + diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzip.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzip.c index 90c2f9314dc..f91c5ebad86 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzip.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzip.c @@ -8,11 +8,9 @@ #include <zzip/zzip.h> #include <stdio.h> #include <string.h> -#include "unzzip.h" - -extern int unzzip_list(int argc, char** argv); -extern int unzzip_print(int argc, char** argv); -extern int unzzip_extract(int argc, char** argv); +#include "unzzipcat-zip.h" +#include "unzzipdir-zip.h" +#include "unzzip-states.h" static const char usage[] = { @@ -52,14 +50,14 @@ main (int argc, char ** argv) if (! strcmp (argv[1], "-l") || ! strcmp(argv[1], "--list")) { argc -= 1; argv += 1; - return unzzip_list(argc, argv); + return unzzip_show_list(argc, argv); } if (! strcmp (argv[1], "-v") || ! strcmp(argv[1], "--versions")) { if (argc == 2) return unzzip_version(); /* compatible with info-zip */ argc -= 1; argv += 1; - return unzzip_list(argc, argv); /* short format here */ + return unzzip_long_list(argc, argv); } if (! strcmp (argv[1], "-p") || ! strcmp(argv[1], "--pipe")) { @@ -70,7 +68,7 @@ main (int argc, char ** argv) if (! strcmp (argv[1], "-")) { fprintf(stderr, "unknown option %s", argv[1]); - return -1; + return EXIT_INVALID_OPTION; } return unzzip_extract(argc, argv); diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-big.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-big.c index 3774939aacb..7ab6bad9b15 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-big.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-big.c @@ -8,27 +8,18 @@ #include <zzip/fseeko.h> #include <stdlib.h> #include <string.h> -#include "unzzip.h" - -#ifdef ZZIP_HAVE_FNMATCH_H -#include <fnmatch.h> -#else -#define fnmatch(x,y,z) strcmp(x,y) -#endif - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -#ifdef DEBUG -#define debug1(msg) do { fprintf(stderr, "%s : " msg "\n", __func__); } while(0) -#define debug2(msg, arg1) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1); } while(0) -#define debug3(msg, arg1, arg2) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1, arg2); } while(0) -#else -#define debug1(msg) -#define debug2(msg, arg1) -#define debug3(msg, arg1, arg2) -#endif +#include <sys/stat.h> +#include <zzip/__mkdir.h> +#include <zzip/__string.h> +#include <zzip/__debug.h> +#include <zzip/__fnmatch.h> +#include "unzzipcat-zip.h" +#include "unzzip-states.h" + +static int exitcode(int e) +{ + return EXIT_ERRORS; +} static void unzzip_big_entry_fprint(ZZIP_ENTRY* entry, FILE* out) { @@ -38,14 +29,14 @@ static void unzzip_big_entry_fprint(ZZIP_ENTRY* entry, FILE* out) char buffer[1024]; int len; while ((len = zzip_entry_fread (buffer, 1024, 1, file))) { - debug2("entry read %i", len); + DBG2("entry read %i", len); fwrite (buffer, len, 1, out); } - debug2("entry done %s", strerror(errno)); + DBG2("entry done %s", strerror(errno)); zzip_entry_fclose (file); } else { - debug2("could not open entry: %s", strerror(errno)); + DBG2("could not open entry: %s", strerror(errno)); } } @@ -62,21 +53,20 @@ static void unzzip_cat_file(FILE* disk, char* name, FILE* out) } } -#if !defined(ZZIP_HAVE_STRNDUP) -static char * -strndup(char *p, size_t maxlen) +static void makedirs(const char* name) { - char *r; - if (!p) - return NULL; - r = malloc(maxlen + 1); - if (!r) - return NULL; - strncpy(r, p, maxlen); - r[maxlen] = '\0'; - return r; + char* p = strrchr(name, '/'); + if (p) { + char* dir_name = _zzip_strndup(name, p-name); + makedirs(dir_name); + free (dir_name); + } + if (_zzip_mkdir(name, 0775) == -1 && errno != EEXIST) + { + DBG3("while mkdir %s : %s", name, strerror(errno)); + } + errno = 0; } -#endif static FILE* create_fopen(char* name, char* mode, int subdirs) { @@ -84,8 +74,8 @@ static FILE* create_fopen(char* name, char* mode, int subdirs) { char* p = strrchr(name, '/'); if (p) { - char* dir_name = strndup(name, p-name); - // makedirs(dir_name); // TODO + char* dir_name = _zzip_strndup(name, p-name); + makedirs(dir_name); free (dir_name); } } @@ -95,13 +85,14 @@ static FILE* create_fopen(char* name, char* mode, int subdirs) static int unzzip_cat (int argc, char ** argv, int extract) { + int done = 0; int argn; FILE* disk; disk = fopen (argv[1], "rb"); if (! disk) { perror(argv[1]); - return -1; + return exitcode(errno); } if (argc == 2) @@ -111,12 +102,20 @@ static int unzzip_cat (int argc, char ** argv, int extract) { char* name = zzip_entry_strdup_name (entry); FILE* out = stdout; + if (! name) { + done = EXIT_WARNINGS; + continue; + } if (extract) out = create_fopen(name, "wb", 1); + if (! out) { + if (errno != EISDIR) done = EXIT_ERRORS; + continue; + } unzzip_cat_file (disk, name, out); if (extract) fclose(out); free (name); } - return 0; + return done; } if (argc == 3 && !extract) @@ -135,12 +134,16 @@ static int unzzip_cat (int argc, char ** argv, int extract) for (; entry ; entry = zzip_entry_findnext(entry)) { char* name = zzip_entry_strdup_name (entry); - debug3(".. check '%s' to zip '%s'", argv[argn], name); - if (! fnmatch (argv[argn], name, - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + DBG3(".. check '%s' to zip '%s'", argv[argn], name); + if (! _zzip_fnmatch (argv[argn], name, + FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) { FILE* out = stdout; if (extract) out = create_fopen(name, "wb", 1); + if (! out) { + if (errno != EISDIR) done = EXIT_ERRORS; + continue; + } unzzip_cat_file (disk, name, out); if (extract) fclose(out); break; /* match loop */ @@ -148,7 +151,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) free (name); } } - return 0; + return done; } int unzzip_print (int argc, char ** argv) diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mem.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mem.c index f7d9e6d152f..13cca3aaf7b 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mem.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mem.c @@ -9,7 +9,13 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "unzzip.h" +#include <sys/stat.h> +#include <zzip/__mkdir.h> +#include <zzip/__fnmatch.h> +#include <zzip/__string.h> +#include <zzip/__debug.h> +#include "unzzipcat-zip.h" +#include "unzzip-states.h" #ifdef ZZIP_HAVE_UNISTD_H #include <unistd.h> @@ -18,15 +24,10 @@ #include <io.h> #endif -#ifdef ZZIP_HAVE_FNMATCH_H -#include <fnmatch.h> -#else -#define fnmatch(x,y,z) strcmp(x,y) -#endif - -#ifndef O_BINARY -#define O_BINARY 0 -#endif +static int exitcode(int e) +{ + return EXIT_ERRORS; +} static void unzzip_mem_entry_fprint(ZZIP_MEM_DISK* disk, ZZIP_MEM_ENTRY* entry, FILE* out) @@ -47,7 +48,7 @@ static void unzzip_mem_disk_cat_file(ZZIP_MEM_DISK* disk, char* name, FILE* out) ZZIP_DISK_FILE* file = zzip_mem_disk_fopen (disk, name); if (file) { - char buffer[1024]; int len; + char buffer[1025]; int len; while ((len = zzip_mem_disk_fread (buffer, 1, 1024, file))) { fwrite (buffer, 1, len, out); @@ -57,21 +58,20 @@ static void unzzip_mem_disk_cat_file(ZZIP_MEM_DISK* disk, char* name, FILE* out) } } -#if !defined(ZZIP_HAVE_STRNDUP) -static char * -strndup(char *p, size_t maxlen) +static void makedirs(const char* name) { - char *r; - if (!p) - return NULL; - r = malloc(maxlen + 1); - if (!r) - return NULL; - strncpy(r, p, maxlen); - r[maxlen] = '\0'; - return r; + char* p = strrchr(name, '/'); + if (p) { + char* dir_name = _zzip_strndup(name, p-name); + makedirs(dir_name); + free (dir_name); + } + if (_zzip_mkdir(name, 0775) == -1 && errno != EEXIST) + { + DBG3("while mkdir %s : %s", name, strerror(errno)); + } + errno = 0; } -#endif static FILE* create_fopen(char* name, char* mode, int subdirs) { @@ -79,45 +79,50 @@ static FILE* create_fopen(char* name, char* mode, int subdirs) { char* p = strrchr(name, '/'); if (p) { - char* dir_name = strndup(name, p-name); - // makedirs(dir_name); // TODO + char* dir_name = _zzip_strndup(name, p-name); + makedirs(dir_name); free (dir_name); } } return fopen(name, mode); } - static int unzzip_cat (int argc, char ** argv, int extract) { + int done; int argn; ZZIP_MEM_DISK* disk; if (argc == 1) { printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); - return -1; /* better provide an archive argument */ + return EXIT_OK; /* better provide an archive argument */ } disk = zzip_mem_disk_open (argv[1]); if (! disk) { + DBG3("disk_open failed [%i] %s", errno, strerror(errno)); perror(argv[1]); - return -1; + return exitcode(errno); } if (argc == 2) { /* print directory list */ ZZIP_MEM_ENTRY* entry = zzip_mem_disk_findfirst(disk); - fprintf(stderr, "..%p\n", entry); + DBG2("findfirst %p\n", entry); for (; entry ; entry = zzip_mem_disk_findnext(disk, entry)) { char* name = zzip_mem_entry_to_name (entry); FILE* out = stdout; if (extract) out = create_fopen(name, "wb", 1); + if (! out) { + if (errno != EISDIR) done = EXIT_ERRORS; + continue; + } unzzip_mem_disk_cat_file (disk, name, out); if (extract) fclose(out); } - return 0; + return done; } if (argc == 3 && !extract) @@ -137,18 +142,22 @@ static int unzzip_cat (int argc, char ** argv, int extract) for (; entry ; entry = zzip_mem_disk_findnext(disk, entry)) { char* name = zzip_mem_entry_to_name (entry); - if (! fnmatch (argv[argn], name, - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + if (! _zzip_fnmatch (argv[argn], name, + FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) { FILE* out = stdout; if (extract) out = create_fopen(name, "wb", 1); + if (! out) { + if (errno != EISDIR) done = EXIT_ERRORS; + continue; + } unzzip_mem_disk_cat_file (disk, name, out); if (extract) fclose(out); break; /* match loop */ } } } - return 0; + return done; } int unzzip_print (int argc, char ** argv) diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mix.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mix.c index 09aad672799..aa9b86c4915 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mix.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-mix.c @@ -9,7 +9,13 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "unzzip.h" +#include <sys/stat.h> +#include <zzip/__mkdir.h> +#include <zzip/__string.h> +#include <zzip/__fnmatch.h> +#include <zzip/__debug.h> +#include "unzzipcat-zip.h" +#include "unzzip-states.h" #ifdef ZZIP_HAVE_UNISTD_H #include <unistd.h> @@ -18,15 +24,35 @@ #include <io.h> #endif -#ifdef ZZIP_HAVE_FNMATCH_H -#include <fnmatch.h> -#else -#define fnmatch(x,y,z) strcmp(x,y) -#endif - -#ifndef O_BINARY -#define O_BINARY 0 -#endif +static int exitcode(int e) +{ + switch (e) + { + case ZZIP_NO_ERROR: + return EXIT_OK; + case ZZIP_OUTOFMEM: /* out of memory */ + return EXIT_ENOMEM; + case ZZIP_DIR_OPEN: /* failed to open zipfile, see errno for details */ + return EXIT_ZIP_NOT_FOUND; + case ZZIP_DIR_STAT: /* failed to fstat zipfile, see errno for details */ + case ZZIP_DIR_SEEK: /* failed to lseek zipfile, see errno for details */ + case ZZIP_DIR_READ: /* failed to read zipfile, see errno for details */ + case ZZIP_DIR_TOO_SHORT: + case ZZIP_DIR_EDH_MISSING: + return EXIT_FILEFORMAT; + case ZZIP_DIRSIZE: + return EXIT_EARLY_END_OF_FILE; + case ZZIP_ENOENT: + return EXIT_FILE_NOT_FOUND; + case ZZIP_UNSUPP_COMPR: + return EXIT_UNSUPPORTED_COMPRESSION; + case ZZIP_CORRUPTED: + case ZZIP_UNDEF: + case ZZIP_DIR_LARGEFILE: + return EXIT_FILEFORMAT; + } + return EXIT_ERRORS; +} static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out) { @@ -43,21 +69,20 @@ static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out) } } -#if !defined(ZZIP_HAVE_STRNDUP) -static char * -strndup(char *p, size_t maxlen) +static void makedirs(const char* name) { - char *r; - if (!p) - return NULL; - r = malloc(maxlen + 1); - if (!r) - return NULL; - strncpy(r, p, maxlen); - r[maxlen] = '\0'; - return r; + char* p = strrchr(name, '/'); + if (p) { + char* dir_name = _zzip_strndup(name, p-name); + makedirs(dir_name); + free (dir_name); + } + if (_zzip_mkdir(name, 0775) == -1 && errno != EEXIST) + { + DBG3("while mkdir %s : %s", name, strerror(errno)); + } + errno = 0; } -#endif static FILE* create_fopen(char* name, char* mode, int subdirs) { @@ -65,30 +90,31 @@ static FILE* create_fopen(char* name, char* mode, int subdirs) { char* p = strrchr(name, '/'); if (p) { - char* dir_name = strndup(name, p-name); - // makedirs(dir_name); // TODO + char* dir_name = _zzip_strndup(name, p-name); + makedirs(dir_name); free (dir_name); } } return fopen(name, mode); } - static int unzzip_cat (int argc, char ** argv, int extract) { + int done = 0; int argn; ZZIP_DIR* disk; if (argc == 1) { printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); - return -1; /* better provide an archive argument */ + return EXIT_OK; /* better provide an archive argument */ } disk = zzip_opendir (argv[1]); if (! disk) { + DBG3("opendir failed [%i] %s", errno, strerror(errno)); perror(argv[1]); - return -1; + return exitcode(errno); } if (argc == 2) @@ -99,9 +125,14 @@ static int unzzip_cat (int argc, char ** argv, int extract) char* name = entry->d_name; FILE* out = stdout; if (extract) out = create_fopen(name, "wb", 1); + if (! out) { + if (errno != EISDIR) done = EXIT_ERRORS; + continue; + } unzzip_cat_file (disk, name, out); if (extract) fclose(out); } + DBG2("readdir done %s", strerror(errno)); } else { /* list only the matching entries - in order of zip directory */ @@ -111,8 +142,8 @@ static int unzzip_cat (int argc, char ** argv, int extract) char* name = entry->d_name; for (argn=1; argn < argc; argn++) { - if (! fnmatch (argv[argn], name, - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + if (! _zzip_fnmatch (argv[argn], name, + FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) { FILE* out = stdout; char* zip_name = argv[1]; @@ -125,6 +156,10 @@ static int unzzip_cat (int argc, char ** argv, int extract) mix_name[zip_name_len] = '/'; strcpy(mix_name + zip_name_len + 1, name); if (extract) out = create_fopen(name, "wb", 1); + if (! out) { + if (errno != EISDIR) done = EXIT_ERRORS; + continue; + } fprintf(stderr, "%s %s -> %s\n", zip_name, name, mix_name); /* 'test1.zip' 'README' -> 'test1/README' */ unzzip_cat_file (disk, mix_name, out); @@ -135,7 +170,7 @@ static int unzzip_cat (int argc, char ** argv, int extract) } } zzip_closedir(disk); - return 0; + return done; } int unzzip_print (int argc, char ** argv) diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-zip.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-zip.c index 750c95f6345..216be41ee29 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-zip.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-zip.c @@ -9,7 +9,13 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "unzzip.h" +#include <sys/stat.h> +#include <zzip/__mkdir.h> +#include <zzip/__string.h> +#include <zzip/__fnmatch.h> +#include <zzip/__debug.h> +#include "unzzipcat-zip.h" +#include "unzzip-states.h" #ifdef ZZIP_HAVE_UNISTD_H #include <unistd.h> @@ -18,15 +24,35 @@ #include <io.h> #endif -#ifdef ZZIP_HAVE_FNMATCH_H -#include <fnmatch.h> -#else -#define fnmatch(x,y,z) strcmp(x,y) -#endif - -#ifndef O_BINARY -#define O_BINARY 0 -#endif +static int exitcode(int e) +{ + switch (e) + { + case ZZIP_NO_ERROR: + return EXIT_OK; + case ZZIP_OUTOFMEM: /* out of memory */ + return EXIT_ENOMEM; + case ZZIP_DIR_OPEN: /* failed to open zipfile, see errno for details */ + return EXIT_ZIP_NOT_FOUND; + case ZZIP_DIR_STAT: /* failed to fstat zipfile, see errno for details */ + case ZZIP_DIR_SEEK: /* failed to lseek zipfile, see errno for details */ + case ZZIP_DIR_READ: /* failed to read zipfile, see errno for details */ + case ZZIP_DIR_TOO_SHORT: + case ZZIP_DIR_EDH_MISSING: + return EXIT_FILEFORMAT; + case ZZIP_DIRSIZE: + return EXIT_EARLY_END_OF_FILE; + case ZZIP_ENOENT: + return EXIT_FILE_NOT_FOUND; + case ZZIP_UNSUPP_COMPR: + return EXIT_UNSUPPORTED_COMPRESSION; + case ZZIP_CORRUPTED: + case ZZIP_UNDEF: + case ZZIP_DIR_LARGEFILE: + return EXIT_FILEFORMAT; + } + return EXIT_ERRORS; +} static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out) { @@ -43,21 +69,20 @@ static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out) } } -#if !defined(ZZIP_HAVE_STRNDUP) -static char * -strndup(char *p, size_t maxlen) +static void makedirs(const char* name) { - char *r; - if (!p) - return NULL; - r = malloc(maxlen + 1); - if (!r) - return NULL; - strncpy(r, p, maxlen); - r[maxlen] = '\0'; - return r; + char* p = strrchr(name, '/'); + if (p) { + char* dir_name = _zzip_strndup(name, p-name); + makedirs(dir_name); + free (dir_name); + } + if (_zzip_mkdir(name, 0775) == -1 && errno != EEXIST) + { + DBG3("while mkdir %s : %s", name, strerror(errno)); + } + errno = 0; } -#endif static FILE* create_fopen(char* name, char* mode, int subdirs) { @@ -65,17 +90,17 @@ static FILE* create_fopen(char* name, char* mode, int subdirs) { char* p = strrchr(name, '/'); if (p) { - char* dir_name = strndup(name, p-name); - // makedirs(dir_name); // TODO + char* dir_name = _zzip_strndup(name, p-name); + makedirs(dir_name); free (dir_name); } } - return fopen(name, mode); + return fopen(name, mode); } - static int unzzip_cat (int argc, char ** argv, int extract) { + int done = 0; int argn; ZZIP_DIR* disk; zzip_error_t error; @@ -83,13 +108,13 @@ static int unzzip_cat (int argc, char ** argv, int extract) if (argc == 1) { printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); - return -1; /* better provide an archive argument */ + return EXIT_OK; /* better provide an archive argument */ } disk = zzip_dir_open (argv[1], &error); if (! disk) { - perror(argv[1]); - return -1; + fprintf(stderr, "%s: %s\n", argv[1], zzip_strerror(error)); + return exitcode(error); } if (argc == 2) @@ -100,6 +125,11 @@ static int unzzip_cat (int argc, char ** argv, int extract) char* name = entry.d_name; FILE* out = stdout; if (extract) out = create_fopen(name, "wb", 1); + if (! out) { + DBG3("fopen' %s : %s", name, strerror(errno)); + if (errno != EISDIR) done = EXIT_ERRORS; + continue; + } unzzip_cat_file (disk, name, out); if (extract) fclose(out); } @@ -112,20 +142,25 @@ static int unzzip_cat (int argc, char ** argv, int extract) char* name = entry.d_name; for (argn=1; argn < argc; argn++) { - if (! fnmatch (argv[argn], name, - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) + if (! _zzip_fnmatch (argv[argn], name, + FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) { - FILE* out = stdout; - if (extract) out = create_fopen(name, "wb", 1); - unzzip_cat_file (disk, name, out); - if (extract) fclose(out); - break; /* match loop */ + FILE* out = stdout; + if (extract) out = create_fopen(name, "wb", 1); + if (! out) { + DBG3("fopen. %s : %s", name, strerror(errno)); + if (errno != EISDIR) done = EXIT_ERRORS; + continue; + } + unzzip_cat_file (disk, name, out); + if (extract) fclose(out); + break; /* match loop */ } } } } zzip_dir_close(disk); - return 0; + return done; } int unzzip_print (int argc, char ** argv) diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzip.h b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-zip.h index 7f0aec1c267..cba2a40a16f 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzip.h +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipcat-zip.h @@ -5,7 +5,6 @@ * This file is used as an example to clarify zzip api usage. */ -extern int unzzip_list(int argc, char** argv); extern int unzzip_print(int argc, char** argv); extern int unzzip_extract(int argc, char** argv); diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-big.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-big.c index a1d14119fa0..e35648ac21e 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-big.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-big.c @@ -5,10 +5,14 @@ * This file is used as an example to clarify zzipfseeko api usage. */ +#define _ZZIP_ENTRY_STRUCT 1 + #include <zzip/fseeko.h> +#include <zzip/fetch.h> #include <stdlib.h> #include <string.h> -#include "unzzip.h" +#include "unzzipdir-zip.h" +#include "unzzip-states.h" #ifdef ZZIP_HAVE_FNMATCH_H #include <fnmatch.h> @@ -16,21 +20,17 @@ #define fnmatch(x,y,z) strcmp(x,y) #endif -#ifndef O_BINARY -#define O_BINARY 0 -#endif +static const char* comprlevel[] = { + "stored", "shrunk", "redu:1", "redu:2", "redu:3", "redu:4", + "impl:N", "toknze", "defl:N", "defl:B", "impl:B" }; -#ifdef DEBUG -#define debug1(msg) do { fprintf(stderr, "%s : " msg "\n", __func__); } while(0) -#define debug2(msg, arg1) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1); } while(0) -#define debug3(msg, arg1, arg2) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1, arg2); } while(0) -#else -#define debug1(msg) -#define debug2(msg, arg1) -#define debug3(msg, arg1, arg2) -#endif +static int exitcode(int e) +{ + return EXIT_ERRORS; +} -int unzzip_list (int argc, char ** argv) +static int +unzzip_list (int argc, char ** argv, int verbose) { int argn; FILE* disk; @@ -38,7 +38,7 @@ int unzzip_list (int argc, char ** argv) disk = fopen (argv[1], "rb"); if (! disk) { perror(argv[1]); - return -1; + return exitcode(errno); } if (argc == 2) @@ -47,7 +47,9 @@ int unzzip_list (int argc, char ** argv) for (; entry ; entry = zzip_entry_findnext(entry)) { char* name = zzip_entry_strdup_name (entry); - printf (" %s \n", name); + unsigned compr = zzip_entry_compr(entry); + const char* defl = (compr < sizeof(comprlevel)) ? comprlevel[compr] : "(redu)"; + printf (" %s %s\n", defl, name); free (name); } return 0; @@ -59,13 +61,27 @@ int unzzip_list (int argc, char ** argv) for (; entry ; entry = zzip_entry_findnext(entry)) { char* name = zzip_entry_strdup_name (entry); - printf (" %s \n", name); + unsigned compr = zzip_entry_compr(entry); + const char* defl = (compr < sizeof(comprlevel)) ? comprlevel[compr] : "(redu)"; + printf (" %s %s\n", defl, name); free (name); } } return 0; } +int +unzzip_long_list (int argc, char ** argv) +{ + return unzzip_list(argc, argv, 1); +} + +int +unzzip_show_list (int argc, char ** argv) +{ + return unzzip_list(argc, argv, 0); +} + /* * Local variables: * c-file-style: "stroustrup" diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mem.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mem.c index bb060794217..79d64911844 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mem.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mem.c @@ -6,10 +6,12 @@ */ #include <zzip/memdisk.h> +#include <zzip/__debug.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "unzzip.h" +#include "unzzipdir-zip.h" +#include "unzzip-states.h" #ifdef ZZIP_HAVE_UNISTD_H #include <unistd.h> @@ -24,13 +26,17 @@ #define fnmatch(x,y,z) strcmp(x,y) #endif -#ifndef O_BINARY -#define O_BINARY 0 -#endif +static const char* comprlevel[] = { + "stored", "shrunk", "redu:1", "redu:2", "redu:3", "redu:4", + "impl:N", "toknze", "defl:N", "defl:B", "impl:B" }; +static int exitcode(int e) +{ + return EXIT_ERRORS; +} -int -unzzip_list (int argc, char ** argv) +static int +unzzip_list (int argc, char ** argv, int verbose) { int argn; ZZIP_MEM_DISK* disk; @@ -38,26 +44,34 @@ unzzip_list (int argc, char ** argv) if (argc == 1) { printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); - return -1; /* better provide an archive argument */ + return EXIT_OK; /* better provide an archive argument */ } disk = zzip_mem_disk_open (argv[1]); if (! disk) { + DBG3("disk_open failed [%i] %s", errno, strerror(errno)); perror(argv[1]); - return -1; + return exitcode(errno); } if (argc == 2) { /* list all */ ZZIP_MEM_ENTRY* entry = zzip_mem_disk_findfirst(disk); + DBG2("findfirst %p", entry); for (; entry ; entry = zzip_mem_disk_findnext(disk, entry)) { char* name = zzip_mem_entry_to_name (entry); - int compr = entry->zz_compr; long long usize = entry->zz_usize; - long long csize = entry->zz_csize; - char* defl = compr ? "deflated" : "stored"; - printf ("%lli/%lli %s %s \n", csize, usize, defl, name); + if (!verbose) + { + printf ("%22lli %s\n", usize, name); + } else + { + long long csize = entry->zz_csize; + unsigned compr = entry->zz_compr; + const char* defl = (compr < sizeof(comprlevel)) ? comprlevel[compr] : "(redu)"; + printf ("%lli/%lli %s %s\n", csize, usize, defl, name); + } } return 0; } @@ -68,11 +82,17 @@ unzzip_list (int argc, char ** argv) while ((entry = zzip_mem_disk_findmatch(disk, argv[2], entry, 0, 0))) { char* name = zzip_mem_entry_to_name (entry); - int compr = entry->zz_compr; long long usize = entry->zz_usize; - long long csize = entry->zz_csize; - char* defl = compr ? "deflated" : "stored"; - printf ("%lli/%lli %s %s \n", csize, usize, defl, name); + if (!verbose) + { + printf ("%22lli %s\n", usize, name); + } else + { + long long csize = entry->zz_csize; + unsigned compr = entry->zz_compr; + const char* defl = (compr < sizeof(comprlevel)) ? comprlevel[compr] : "(redu)"; + printf ("%lli/%lli %s %s\n", csize, usize, defl, name); + } } return 0; } @@ -87,11 +107,18 @@ unzzip_list (int argc, char ** argv) if (! fnmatch (argv[argn], name, FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) { - int compr = entry->zz_compr; + char* name = zzip_mem_entry_to_name (entry); long long usize = entry->zz_usize; - long long csize = entry->zz_csize; - char* defl = compr ? "deflated" : "stored"; - printf ("%lli/%lli %s %s \n", csize, usize, defl, name); + if (!verbose) + { + printf ("%22lli %s\n", usize, name); + } else + { + long long csize = entry->zz_csize; + unsigned compr = entry->zz_compr; + const char* defl = (compr < sizeof(comprlevel)) ? comprlevel[compr] : "(redu)"; + printf ("%lli/%lli %s %s\n", csize, usize, defl, name); + } break; /* match loop */ } } @@ -100,6 +127,18 @@ unzzip_list (int argc, char ** argv) } } +int +unzzip_long_list (int argc, char ** argv) +{ + return unzzip_list(argc, argv, 1); +} + +int +unzzip_show_list (int argc, char ** argv) +{ + return unzzip_list(argc, argv, 0); +} + /* * Local variables: * c-file-style: "stroustrup" diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mix.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mix.c index 5fdc98e3827..3caa4810b69 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mix.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-mix.c @@ -6,10 +6,12 @@ */ #include <zzip/lib.h> +#include <zzip/__debug.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "unzzip.h" +#include "unzzipdir-zip.h" +#include "unzzip-states.h" #ifdef ZZIP_HAVE_UNISTD_H #include <unistd.h> @@ -24,27 +26,57 @@ #define fnmatch(x,y,z) strcmp(x,y) #endif -#ifndef O_BINARY -#define O_BINARY 0 -#endif +static const char* comprlevel[] = { + "stored", "shrunk", "redu:1", "redu:2", "redu:3", "redu:4", + "impl:N", "toknze", "defl:N", "defl:B", "impl:B" }; +static int exitcode(int e) +{ + switch (e) + { + case ZZIP_NO_ERROR: + return EXIT_OK; + case ZZIP_OUTOFMEM: /* out of memory */ + return EXIT_ENOMEM; + case ZZIP_DIR_OPEN: /* failed to open zipfile, see errno for details */ + return EXIT_ZIP_NOT_FOUND; + case ZZIP_DIR_STAT: /* failed to fstat zipfile, see errno for details */ + case ZZIP_DIR_SEEK: /* failed to lseek zipfile, see errno for details */ + case ZZIP_DIR_READ: /* failed to read zipfile, see errno for details */ + case ZZIP_DIR_TOO_SHORT: + case ZZIP_DIR_EDH_MISSING: + return EXIT_FILEFORMAT; + case ZZIP_DIRSIZE: + return EXIT_EARLY_END_OF_FILE; + case ZZIP_ENOENT: + return EXIT_FILE_NOT_FOUND; + case ZZIP_UNSUPP_COMPR: + return EXIT_UNSUPPORTED_COMPRESSION; + case ZZIP_CORRUPTED: + case ZZIP_UNDEF: + case ZZIP_DIR_LARGEFILE: + return EXIT_FILEFORMAT; + } + return EXIT_ERRORS; +} -int -unzzip_list (int argc, char ** argv) +static int +unzzip_list (int argc, char ** argv, int verbose) { int argn; ZZIP_DIR* disk; - + if (argc == 1) { printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); - return -1; /* better provide an archive argument */ + return EXIT_OK; /* better provide an archive argument */ } disk = zzip_opendir (argv[1]); if (! disk) { + DBG3("opendir failed [%i] %s", errno, strerror(errno)); perror(argv[1]); - return -1; + return exitcode(errno); } if (argc == 2) @@ -53,11 +85,19 @@ unzzip_list (int argc, char ** argv) while((entry = zzip_readdir(disk))) { char* name = entry->d_name; - long long csize = entry->d_csize; long long usize = entry->st_size; - char* defl = entry->d_compr ? "deflated" : "stored"; - printf ("%lli/%lli %s %s \n", usize, csize, defl, name); + if (!verbose) + { + printf ("%22lli %s\n", usize, name); + } else + { + long long csize = entry->d_csize; + unsigned compr = entry->d_compr; + const char* defl = (compr < sizeof(comprlevel)) ? comprlevel[compr] : "(redu)"; + printf ("%lli/%lli %s %s\n", usize, csize, defl, name); + } } + DBG2("readdir done %s", strerror(errno)); } else { /* list only the matching entries - in order of zip directory */ @@ -70,19 +110,39 @@ unzzip_list (int argc, char ** argv) if (! fnmatch (argv[argn], name, FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) { - long long csize = entry->d_csize; long long usize = entry->st_size; - char* defl = entry->d_compr ? "deflated" : "stored"; - printf ("%lli/%lli %s %s \n", usize, csize, defl, name); + if (!verbose) + { + printf ("%22lli %s\n", usize, name); + } else + { + long long csize = entry->d_csize; + unsigned compr = entry->d_compr; + const char* defl = (compr < sizeof(comprlevel)) ? comprlevel[compr] : "(redu)"; + printf ("%lli/%lli %s %s\n", usize, csize, defl, name); + } break; /* match loop */ } } } + DBG2("readdir done %s", strerror(errno)); } zzip_closedir(disk); return 0; } +int +unzzip_long_list (int argc, char ** argv) +{ + return unzzip_list(argc, argv, 1); +} + +int +unzzip_show_list (int argc, char ** argv) +{ + return unzzip_list(argc, argv, 0); +} + /* * Local variables: * c-file-style: "stroustrup" diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.c index c8751f25dbf..bfac8334837 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.c @@ -9,7 +9,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "unzzip.h" +#include "unzzipdir-zip.h" +#include "unzzip-states.h" #ifdef ZZIP_HAVE_UNISTD_H #include <unistd.h> @@ -24,13 +25,42 @@ #define fnmatch(x,y,z) strcmp(x,y) #endif -#ifndef O_BINARY -#define O_BINARY 0 -#endif +static const char* comprlevel[] = { + "stored", "shrunk", "redu:1", "redu:2", "redu:3", "redu:4", + "impl:N", "toknze", "defl:N", "defl:B", "impl:B" }; +static int exitcode(int e) +{ + switch (e) + { + case ZZIP_NO_ERROR: + return EXIT_OK; + case ZZIP_OUTOFMEM: /* out of memory */ + return EXIT_ENOMEM; + case ZZIP_DIR_OPEN: /* failed to open zipfile, see errno for details */ + return EXIT_ZIP_NOT_FOUND; + case ZZIP_DIR_STAT: /* failed to fstat zipfile, see errno for details */ + case ZZIP_DIR_SEEK: /* failed to lseek zipfile, see errno for details */ + case ZZIP_DIR_READ: /* failed to read zipfile, see errno for details */ + case ZZIP_DIR_TOO_SHORT: + case ZZIP_DIR_EDH_MISSING: + return EXIT_FILEFORMAT; + case ZZIP_DIRSIZE: + return EXIT_EARLY_END_OF_FILE; + case ZZIP_ENOENT: + return EXIT_FILE_NOT_FOUND; + case ZZIP_UNSUPP_COMPR: + return EXIT_UNSUPPORTED_COMPRESSION; + case ZZIP_CORRUPTED: + case ZZIP_UNDEF: + case ZZIP_DIR_LARGEFILE: + return EXIT_FILEFORMAT; + } + return EXIT_ERRORS; +} -int -unzzip_list (int argc, char ** argv) +static int +unzzip_list (int argc, char ** argv, int verbose) { int argn; ZZIP_DIR* disk; @@ -39,13 +69,13 @@ unzzip_list (int argc, char ** argv) if (argc == 1) { printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); - return -1; /* better provide an archive argument */ + return EXIT_OK; /* better provide an archive argument */ } disk = zzip_dir_open (argv[1], &error); if (! disk) { perror(argv[1]); - return -1; + return exitcode(error); } if (argc == 2) @@ -54,10 +84,17 @@ unzzip_list (int argc, char ** argv) while(zzip_dir_read(disk, &entry)) { char* name = entry.d_name; - long long csize = entry.d_csize; long long usize = entry.st_size; - char* defl = entry.d_compr ? "deflated" : "stored"; - printf ("%lli/%lli %s %s \n", usize, csize, defl, name); + if (!verbose) + { + printf ("%22lli %s\n", usize, name); + } else + { + long long csize = entry.d_csize; + unsigned compr = entry.d_compr; + const char* defl = (compr < sizeof(comprlevel)) ? comprlevel[compr] : "(redu)"; + printf ("%lli/%lli %s %s\n", usize, csize, defl, name); + } } } else @@ -71,10 +108,17 @@ unzzip_list (int argc, char ** argv) if (! fnmatch (argv[argn], name, FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) { - long long csize = entry.d_csize; long long usize = entry.st_size; - char* defl = entry.d_compr ? "deflated" : "stored"; - printf ("%lli/%lli %s %s \n", usize, csize, defl, name); + if (!verbose) + { + printf ("%22lli %s\n", usize, name); + } else + { + long long csize = entry.d_csize; + unsigned compr = entry.d_compr; + const char* defl = (compr < sizeof(comprlevel)) ? comprlevel[compr] : "(redu)"; + printf ("%lli/%lli %s %s\n", usize, csize, defl, name); + } break; /* match loop */ } } @@ -84,6 +128,18 @@ unzzip_list (int argc, char ** argv) return 0; } +int +unzzip_long_list (int argc, char ** argv) +{ + return unzzip_list(argc, argv, 1); +} + +int +unzzip_show_list (int argc, char ** argv) +{ + return unzzip_list(argc, argv, 0); +} + /* * Local variables: * c-file-style: "stroustrup" diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.h b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.h new file mode 100644 index 00000000000..683c1387858 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/bins/unzzipdir-zip.h @@ -0,0 +1,10 @@ +/* + * Copyright (c) 2003 Guido Draheim <guidod@gmx.de> + * Use freely under the restrictions of the ZLIB license. + * + * This file is used as an example to clarify zzip api usage. + */ + +extern int unzzip_show_list(int argc, char** argv); +extern int unzzip_long_list(int argc, char** argv); + diff --git a/Build/source/libs/zziplib/zziplib-src/bins/unzzipshow.c b/Build/source/libs/zziplib/zziplib-src/bins/unzzipshow.c deleted file mode 100644 index 58d1add95a8..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/bins/unzzipshow.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2003 Guido Draheim <guidod@gmx.de> - * Use freely under the restrictions of the ZLIB license. - * - * This file is used as an example to clarify zzipfseeko api usage. - */ - -#include <zzip/fseeko.h> -#include <stdlib.h> -#include <string.h> - -#ifdef ZZIP_HAVE_FNMATCH_H -#include <fnmatch.h> -#else -#define fnmatch(x,y,z) strcmp(x,y) -#endif - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -static const char usage[] = -{ - "unzzipshow <zip> [names].. \n" - " - unzzip data content of files contained in a zip archive.\n" -}; - -static void zzip_entry_fprint(ZZIP_ENTRY* entry, FILE* out) -{ - ZZIP_ENTRY_FILE* file = zzip_entry_fopen (entry, 0); - if (file) - { - char buffer[1024]; int len; - while ((len = zzip_entry_fread (buffer, 1024, 1, file))) - fwrite (buffer, len, 1, out); - - zzip_entry_fclose (file); - } -} - -static void zzip_cat_file(FILE* disk, char* name, FILE* out) -{ - ZZIP_ENTRY_FILE* file = zzip_entry_ffile (disk, name); - if (file) - { - char buffer[1024]; int len; - while ((len = zzip_entry_fread (buffer, 1024, 1, file))) - fwrite (buffer, len, 1, out); - - zzip_entry_fclose (file); - } -} - -int -main (int argc, char ** argv) -{ - int argn; - FILE* disk; - - if (argc <= 1 || ! strcmp (argv[1], "--help")) - { - printf (usage); - return 0; - } - if (! strcmp (argv[1], "--version")) - { - printf (__FILE__" version "ZZIP_PACKAGE" "ZZIP_VERSION"\n"); - return 0; - } - - disk = fopen (argv[1], "rb"); - if (! disk) { - perror(argv[1]); - return -1; - } - - if (argc == 2) - { /* print directory list */ - ZZIP_ENTRY* entry = zzip_entry_findfirst(disk); - if (! entry) puts("no first entry!\n"); - for (; entry ; entry = zzip_entry_findnext(entry)) - { - char* name = zzip_entry_strdup_name (entry); - printf ("%s\n", name); - free (name); - } - return 0; - } - - if (argc == 3) - { /* list from one spec */ - ZZIP_ENTRY* entry = 0; - while ((entry = zzip_entry_findmatch(disk, argv[2], entry, 0, 0))) - zzip_entry_fprint (entry, stdout); - - return 0; - } - - for (argn=1; argn < argc; argn++) - { /* list only the matching entries - each in order of commandline */ - ZZIP_ENTRY* entry = zzip_entry_findfirst(disk); - for (; entry ; entry = zzip_entry_findnext(entry)) - { - char* name = zzip_entry_strdup_name (entry); - if (! fnmatch (argv[argn], name, - FNM_NOESCAPE|FNM_PATHNAME|FNM_PERIOD)) - zzip_cat_file (disk, name, stdout); - free (name); - } - } - return 0; -} - -/* - * Local variables: - * c-file-style: "stroustrup" - * End: - */ diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zzdir.c b/Build/source/libs/zziplib/zziplib-src/bins/zzdir.c index 5345f0852da..39652a97248 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/zzdir.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/zzdir.c @@ -7,10 +7,6 @@ #include <stdio.h> #include <string.h> -#ifndef O_BINARY -#define O_BINARY 0 -#endif - static const char usage[] = { "zzdir <dir>.. \n" @@ -59,13 +55,13 @@ main (int argc, char ** argv) /* orignalsize / compression-type / compression-ratio / filename */ if (d->st_size > 999999) { - printf ("%5dK %-9s %2d%% %s \n", + printf ("%5dK %-9s %2d%% %s\n", d->st_size>>10, zzip_compr_str(d->d_compr), 100 - (d->d_csize|1)/((d->st_size/100)|1), d->d_name); }else{ - printf ("%6d %-9s %2d%% %s \n", + printf ("%6d %-9s %2d%% %s\n", d->st_size, zzip_compr_str(d->d_compr), 100 - (d->d_csize|1)*100/(d->st_size|1), diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zzip.c b/Build/source/libs/zziplib/zziplib-src/bins/zzip.c index 2869a36a611..965f60d6957 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/zzip.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/zzip.c @@ -11,6 +11,7 @@ #include <zzip/write.h> #include <stdio.h> #include <string.h> +#include "zzipmake-zip.h" #ifdef ZZIP_HAVE_UNISTD_H #include <unistd.h> @@ -19,10 +20,6 @@ #include <io.h> #endif -#ifndef O_BINARY -#define O_BINARY 0 -#endif - static const char usage[] = { "zzip <dir> files... \n" @@ -51,48 +48,7 @@ main (int argc, char ** argv) return 0; } - dir = zzip_dir_creat(argv[1], 0755); - if (! dir) - { - fprintf (stderr, "did not creat %s: \n", argv[1]); - perror(argv[1]); - if (1) - return 1; - else - fprintf (stderr, "(ignored)\n"); - } - - for (argn=2; argn < argc; argn++) - { - int input = open (argv[argn], O_RDONLY); - if (input == -1) - { - perror (argv[argn]); - continue; - } - else - { - char buf[17]; zzip_ssize_t n; - ZZIP_FILE* output = zzip_file_creat (dir, argv[argn], 0755); - if (! output) - { - fprintf (stderr, "|did not open %s: \n", argv[argn]); - fprintf (stderr, "|%s: %s\n", argv[argn], - zzip_strerror_of(dir)); - continue; - } - - while ((n = read (input, buf, 16))) - { - zzip_write (output, buf, n); - } - zzip_close (output); - } - close (input); - } - zzip_closedir(dir); - - return exitcode; + return rezzip_make(argc, argv); } /* diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zziplib.m4 b/Build/source/libs/zziplib/zziplib-src/bins/zziplib.m4 index 4029ca546e3..d5728ca3d76 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/zziplib.m4 +++ b/Build/source/libs/zziplib/zziplib-src/bins/zziplib.m4 @@ -7,7 +7,7 @@ dnl projects. In general, you can include in your configure.ac dnl some line like dnl PKG_CHECK_ZZIPLIB([ZZIP],[0.10.75]) dnl in order to get the two autoconf/automake subst variables -dnl named ZZIP_CFLAGS and ZZIP_LIBS respectivly. +dnl named ZZIP_CFLAGS and ZZIP_LIBS respectively. dnl PKG_CHECK_ZZIPLIB(ZZIP, minversion, action-if, action-not) dnl defines ZZIP_LIBS, ZZIP_CFLAGS, see pkg-config man page diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zzipmake-zip.c b/Build/source/libs/zziplib/zziplib-src/bins/zzipmake-zip.c new file mode 100644 index 00000000000..8e09c31d90f --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/bins/zzipmake-zip.c @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2003 Guido Draheim <guidod@gmx.de> + * Use freely under the restrictions of the ZLIB license. + * + * This file is used as an example to clarify zzip api usage. + * (the write-api is work in progress, beware) + */ + +#define _ZZIP_WRITE_SOURCE + +#include <zzip/write.h> +#include <stdio.h> +#include <string.h> +#include "zzipmake-zip.h" + +#ifdef ZZIP_HAVE_UNISTD_H +#include <unistd.h> +#endif +#ifdef ZZIP_HAVE_IO_H +#include <io.h> +#endif + +int rezzip_make (int argc, char ** argv) +{ + int argn; + int exitcode = 0; + ZZIP_DIR * dir; + + dir = zzip_dir_creat(argv[1], 0755); + if (! dir) + { + fprintf (stderr, "did not creat %s: \n", argv[1]); + perror(argv[1]); + if (1) + return 1; + else + fprintf (stderr, "(ignored)\n"); + } + + for (argn=2; argn < argc; argn++) + { + int input = open (argv[argn], O_RDONLY); + if (input == -1) + { + perror (argv[argn]); + continue; + } + else + { + char buf[17]; zzip_ssize_t n; + ZZIP_FILE* output = zzip_file_creat (dir, argv[argn], 0755); + if (! output) + { + fprintf (stderr, "|did not open %s: \n", argv[argn]); + fprintf (stderr, "|%s: %s\n", argv[argn], + zzip_strerror_of(dir)); + continue; + } + + while ((n = read (input, buf, 16))) + { + zzip_write (output, buf, n); + } + zzip_close (output); + } + close (input); + } + zzip_dir_close(dir); + + return exitcode; +} + +/* + * Local variables: + * c-file-style: "stroustrup" + * End: + */ diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zzipmake-zip.h b/Build/source/libs/zziplib/zziplib-src/bins/zzipmake-zip.h new file mode 100644 index 00000000000..b0d9da095bb --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/bins/zzipmake-zip.h @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2003 Guido Draheim <guidod@gmx.de> + * Use freely under the restrictions of the ZLIB license. + * + * This file is used as an example to clarify zzip api usage. + */ + +extern int rezzip_make(int argc, char** argv); + diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zzxorcopy.c b/Build/source/libs/zziplib/zziplib-src/bins/zzxorcopy.c index 1c06e534126..269b8fd76a7 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/zzxorcopy.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/zzxorcopy.c @@ -15,10 +15,6 @@ #include <zzip/_config.h> /* for ZZIP_VERSION */ -#ifndef O_BINARY -#define O_BINARY 0 -#endif - #if __STDC_VERSION__+0 < 199901 #define _ssize_t int #define _size_t unsigned diff --git a/Build/source/libs/zziplib/zziplib-src/bins/zzxordir.c b/Build/source/libs/zziplib/zziplib-src/bins/zzxordir.c index c1e1f141446..4c1f4ad6534 100644 --- a/Build/source/libs/zziplib/zziplib-src/bins/zzxordir.c +++ b/Build/source/libs/zziplib/zziplib-src/bins/zzxordir.c @@ -22,10 +22,6 @@ #error need posix io for this example #endif -#ifndef O_BINARY -#define O_BINARY 0 -#endif - static const char usage[] = { "zzdir <dir>.. \n" @@ -99,13 +95,13 @@ main (int argc, char ** argv) /* orignalsize / compression-type / compression-ratio / filename */ if (d->st_size > 999999) { - printf ("%5dK %-9s %2d%% %s \n", + printf ("%5dK %-9s %2d%% %s\n", d->st_size>>10, zzip_compr_str(d->d_compr), 100 - (d->d_csize|1)/((d->st_size/100)|1), d->d_name); }else{ - printf ("%6d %-9s %2d%% %s \n", + printf ("%6d %-9s %2d%% %s\n", d->st_size, zzip_compr_str(d->d_compr), 100 - (d->d_csize|1)*100/(d->st_size|1), diff --git a/Build/source/libs/zziplib/zziplib-src/docs/Makefile.am b/Build/source/libs/zziplib/zziplib-src/docs/Makefile.am index ec0dd845747..d0efaad98f4 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/Makefile.am +++ b/Build/source/libs/zziplib/zziplib-src/docs/Makefile.am @@ -50,7 +50,7 @@ install-data-local : @MAINTAINER_MODE_FALSE@ install-mans # ------------------------------------------------------------------- zziplib.spec : @top_srcdir@/$(PACKAGE).spec - @ cp $? $@ # the two zzip-doc.* will grep thru zziplib.spec + @ cp $? $@ # the two zzip-doc.* will grep through zziplib.spec doc : $(doc_FILES) site.html docs : doc manpages.tar htmpages.tar # docu : docs diff --git a/Build/source/libs/zziplib/zziplib-src/docs/Makefile.in b/Build/source/libs/zziplib/zziplib-src/docs/Makefile.in index b6a6ea453dd..740772d525f 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/Makefile.in +++ b/Build/source/libs/zziplib/zziplib-src/docs/Makefile.in @@ -552,7 +552,7 @@ install-data-local : @MAINTAINER_MODE_FALSE@ install-mans # ------------------------------------------------------------------- zziplib.spec : @top_srcdir@/$(PACKAGE).spec - @ cp $? $@ # the two zzip-doc.* will grep thru zziplib.spec + @ cp $? $@ # the two zzip-doc.* will grep through zziplib.spec doc : $(doc_FILES) site.html docs : doc manpages.tar htmpages.tar # docu : docs diff --git a/Build/source/libs/zziplib/zziplib-src/docs/README.MSVC6 b/Build/source/libs/zziplib/zziplib-src/docs/README.MSVC6 index ee042c35092..ca7d05d9cf3 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/README.MSVC6 +++ b/Build/source/libs/zziplib/zziplib-src/docs/README.MSVC6 @@ -85,7 +85,7 @@ Step 4: Customization or just ignore the value when no messages are there -> Project -> Settings -> Tab: Link -> Category: General -> "Output Filename" - e.g. "zzip-1.dll" intead of "zzip.dll" for this first generation + e.g. "zzip-1.dll" instead of "zzip.dll" for this first generation (needs also to rename dll dependencies from "zzip.lib" to "zzip-1.lib") - there are a few defines that trigger extra code in zziplib, e.g. ZZIP_HARDEN - extra sanity check for obfuscated zip files diff --git a/Build/source/libs/zziplib/zziplib-src/docs/README.SDL b/Build/source/libs/zziplib/zziplib-src/docs/README.SDL index f0fc66fee24..64173359415 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/README.SDL +++ b/Build/source/libs/zziplib/zziplib-src/docs/README.SDL @@ -84,8 +84,8 @@ NOTE and zziplib will take one of them (depending on the modes when calling zziplib). - But this didnt work for all of my original files, so I suggest using zipped - files only (and remove the original unzipped files, so zziplib doesnt try to + But this didn't work for all of my original files, so I suggest using zipped + files only (and remove the original unzipped files, so zziplib doesn't try to open the original version). diff --git a/Build/source/libs/zziplib/zziplib-src/docs/body.htm b/Build/source/libs/zziplib/zziplib-src/docs/body.htm index a2b2dba91f4..296ab4840cc 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/body.htm +++ b/Build/source/libs/zziplib/zziplib-src/docs/body.htm @@ -66,7 +66,8 @@ <small><><a href="zip-php.html"> zip-php </a></small> <hr><a href="download.html"> Download Area </a> <br><><a href="developer.html"> Developer Area </a> -<br><><a href="http://sourceforge.net/projects/zziplib"> Sourceforge Project</a> +<br><><a href="https://github.com/gdraheim/zziplib"> GitHub Project</a> +<br><><a href="http://sourceforge.net/projects/zziplib"> Old SF Project</a> <br><><a href="http://zziplib.sourceforge.net"> zziplib.sf.net <small><i>Home</i></small></a> @@ -99,5 +100,9 @@ generated <!--$today--> <br>-<a href="64on32.xml"> 64on32 extras</a> <br>-<a href="future.xml"> Next To Come</a> <br> <> </td><td> +<blockquote style="background-color: #FDB; float: right; border: 1px solid black; padding: 0.5em 2em"> + Now hosted on <a href="https://github.com/gdraheim/zziplib" + style="font-weight: bold">github.com/gdraheim/zziplib</a> +</blockquote> </td></tr></table></body></html> diff --git a/Build/source/libs/zziplib/zziplib-src/docs/configs.htm b/Build/source/libs/zziplib/zziplib-src/docs/configs.htm index 49631e673de..0191c17e0ab 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/configs.htm +++ b/Build/source/libs/zziplib/zziplib-src/docs/configs.htm @@ -83,7 +83,7 @@ </section><section> <h3> zzip-config </h3> <P> - The pkg-config ".pc" files are relativly young in the history of + The pkg-config ".pc" files are relatively young in the history of zziplib. A long time before that there was the `zzip-config` script installed in the system. These `*-config` were common before the pkg-config came about, and in fact the pkg-config @@ -147,7 +147,7 @@ </P><P> which will provide you with two autoconf/automake variables named <b><code>ZZIP_CFLAGS</code></b> and <b><code>ZZIP_LIBS</code></b> - respectivly. + respectively. </P> <P> Up to 2004, the macro in zziplib.m4 will be however carry diff --git a/Build/source/libs/zziplib/zziplib-src/docs/cpp2markdown-1.py b/Build/source/libs/zziplib/zziplib-src/docs/cpp2markdown-1.py deleted file mode 100644 index 60d28c4a0f4..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/docs/cpp2markdown-1.py +++ /dev/null @@ -1,249 +0,0 @@ -#! /usr/bin/env python -import pygments.lexers.compiled as lexer -import optparse -import re -from pygments.token import Token -import logging - -logg = logging.getLogger(__name__) - -FileComment = "FileComment" -FileInclude = "FileInclude" -FunctionComment = "FunctionComment" -FunctionPrototype = "FunctionPrototype" - -# use the markdown lexer to identify elements -# then filter only those we want. The returned -# token list is more global flagging the role -# of each token for the manual generation. -class CppToMarkdown: - def __init__(self): - self.alldefinitions = 0 - self.internaldefs = ["static"] - self.filecomment_done = "" - self.fileinclude_done = "" - self.filecomment_text = "" - self.fileinclude_text = "" - self.comment_text = "" - self.function_text = "" - self.nesting = 0 - def split_copyright(self, text): - # there are two modes - the copyright starts in the first line - # and the source description follows or the other way round. - lines = text.split("\n") - if len(lines) <= 2: - return "", text - introtext = [lines[0]] - copyright = [lines[0]] - check1 = re.compile(r"^\s[*]\s+[(][c][C][)]") - check2 = re.compile(r"^\s[*]\s+\b[Cc]opyright\b") - empty1 = re.compile(r"^\s[*]\s*$") - state = "intro" - for i in xrange(1,len(lines)-1): - line = lines[i] - if state == "intro": - if empty1.match(line): - introtext += [ line ] - continue - if check1.match(line) or check2.match(line): - state = "copyrightfirst" - copyright += [ line ] - else: - state = "introtextfirst" - introtext += [ line ] - elif state == "copyrightfirst": - if empty1.match(line): - state = "introtextlast" - introtext += [ line ] - else: - copyright += [ line ] - elif state == "introtextfirst": - if check1.match(line) or check2.match(line): - state = "copyrightlast" - copyright += [ line ] - else: - introtext += [ line ] - elif state == "copyrightlast": - copyright += [ line ] - elif state == "introtextlast": - introtext += [ line ] - else: - logg.fatal("UNKNOWN STATE %s", state) - introtext += [lines[-1]] - copyright += [lines[-1]] - logg.debug("@ COPYRIGHT\n %s", copyright) - logg.debug("@ INTROTEXT\n %s", introtext) - return "\n".join(copyright), "\n".join(introtext) - def commentblock(self, text): - prefix = re.compile(r"(?s)^\s*[/][*]+([^\n]*)(?=\n)") - suffix = re.compile(r"(?s)\n [*][/]\s*") - empty = re.compile(r"(?s)\n [*][ \t]*(?=\n)") - lines1 = re.compile(r"(?s)\n [*][ ][\t]") - lines2 = re.compile(r"(?s)\n [*][ ]") - lines3 = re.compile(r"(?s)\n [*][\t][\t]") - lines4 = re.compile(r"(?s)\n [*][\t]") - text = suffix.sub("\n", text) - text = prefix.sub("> \\1\n", text) - text = empty.sub("\n", text) - text = lines1.sub("\n ", text) - text = lines2.sub("\n", text) - text = lines3.sub("\n ", text) - text = lines4.sub("\n ", text) - return text - def functionblock(self, text): - empty = re.compile(r"(?s)\n[ \t]*(?=\n)") - text = " " + text.replace("\n", "\n ") - text = empty.sub("", text) - return text - def functionname(self, text): - check1 = re.compile(r"^[^()=]*(\b\w+)\s*[(=]") - found = check1.match(text) - if found: - return found.group(1) - check2 = re.compile(r"^[^()=]*(\b\w+)\s*$") - found = check2.match(text) - if found: - return found.group(1) - return "" - def run(self, filename): - filetext = open(filename).read() - for line in self.process(filetext, filename): - print line - def process(self, filetext, filename=""): - section_ruler = "-----------------------------------------" - copyright = "" - for token, text in self.parse(filetext): - if token == FileInclude: - yield "## SOURCE " + filename.replace("../", "") - yield " #" + text.replace("\n", "\n ") - elif token == FileComment: - yield "### INTRODUCTION" - copyright, introduction = self.split_copyright(text) - yield self.commentblock(introduction) - elif token == FunctionPrototype: - name = self.functionname(text) - yield section_ruler - yield "### " + name - # yield '<a id="%s"></a>' % name - yield "#### NAME" - yield " " + name - yield "#### SYNOPSIS" - yield self.functionblock(text) - elif token == FunctionComment: - if text: - yield "#### DESCRIPTION" - yield self.commentblock(text) - else: - if text: - yield "#### NOTES" - print token, text.replace("\n", "\n ") - if copyright: - yield section_ruler - yield "### COPYRIGHT" - yield self.commentblock(copyright) - def isexported_function(self): - function = self.function_text.strip().replace("\n"," ") - logg.debug("@ --------------------------------------") - logg.debug("@ ALLDEFINITIONS %s", self.alldefinitions) - if function.startswith("static ") and self.alldefinitions < 3: - logg.debug("@ ONLY INTERNAL %s", function) - return False - if not self.comment_text: - if not self.alldefinitions: - logg.info("@ NO COMMENT ON %s", function) - return False - else: - logg.warn("@ NO COMMENT ON %s", function) - text = self.comment_text - if text.startswith("/**"): return True - if text.startswith("/*!"): return True - if text.startswith("///"): return True - if text.startswith("//!"): return True - if self.alldefinitions >= 1: - if text.startswith("/*"): return True - if text.startswith("//"): return True - if self.alldefinitions >= 2: - return True - logg.debug("@ NO ** COMMENT %s", self.function_text.strip()) - defs = self.function_text - return False - def parse(self, filetext): - c = lexer.CLexer() - for token, text in c.get_tokens(filetext): - logg.debug("|| %s %s", token, text.replace("\n", "\n |")) - # completion - if token != Token.Comment.Preproc and self.fileinclude_done == "no": - yield FileInclude, self.fileinclude_text - if self.filecomment_text: - yield FileComment, self.filecomment_text - self.fileinclude_done = "done" - # parsing - if token == Token.Comment.Multiline: - if not self.filecomment_done: - self.filecomment_done = "done" - self.filecomment_text = text - # wait until we know it is not a function documentation - self.comment_text = text - else: - self.comment_text = text - elif token == Token.Comment.Preproc and "include" in text: - if not self.fileinclude_done: - self.fileinclude_done = "no" - self.fileinclude_text += text - self.comment_text = "" - elif token == Token.Comment.Preproc and self.fileinclude_done == "no": - if not "\n" in self.fileinclude_text: - self.fileinclude_text += text - self.comment_text = "" - elif token == Token.Comment.Preproc: - self.comment_text = "" - self.function_text = "" - elif token == Token.Operator and text == "=": - if not self.nesting and self.function_text.strip(): - if self.isexported_function(): - yield FunctionPrototype, self.function_text - yield FunctionComment, self.comment_text - self.comment_text = "" - self.function_text = "" - elif token == Token.Punctuation and text == ";": - self.comment_text = "" - self.function_text = "" - elif token == Token.Punctuation and text == "{": - if not self.nesting and self.function_text.strip(): - if self.isexported_function(): - yield FunctionPrototype, self.function_text - yield FunctionComment, self.comment_text - self.comment_text = "" - self.function_text = "" - self.nesting += 1 - elif token == Token.Punctuation and text == "}": - self.nesting -= 1 - self.comment_text = "" - self.function_text = "" - else: - if not self.nesting: - self.function_text += text - else: - pass # yield "|",text - - -if __name__ == "__main__": - _o = optparse.OptionParser() - _o.add_option("-v", "--verbose", action="count", default=0) - _o.add_option("-a", "--all", action="count", default=0, - help="include all definitions in the output (not only /**)") - opt, args = _o.parse_args() - - logg.addHandler(logging.StreamHandler()) - if opt.verbose: - logg.setLevel(logging.WARN - 10 * opt.verbose) - - c = CppToMarkdown() - if opt.all: - c.alldefinitions = opt.all - for arg in args: - c.run(arg) - - - - diff --git a/Build/source/libs/zziplib/zziplib-src/docs/cpp2markdown.py b/Build/source/libs/zziplib/zziplib-src/docs/cpp2markdown.py deleted file mode 100644 index 710bbdc2437..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/docs/cpp2markdown.py +++ /dev/null @@ -1,195 +0,0 @@ -import pygments.lexers.compiled as lexer -import optparse -import re -from pygments.token import Token -import logging - -logg = logging.getLogger(__name__) - -FileComment = "FileComment" -FileInclude = "FileInclude" -FunctionComment = "FunctionComment" -FunctionPrototype = "FunctionPrototype" - -# use the markdown lexer to identify elements -# then filter only those we want. The returned -# token list is more global flagging the role -# of each token for the manual generation. -class CppToMarkdown: - def __init__(self): - self.alldefinitions = 0 - self.internaldefs = ["static"] - self.filecomment_done = "" - self.fileinclude_done = "" - self.filecomment_text = "" - self.fileinclude_text = "" - self.comment_text = "" - self.function_text = "" - self.nesting = 0 - def commentblock(self, text): - emptyprefix = re.compile(r"(?s)^\s*[/][*]+[ \t]*(?=\n)") - prefix = re.compile(r"(?s)^\s*[/][*]+([^\n]*)(?=\n)") - suffix = re.compile(r"(?s)\n [*][/]\s*") - empty = re.compile(r"(?s)\n [*][ \t]*(?=\n)") - lines1 = re.compile(r"(?s)\n [*][ ][\t]") - lines2 = re.compile(r"(?s)\n [*][ ]") - lines3 = re.compile(r"(?s)\n [*][\t][\t]") - lines4 = re.compile(r"(?s)\n [*][\t]") - text = suffix.sub("\n", text) - text = emptyprefix.sub("", text) - text = prefix.sub("> \\1\n", text) - text = empty.sub("\n", text) - text = lines1.sub("\n ", text) - text = lines2.sub("\n", text) - text = lines3.sub("\n ", text) - text = lines4.sub("\n ", text) - return text - def functionblock(self, text): - empty = re.compile(r"(?s)\n[ \t]*(?=\n)") - text = " " + text.replace("\n", "\n ") - text = empty.sub("", text) - return text - def functionname(self, text): - check1 = re.compile(r"^[^()=]*(\b\w+)\s*[(=]") - found = check1.match(text) - if found: - return found.group(1) - check2 = re.compile(r"^[^()=]*(\b\w+)\s*$") - found = check2.match(text) - if found: - return found.group(1) - return "" - def run(self, filename): - filetext = open(filename).read() - for line in self.process(filetext, filename): - print line - def process(self, filetext, filename=""): - for token, text in self.parse(filetext): - if token == FileInclude: - yield "## SOURCE " + filename.replace("../", "") - yield " #" + text.replace("\n", "\n ") - elif token == FileComment: - yield "## INTRODUCTION" - yield self.commentblock(text) - elif token == FunctionPrototype: - name = self.functionname(text) - yield "-----------------------------------------" - yield "### " + name - yield "#### NAME" - yield " " + name - yield "#### SYNOPSIS" - yield self.functionblock(text) - elif token == FunctionComment: - if text: - yield "#### DESCRIPTION" - yield self.commentblock(text) - else: - if text: - yield "#### NOTES" - print token, text.replace("\n", "\n ") - def isexported_function(self): - function = self.function_text.strip().replace("\n"," ") - logg.debug("@ --------------------------------------") - logg.debug("@ ALLDEFINITIONS %s", self.alldefinitions) - if function.startswith("static ") and self.alldefinitions < 3: - logg.debug("@ ONLY INTERNAL %s", function) - return False - if not self.comment_text: - if not self.alldefinitions: - logg.info("@ NO COMMENT ON %s", function) - return False - else: - logg.warn("@ NO COMMENT ON %s", function) - text = self.comment_text - if text.startswith("/**"): return True - if text.startswith("/*!"): return True - if text.startswith("///"): return True - if text.startswith("//!"): return True - if self.alldefinitions >= 1: - if text.startswith("/*"): return True - if text.startswith("//"): return True - if self.alldefinitions >= 2: - return True - logg.debug("@ NO ** COMMENT %s", self.function_text.strip()) - defs = self.function_text - return False - def parse(self, filetext): - c = lexer.CLexer() - for token, text in c.get_tokens(filetext): - logg.debug("|| %s %s", token, text.replace("\n", "\n |")) - # completion - if token != Token.Comment.Preproc and self.fileinclude_done == "no": - yield FileInclude, self.fileinclude_text - if self.filecomment_text: - yield FileComment, self.filecomment_text - self.fileinclude_done = "done" - # parsing - if token == Token.Comment.Multiline: - if not self.filecomment_done: - self.filecomment_done = "done" - self.filecomment_text = text - # wait until we know it is not a function documentation - self.comment_text = text - else: - self.comment_text = text - elif token == Token.Comment.Preproc and "include" in text: - if not self.fileinclude_done: - self.fileinclude_done = "no" - self.fileinclude_text += text - self.comment_text = "" - elif token == Token.Comment.Preproc and self.fileinclude_done == "no": - if not "\n" in self.fileinclude_text: - self.fileinclude_text += text - self.comment_text = "" - elif token == Token.Comment.Preproc: - self.comment_text = "" - self.function_text = "" - elif token == Token.Operator and text == "=": - if not self.nesting and self.function_text.strip(): - if self.isexported_function(): - yield FunctionPrototype, self.function_text - yield FunctionComment, self.comment_text - self.comment_text = "" - self.function_text = "" - elif token == Token.Punctuation and text == ";": - self.comment_text = "" - self.function_text = "" - elif token == Token.Punctuation and text == "{": - if not self.nesting and self.function_text.strip(): - if self.isexported_function(): - yield FunctionPrototype, self.function_text - yield FunctionComment, self.comment_text - self.comment_text = "" - self.function_text = "" - self.nesting += 1 - elif token == Token.Punctuation and text == "}": - self.nesting -= 1 - self.comment_text = "" - self.function_text = "" - else: - if not self.nesting: - self.function_text += text - else: - pass # yield "|",text - - -if __name__ == "__main__": - _o = optparse.OptionParser() - _o.add_option("-v", "--verbose", action="count", default=0) - _o.add_option("-a", "--all", action="count", default=0, - help="include all definitions in the output (not only /**)") - opt, args = _o.parse_args() - - logg.addHandler(logging.StreamHandler()) - if opt.verbose: - logg.setLevel(logging.WARN - 10 * opt.verbose) - - c = CppToMarkdown() - if opt.all: - c.alldefinitions = opt.all - for arg in args: - c.run(arg) - - - - diff --git a/Build/source/libs/zziplib/zziplib-src/docs/developer.htm b/Build/source/libs/zziplib/zziplib-src/docs/developer.htm index 9c964f09933..7b65b950455 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/developer.htm +++ b/Build/source/libs/zziplib/zziplib-src/docs/developer.htm @@ -20,7 +20,7 @@ </P> <P> I was using the sourceforge compilefarm to do remote testing of - releses for crossplatform compatibility. This included usually + releases for crossplatform compatibility. This included usually some unix compatible platforms such as Linux, Solaris, FreeBSD, Darwin/MacOSX including i386, amd64, sparc, sparc64, powerpc when available. Even the latest daytoday cvs snapshots diff --git a/Build/source/libs/zziplib/zziplib-src/docs/dir-zzip-192.png b/Build/source/libs/zziplib/zziplib-src/docs/dir-zzip-192.png Binary files differdeleted file mode 100644 index 2207e825182..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/docs/dir-zzip-192.png +++ /dev/null diff --git a/Build/source/libs/zziplib/zziplib-src/docs/dir-zzip-64.png b/Build/source/libs/zziplib/zziplib-src/docs/dir-zzip-64.png Binary files differdeleted file mode 100644 index c98b192c11e..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/docs/dir-zzip-64.png +++ /dev/null diff --git a/Build/source/libs/zziplib/zziplib-src/docs/download.htm b/Build/source/libs/zziplib/zziplib-src/docs/download.htm index d52111155fc..0b1c9a06123 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/download.htm +++ b/Build/source/libs/zziplib/zziplib-src/docs/download.htm @@ -13,7 +13,7 @@ All source releases and some binary releases are listed at the sourceforge download area under the link show above. The sourceforge file area is replicated all over the world and should be accessible - with highest bandwith in all corners of the world. + with highest bandwidth in all corners of the world. </P> </section><section> diff --git a/Build/source/libs/zziplib/zziplib-src/docs/faq.htm b/Build/source/libs/zziplib/zziplib-src/docs/faq.htm index 56d79366655..0f2deb23fc5 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/faq.htm +++ b/Build/source/libs/zziplib/zziplib-src/docs/faq.htm @@ -30,7 +30,7 @@ decades including the age when the ZIP file format was invented. The first instances of pkware's zip compressor were used on DOS with a codepage 437 which has a way different encoding for the upper plane - than todays latin-1 encoding which in fact used in <em>all</em> + than today's latin-1 encoding which in fact used in <em>all</em> modern operating systems. So what really see is a mismatch of character encodings that you are used to. </P><P> diff --git a/Build/source/libs/zziplib/zziplib-src/docs/functions.htm b/Build/source/libs/zziplib/zziplib-src/docs/functions.htm index 1ded1f47d66..c69f56c937f 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/functions.htm +++ b/Build/source/libs/zziplib/zziplib-src/docs/functions.htm @@ -15,7 +15,7 @@ </ul> <P> - Additonally, there is a complete set of unpacked documentation - the + Additionally, there is a complete set of unpacked documentation - the unix manual pages are translated to html manual pages. </P> diff --git a/Build/source/libs/zziplib/zziplib-src/docs/make-doc.py b/Build/source/libs/zziplib/zziplib-src/docs/make-doc.py index c58427c4a5c..f12553fa32e 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/make-doc.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/make-doc.py @@ -692,7 +692,7 @@ class RefPage: return copyright # !!! return "" def seealso_text(page): - """ the last section on a manpage is called 'SEE ALSO' usally and + """ the last section on a manpage is called 'SEE ALSO' usually and contains a comma-separated list of references. Some manpage viewers can parse these and convert them into hyperlinks """ if page.seealso: diff --git a/Build/source/libs/zziplib/zziplib-src/docs/site.htm b/Build/source/libs/zziplib/zziplib-src/docs/site.htm deleted file mode 100644 index 6f4e4e65066..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/docs/site.htm +++ /dev/null @@ -1,68 +0,0 @@ -<html><head><title>zziplib</title> - <style> - a:link { text-decoration : none ; color : #000080 ; } - a:visited { text-decoration : none ; color : #200060 ; } - .justify { text-align : justify ; } - </style> -</head><body> - -<table width="100%"><tr valign="top"><td bgcolor="#F0F0F0" width="145"> -<center> - <big><big><big><b> - <font color="#800080"><sup>Z</sup>ZIP<sub>lib</sub></font> - </b></big></big></big> -<br><big><b> <!--VERSION--> </b></big> -</center> -<hr> <a href="zzip-index.html">Library</a> -<br>-<a href="zzip-zip.html">ZIP Access</a> -<br>-<a href="zzip-file.html">Transparently</a> -<br>-<a href="zzip-sdl-rwops.html">SDLrwops Example</a> -<br>-<a href="zzip-extio.html">ext/io Customization</a> -<br>-<a href="zzip-xor.html">xor/io Obfuscation</a> -<br>-<a href="zzip-api.html">Library API</a> -<br>-<a href="zzip-parse.html">Parsing ZIPs</a> -<br>-<a href="64on32.html">64on32 extras</a> -<br>-<a href="future.html">Next To Come</a> -<br>-<a href="configs.html">Config Helpers</a> -<br>-<a href="sfx-make.html">Making a zip/exe</a> -<br>-<a href="history.html">Hints And Links</a> -<br>-<a href="referentials.html">Referentials</a> -<br> -<a href="zziplib.html">Functions List #</a> -<!--START--> -<br> -<a href="man/index.html">The Manual Pages #</a> -<!--ENDS--> - -<br>    <small>(# autogenerated)</small> - -<br> <hr> - -<br><b><a alt="Tarballs, RPM-archive and windll-ZIPs can be downloaded from" - href="http://sourceforge.net/project/showfiles.php?group_id=6389"> - Download Area *</a></b> -<br><a alt="Sourceforge Project CVS web access" - href="http://zziplib.svn.sourceforge.net/viewvc/zziplib/">Sourceforge SVN</a> -<br><a alt="Sourceforge Project Index Page" - href="http://sourceforge.net/projects/zziplib">Sourceforge Project</a> -<br><a alt="the zziplib webpage at sourceforge" - href="http://zziplib.sourceforge.net">zziplib.sf.net - <small><i>Home</i></small></a> - -<br><small><a alt="zziplib - license details" - href="copying.html">LGPL/MPL license</a></small> -<br> -<hr> -<center><!--START--> - <a href="http://sourceforge.net/project/?group_id=6389"> - <img src="http://sourceforge.net/sflogo.php?group_id=6389&type=2" - border="0" alt="sourceforge.net" width="125" height="37"> - </a> -</center><!--ENDS--> - -<p align="right"><small> -generated <!--DATE--> -</small> -<br> <small>(C)</small> Guido Draheim -<br><i> guidod<small>@</small>gmx.de</i> -</p> - -</td><td> diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzip-api.htm b/Build/source/libs/zziplib/zziplib-src/docs/zzip-api.htm index 79bed1401d4..92a42a7ef87 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzip-api.htm +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzip-api.htm @@ -4,7 +4,7 @@ <!--border--> <P> - The zzip library was orginally developped by Tomi Ollila as a + The zzip library was originally developed by Tomi Ollila as a set of zip decoder routines. Guido Draheim did pick it up and wrapped them under a call synopsis matching their posix api calls. Therefore <code>zzip_open()</code> has the same diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzip-basics.htm b/Build/source/libs/zziplib/zziplib-src/docs/zzip-basics.htm index 0d0504710e7..bf603f2fe36 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzip-basics.htm +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzip-basics.htm @@ -58,7 +58,7 @@ <tr><td width=50%> zzip_dir_close </td> <td width=50%> close a zip-file and free the memory shadow</td></tr> <tr><td width=50%> zzip_dir_fdopen </td> - <td width=50%> aquire the given posix-file and try to parse it + <td width=50%> acquire the given posix-file and try to parse it as a zip-file.</td></tr> <tr><td width=50%> zzip_dir_read </td> <td width=50%> return the next info entry of a zip-file's central @@ -119,7 +119,7 @@ <table cellpadding=10 width=100%><tr><td><table border=1 width=100%> <tr><td width=50%> zzip_open </td> <td width=50%> try the file-path as a real-file, and if not - there, look for the existance of ZZIP_DIR by + there, look for the existence of ZZIP_DIR by applying extensions, and open the file contained within that one.</td></tr> <tr><td width=50%> zzip_close </td> diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzip-extio.htm b/Build/source/libs/zziplib/zziplib-src/docs/zzip-extio.htm index c7c47f1a37d..229dd030f9a 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzip-extio.htm +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzip-extio.htm @@ -40,7 +40,7 @@ Other wishes on <a href="zziplib.html">zziplib</a> circulated around <a href="zzip-xor.html">obfuscation</a> or access to zip-files wrapped in other data areas including encrpyted resources from other applications. - This has been adressed with the IO-handlers that you can explicitly + This has been addressed with the IO-handlers that you can explicitly submit to the *_ext_io functions - the default will be posix-IO open/read/write and seek/tell. An application using <a href="zziplib.html">zziplib</a> can divert these to its own set of @@ -81,7 +81,7 @@ static zzip_strings_t my_ext[] = { ".zip", ".ZIP", "", 0 }; </pre> </P><P> - And last not least, people want to tell the libary to not try to + And last not least, people want to tell the library to not try to open a real file that lives side by side with the same path as the file path that can be matched by the zziplib. Actually, the magic wrappers were never meant to be used like - the developer should @@ -90,7 +90,7 @@ the magic-wrappers look rather more familiar, and so you will find now a bit-option ZZIP_ONLYZIP that can be passed down to the _ext_io variants of the magic-wrapper calls, and a real-file will never get - tested for existance. Actually, I would rather recommend that for + tested for existence. Actually, I would rather recommend that for application data the option ZZIP_PREFERZIP, so that one can enter debugging mode by unpacking the zip-file as a real directory tree in the place of the original zip. @@ -176,8 +176,8 @@ structure for usage within the <code>zzip_read</code> calls. </P><P> This adds just a few bytes to the libs and just consumes additional - cpu cycles that can be rightfully called to be negligable (unlike - most commerical vendors will tell you when they indeed want to + cpu cycles that can be rightfully called to be negligible (unlike + most commercial vendors will tell you when they indeed want to tell you that for soooo many new features you have to pay a price). It makes for greater variability without adding fatness to the core in the default case, this is truly efficient I'd say. Well, diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzip-file.htm b/Build/source/libs/zziplib/zziplib-src/docs/zzip-file.htm index 241baef85a7..2661fce73cf 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzip-file.htm +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzip-file.htm @@ -113,7 +113,7 @@ <P> What the current of version of the <a href="zziplib.html">zziplib library</a> - can definitly not do: calling zzip_opendir on a directory zippend + can definitely not do: calling zzip_opendir on a directory zippend <em>inside</em> a zip-file. </P> <P> diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzip-index.htm b/Build/source/libs/zziplib/zziplib-src/docs/zzip-index.htm index 8b7a9bb6637..f48bdb8ed2f 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzip-index.htm +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzip-index.htm @@ -26,7 +26,7 @@ </dd> <dt>replacement mode:</dt> <dd> Use ZZIP_FILE / ZZIP_DIR pointers provided by zziplib and - put them to work with routines originally developped to + put them to work with routines originally developed to work with real directories and file handles. The API calls do follow traditional synopsis from posix/stdio. </dd> diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzip-sdl-rwops.htm b/Build/source/libs/zziplib/zziplib-src/docs/zzip-sdl-rwops.htm index 38923f6f0be..539165490d2 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzip-sdl-rwops.htm +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzip-sdl-rwops.htm @@ -23,7 +23,7 @@ <a href="SDL_rwops_zzip.c">SDL_rwops_zzip.c</a> to the directory with your other project sources, and make sure to link it somehow to your programs. I did not make the effort to - create a seperate library out of it - it would just export one + create a separate library out of it - it would just export one single function <tt>SDL_RWFromZZIP</tt> that has the same call-synopsis like <tt>SDL_RWFromFile</tt> (but it can not (yet) write a zip-file). </P> diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzip-zip.htm b/Build/source/libs/zziplib/zziplib-src/docs/zzip-zip.htm index 141700044a5..7297b5a10e5 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzip-zip.htm +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzip-zip.htm @@ -28,7 +28,7 @@ <P> Before a file in the zip-archive is accessed, the application must first get a handle to the central directory contained in the - zip-file. This is achived by calling + zip-file. This is achieved by calling <a href="zziplib.html#zzip_dir_open"> zzip_dir_open </a> or <a href="zziplib.html#zzip_dir_fdopen"> zzip_dir_fdopen </a>. @@ -84,7 +84,7 @@ <a href="zziplib.html">zziplib library</a>. </P> <P> - The magic functions are described in a seperated document on + The magic functions are described in a separated document on <a href="zzip-file.html"> Using Zipped Files </a>. In general, the functions have a prefix <tt>zzip_</tt> and their argument types have a prefix <tt>ZZIP_</tt> where appropriate. Calls @@ -99,10 +99,10 @@ <a href="zziplib.html#zzip_dir_real"> zzip_dir_real </a> can be used. If these return a true value, the standard posix functions - are more apropriate. The posix handles can be obtained with + are more appropriate. The posix handles can be obtained with a call to <a href="zziplib.html#zzip_realdir"> zzip_realdir </a> and - <a href="zziplib.html#zzip_realfd"> zzip_realfd </a> respectivly. + <a href="zziplib.html#zzip_realfd"> zzip_realfd </a> respectively. </P> </section><section> diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionlistreference.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionlistreference.py index 944d005c6fb..c38ff0a3d80 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionlistreference.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/functionlistreference.py @@ -217,7 +217,7 @@ class FunctionListRefEntry: return copyright # !!! return "" def seealso_text(self): - """ the last section on a manpage is called 'SEE ALSO' usally and + """ the last section on a manpage is called 'SEE ALSO' usually and contains a comma-separated list of references. Some manpage viewers can parse these and convert them into hyperlinks """ if self.seealso: diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/textfileheader.py b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/textfileheader.py index 2ac0896e5fd..ceaa28e9908 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/textfileheader.py +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipdoc/textfileheader.py @@ -17,7 +17,7 @@ class TextFileHeader: x = Match() text = self.textfile.get_src_text() if not text: - print "nonexistant file:", self.textfile.get_filename() + print "nonexistent file:", self.textfile.get_filename() return False if text & x(r"(?s)[/][*]+(\s(?:.(?!\*\/))*.)\*\/" r"(?:\s*\#(?:define|ifdef|endif)[ ]*\S*[ ]*\S*)*" diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipfseeko.html b/Build/source/libs/zziplib/zziplib-src/docs/zzipfseeko.html new file mode 100644 index 00000000000..1b16024103d --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipfseeko.html @@ -0,0 +1,184 @@ +<html><head><title>zziplib Library Functions</title> +</head><body> +<h2>zziplib Library Functions</h2><p>Version 0.13.68</p><p><big><b><code>#include <zzip/fseeko.h></code></b></big></p><table width="100%"><tr><td valign="top"><code><b><code><a href="#zzip_entry_fopen">zzip_entry_fopen</a></code></b>(ZZIP_ENTRY * entry, int takeover) + : zzip__new__ ZZIP_ENTRY_FILE * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_entry_ffile">zzip_entry_ffile</a></code></b>(FILE * disk, char *filename) + : zzip__new__ ZZIP_ENTRY_FILE * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_entry_fread">zzip_entry_fread</a></code></b>(void *ptr, zzip_size_t sized, zzip_size_t nmemb, + ZZIP_ENTRY_FILE * file) + : zzip_size_t +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_entry_fclose">zzip_entry_fclose</a></code></b>(ZZIP_ENTRY_FILE * file) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_entry_feof">zzip_entry_feof</a></code></b>(ZZIP_ENTRY_FILE * file) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_entry_data_offset">zzip_entry_data_offset</a></code></b>(ZZIP_ENTRY * entry) + : zzip_off_t +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_entry_fread_file_header">zzip_entry_fread_file_header</a></code></b>(ZZIP_ENTRY * entry, + struct zzip_file_header *file_header) + : static zzip_off_t +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_entry_strdup_name">zzip_entry_strdup_name</a></code></b>(ZZIP_ENTRY * entry) + : zzip__new__ char * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_entry_findfile">zzip_entry_findfile</a></code></b>(FILE * disk, char *filename, + ZZIP_ENTRY * _zzip_restrict entry, zzip_strcmp_fn_t compare) + : zzip__new__ ZZIP_ENTRY * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_entry_findfirst">zzip_entry_findfirst</a></code></b>(FILE * disk) + : zzip__new__ ZZIP_ENTRY * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_entry_findnext">zzip_entry_findnext</a></code></b>(ZZIP_ENTRY * _zzip_restrict entry) + : zzip__new__ ZZIP_ENTRY * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_entry_free">zzip_entry_free</a></code></b>(ZZIP_ENTRY * entry) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_entry_findmatch">zzip_entry_findmatch</a></code></b>(FILE * disk, char *filespec, + ZZIP_ENTRY * _zzip_restrict entry, + zzip_fnmatch_fn_t compare, int flags) + : zzip__new__ ZZIP_ENTRY * +</code></td></tr></table><h3>Documentation</h3><dl><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_entry_fopen">zzip_entry_fopen</a></b>(ZZIP_ENTRY * entry, int takeover) + : zzip__new__ ZZIP_ENTRY_FILE * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_entry_ffile">zzip_entry_ffile</a></b>(FILE * disk, char *filename) + : zzip__new__ ZZIP_ENTRY_FILE * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_entry_fread">zzip_entry_fread</a></b>(void *ptr, zzip_size_t sized, zzip_size_t nmemb, + ZZIP_ENTRY_FILE * file) + : zzip_size_t +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_entry_fclose">zzip_entry_fclose</a></b>(ZZIP_ENTRY_FILE * file) + : int +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_entry_feof">zzip_entry_feof</a></b>(ZZIP_ENTRY_FILE * file) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em> open a file within a zip disk for reading</em> </td><td align="right"> <em><small>zzip/fseeko.c</small></em></td></table><p> + The <code>zzip_entry_fopen</code> function does take an "entry" argument and copies it (or just takes + it over as owner) to a new ZZIP_ENTRY_FILE handle structure. That + structure contains also a zlib buffer for decoding. The <code>zzip_entry_fopen</code> function does + seek to the file_header of the given "entry" and validates it for the + data buffer following it. We do also prefetch some data from the data + buffer thereby trying to match the disk pagesize for faster access later. + The <code><a href="#zzip_entry_fread">zzip_entry_fread</a></code> will then read in chunks of pagesizes which is + the size of the internal readahead buffer. If an error occurs then null + is returned. +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_entry_ffile</code> function opens a file found by name, so it does a search into + the zip central directory with <code><a href="#zzip_entry_findfile">zzip_entry_findfile</a></code> and whatever + is found first is given to <code><a href="#zzip_entry_fopen">zzip_entry_fopen</a></code> +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_entry_fread</code> function reads more bytes into the output buffer specified as + arguments. The return value is null on eof or error, the stdio-like + interface can not distinguish between these so you need to check + with <code><a href="#zzip_entry_feof">zzip_entry_feof</a></code> for the difference. +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_entry_fclose</code> function releases any zlib decoder info needed for decompression + and dumps the ZZIP_ENTRY_FILE struct then. +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_entry_feof</code> function allows to distinguish an error from an eof condition. + Actually, if we found an error but we did already reach eof then we + just keep on saying that it was an eof, so the app can just continue. +</p> +</td></tr></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_entry_data_offset">zzip_entry_data_offset</a></b>(ZZIP_ENTRY * entry) + : zzip_off_t +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_entry_fread_file_header">zzip_entry_fread_file_header</a></b>(ZZIP_ENTRY * entry, + struct zzip_file_header *file_header) + : static zzip_off_t +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_entry_strdup_name">zzip_entry_strdup_name</a></b>(ZZIP_ENTRY * entry) + : zzip__new__ char * +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em> helper functions for (fseeko) zip access api</em> </td><td align="right"> <em><small>zzip/fseeko.c</small></em></td></table><p> + The <code>zzip_entry_data_offset</code> functions returns the seekval offset of the data portion of the + file referenced by the given zzip_entry. It requires an intermediate + check of the file_header structure (i.e. it reads it from disk). After + this call, the contained diskfile readposition is already set to the + data_offset returned here. +</p><p>The <code>zzip_entry_data_offset</code> function + Returns -1 on error. (errno = EINVAL|EBADMSG) +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_entry_fread_file_header</code> functions read the correspoding struct zzip_file_header from + the zip disk of the given "entry". The returned off_t points to the + end of the file_header where the current fseek pointer has stopped. + This is used to immediately parse out any filename/extras block following + the file_header. +</p><p>The <code>zzip_entry_fread_file_header</code> function + Returns zero on error. (errno = EINVAL|EBADMSG|EBADF|EIO) +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_entry_strdup_name</code> function is a big helper despite its little name: in a zip file the + encoded filenames are usually NOT zero-terminated but for common usage + with libc we need it that way. Secondly, the filename SHOULD be present + in the zip central directory but if not then we fallback to the filename + given in the file_header of each compressed data portion. +</p><p> + returns: new string buffer, null on error (errno = EINVAL|ENOMEM|EBADMSG) +</p> +</td></tr></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_entry_findfile">zzip_entry_findfile</a></b>(FILE * disk, char *filename, + ZZIP_ENTRY * _zzip_restrict entry, zzip_strcmp_fn_t compare) + : zzip__new__ ZZIP_ENTRY * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_entry_findfirst">zzip_entry_findfirst</a></b>(FILE * disk) + : zzip__new__ ZZIP_ENTRY * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_entry_findnext">zzip_entry_findnext</a></b>(ZZIP_ENTRY * _zzip_restrict entry) + : zzip__new__ ZZIP_ENTRY * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_entry_free">zzip_entry_free</a></b>(ZZIP_ENTRY * entry) + : int +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_entry_findmatch">zzip_entry_findmatch</a></b>(FILE * disk, char *filespec, + ZZIP_ENTRY * _zzip_restrict entry, + zzip_fnmatch_fn_t compare, int flags) + : zzip__new__ ZZIP_ENTRY * +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em> search for files in the (fseeko) zip central directory</em> </td><td align="right"> <em><small>zzip/fseeko.c</small></em></td></table><p> + The <code>zzip_entry_findfile</code> function is given a filename as an additional argument, to find the + disk_entry matching a given filename. The compare-function is usually + strcmp or strcasecmp or perhaps strcoll, if null then strcmp is used. + - use null as argument for "old"-entry when searching the first + matching entry, otherwise the last returned value if you look for other + entries with a special "compare" function (if null then a doubled search + is rather useless with this variant of _findfile). If no further entry is + found then null is returned and any "old"-entry gets already free()d. +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_entry_findfirst</code> function is the first call of all the zip access functions here. + It contains the code to find the first entry of the zip central directory. + Here we require the stdio handle to represent a real zip file where the + disk_trailer is _last_ in the file area, so that its position would be at + a fixed offset from the end of the file area if not for the comment field + allowed to be of variable length (which needs us to do a little search + for the disk_tailer). However, in this simple implementation we disregard + any disk_trailer info telling about multidisk archives, so we just return + a pointer to the first entry in the zip central directory of that file. +</p><p> + For an actual means, we are going to search backwards from the end + of the mmaped block looking for the PK-magic signature of a + disk_trailer. If we see one then we check the rootseek value to + find the first disk_entry of the root central directory. If we find + the correct PK-magic signature of a disk_entry over there then we + assume we are done and we are going to return a pointer to that label. +</p><p> + The return value is a pointer to the first zzip_disk_entry being checked + to be within the bounds of the file area specified by the arguments. If + no disk_trailer was found then null is returned, and likewise we only + accept a disk_trailer with a seekvalue that points to a disk_entry and + both parts have valid PK-magic parts. Beyond some sanity check we try to + catch a common brokeness with zip archives that still allows us to find + the start of the zip central directory. +</p><p>The <code>zzip_entry_findfirst</code> function + Returns null on error (errno = EINVAL|ENOMEM|EBADMSG|EBADF|ENOENT) +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_entry_findnext</code> function takes an existing "entry" in the central root directory + (e.g. from zzip_entry_findfirst) and moves it to point to the next entry. + On error it returns 0, otherwise the old entry. If no further match is + found then null is returned and the entry already free()d. If you want + to stop searching for matches before that case then please call + <code><a href="#zzip_entry_free">zzip_entry_free</a></code> on the cursor struct ZZIP_ENTRY. +</p> +</td></tr><tr><td valign="top"><p> the <code>zzip_entry_free</code> function releases the malloc()ed areas needed for zzip_entry, the + pointer is invalid afterwards. The <code>zzip_entry_free</code> function has #define synonyms of + zzip_entry_findlast(), zzip_entry_findlastfile(), zzip_entry_findlastmatch() +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_entry_findmatch</code> function uses a compare-function with an additional argument + and it is called just like fnmatch(3) from POSIX.2 AD:1993), i.e. + the argument filespec first and the ziplocal filename second with + the integer-flags put in as third to the indirect call. If the + platform has fnmatch available then null-compare will use that one + and otherwise we fall back to mere strcmp, so if you need fnmatch + searching then please provide an implementation somewhere else. + - use null as argument for "after"-entry when searching the first + matching entry, or the last disk_entry return-value to find the + next entry matching the given filespec. If no further entry is + found then null is returned and any "old"-entry gets already free()d. +</p> +</td></tr></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd></dl> +</body></html> diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zziplib-manpages.tar b/Build/source/libs/zziplib/zziplib-src/docs/zziplib-manpages.tar Binary files differnew file mode 100644 index 00000000000..aa567cca6c8 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/docs/zziplib-manpages.tar diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zziplib.html b/Build/source/libs/zziplib/zziplib-src/docs/zziplib.html index a73f26f7942..a67583520d6 100644 --- a/Build/source/libs/zziplib/zziplib-src/docs/zziplib.html +++ b/Build/source/libs/zziplib/zziplib-src/docs/zziplib.html @@ -1,1255 +1,464 @@ -<html><head><title>zziplib - </title> - <style> - a:link { text-decoration : none ; color : #000080 ; } - a:visited { text-decoration : none ; color : #200060 ; } - .justify { text-align : justify ; } - </style> +<html><head><title>zziplib Library Functions</title> </head><body> - -<table width="100%"><tr valign="top"><td bgcolor="#F0F0F0" width="145"> -<center> - <big><big><big><b> - <font color="#800080"><sup>Z</sup>ZIP<sub>lib</sub></font> - </b></big></big></big> -<br><big><b> 0.13.24 </b></big> -</center> -<hr> - -<br> <a alt="zzip-index - Overview" - href="zzip-index.html">Library</a> -<br>-<a alt="zzip-zip - Accessing Zip Archives with ZLib Decompression" - href="zzip-zip.html">ZIP Access</a> -<br>-<a alt="zzip-file - Using Zipped Files Transparently" - href="zzip-file.html">Transparently</a> -<br>-<a alt="zzip-sdl-rwops - Example to make an SDL_rwops Inteface" - href="zzip-sdl-rwops.html">SDLrwops Example</a> -<br>-<a alt="zzip-extio - Customizing the file access" - href="zzip-extio.html">ext/io Customization</a> -<br>-<a alt="zzip-xor - Using obfuscations like xor" - href="zzip-xor.html">xor/io Obfuscation</a> -<br>-<a alt="zzip-api - The complete API description" - href="zzip-api.html">Library API</a> -<br>-<a alt="zzip-parse - About zip parsing internals" - href="zzip-parse.html">Parsing ZIPs</a> -<br>-<a alt="64on32 - About largefile problems" - href="64on32.html">64on32 extras</a> -<br>-<a alt="future - What next to come" - href="future.html">Next To Come</a> -<br>-<a alt="configs - To Configure Your zziplib-based software" - href="configs.html">Config Helpers</a> -<br>-<a alt="sfx-make - to combine an EXE with a ZIP archive" - href="sfx-make.html">Making a zip/exe</a> -<br>-<a alt="history - Hints And Links" - href="history.html">Hints And Links</a> -<br>-<a alt="referentials - Where it is used" - href="referentials.html">Referentials</a> -<br>-<a alt="zziplib - The Functions List (autogenerated)" - href="zziplib.html">Functions List #</a> -<!--START--> -<br>-<a alt="zzip/man - The Manual Pages (autogenerated)" - href="man/index.html">The Manual Pages #</a> -<!--ENDS--> - -<br>    <small>(# autogenerated)</small> - -<br> <hr> - -<br><b><a alt="Tarballs, RPM-archive and windll-ZIPs can be downloaded from" - href="http://sourceforge.net/project/showfiles.php?group_id=6389"> - Download Area *</a></b> -<br><a alt="Sourceforge Project Index Page" - href="http://sourceforge.net/projects/zziplib">Sourceforge Project</a> -<br><a alt="the zziplib webpage at sourceforge" - href="http://zziplib.sourceforge.net">zziplib.sf.net - <small><i>Home</i></small></a> - -<br><small><a alt="zziplib - license details" - href="copying.html">LGPL/MPL license</a></small> -<br> -<hr> -<center><!--START--> - <a href="http://sourceforge.net/project/?group_id=6389"> - <img src="http://sourceforge.net/sflogo.php?group_id=6389&type=2" - border="0" alt="sourceforge.net" width="125" height="37"> - </a> -</center><!--ENDS--> - -<p align="right"><small> -generated 2003-12-12 -</small> -<br> <small>(C)</small> Guido Draheim -<br><i> guidod<small>@</small>gmx.de</i> +<h2>zziplib Library Functions</h2><p>Version 0.13.68</p><p><big><b><code>#include <zzip/lib.h></code></b></big></p><table width="100%"><tr><td valign="top"><code><b><code><a href="#zzip_error">zzip_error</a></code></b>(ZZIP_DIR * dir) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_seterror">zzip_seterror</a></code></b>(ZZIP_DIR * dir, int errcode) : void +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_open">zzip_open</a></code></b>(zzip_char_t * filename, int o_flags) + : ZZIP_FILE * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_open_ext_io">zzip_open_ext_io</a></code></b>(zzip_char_t * filename, int o_flags, int o_modes, + zzip_strings_t * ext, zzip_plugin_io_t io) + : ZZIP_FILE * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_open_shared_io">zzip_open_shared_io</a></code></b>(ZZIP_FILE * stream, + zzip_char_t * filename, int o_flags, int o_modes, + zzip_strings_t * ext, zzip_plugin_io_t io) + : ZZIP_FILE * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_opendir">zzip_opendir</a></code></b>(zzip_char_t * filename) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_opendir_ext_io">zzip_opendir_ext_io</a></code></b>(zzip_char_t * filename, int o_modes, + zzip_strings_t * ext, zzip_plugin_io_t io) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_file_real">zzip_file_real</a></code></b>(ZZIP_FILE * fp) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_dir_real">zzip_dir_real</a></code></b>(ZZIP_DIR * dir) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_realdir">zzip_realdir</a></code></b>(ZZIP_DIR * dir) + : void * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_realfd">zzip_realfd</a></code></b>(ZZIP_FILE * fp) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_tell">zzip_tell</a></code></b>(ZZIP_FILE * fp) + : zzip_off_t +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_tell32">zzip_tell32</a></code></b>(ZZIP_FILE * fp) + : long +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_dir_stat">zzip_dir_stat</a></code></b>(ZZIP_DIR * dir, zzip_char_t * name, ZZIP_STAT * zs, int flags) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_file_stat">zzip_file_stat</a></code></b>(ZZIP_FILE * file, ZZIP_STAT * zs) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_fstat">zzip_fstat</a></code></b>(ZZIP_FILE * file, ZZIP_STAT * zs) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_strerror">zzip_strerror</a></code></b>(int errcode) + : zzip_char_t * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_strerror_of">zzip_strerror_of</a></code></b>(ZZIP_DIR * dir) + : zzip_char_t * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_dir_open">zzip_dir_open</a></code></b>(zzip_char_t * filename, zzip_error_t * e) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_dir_open_ext_io">zzip_dir_open_ext_io</a></code></b>(zzip_char_t * filename, zzip_error_t * e, + zzip_strings_t * ext, zzip_plugin_io_t io) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_dir_read">zzip_dir_read</a></code></b>(ZZIP_DIR * dir, ZZIP_DIRENT * d) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_init_io">zzip_init_io</a></code></b>(zzip_plugin_io_handlers_t io, int flags) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_get_default_io">zzip_get_default_io</a></code></b>(void) + : zzip_plugin_io_t +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_rewinddir">zzip_rewinddir</a></code></b>(ZZIP_DIR * dir) + : void +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_telldir">zzip_telldir</a></code></b>(ZZIP_DIR * dir) + : zzip_off_t +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_seekdir">zzip_seekdir</a></code></b>(ZZIP_DIR * dir, zzip_off_t offset) + : void +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_telldir32">zzip_telldir32</a></code></b>(ZZIP_DIR * dir) + : long +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_seekdir32">zzip_seekdir32</a></code></b>(ZZIP_DIR * dir, long offset) + : void +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_fopen">zzip_fopen</a></code></b>(zzip_char_t * filename, zzip_char_t * mode) + : ZZIP_FILE * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_freopen">zzip_freopen</a></code></b>(zzip_char_t * filename, zzip_char_t * mode, ZZIP_FILE * stream) + : ZZIP_FILE * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_dirhandle">zzip_dirhandle</a></code></b>(ZZIP_FILE * fp) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_dirfd">zzip_dirfd</a></code></b>(ZZIP_DIR * dir) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_seek">zzip_seek</a></code></b>(ZZIP_FILE * fp, zzip_off_t offset, int whence) + : zzip_off_t +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_seek32">zzip_seek32</a></code></b>(ZZIP_FILE * fp, long offset, int whence) + : long +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_read">zzip_read</a></code></b>(ZZIP_FILE * fp, void *buf, zzip_size_t len) + : zzip_ssize_t +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_fread">zzip_fread</a></code></b>(void *ptr, zzip_size_t size, zzip_size_t nmemb, ZZIP_FILE * file) + : zzip_size_t +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_dir_free">zzip_dir_free</a></code></b>(ZZIP_DIR * dir) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_dir_close">zzip_dir_close</a></code></b>(ZZIP_DIR * dir) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_fclose">zzip_fclose</a></code></b>(ZZIP_FILE * fp) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_close">zzip_close</a></code></b>(ZZIP_FILE * fp) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_dir_fdopen">zzip_dir_fdopen</a></code></b>(int fd, zzip_error_t * errcode_p) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_dir_fdopen_ext_io">zzip_dir_fdopen_ext_io</a></code></b>(int fd, zzip_error_t * errcode_p, + zzip_strings_t * ext, const zzip_plugin_io_t io) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_dir_alloc_ext_io">zzip_dir_alloc_ext_io</a></code></b>(zzip_strings_t * ext, const zzip_plugin_io_t io) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_dir_alloc">zzip_dir_alloc</a></code></b>(zzip_strings_t * fileext) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_readdir">zzip_readdir</a></code></b>(ZZIP_DIR * dir) + : ZZIP_DIRENT * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_closedir">zzip_closedir</a></code></b>(ZZIP_DIR * dir) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_errno">zzip_errno</a></code></b>(int errcode) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_file_close">zzip_file_close</a></code></b>(ZZIP_FILE * fp) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_file_open">zzip_file_open</a></code></b>(ZZIP_DIR * dir, zzip_char_t * name, int o_mode) + : ZZIP_FILE * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_inflate_init">zzip_inflate_init</a></code></b>(ZZIP_FILE * fp, struct zzip_dir_hdr *hdr) + : static int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_file_read">zzip_file_read</a></code></b>(ZZIP_FILE * fp, void *buf, zzip_size_t len) + : zzip_ssize_t +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_rewind">zzip_rewind</a></code></b>(ZZIP_FILE * fp) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_compr_str">zzip_compr_str</a></code></b>(int compr) + : zzip_char_t * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#__zzip_fetch_disk_trailer">__zzip_fetch_disk_trailer</a></code></b>(int fd, zzip_off_t filesize, + struct _disk_trailer *_zzip_restrict trailer, + zzip_plugin_io_t io) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#__zzip_parse_root_directory">__zzip_parse_root_directory</a></code></b>(int fd, + struct _disk_trailer *trailer, + struct zzip_dir_hdr **hdr_return, + zzip_plugin_io_t io) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#__zzip_try_open">__zzip_try_open</a></code></b>(zzip_char_t * filename, int filemode, + zzip_strings_t * ext, zzip_plugin_io_t io) + : int +</code></td></tr></table><h3>Documentation</h3><dl><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_error">zzip_error</a></b>(ZZIP_DIR * dir) + : int +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_seterror">zzip_seterror</a></b>(ZZIP_DIR * dir, int errcode) : void +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/info.c</small></em></td></table> +</td></tr><tr><td valign="top"><p> The <code>zzip_seterror</code> function just does dir->errcode = errcode </p> - -</td><td> -<html><head><title> zziplib autodoc documentation </title></head> -<body> - -<h1>zziplib <small><small><i>-0.10.82.pre2</i></small></small></h1> -<table border=0 cellspacing=2 cellpadding=0><tr valign="top"> -<td valign="top"><code>void -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_rewinddir"> - <code>zzip_rewinddir</code> -</a></td><td valign="top"> </td><td valign="top">1000 - <code>(<nobr>ZZIP_DIR * dir</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_DIRENT* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_readdir"> - <code>zzip_readdir</code> -</a></td><td valign="top"> </td><td valign="top">1000 - <code>(<nobr>ZZIP_DIR * dir</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>zzip_off_t -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_telldir"> - <code>zzip_telldir</code> -</a></td><td valign="top"> </td><td valign="top">zzip_telldir - <code>(<nobr>ZZIP_DIR* dir</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>void -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_seekdir"> - <code>zzip_seekdir</code> -</a></td><td valign="top"> </td><td valign="top">zzip_seekdir - <code>(<nobr>ZZIP_DIR* dir</nobr>, -<nobr>zzip_off_t offset</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_DIR* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_opendir"> - <code>zzip_opendir</code> -</a></td><td valign="top"> </td><td valign="top">zzip_opendir - <code>(<nobr>zzip_char_t* filename</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_DIR* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_opendir_ext_io"> - <code>zzip_opendir_ext_io</code> -</a></td><td valign="top"> </td><td valign="top">zzip_opendir_ext_io - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>int o_modes</nobr>, -<nobr>zzip_strings_t* ext</nobr>, -<nobr>zzip_plugin_io_t io</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_closedir"> - <code>zzip_closedir</code> -</a></td><td valign="top"> </td><td valign="top">zzip_closedir - <code>(<nobr>ZZIP_DIR* dir</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>zzip_char_t* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_strerror"> - <code>zzip_strerror</code> -</a></td><td valign="top"> </td><td valign="top">zzip_strerror - <code>(<nobr>int errcode</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>zzip_char_t* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_strerror_of"> - <code>zzip_strerror_of</code> -</a></td><td valign="top"> </td><td valign="top">zzip_strerror_of - <code>(<nobr>ZZIP_DIR* dir</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_errno"> - <code>zzip_errno</code> -</a></td><td valign="top"> </td><td valign="top">zzip_errno - <code>(<nobr>int errcode</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_file_close"> - <code>zzip_file_close</code> -</a></td><td valign="top"> </td><td valign="top">zzip_file_close - <code>(<nobr>ZZIP_FILE * fp</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_FILE * -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_file_open"> - <code>zzip_file_open</code> -</a></td><td valign="top"> </td><td valign="top">zzip_file_open - <code>(<nobr>ZZIP_DIR * dir</nobr>, -<nobr>zzip_char_t* name</nobr>, -<nobr>int o_mode</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>static int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_inflate_init"> - <code>zzip_inflate_init</code> -</a></td><td valign="top"> </td><td valign="top">zzip_inflate_init - <code>(<nobr>ZZIP_FILE * fp</nobr>, -<nobr>struct zzip_dir_hdr* hdr</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_fclose"> - <code>zzip_fclose</code> -</a></td><td valign="top"> </td><td valign="top">zzip_fclose - <code>(<nobr>ZZIP_FILE * fp</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_close"> - <code>zzip_close</code> -</a></td><td valign="top"> </td><td valign="top">zzip_close - <code>(<nobr>ZZIP_FILE* fp</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>zzip_ssize_t -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_file_read"> - <code>zzip_file_read</code> -</a></td><td valign="top"> </td><td valign="top">zzip_file_read - <code>(<nobr>ZZIP_FILE * fp</nobr>, -<nobr>char * buf</nobr>, -<nobr>zzip_size_t len</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>zzip_ssize_t -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_read"> - <code>zzip_read</code> -</a></td><td valign="top"> </td><td valign="top">zzip_read - <code>(<nobr>ZZIP_FILE * fp</nobr>, -<nobr>char * buf</nobr>, -<nobr>zzip_size_t len</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>zzip_size_t -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_fread"> - <code>zzip_fread</code> -</a></td><td valign="top"> </td><td valign="top">zzip_fread - <code>(<nobr>void *ptr</nobr>, -<nobr>zzip_size_t size</nobr>, -<nobr>zzip_size_t nmemb</nobr>, -<nobr>ZZIP_FILE *file</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_FILE* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_fopen"> - <code>zzip_fopen</code> -</a></td><td valign="top"> </td><td valign="top">zzip_fopen - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>zzip_char_t* mode</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_FILE* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_freopen"> - <code>zzip_freopen</code> -</a></td><td valign="top"> </td><td valign="top">zzip_freopen - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>zzip_char_t* mode</nobr>, -<nobr>ZZIP_FILE* stream</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_FILE* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_open"> - <code>zzip_open</code> -</a></td><td valign="top"> </td><td valign="top">zzip_open - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>int o_flags</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_FILE* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_open_ext_io"> - <code>zzip_open_ext_io</code> -</a></td><td valign="top"> </td><td valign="top">zzip_open_ext_io - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>int o_flags</nobr>, -<nobr>int o_modes</nobr>, -<nobr>zzip_strings_t* ext</nobr>, -<nobr>zzip_plugin_io_t io</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_FILE* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_open_shared_io"> - <code>zzip_open_shared_io</code> -</a></td><td valign="top"> </td><td valign="top">zzip_open_shared_io - <code>(<nobr>ZZIP_FILE* stream</nobr>, -<nobr>zzip_char_t* filename</nobr>, -<nobr>int o_flags</nobr>, -<nobr>int o_modes</nobr>, -<nobr>zzip_strings_t* ext</nobr>, -<nobr>zzip_plugin_io_t io</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_rewind"> - <code>zzip_rewind</code> -</a></td><td valign="top"> </td><td valign="top">zzip_rewind - <code>(<nobr>ZZIP_FILE *fp</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>zzip_off_t -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_seek"> - <code>zzip_seek</code> -</a></td><td valign="top"> </td><td valign="top">zzip_seek - <code>(<nobr>ZZIP_FILE * fp</nobr>, -<nobr>zzip_off_t offset</nobr>, -<nobr>int whence</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>zzip_off_t -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_tell"> - <code>zzip_tell</code> -</a></td><td valign="top"> </td><td valign="top">zzip_tell - <code>(<nobr>ZZIP_FILE * fp</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_error"> - <code>zzip_error</code> -</a></td><td valign="top"> </td><td valign="top">zzip_error - <code>(<nobr>ZZIP_DIR * dir</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>void -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_seterror"> - <code>zzip_seterror</code> -</a></td><td valign="top"> </td><td valign="top">zzip_seterror - <code>(<nobr>ZZIP_DIR * dir</nobr>, -<nobr>int errcode</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_DIR * -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_dirhandle"> - <code>zzip_dirhandle</code> -</a></td><td valign="top"> </td><td valign="top">zzip_dirhandle - <code>(<nobr>ZZIP_FILE * fp</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_dirfd"> - <code>zzip_dirfd</code> -</a></td><td valign="top"> </td><td valign="top">zzip_dirfd - <code>(<nobr>ZZIP_DIR* dir</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>zzip_char_t* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_compr_str"> - <code>zzip_compr_str</code> -</a></td><td valign="top"> </td><td valign="top">zzip_compr_str - <code>(<nobr>int compr</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_dir_real"> - <code>zzip_dir_real</code> -</a></td><td valign="top"> </td><td valign="top">zzip_dir_real - <code>(<nobr>ZZIP_DIR* dir</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_file_real"> - <code>zzip_file_real</code> -</a></td><td valign="top"> </td><td valign="top">zzip_file_real - <code>(<nobr>ZZIP_FILE* fp</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>void* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_realdir"> - <code>zzip_realdir</code> -</a></td><td valign="top"> </td><td valign="top">zzip_realdir - <code>(<nobr>ZZIP_DIR* dir</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_realfd"> - <code>zzip_realfd</code> -</a></td><td valign="top"> </td><td valign="top">zzip_realfd - <code>(<nobr>ZZIP_FILE* fp</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>zzip_plugin_io_t -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_get_default_io"> - <code>zzip_get_default_io</code> -</a></td><td valign="top"> </td><td valign="top">zzip_get_default_io - <code>(<nobr></nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int </code></td><td valign="top"> </td><td valign="top"><a href="#zzip_init_io"> - <code>zzip_init_io</code> -</a></td><td valign="top"> </td><td valign="top">zzip_init_io - <code>(<nobr>struct zzip_plugin_io* io</nobr>, -<nobr>int flags</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_dir_stat"> - <code>zzip_dir_stat</code> -</a></td><td valign="top"> </td><td valign="top">zzip_dir_stat - <code>(<nobr>ZZIP_DIR * dir</nobr>, -<nobr>zzip_char_t* name</nobr>, -<nobr>ZZIP_STAT * zs</nobr>, -<nobr>int flags</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>uint32_t </code></td><td valign="top"> </td><td valign="top"><a href="#__zzip_get32"> - <code>__zzip_get32</code> -</a></td><td valign="top"> </td><td valign="top">__zzip_get32 - <code>(<nobr>unsigned char * s</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>uint16_t </code></td><td valign="top"> </td><td valign="top"><a href="#__zzip_get16"> - <code>__zzip_get16</code> -</a></td><td valign="top"> </td><td valign="top">__zzip_get16 - <code>(<nobr>unsigned char * s</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#__zzip_find_disk_trailer"> - <code>__zzip_find_disk_trailer</code> -</a></td><td valign="top"> </td><td valign="top">__zzip_find_disk_trailer - <code>(<nobr>int fd</nobr>, -<nobr>zzip_off_t filesize</nobr>, -<nobr>struct zzip_disk_trailer * trailer</nobr>, -<nobr>zzip_plugin_io_t io</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#__zzip_parse_root_directory"> - <code>__zzip_parse_root_directory</code> -</a></td><td valign="top"> </td><td valign="top">__zzip_parse_root_directory - <code>(<nobr>int fd</nobr>, -<nobr>struct zzip_disk_trailer * trailer</nobr>, -<nobr>struct zzip_dir_hdr ** hdr_return</nobr>, -<nobr>zzip_plugin_io_t io</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_DIR* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_dir_alloc_ext_io"> - <code>zzip_dir_alloc_ext_io</code> -</a></td><td valign="top"> </td><td valign="top">zzip_dir_alloc_ext_io - <code>(<nobr>zzip_strings_t* ext</nobr>, -<nobr>const zzip_plugin_io_t io</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_DIR* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_dir_alloc"> - <code>zzip_dir_alloc</code> -</a></td><td valign="top"> </td><td valign="top">zzip_dir_alloc - <code>(<nobr>zzip_strings_t* fileext</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_dir_free"> - <code>zzip_dir_free</code> -</a></td><td valign="top"> </td><td valign="top">zzip_dir_free - <code>(<nobr>ZZIP_DIR * dir</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_dir_close"> - <code>zzip_dir_close</code> -</a></td><td valign="top"> </td><td valign="top">zzip_dir_close - <code>(<nobr>ZZIP_DIR * dir</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_DIR * -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_dir_fdopen"> - <code>zzip_dir_fdopen</code> -</a></td><td valign="top"> </td><td valign="top">zzip_dir_fdopen - <code>(<nobr>int fd</nobr>, -<nobr>zzip_error_t * errcode_p</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_DIR * -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_dir_fdopen_ext_io"> - <code>zzip_dir_fdopen_ext_io</code> -</a></td><td valign="top"> </td><td valign="top">zzip_dir_fdopen_ext_io - <code>(<nobr>int fd</nobr>, -<nobr>zzip_error_t * errcode_p</nobr>, -<nobr>zzip_strings_t* ext</nobr>, -<nobr>const zzip_plugin_io_t io</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#__zzip_try_open"> - <code>__zzip_try_open</code> -</a></td><td valign="top"> </td><td valign="top">__zzip_try_open - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>int filemode</nobr>, -<nobr>zzip_strings_t* ext</nobr>, -<nobr>zzip_plugin_io_t io</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_DIR* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_dir_open"> - <code>zzip_dir_open</code> -</a></td><td valign="top"> </td><td valign="top">zzip_dir_open - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>zzip_error_t* e</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>ZZIP_DIR* -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_dir_open_ext_io"> - <code>zzip_dir_open_ext_io</code> -</a></td><td valign="top"> </td><td valign="top">zzip_dir_open_ext_io - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>zzip_error_t* e</nobr>, -<nobr>zzip_strings_t* ext</nobr>, -<nobr>zzip_plugin_io_t io</nobr>)</code> - -</td></tr><tr valign="top"> -<td valign="top"><code>int -</code></td><td valign="top"> </td><td valign="top"><a href="#zzip_dir_read"> - <code>zzip_dir_read</code> -</a></td><td valign="top"> </td><td valign="top">zzip_dir_read - <code>(<nobr>ZZIP_DIR * dir</nobr>, -<nobr>ZZIP_DIRENT * d</nobr> )</code> - -</td></tr> -</table> -<h3>Documentation</h3> - -<dl> -<dt><a name="zzip_rewinddir" /><a name="zzip_telldir" /><a name="zzip_seekdir" /><code><code>void -</code> - <br /><b><code>zzip_rewinddir</code></b> - <code>1000 - <code>(<nobr>ZZIP_DIR * dir</nobr>)</code> - -</code></code><br /> -<code><code>zzip_off_t -</code> - <br /><b><code>zzip_telldir</code></b> - <code>zzip_telldir - <code>(<nobr>ZZIP_DIR* dir</nobr>)</code> - -</code></code><br /> -<code><code>void -</code> - <br /><b><code>zzip_seekdir</code></b> - <code>zzip_seekdir - <code>(<nobr>ZZIP_DIR* dir</nobr>, -<nobr>zzip_off_t offset</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/dir.c) -<p> This function is the equivalent of a <code>rewinddir(2)</code> for a realdir or - <br /> the zipfile in place of a directory. The ZZIP_DIR handle returned from - <br /> <a href="#zzip_opendir"><code>zzip_opendir</code></a> has a flag saying realdir or zipfile. As for a zipfile, - <br /> the filenames will include the filesubpath, so take care. - -<p align="right"><small>(../zzip/dir.c)</small></p></dd> -<dt><a name="zzip_readdir" /><code><code>ZZIP_DIRENT* -</code> - <br /><b><code>zzip_readdir</code></b> - <code>1000 - <code>(<nobr>ZZIP_DIR * dir</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/dir.c) -<p> This function is the equivalent of a <code>readdir(2)</code> for a realdir - <br /> or a zipfile referenced by the ZZIP_DIR returned from <a href="#zzip_opendir"><code>zzip_opendir</code></a>. - <p> - The ZZIP_DIR handle (as returned by <a href="#zzip_opendir"><code>zzip_opendir)</code></a> contains a few more - <br /> entries than being copied into the ZZIP_DIRENT. The only valid fields in - <br /> a ZZIP_DIRENT are d_name (the file name), d_compr (compression), d_csize - <br /> (compressed size), st_size (uncompressed size). - -<p align="right"><small>(../zzip/dir.c)</small></p></dd> -<dt><a name="zzip_opendir" /><a name="zzip_opendir_ext_io" /><code><code>ZZIP_DIR* -</code> - <br /><b><code>zzip_opendir</code></b> - <code>zzip_opendir - <code>(<nobr>zzip_char_t* filename</nobr>)</code> - -</code></code><br /> -<code><code>ZZIP_DIR* -</code> - <br /><b><code>zzip_opendir_ext_io</code></b> - <code>zzip_opendir_ext_io - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>int o_modes</nobr>, -<nobr>zzip_strings_t* ext</nobr>, -<nobr>zzip_plugin_io_t io</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/dir.c) -<p> This function is the equivalent of <code>opendir(3)</code> for a realdir or zipfile. - <br /> <p> - This function has some magic - if the given argument-path - <br /> is a directory, it will wrap a real <code>opendir(3)</code> into the ZZIP_DIR - <br /> structure. Otherwise it will divert to <a href="#zzip_dir_open"><code>zzip_dir_open</code></a> which - <br /> can also attach a ".zip" extension if needed to find the archive. - <br /> <p> - the error-code is mapped to <code>errno(3)</code>. - -<p align="right"><small>(../zzip/dir.c)</small></p></dd> -<dt><a name="zzip_closedir" /><code><code>int -</code> - <br /><b><code>zzip_closedir</code></b> - <code>zzip_closedir - <code>(<nobr>ZZIP_DIR* dir</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/dir.c) -<p> This function is the equivalent of <code>closedir(3)</code> for a realdir or zipfile. - <br /> <p> - This function is magic - if the given arg-ZZIP_DIR - <br /> is a real directory, it will call the real <code>closedir(3)</code> and then - <br /> free the wrapping ZZIP_DIR structure. Otherwise it will divert - <br /> to <a href="#zzip_dir_close"><code>zzip_dir_close</code></a> which will free the ZZIP_DIR structure. - -<p align="right"><small>(../zzip/dir.c)</small></p></dd> -<dt><a name="zzip_strerror" /><a name="zzip_strerror_of" /><code><code>zzip_char_t* -</code> - <br /><b><code>zzip_strerror</code></b> - <code>zzip_strerror - <code>(<nobr>int errcode</nobr>)</code> - -</code></code><br /> -<code><code>zzip_char_t* -</code> - <br /><b><code>zzip_strerror_of</code></b> - <code>zzip_strerror_of - <code>(<nobr>ZZIP_DIR* dir</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/err.c) -<p> returns the static string for the given error code. The - - <br /> error code can be either a normal system error (a - - <br /> positive error code will flag this), it can be <code>libz</code> - - <br /> error code (a small negative error code will flag this) - - <br /> or it can be an error code from <code>libzzip</code>, which is an - - <br /> negative value lower than <code>ZZIP_ERROR</code> - - -<p align="right"><small>(../zzip/err.c)</small></p></dd> -<dt><a name="zzip_errno" /><code><code>int -</code> - <br /><b><code>zzip_errno</code></b> - <code>zzip_errno - <code>(<nobr>int errcode</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/err.c) -<p> map the error code to a system error code. This is used - - <br /> for the drop-in replacement functions to return a value - - <br /> that can be interpreted correctly by code sections that - - <br /> are unaware of the fact they their <code>open(2)</code> call had been - - <br /> diverted to a file inside a zip-archive. - - -<p align="right"><small>(../zzip/err.c)</small></p></dd> -<dt><a name="zzip_file_close" /><code><code>int -</code> - <br /><b><code>zzip_file_close</code></b> - <code>zzip_file_close - <code>(<nobr>ZZIP_FILE * fp</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/file.c) -<p> the direct function of <a href="#zzip_close"><code>zzip_close(fp)</code></a>. it will cleanup the - <br /> inflate-portion of <code>zlib</code> and free the structure given. - <p> - it is called quite from the error-cleanup parts - <br /> of the various <code>_open</code> functions. - <p> - the .refcount is decreased and if zero the fp<small>-></small>dir is closed just as well. - -<p align="right"><small>(../zzip/file.c)</small></p></dd> -<dt><a name="zzip_file_open" /><code><code>ZZIP_FILE * -</code> - <br /><b><code>zzip_file_open</code></b> - <code>zzip_file_open - <code>(<nobr>ZZIP_DIR * dir</nobr>, -<nobr>zzip_char_t* name</nobr>, -<nobr>int o_mode</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/file.c) -<p> open an <code>ZZIP_FILE</code> from an already open <code>ZZIP_DIR</code> handle. Since - <br /> we have a chance to reuse a cached <code>buf32k</code> and <code>ZZIP_FILE</code> memchunk - <br /> this is the best choice to unpack multiple files. - <p> - Note: the zlib supports 2..15 bit windowsize, hence we provide a 32k - <br /> memchunk here... just to be safe. - -<p align="right"><small>(../zzip/file.c)</small></p></dd> -<dt><a name="zzip_inflate_init" /><code><code>static int -</code> - <br /><b><code>zzip_inflate_init</code></b> - <code>zzip_inflate_init - <code>(<nobr>ZZIP_FILE * fp</nobr>, -<nobr>struct zzip_dir_hdr* hdr</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/file.c) -<p> call <code>inflateInit</code> and setup fp's iterator variables, - <br /> used by lowlevel <code>_open</code> functions. - -<p align="right"><small>(../zzip/file.c)</small></p></dd> -<dt><a name="zzip_fclose" /><a name="zzip_close" /><code><code>int -</code> - <br /><b><code>zzip_fclose</code></b> - <code>zzip_fclose - <code>(<nobr>ZZIP_FILE * fp</nobr>)</code> - -</code></code><br /> -<code><code>int -</code> - <br /><b><code>zzip_close</code></b> - <code>zzip_close - <code>(<nobr>ZZIP_FILE* fp</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/file.c) -<p> This function closes the given ZZIP_FILE handle. - <p> - If the ZZIP_FILE wraps a normal stat'fd then it is just that int'fd - <br /> that is being closed and the otherwise empty ZZIP_FILE gets freed. - -<p align="right"><small>(../zzip/file.c)</small></p></dd> -<dt><a name="zzip_file_read" /><code><code>zzip_ssize_t -</code> - <br /><b><code>zzip_file_read</code></b> - <code>zzip_file_read - <code>(<nobr>ZZIP_FILE * fp</nobr>, -<nobr>char * buf</nobr>, -<nobr>zzip_size_t len</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/file.c) -<p> This functions read data from zip-contained file. - <p> - It works like <code>read(2)</code> and will fill the given buffer with bytes from - <br /> the opened file. It will return the number of bytes read, so if the <code>EOF</code> - <br /> is encountered you will be prompted with the number of bytes actually read. - <p> - This is the routines that needs the <code>buf32k</code> buffer, and it would have - <br /> need for much more polishing but it does already work quite well. - <p> - Note: the 32K buffer is rather big. The original inflate-algorithm - <br /> required just that but the latest zlib would work just fine with - <br /> a smaller buffer. - -<p align="right"><small>(../zzip/file.c)</small></p></dd> -<dt><a name="zzip_read" /><a name="zzip_fread" /><code><code>zzip_ssize_t -</code> - <br /><b><code>zzip_read</code></b> - <code>zzip_read - <code>(<nobr>ZZIP_FILE * fp</nobr>, -<nobr>char * buf</nobr>, -<nobr>zzip_size_t len</nobr>)</code> - -</code></code><br /> -<code><code>zzip_size_t -</code> - <br /><b><code>zzip_fread</code></b> - <code>zzip_fread - <code>(<nobr>void *ptr</nobr>, -<nobr>zzip_size_t size</nobr>, -<nobr>zzip_size_t nmemb</nobr>, -<nobr>ZZIP_FILE *file</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/file.c) -<p> This function will read(2) data from a real/zipped file. - <p> - the replacement for <code>read(2)</code> will fill the given buffer with bytes from - <br /> the opened file. It will return the number of bytes read, so if the EOF - <br /> is encountered you will be prompted with the number of bytes actually read. - <p> - If the file-handle is wrapping a stat'able file then it will actually just - <br /> perform a normal <code>read(2)</code>-call, otherwise <a href="#zzip_file_read"><code>zzip_file_read</code></a> is called - <br /> to decompress the data stream and any error is mapped to <code>errno(3)</code>. - -<p align="right"><small>(../zzip/file.c)</small></p></dd> -<dt><a name="zzip_fopen" /><a name="zzip_freopen" /><code><code>ZZIP_FILE* -</code> - <br /><b><code>zzip_fopen</code></b> - <code>zzip_fopen - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>zzip_char_t* mode</nobr>)</code> - -</code></code><br /> -<code><code>ZZIP_FILE* -</code> - <br /><b><code>zzip_freopen</code></b> - <code>zzip_freopen - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>zzip_char_t* mode</nobr>, -<nobr>ZZIP_FILE* stream</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/file.c) -<p> This function will <code>fopen(3)</code> a real/zipped file. - <p> - It has some magic functionality builtin - it will first try to open - <br /> the given <em>filename</em> as a normal file. If it does not - <br /> exist, the given path to the filename (if any) is split into - <br /> its directory-part and the file-part. A ".zip" extension is - <br /> then added to the directory-part to create the name of a - <br /> zip-archive. That zip-archive (if it exists) is being searched - <br /> for the file-part, and if found a zzip-handle is returned. - <p> - Note that if the file is found in the normal fs-directory the - <br /> returned structure is mostly empty and the <a href="#zzip_read"><code>zzip_read</code></a> call will - <br /> use the libc <code>read</code> to obtain data. Otherwise a <a href="#zzip_file_open"><code>zzip_file_open</code></a> - <br /> is performed and any error mapped to <code>errno(3)</code>. - <p> - unlike the posix-wrapper <a href="#zzip_open"><code>zzip_open</code></a> the mode-argument is - <br /> a string which allows for more freedom to support the extra - <br /> zzip modes called ZZIP_CASEINSENSITIVE and ZZIP_IGNOREPATH. - <br /> Currently, this <a href="#zzip_fopen"><code>zzip_fopen</code></a> call will convert the following - <br /> characters in the mode-string into their corrsponding mode-bits: - <br /> <ul><li><code> "r" : O_RDONLY : </code> read-only - <br /> </li><li><code> "b" : O_BINARY : </code> binary (win32 specific) - <br /> </li><li><code> "f" : O_NOCTTY : </code> no char device (unix) - <br /> </li><li><code> "i" : ZZIP_CASELESS : </code> inside zip file - <br /> </li><li><code> "*" : ZZIP_NOPATHS : </code> inside zip file only - <br /> </ul> all other modes will be ignored for zip-contained entries - <br /> but they are transferred for compatibility and portability, - <br /> including these extra sugar bits: - <br /> <ul><li><code> "x" : O_EXCL :</code> fail if file did exist - <br /> </li><li><code> "s" : O_SYNC :</code> synchronized access - <br /> </li><li><code> "n" : O_NONBLOCK :</code> nonblocking access - <br /> </li><li><code> "z#" : compression level :</code> for zlib - <br /> </li><li><code> "g#" : group access :</code> unix access bits - <br /> </li><li><code> "u#" : owner access :</code> unix access bits - <br /> </li><li><code> "o#" : world access :</code> unix access bits - <br /> </ul>... the access bits are in traditional unix bit format - <br /> with 7 = read/write/execute, 6 = read/write, 4 = read-only. - <p> - The default access mode is 0664, and the compression level - <br /> is ignored since the lib can not yet write zip files, otherwise - <br /> it would be the initialisation value for the zlib deflateInit - <br /> where 0 = no-compression, 1 = best-speed, 9 = best-compression. - -<p align="right"><small>(../zzip/file.c)</small></p></dd> -<dt><a name="zzip_open" /><a name="zzip_open_ext_io" /><a name="zzip_open_shared_io" /><code><code>ZZIP_FILE* -</code> - <br /><b><code>zzip_open</code></b> - <code>zzip_open - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>int o_flags</nobr>)</code> - -</code></code><br /> -<code><code>ZZIP_FILE* -</code> - <br /><b><code>zzip_open_ext_io</code></b> - <code>zzip_open_ext_io - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>int o_flags</nobr>, -<nobr>int o_modes</nobr>, -<nobr>zzip_strings_t* ext</nobr>, -<nobr>zzip_plugin_io_t io</nobr>)</code> - -</code></code><br /> -<code><code>ZZIP_FILE* -</code> - <br /><b><code>zzip_open_shared_io</code></b> - <code>zzip_open_shared_io - <code>(<nobr>ZZIP_FILE* stream</nobr>, -<nobr>zzip_char_t* filename</nobr>, -<nobr>int o_flags</nobr>, -<nobr>int o_modes</nobr>, -<nobr>zzip_strings_t* ext</nobr>, -<nobr>zzip_plugin_io_t io</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/file.c) -<p> This function will <code>open(2)</code> a real/zipped file - <p> - It has some magic functionality builtin - it will first try to open - <br /> the given <em>filename</em> as a normal file. If it does not - <br /> exist, the given path to the filename (if any) is split into - <br /> its directory-part and the file-part. A ".zip" extension is - <br /> then added to the directory-part to create the name of a - <br /> zip-archive. That zip-archive (if it exists) is being searched - <br /> for the file-part, and if found a zzip-handle is returned. - <p> - Note that if the file is found in the normal fs-directory the - <br /> returned structure is mostly empty and the <a href="#zzip_read"><code>zzip_read</code></a> call will - <br /> use the libc <code>read</code> to obtain data. Otherwise a <a href="#zzip_file_open"><code>zzip_file_open</code></a> - <br /> is performed and any error mapped to <code>errno(3)</code>. - <p> - There was a possibility to transfer zziplib-specific openmodes - <br /> through o_flags but you should please not use them anymore and - <br /> look into <a href="#zzip_open_ext_io"><code>zzip_open_ext_io</code></a> to submit them down. This function - <br /> is shallow in that it just extracts the zzipflags and calls <ul><li><code> - <br /> zzip_open_ext_io(filename, o_flags, zzipflags|0664, 0, 0) </code></li></ul> - <br /> you must stop using this extra functionality (not well known - <br /> anyway) since zzip_open might be later usable to open files - <br /> for writing in which case the _EXTRAFLAGS will get in conflict. - <p> - compare with <code>open(2)</code> and <a href="#zzip_fopen"><code>zzip_fopen</code></a> - -<p align="right"><small>(../zzip/file.c)</small></p></dd> -<dt><a name="zzip_rewind" /><code><code>int -</code> - <br /><b><code>zzip_rewind</code></b> - <code>zzip_rewind - <code>(<nobr>ZZIP_FILE *fp</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/file.c) -<p> This function will rewind a real/zipped file. - <p> - It seeks to the beginning of this file's data in the zip, - <br /> or the beginning of the file for a stat'fd. - -<p align="right"><small>(../zzip/file.c)</small></p></dd> -<dt><a name="zzip_seek" /><code><code>zzip_off_t -</code> - <br /><b><code>zzip_seek</code></b> - <code>zzip_seek - <code>(<nobr>ZZIP_FILE * fp</nobr>, -<nobr>zzip_off_t offset</nobr>, -<nobr>int whence</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/file.c) -<p> This function will perform a <code>lseek(2)</code> operation on a real/zipped file - <p> - It will try to seek to the offset specified by offset, relative to whence, - <br /> which is one of SEEK_SET, SEEK_CUR or SEEK_END. - <p> - If the file-handle is wrapping a stat'able file then it will actually just - <br /> perform a normal <code>lseek(2)</code>-call. Otherwise the relative offset - <br /> is calculated, negative offsets are transformed into positive ones - <br /> by rewinding the file, and then data is read until the offset is - <br /> reached. This can make the function terribly slow, but this is - <br /> how gzio implements it, so I'm not sure there is a better way - <br /> without using the internals of the algorithm. - -<p align="right"><small>(../zzip/file.c)</small></p></dd> -<dt><a name="zzip_tell" /><code><code>zzip_off_t -</code> - <br /><b><code>zzip_tell</code></b> - <code>zzip_tell - <code>(<nobr>ZZIP_FILE * fp</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/file.c) -<p> This function will <code>tell(2)</code> the current position in a real/zipped file - <p> - It will return the current offset within the real/zipped file, - <br /> measured in uncompressed bytes for the zipped-file case. - <p> - If the file-handle is wrapping a stat'able file then it will actually just - <br /> perform a normal <code>tell(2)</code>-call, otherwise the offset is - <br /> calculated from the amount of data left and the total uncompressed - <br /> size; - -<p align="right"><small>(../zzip/file.c)</small></p></dd> -<dt><a name="zzip_error" /><a name="zzip_seterror" /><code><code>int -</code> - <br /><b><code>zzip_error</code></b> - <code>zzip_error - <code>(<nobr>ZZIP_DIR * dir</nobr>)</code> - -</code></code><br /> -<code><code>void -</code> - <br /><b><code>zzip_seterror</code></b> - <code>zzip_seterror - <code>(<nobr>ZZIP_DIR * dir</nobr>, -<nobr>int errcode</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/info.c) -<p> just returns dir<small>-></small>errcode of the ZZIP_DIR handle - <br /> see: <a href="#zzip_dir_open"><code>zzip_dir_open</code></a>, <code>zzip_diropen</code>, <a href="#zzip_readdir"><code>zzip_readdir</code></a>, <a href="#zzip_dir_read"><code>zzip_dir_read</code></a> - -<p align="right"><small>(../zzip/info.c)</small></p></dd> -<dt><a name="zzip_dirhandle" /><a name="zzip_dirfd" /><code><code>ZZIP_DIR * -</code> - <br /><b><code>zzip_dirhandle</code></b> - <code>zzip_dirhandle - <code>(<nobr>ZZIP_FILE * fp</nobr>)</code> - -</code></code><br /> -<code><code>int -</code> - <br /><b><code>zzip_dirfd</code></b> - <code>zzip_dirfd - <code>(<nobr>ZZIP_DIR* dir</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/info.c) -<p> This function will just return fp<small>-></small>dir - <p> - If a ZZIP_FILE is contained within a zip-file that one will be a valid - <br /> pointer, otherwise a NULL is returned and the ZZIP_FILE wraps a real file. - -<p align="right"><small>(../zzip/info.c)</small></p></dd> -<dt><a name="zzip_compr_str" /><code><code>zzip_char_t* -</code> - <br /><b><code>zzip_compr_str</code></b> - <code>zzip_compr_str - <code>(<nobr>int compr</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/info.c) -<p> return static const string of the known compression methods, - <br /> otherwise just "zipped" is returned - -<p align="right"><small>(../zzip/info.c)</small></p></dd> -<dt><a name="zzip_file_real" /><a name="zzip_dir_real" /><a name="zzip_realdir" /><a name="zzip_realfd" /><code><code>int -</code> - <br /><b><code>zzip_file_real</code></b> - <code>zzip_file_real - <code>(<nobr>ZZIP_FILE* fp</nobr>)</code> - -</code></code><br /> -<code><code>int -</code> - <br /><b><code>zzip_dir_real</code></b> - <code>zzip_dir_real - <code>(<nobr>ZZIP_DIR* dir</nobr>)</code> - -</code></code><br /> -<code><code>void* -</code> - <br /><b><code>zzip_realdir</code></b> - <code>zzip_realdir - <code>(<nobr>ZZIP_DIR* dir</nobr>)</code> - -</code></code><br /> -<code><code>int -</code> - <br /><b><code>zzip_realfd</code></b> - <code>zzip_realfd - <code>(<nobr>ZZIP_FILE* fp</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/info.c) -<p> This function checks if the ZZIP_FILE-handle is wrapping - <br /> a real file or a zip-contained file. - <br /> Returns 1 for a stat'able file, and 0 for a file inside a zip-archive. - -<p align="right"><small>(../zzip/info.c)</small></p></dd> -<dt><a name="zzip_init_io" /><a name="zzip_get_default_io" /><code><code>int </code> - <br /><b><code>zzip_init_io</code></b> - <code>zzip_init_io - <code>(<nobr>struct zzip_plugin_io* io</nobr>, -<nobr>int flags</nobr>)</code> - -</code></code><br /> -<code><code>zzip_plugin_io_t -</code> - <br /><b><code>zzip_get_default_io</code></b> - <code>zzip_get_default_io - <code>(<nobr></nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/plugin.c) -<p> This function initializes the users handler struct to default values - <br /> being the posix io functions in default configured environments. - -<p align="right"><small>(../zzip/plugin.c)</small></p></dd> -<dt><a name="zzip_dir_stat" /><code><code>int -</code> - <br /><b><code>zzip_dir_stat</code></b> - <code>zzip_dir_stat - <code>(<nobr>ZZIP_DIR * dir</nobr>, -<nobr>zzip_char_t* name</nobr>, -<nobr>ZZIP_STAT * zs</nobr>, -<nobr>int flags</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/stat.c) -<p> obtain information about a filename in an opened zip-archive without - <br /> opening that file first. Mostly used to obtain the uncompressed - <br /> size of a file inside a zip-archive. see <a href="#zzip_dir_open"><code>zzip_dir_open</code></a>. - -<p align="right"><small>(../zzip/stat.c)</small></p></dd> -<dt><a name="__zzip_get32" /><code><code>uint32_t </code> - <br /><b><code>__zzip_get32</code></b> - <code>__zzip_get32 - <code>(<nobr>unsigned char * s</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/zip.c) -<p> Make 32 bit value in host byteorder from little-endian mapped octet-data - <br /> (works also on machines which SIGBUS on misaligned data access (eg. 68000)) - -<p align="right"><small>(../zzip/zip.c)</small></p></dd> -<dt><a name="__zzip_find_disk_trailer" /><code><code>int -</code> - <br /><b><code>__zzip_find_disk_trailer</code></b> - <code>__zzip_find_disk_trailer - <code>(<nobr>int fd</nobr>, -<nobr>zzip_off_t filesize</nobr>, -<nobr>struct zzip_disk_trailer * trailer</nobr>, -<nobr>zzip_plugin_io_t io</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/zip.c) -<p> This function is used by <a href="#zzip_file_open"><code>zzip_file_open</code></a>. It tries to find - <br /> the zip's central directory info that is usually a few - <br /> bytes off the end of the file. - -<p align="right"><small>(../zzip/zip.c)</small></p></dd> -<dt><a name="__zzip_parse_root_directory" /><code><code>int -</code> - <br /><b><code>__zzip_parse_root_directory</code></b> - <code>__zzip_parse_root_directory - <code>(<nobr>int fd</nobr>, -<nobr>struct zzip_disk_trailer * trailer</nobr>, -<nobr>struct zzip_dir_hdr ** hdr_return</nobr>, -<nobr>zzip_plugin_io_t io</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/zip.c) -<p> This function is used by <a href="#zzip_file_open"><code>zzip_file_open</code></a>, it is usually called after - <br /> <a href="#__zzip_find_disk_trailer"><code>__zzip_find_disk_trailer</code></a>. It will parse the zip's central directory - <br /> information and create a zziplib private directory table in - <br /> memory. - -<p align="right"><small>(../zzip/zip.c)</small></p></dd> -<dt><a name="zzip_dir_alloc_ext_io" /><a name="zzip_dir_alloc" /><code><code>ZZIP_DIR* -</code> - <br /><b><code>zzip_dir_alloc_ext_io</code></b> - <code>zzip_dir_alloc_ext_io - <code>(<nobr>zzip_strings_t* ext</nobr>, -<nobr>const zzip_plugin_io_t io</nobr>)</code> - -</code></code><br /> -<code><code>ZZIP_DIR* -</code> - <br /><b><code>zzip_dir_alloc</code></b> - <code>zzip_dir_alloc - <code>(<nobr>zzip_strings_t* fileext</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/zip.c) -<p> allocate a new ZZIP_DIR handle and do basic - <br /> initializations before usage by <a href="#zzip_dir_fdopen"><code>zzip_dir_fdopen</code></a> - <br /> <a href="#zzip_dir_open"><code>zzip_dir_open</code></a> <a href="#zzip_file_open"><code>zzip_file_open</code></a> or through - <br /> <a href="#zzip_open"><code>zzip_open</code></a> - <br /> (ext==null flags uses { ".zip" , ".ZIP" } ) - <br /> (io ==null flags use of posix io defaults) - -<p align="right"><small>(../zzip/zip.c)</small></p></dd> -<dt><a name="zzip_dir_free" /><code><code>int -</code> - <br /><b><code>zzip_dir_free</code></b> - <code>zzip_dir_free - <code>(<nobr>ZZIP_DIR * dir</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/zip.c) -<p> will free the zzip_dir handle unless there are still - <br /> zzip_files attached (that may use its cache buffer). - <br /> This is the inverse of <a href="#zzip_dir_alloc"><code>zzip_dir_alloc</code></a> , and both - <br /> are helper functions used implicitly in other zzipcalls - <br /> e.g. <a href="#zzip_dir_close"><code>zzip_dir_close</code></a> = zzip_close - <p> - returns zero on sucess - <br /> returns the refcount when files are attached. - -<p align="right"><small>(../zzip/zip.c)</small></p></dd> -<dt><a name="zzip_dir_close" /><code><code>int -</code> - <br /><b><code>zzip_dir_close</code></b> - <code>zzip_dir_close - <code>(<nobr>ZZIP_DIR * dir</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/zip.c) -<p> It will also <code>free(2)</code> the <code>ZZIP_DIR</code>-handle given. - <br /> the counterpart for <a href="#zzip_dir_open"><code>zzip_dir_open</code></a> - <br /> see also <a href="#zzip_dir_free"><code>zzip_dir_free</code></a> - -<p align="right"><small>(../zzip/zip.c)</small></p></dd> -<dt><a name="zzip_dir_fdopen" /><a name="zzip_dir_fdopen_ext_io" /><code><code>ZZIP_DIR * -</code> - <br /><b><code>zzip_dir_fdopen</code></b> - <code>zzip_dir_fdopen - <code>(<nobr>int fd</nobr>, -<nobr>zzip_error_t * errcode_p</nobr>)</code> - -</code></code><br /> -<code><code>ZZIP_DIR * -</code> - <br /><b><code>zzip_dir_fdopen_ext_io</code></b> - <code>zzip_dir_fdopen_ext_io - <code>(<nobr>int fd</nobr>, -<nobr>zzip_error_t * errcode_p</nobr>, -<nobr>zzip_strings_t* ext</nobr>, -<nobr>const zzip_plugin_io_t io</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/zip.c) -<p> used by the <a href="#zzip_dir_open"><code>zzip_dir_open</code></a> and zzip_opendir(2) call. Opens the - <br /> zip-archive as specified with the fd which points to an - <br /> already openend file. This function then search and parse - <br /> the zip's central directory. - <br /> <p> - NOTE: refcount is zero, so an _open/_close pair will also delete - <br /> this _dirhandle - -<p align="right"><small>(../zzip/zip.c)</small></p></dd> -<dt><a name="__zzip_try_open" /><code><code>int -</code> - <br /><b><code>__zzip_try_open</code></b> - <code>__zzip_try_open - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>int filemode</nobr>, -<nobr>zzip_strings_t* ext</nobr>, -<nobr>zzip_plugin_io_t io</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/zip.c) -<p> will attach a .zip extension and tries to open it - <br /> the with <code>open(2)</code>. This is a helper function for - <br /> <a href="#zzip_dir_open"><code>zzip_dir_open</code></a>, <a href="#zzip_opendir"><code>zzip_opendir</code></a> and <a href="#zzip_open"><code>zzip_open</code></a>. - -<p align="right"><small>(../zzip/zip.c)</small></p></dd> -<dt><a name="zzip_dir_open" /><a name="zzip_dir_open_ext_io" /><code><code>ZZIP_DIR* -</code> - <br /><b><code>zzip_dir_open</code></b> - <code>zzip_dir_open - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>zzip_error_t* e</nobr>)</code> - -</code></code><br /> -<code><code>ZZIP_DIR* -</code> - <br /><b><code>zzip_dir_open_ext_io</code></b> - <code>zzip_dir_open_ext_io - <code>(<nobr>zzip_char_t* filename</nobr>, -<nobr>zzip_error_t* e</nobr>, -<nobr>zzip_strings_t* ext</nobr>, -<nobr>zzip_plugin_io_t io</nobr>)</code> - -</code></code><dt> -<dd><p> (../zzip/zip.c) -<p> Opens the zip-archive (if available). - <br /> the two ext_io arguments will default to use posix io and - <br /> a set of default fileext that can atleast add .zip ext itself. - -<p align="right"><small>(../zzip/zip.c)</small></p></dd> -<dt><a name="zzip_dir_read" /><code><code>int -</code> - <br /><b><code>zzip_dir_read</code></b> - <code>zzip_dir_read - <code>(<nobr>ZZIP_DIR * dir</nobr>, -<nobr>ZZIP_DIRENT * d</nobr> )</code> - -</code></code><dt> -<dd><p> (../zzip/zip.c) -<p> fills the dirent-argument with the values and - <br /> increments the read-pointer of the dir-argument. - <br /> <p> - returns 0 if there no entry (anymore). - -<p align="right"><small>(../zzip/zip.c)</small></p></dd> -</dl> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_open">zzip_open</a></b>(zzip_char_t * filename, int o_flags) + : ZZIP_FILE * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_open_ext_io">zzip_open_ext_io</a></b>(zzip_char_t * filename, int o_flags, int o_modes, + zzip_strings_t * ext, zzip_plugin_io_t io) + : ZZIP_FILE * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_open_shared_io">zzip_open_shared_io</a></b>(ZZIP_FILE * stream, + zzip_char_t * filename, int o_flags, int o_modes, + zzip_strings_t * ext, zzip_plugin_io_t io) + : ZZIP_FILE * +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/file.c</small></em></td></table> +</td></tr><tr><td valign="top"><p> + The <code>zzip_open_ext_io</code> function uses explicit ext and io instead of the internal + defaults, setting them to zero is equivalent to <code><a href="#zzip_open">zzip_open</a></code> +</p><p> + note that the two flag types have been split into an o_flags + (for fcntl-like openflags) and o_modes where the latter shall + carry the zzip_flags and possibly accessmodes for unix filesystems. + Since this version of zziplib can not write zipfiles, it is not + yet used for anything else than zzip-specific modeflags. +</p><p> + The <code>zzip_open_ext_io</code> function returns a new zzip-handle (use <code><a href="#zzip_close">zzip_close</a></code> to return + it). On error the <code>zzip_open_ext_io</code> function will return null setting <a href="http://www.opengroup.org/onlinepubs/000095399/functions/errno.html"><code>errno(3)</code></a>. +</p><p> + If any ext_io handlers were used then the referenced structure + should be static as the allocated ZZIP_FILE does not copy them. +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_open_shared_io</code> function takes an extra stream argument - if a handle has been + then ext/io can be left null and the new stream handle will pick up + the ext/io. This should be used only in specific environment however + since <code><a href="#zzip_file_real">zzip_file_real</a></code> does not store any ext-sequence. +</p><p> + The benefit for the <code>zzip_open_shared_io</code> function comes in when the old file handle + was openened from a file within a zip archive. When the new file + is in the same zip archive then the internal zzip_dir structures + will be shared. It is even quicker, as no check needs to be done + anymore trying to guess the zip archive place in the filesystem, + here we just check whether the zip archive's filepath is a prefix + part of the filename to be opened. +</p><p> + Note that the <code>zzip_open_shared_io</code> function is also used by <code><a href="#zzip_freopen">zzip_freopen</a></code> that + will unshare the old handle, thereby possibly closing the handle. +</p><p> + The <code>zzip_open_shared_io</code> function returns a new zzip-handle (use <code><a href="#zzip_close">zzip_close</a></code> to return + it). On error the <code>zzip_open_shared_io</code> function will return null setting <a href="http://www.opengroup.org/onlinepubs/000095399/functions/errno.html"><code>errno(3)</code></a>. +</p> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_opendir">zzip_opendir</a></b>(zzip_char_t * filename) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_opendir_ext_io">zzip_opendir_ext_io</a></b>(zzip_char_t * filename, int o_modes, + zzip_strings_t * ext, zzip_plugin_io_t io) + : ZZIP_DIR * +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/dir.c</small></em></td></table> +</td></tr><tr><td valign="top"><p> The <code>zzip_opendir_ext_io</code> function uses explicit ext and io instead of the internal + defaults, setting them to zero is equivalent to <code><a href="#zzip_opendir">zzip_opendir</a></code> +</p> +</td></tr></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_file_real">zzip_file_real</a></b>(ZZIP_FILE * fp) + : int +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_dir_real">zzip_dir_real</a></b>(ZZIP_DIR * dir) + : int +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_realdir">zzip_realdir</a></b>(ZZIP_DIR * dir) + : void * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_realfd">zzip_realfd</a></b>(ZZIP_FILE * fp) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/info.c</small></em></td></table> +</td></tr><tr><td valign="top"><p> The <code>zzip_dir_real</code> function checks if the ZZIP_DIR-handle is wrapping + a real directory or a zip-archive. + Returns 1 for a stat'able directory, and 0 for a handle to zip-archive. +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_realdir</code> function returns the posix DIR* handle (if one exists). + Check before with <code><a href="#zzip_dir_real">zzip_dir_real</a></code> if the + the ZZIP_DIR points to a real directory. +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_realfd</code> function returns the posix file descriptor (if one exists). + Check before with <code><a href="#zzip_file_real">zzip_file_real</a></code> if the + the ZZIP_FILE points to a real file. +</p> +</td></tr></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_tell">zzip_tell</a></b>(ZZIP_FILE * fp) + : zzip_off_t +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_tell32">zzip_tell32</a></b>(ZZIP_FILE * fp) + : long +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/file.c</small></em></td></table> +</td></tr><tr><td valign="top"><p> The <code>zzip_tell32</code> function is provided for users who can not use any largefile-mode. +</p> +</td></tr></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_dir_stat">zzip_dir_stat</a></b>(ZZIP_DIR * dir, zzip_char_t * name, ZZIP_STAT * zs, int flags) + : int +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_file_stat">zzip_file_stat</a></b>(ZZIP_FILE * file, ZZIP_STAT * zs) + : int +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_fstat">zzip_fstat</a></b>(ZZIP_FILE * file, ZZIP_STAT * zs) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/stat.c</small></em></td></table> +</td></tr><tr><td valign="top"><p> The <code>zzip_file_stat</code> function will obtain information about a opened file _within_ a + zip-archive. The file is supposed to be open (otherwise -1 is returned). + The st_size stat-member contains the uncompressed size. The optional + d_name is never set here. +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_fstat</code> function will obtain information about a opened file which may be + either real/zipped. The file is supposed to be open (otherwise -1 is + returned). The st_size stat-member contains the uncompressed size. + The optional d_name is never set here. For a real file, we do set the + d_csize := st_size and d_compr := 0 for meaningful defaults. +</p> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_strerror">zzip_strerror</a></b>(int errcode) + : zzip_char_t * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_strerror_of">zzip_strerror_of</a></b>(ZZIP_DIR * dir) + : zzip_char_t * +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/err.c</small></em></td></table> +</td></tr><tr><td valign="top"><p> The <code>zzip_strerror_of</code> function fetches the errorcode from the <code>DIR-handle</code> and + runs it through <code><a href="#zzip_strerror">zzip_strerror</a></code> to obtain the static string + describing the error. +</p> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_dir_open">zzip_dir_open</a></b>(zzip_char_t * filename, zzip_error_t * e) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_dir_open_ext_io">zzip_dir_open_ext_io</a></b>(zzip_char_t * filename, zzip_error_t * e, + zzip_strings_t * ext, zzip_plugin_io_t io) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_dir_read">zzip_dir_read</a></b>(ZZIP_DIR * dir, ZZIP_DIRENT * d) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/zip.c</small></em></td></table> +</td></tr><tr><td valign="top"><p> the <code>zzip_dir_open_ext_io</code> function uses explicit ext and io instead of the internal + defaults. Setting these to zero is equivalent to <code><a href="#zzip_dir_open">zzip_dir_open</a></code> + Note that the referenced ext_io plugin handlers structure must be + static as it is not copied to the returned ZZIP_DIR structure. +</p> +</td></tr><tr><td valign="top"><p> fills the dirent-argument with the values and + increments the read-pointer of the dir-argument. +</p><p> + returns 0 if there no entry (anymore). +</p> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_init_io">zzip_init_io</a></b>(zzip_plugin_io_handlers_t io, int flags) + : int +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_get_default_io">zzip_get_default_io</a></b>(void) + : zzip_plugin_io_t +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/plugin.c</small></em></td></table> +</td></tr><tr><td valign="top"><p> The <code>zzip_get_default_io</code> function returns a zzip_plugin_io_t handle to static defaults + wrapping the posix io file functions for actual file access. The + returned structure is shared by all threads in the system. +</p> +</td></tr></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_rewinddir">zzip_rewinddir</a></b>(ZZIP_DIR * dir) + : void +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_telldir">zzip_telldir</a></b>(ZZIP_DIR * dir) + : zzip_off_t +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_seekdir">zzip_seekdir</a></b>(ZZIP_DIR * dir, zzip_off_t offset) + : void +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_telldir32">zzip_telldir32</a></b>(ZZIP_DIR * dir) + : long +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_seekdir32">zzip_seekdir32</a></b>(ZZIP_DIR * dir, long offset) + : void +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em> </em> </td><td align="right"> <em><small>zzip/dir.c</small></em></td></table><p> The <code>zzip_rewinddir</code> function is the equivalent of a <a href="http://www.opengroup.org/onlinepubs/000095399/functions/rewinddir.html"><code>rewinddir(2)</code></a> for a realdir or + the zipfile in place of a directory. The ZZIP_DIR handle returned from + <code><a href="#zzip_opendir">zzip_opendir</a></code> has a flag saying realdir or zipfile. As for a zipfile, + the filenames will include the filesubpath, so take care. +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_telldir</code> function is the equivalent of <a href="http://www.opengroup.org/onlinepubs/000095399/functions/telldir.html"><code>telldir(2)</code></a> for a realdir or zipfile. +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_seekdir</code> function is the equivalent of <a href="http://www.opengroup.org/onlinepubs/000095399/functions/seekdir.html"><code>seekdir(2)</code></a> for a realdir or zipfile. +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_telldir32</code> function is provided for users who can not use any largefile-mode. +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_seekdir32</code> function is provided for users who can not use any largefile-mode. +</p> +</td></tr></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_fopen">zzip_fopen</a></b>(zzip_char_t * filename, zzip_char_t * mode) + : ZZIP_FILE * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_freopen">zzip_freopen</a></b>(zzip_char_t * filename, zzip_char_t * mode, ZZIP_FILE * stream) + : ZZIP_FILE * +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em> </em> </td><td align="right"> <em><small>zzip/file.c</small></em></td></table><p> The <code>zzip_fopen</code> function will <a href="http://www.opengroup.org/onlinepubs/000095399/functions/fopen.html"><code>fopen(3)</code></a> a real/zipped file. +</p><p> + It has some magic functionality builtin - it will first try to open + the given <em>filename</em> as a normal file. If it does not + exist, the given path to the filename (if any) is split into + its directory-part and the file-part. A ".zip" extension is + then added to the directory-part to create the name of a + zip-archive. That zip-archive (if it exists) is being searched + for the file-part, and if found a zzip-handle is returned. +</p><p> + Note that if the file is found in the normal fs-directory the + returned structure is mostly empty and the <code><a href="#zzip_read">zzip_read</a></code> call will + use the libc <a href="http://www.opengroup.org/onlinepubs/000095399/functions/read.html"><code>read(2)</code></a> to obtain data. Otherwise a <code><a href="#zzip_file_open">zzip_file_open</a></code> + is performed and any error mapped to <a href="http://www.opengroup.org/onlinepubs/000095399/functions/errno.html"><code>errno(3)</code></a>. +</p><p> + unlike the posix-wrapper <code><a href="#zzip_open">zzip_open</a></code> the mode-argument is + a string which allows for more freedom to support the extra + zzip modes called ZZIP_CASEINSENSITIVE and ZZIP_IGNOREPATH. + Currently, this <code><a href="#zzip_fopen">zzip_fopen</a></code> call will convert the following + characters in the mode-string into their corrsponding mode-bits: +</p><ul><li><p> <code> "r" : O_RDONLY : </code> read-only </p></li> +<li><p> <code> "b" : O_BINARY : </code> binary (win32 specific) </p></li> +<li><p> <code> "f" : O_NOCTTY : </code> no char device (unix) </p></li> +<li><p> <code> "i" : ZZIP_CASELESS : </code> inside zip file </p></li> +<li><p> <code> "*" : ZZIP_NOPATHS : </code> inside zip file only </p></li> +</ul><p> all other modes will be ignored for zip-contained entries + but they are transferred for compatibility and portability, + including these extra sugar bits: +</p><ul><li><p> <code> "x" : O_EXCL :</code> fail if file did exist </p></li> +<li><p> <code> "s" : O_SYNC :</code> synchronized access </p></li> +<li><p> <code> "n" : O_NONBLOCK :</code> nonblocking access </p></li> +<li><p> <code> "z#" : compression level :</code> for zlib </p></li> +<li><p> <code> "g#" : group access :</code> unix access bits </p></li> +<li><p> <code> "u#" : owner access :</code> unix access bits </p></li> +<li><p> <code> "o#" : world access :</code> unix access bits </p></li> +</ul><p> ... the access bits are in traditional unix bit format + with 7 = read/write/execute, 6 = read/write, 4 = read-only. +</p><p> + The default access mode is 0664, and the compression level + is ignored since the lib can not yet write zip files, otherwise + it would be the initialisation value for the zlib deflateInit + where 0 = no-compression, 1 = best-speed, 9 = best-compression. +</p><p> + The <code>zzip_fopen</code> function returns a new zzip-handle (use <code><a href="#zzip_close">zzip_close</a></code> to return + it). On error the <code>zzip_fopen</code> function will return null setting <a href="http://www.opengroup.org/onlinepubs/000095399/functions/errno.html"><code>errno(3)</code></a>. +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_freopen</code> function receives an additional argument pointing to + a ZZIP_FILE* being already in use. If this extra argument is + null then the <code>zzip_freopen</code> function is identical with calling <code><a href="#zzip_fopen">zzip_fopen</a></code> +</p><p> + Per default, the old file stream is closed and only the internal + structures associated with it are kept. These internal structures + may be reused for the return value, and this is a lot quicker when + the filename matches a zipped file that is incidentally in the very + same zip arch as the old filename wrapped in the stream struct. +</p><p> + That's simply because the zip arch's central directory does not + need to be read again. As an extension for the <code>zzip_freopen</code> function, if the + mode-string contains a "q" then the old stream is not closed but + left untouched, instead it is only given as a hint that a new + file handle may share/copy the zip arch structures of the old file + handle if that is possible, i.e when they are in the same zip arch. +</p><p> + The <code>zzip_freopen</code> function returns a new zzip-handle (use <code><a href="#zzip_close">zzip_close</a></code> to return + it). On error the <code>zzip_freopen</code> function will return null setting <a href="http://www.opengroup.org/onlinepubs/000095399/functions/errno.html"><code>errno(3)</code></a>. +</p> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_dirhandle">zzip_dirhandle</a></b>(ZZIP_FILE * fp) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_dirfd">zzip_dirfd</a></b>(ZZIP_DIR * dir) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/info.c</small></em></td></table> +</td></tr><tr><td valign="top"><p> The <code>zzip_dirfd</code> function will just return dir->fd +</p><p> + If a ZZIP_DIR does point to a zipfile then the file-descriptor of that + zipfile is returned, otherwise a NULL is returned and the ZZIP_DIR wraps + a real directory DIR (if you have dirent on your system). +</p> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_seek">zzip_seek</a></b>(ZZIP_FILE * fp, zzip_off_t offset, int whence) + : zzip_off_t +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_seek32">zzip_seek32</a></b>(ZZIP_FILE * fp, long offset, int whence) + : long +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/file.c</small></em></td></table> +</td></tr><tr><td valign="top"><p> The <code>zzip_seek32</code> function is provided for users who can not use any largefile-mode. +</p> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_read">zzip_read</a></b>(ZZIP_FILE * fp, void *buf, zzip_size_t len) + : zzip_ssize_t +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_fread">zzip_fread</a></b>(void *ptr, zzip_size_t size, zzip_size_t nmemb, ZZIP_FILE * file) + : zzip_size_t +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/file.c</small></em></td></table> +</td></tr><tr><td valign="top"> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_dir_free">zzip_dir_free</a></b>(ZZIP_DIR * dir) + : int +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_dir_close">zzip_dir_close</a></b>(ZZIP_DIR * dir) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/zip.c</small></em></td></table> +</td></tr><tr><td valign="top"><p> It will also <a href="http://www.opengroup.org/onlinepubs/000095399/functions/free.html"><code>free(2)</code></a> the <code>ZZIP_DIR-handle</code> given. + the counterpart for <code><a href="#zzip_dir_open">zzip_dir_open</a></code> + see also <code><a href="#zzip_dir_free">zzip_dir_free</a></code> +</p> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_fclose">zzip_fclose</a></b>(ZZIP_FILE * fp) + : int +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_close">zzip_close</a></b>(ZZIP_FILE * fp) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/file.c</small></em></td></table> +</td></tr><tr><td valign="top"> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_dir_fdopen">zzip_dir_fdopen</a></b>(int fd, zzip_error_t * errcode_p) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_dir_fdopen_ext_io">zzip_dir_fdopen_ext_io</a></b>(int fd, zzip_error_t * errcode_p, + zzip_strings_t * ext, const zzip_plugin_io_t io) + : ZZIP_DIR * +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/zip.c</small></em></td></table> +</td></tr><tr><td valign="top"><p> the <code>zzip_dir_fdopen_ext_io</code> function uses explicit ext and io instead of the internal + defaults, setting these to zero is equivalent to <code><a href="#zzip_dir_fdopen">zzip_dir_fdopen</a></code> +</p> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_dir_alloc_ext_io">zzip_dir_alloc_ext_io</a></b>(zzip_strings_t * ext, const zzip_plugin_io_t io) + : ZZIP_DIR * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_dir_alloc">zzip_dir_alloc</a></b>(zzip_strings_t * fileext) + : ZZIP_DIR * +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/zip.c</small></em></td></table> +</td></tr><tr><td valign="top"><p> the <code>zzip_dir_alloc</code> function is obsolete - it was generally used for implementation + and exported to let other code build on it. It is now advised to + use <code><a href="#zzip_dir_alloc_ext_io">zzip_dir_alloc_ext_io</a></code> now on explicitly, just set that second + argument to zero to achieve the same functionality as the old style. +</p> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_readdir">zzip_readdir</a></b>(ZZIP_DIR * dir) + : ZZIP_DIRENT * +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/dir.c</small></em></td></table> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_closedir">zzip_closedir</a></b>(ZZIP_DIR * dir) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/dir.c</small></em></td></table> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_errno">zzip_errno</a></b>(int errcode) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/err.c</small></em></td></table> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_file_close">zzip_file_close</a></b>(ZZIP_FILE * fp) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/file.c</small></em></td></table> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_file_open">zzip_file_open</a></b>(ZZIP_DIR * dir, zzip_char_t * name, int o_mode) + : ZZIP_FILE * +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/file.c</small></em></td></table> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_inflate_init">zzip_inflate_init</a></b>(ZZIP_FILE * fp, struct zzip_dir_hdr *hdr) + : static int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/file.c</small></em></td></table> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_file_read">zzip_file_read</a></b>(ZZIP_FILE * fp, void *buf, zzip_size_t len) + : zzip_ssize_t +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/file.c</small></em></td></table> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_rewind">zzip_rewind</a></b>(ZZIP_FILE * fp) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/file.c</small></em></td></table> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_compr_str">zzip_compr_str</a></b>(int compr) + : zzip_char_t * +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/info.c</small></em></td></table> +</td></tr></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="__zzip_fetch_disk_trailer">__zzip_fetch_disk_trailer</a></b>(int fd, zzip_off_t filesize, + struct _disk_trailer *_zzip_restrict trailer, + zzip_plugin_io_t io) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/zip.c</small></em></td></table> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="__zzip_parse_root_directory">__zzip_parse_root_directory</a></b>(int fd, + struct _disk_trailer *trailer, + struct zzip_dir_hdr **hdr_return, + zzip_plugin_io_t io) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/zip.c</small></em></td></table> +</td></tr></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="__zzip_try_open">__zzip_try_open</a></b>(zzip_char_t * filename, int filemode, + zzip_strings_t * ext, zzip_plugin_io_t io) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em>...</em> </td><td align="right"> <em><small>zzip/zip.c</small></em></td></table> +</td></tr></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd></dl> </body></html> -</td></tr></table></body></html> diff --git a/Build/source/libs/zziplib/zziplib-src/docs/zzipmmapped.html b/Build/source/libs/zziplib/zziplib-src/docs/zzipmmapped.html new file mode 100644 index 00000000000..38f22983ce8 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/docs/zzipmmapped.html @@ -0,0 +1,263 @@ +<html><head><title>zziplib Library Functions</title> +</head><body> +<h2>zziplib Library Functions</h2><p>Version 0.13.68</p><p><big><b><code>#include <zzip/mmapped.h></code></b></big></p><table width="100%"><tr><td valign="top"><code><b><code><a href="#zzip_disk_entry_to_data">zzip_disk_entry_to_data</a></code></b>(ZZIP_DISK * disk, struct zzip_disk_entry * entry) + : zzip_byte_t * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_entry_to_file_header">zzip_disk_entry_to_file_header</a></code></b>(ZZIP_DISK * disk, struct zzip_disk_entry *entry) + : struct zzip_file_header * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_entry_strdup_name">zzip_disk_entry_strdup_name</a></code></b>(ZZIP_DISK * disk, struct zzip_disk_entry *entry) + : zzip__new__ char * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_entry_strdup_comment">zzip_disk_entry_strdup_comment</a></code></b>(ZZIP_DISK * disk, struct zzip_disk_entry *entry) + : zzip__new__ char * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_findfile">zzip_disk_findfile</a></code></b>(ZZIP_DISK * disk, char *filename, + struct zzip_disk_entry *after, zzip_strcmp_fn_t compare) + : struct zzip_disk_entry * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_findfirst">zzip_disk_findfirst</a></code></b>(ZZIP_DISK * disk) + : struct zzip_disk_entry * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_findnext">zzip_disk_findnext</a></code></b>(ZZIP_DISK * disk, struct zzip_disk_entry *entry) + : struct zzip_disk_entry * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_findmatch">zzip_disk_findmatch</a></code></b>(ZZIP_DISK * disk, char *filespec, + struct zzip_disk_entry *after, + zzip_fnmatch_fn_t compare, int flags) + : struct zzip_disk_entry * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_fopen">zzip_disk_fopen</a></code></b>(ZZIP_DISK * disk, char *filename) + : zzip__new__ ZZIP_DISK_FILE * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_entry_fopen">zzip_disk_entry_fopen</a></code></b>(ZZIP_DISK * disk, ZZIP_DISK_ENTRY * entry) + : zzip__new__ ZZIP_DISK_FILE * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_fread">zzip_disk_fread</a></code></b>(void *ptr, zzip_size_t sized, zzip_size_t nmemb, + ZZIP_DISK_FILE * file) + : zzip_size_t +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_fclose">zzip_disk_fclose</a></code></b>(ZZIP_DISK_FILE * file) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_feof">zzip_disk_feof</a></code></b>(ZZIP_DISK_FILE * file) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_mmap">zzip_disk_mmap</a></code></b>(int fd) + : zzip__new__ ZZIP_DISK * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_init">zzip_disk_init</a></code></b>(ZZIP_DISK * disk, void *buffer, zzip_size_t buflen) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_new">zzip_disk_new</a></code></b>(void) + : zzip__new__ ZZIP_DISK * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_munmap">zzip_disk_munmap</a></code></b>(ZZIP_DISK * disk) + : int +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_open">zzip_disk_open</a></code></b>(char *filename) + : zzip__new__ ZZIP_DISK * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_buffer">zzip_disk_buffer</a></code></b>(void *buffer, size_t buflen) : zzip__new__ ZZIP_DISK * +</code></td></tr><tr><td valign="top"><code><b><code><a href="#zzip_disk_close">zzip_disk_close</a></code></b>(ZZIP_DISK * disk) + : int +</code></td></tr></table><h3>Documentation</h3><dl><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_disk_entry_to_data">zzip_disk_entry_to_data</a></b>(ZZIP_DISK * disk, struct zzip_disk_entry * entry) + : zzip_byte_t * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_entry_to_file_header">zzip_disk_entry_to_file_header</a></b>(ZZIP_DISK * disk, struct zzip_disk_entry *entry) + : struct zzip_file_header * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_entry_strdup_name">zzip_disk_entry_strdup_name</a></b>(ZZIP_DISK * disk, struct zzip_disk_entry *entry) + : zzip__new__ char * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_entry_strdup_comment">zzip_disk_entry_strdup_comment</a></b>(ZZIP_DISK * disk, struct zzip_disk_entry *entry) + : zzip__new__ char * +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em> helper functions for (mmapped) zip access api</em> </td><td align="right"> <em><small>zzip/mmapped.c</small></em></td></table><p> + The <code>zzip_disk_entry_to_data</code> function augments the other zzip_disk_entry_* helpers: here we move + a disk_entry pointer (as returned by _find* functions) into a pointer to + the data block right after the file_header. Only disk->buffer would be + needed to perform the seek but we check the mmapped range end as well. +</p><p> + The <code>zzip_disk_entry_to_data</code> function returns a pointer into disk->buffer or 0 on error (errno). +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_disk_entry_to_file_header</code> function does half the job of <code><a href="#zzip_disk_entry_to_data">zzip_disk_entry_to_data</a></code> where it + can augment with <code><u>zzip_file_header_to_data</u></code> helper from format/fetch.h +</p><p> + The <code>zzip_disk_entry_to_file_header</code> function returns a pointer into disk->buffer or 0 on error (errno). +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_disk_entry_strdup_name</code> function is a big helper despite its little name: in a zip file the + encoded filenames are usually NOT zero-terminated but for common usage + with libc we need it that way. Secondly, the filename SHOULD be present + in the zip central directory but if not then we fallback to the filename + given in the file_header of each compressed data portion. +</p><p> + The <code>zzip_disk_entry_strdup_name</code> function returns a new string buffer, or null on error. + If no name can be found then an empty string is returned. +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_disk_entry_strdup_comment</code> function is similar creating a reference to a zero terminated + string but it can only exist in the zip central directory entry. +</p><p> + The <code>zzip_disk_entry_strdup_comment</code> function returns a new string buffer, or null on error (errno). + If no name can be found then an empty string is returned. +</p> +</td></tr></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_disk_findfile">zzip_disk_findfile</a></b>(ZZIP_DISK * disk, char *filename, + struct zzip_disk_entry *after, zzip_strcmp_fn_t compare) + : struct zzip_disk_entry * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_findfirst">zzip_disk_findfirst</a></b>(ZZIP_DISK * disk) + : struct zzip_disk_entry * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_findnext">zzip_disk_findnext</a></b>(ZZIP_DISK * disk, struct zzip_disk_entry *entry) + : struct zzip_disk_entry * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_findmatch">zzip_disk_findmatch</a></b>(ZZIP_DISK * disk, char *filespec, + struct zzip_disk_entry *after, + zzip_fnmatch_fn_t compare, int flags) + : struct zzip_disk_entry * +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em> search for files in the (mmapped) zip central directory</em> </td><td align="right"> <em><small>zzip/mmapped.c</small></em></td></table><p> + The <code>zzip_disk_findfile</code> function is given a filename as an additional argument, to find the + disk_entry matching a given filename. The compare-function is usually + strcmp or strcasecmp or perhaps strcoll, if null then strcmp is used. + - use null as argument for "after"-entry when searching the first + matching entry, otherwise the last returned value if you look for other + entries with a special "compare" function (if null then a doubled search + is rather useless with this variant of _findfile). +</p><p> + The <code>zzip_disk_findfile</code> functionreturns the entry pointer. + The <code>zzip_disk_findfile</code> function may return null on error. (errno = ENOMEM|EBADMSG|ENOENT) +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_disk_findfirst</code> function is the first call of all the zip access functions here. + It contains the code to find the first entry of the zip central directory. + Here we require the mmapped block to represent a real zip file where the + disk_trailer is _last_ in the file area, so that its position would be at + a fixed offset from the end of the file area if not for the comment field + allowed to be of variable length (which needs us to do a little search + for the disk_tailer). However, in this simple implementation we disregard + any disk_trailer info telling about multidisk archives, so we just return + a pointer to the zip central directory. +</p><p> + For an actual means, we are going to search backwards from the end + of the mmaped block looking for the PK-magic signature of a + disk_trailer. If we see one then we check the rootseek value to + find the first disk_entry of the root central directory. If we find + the correct PK-magic signature of a disk_entry over there then we + assume we are done and we are going to return a pointer to that label. +</p><p> + The return value is a pointer to the first zzip_disk_entry being checked + to be within the bounds of the file area specified by the arguments. If + no disk_trailer was found then null is returned, and likewise we only + accept a disk_trailer with a seekvalue that points to a disk_entry and + both parts have valid PK-magic parts. Beyond some sanity check we try to + catch a common brokeness with zip archives that still allows us to find + the start of the zip central directory.So the <code>zzip_disk_findfirst</code> function may return null + and sets errno. +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_disk_findnext</code> function takes an existing disk_entry in the central root directory + (e.g. from zzip_disk_findfirst) and returns the next entry within in + the given bounds of the mmapped file area. +</p><p> + The <code>zzip_disk_findnext</code> function returns null if no next entry can be found. + The <code>zzip_disk_findnext</code> function may return null on errors. (errno = ENOENT|EINVAL|EBADMSG) +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_disk_findmatch</code> function uses a compare-function with an additional argument + and it is called just like fnmatch(3) from POSIX.2 AD:1993), i.e. + the argument filespec first and the ziplocal filename second with + the integer-flags put in as third to the indirect call. If the + platform has fnmatch available then null-compare will use that one + and otherwise we fall back to mere strcmp, so if you need fnmatch + searching then please provide an implementation somewhere else. + - use null as argument for "after"-entry when searching the first + matching entry, or the last disk_entry return-value to find the + next entry matching the given filespec. +</p><p> + The <code>zzip_disk_findmatch</code> function will return the matching entry pointer. + The <code>zzip_disk_findmatch</code> function may return null on error. (errno = ENOMEM|EBADMSG|ENOENT) +</p> +</td></tr></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_disk_fopen">zzip_disk_fopen</a></b>(ZZIP_DISK * disk, char *filename) + : zzip__new__ ZZIP_DISK_FILE * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_entry_fopen">zzip_disk_entry_fopen</a></b>(ZZIP_DISK * disk, ZZIP_DISK_ENTRY * entry) + : zzip__new__ ZZIP_DISK_FILE * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_fread">zzip_disk_fread</a></b>(void *ptr, zzip_size_t sized, zzip_size_t nmemb, + ZZIP_DISK_FILE * file) + : zzip_size_t +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_fclose">zzip_disk_fclose</a></b>(ZZIP_DISK_FILE * file) + : int +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_feof">zzip_disk_feof</a></b>(ZZIP_DISK_FILE * file) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em> openening a file part wrapped within a (mmapped) zip archive</em> </td><td align="right"> <em><small>zzip/mmapped.c</small></em></td></table><p> + The <code>zzip_disk_fopen</code> function opens a file found by name, so it does a search into + the zip central directory with <code><a href="#zzip_disk_findfile">zzip_disk_findfile</a></code> and whatever + is found first is given to <code><a href="#zzip_disk_entry_fopen">zzip_disk_entry_fopen</a></code> +</p><p> + The <code>zzip_disk_fopen</code> function may return null on errors (errno). +</p> +</td></tr><tr><td valign="top"><p> + the ZZIP_DISK_FILE* is rather simple in just encapsulating the + arguments given to the <code>zzip_disk_entry_fopen</code> function plus a zlib deflate buffer. + Note that the ZZIP_DISK pointer does already contain the full + mmapped file area of a zip disk, so open()ing a file part within + that area happens to be a lookup of its bounds and encoding. That + information is memorized on the ZZIP_DISK_FILE so that subsequent + _read() operations will be able to get the next data portion or + return an eof condition for that file part wrapped in the zip archive. +</p><p> + The <code>zzip_disk_entry_fopen</code> function may return null on errors (errno = ENOMEM|EBADMSG). +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_disk_fread</code> function reads more bytes into the output buffer specified as + arguments. The return value is null on eof or error, the stdio-like + interface can not distinguish between these so you need to check + with <code><a href="#zzip_disk_feof">zzip_disk_feof</a></code> for the difference. +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_disk_fclose</code> function releases any zlib decoder info needed for decompression + and dumps the ZZIP_DISK_FILE* then. +</p><p> + The <code>zzip_disk_fclose</code> function always returns 0. +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_disk_feof</code> function allows to distinguish an error from an eof condition. + Actually, if we found an error but we did already reach eof then we + just keep on saying that it was an eof, so the app can just continue. +</p><p> + The <code>zzip_disk_feof</code> function returns EOF in case and 0 when not at the end + of file. +</p> +</td></tr></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"><tr><td valign="top"><code><b><a name="zzip_disk_mmap">zzip_disk_mmap</a></b>(int fd) + : zzip__new__ ZZIP_DISK * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_init">zzip_disk_init</a></b>(ZZIP_DISK * disk, void *buffer, zzip_size_t buflen) + : int +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_new">zzip_disk_new</a></b>(void) + : zzip__new__ ZZIP_DISK * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_munmap">zzip_disk_munmap</a></b>(ZZIP_DISK * disk) + : int +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_open">zzip_disk_open</a></b>(char *filename) + : zzip__new__ ZZIP_DISK * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_buffer">zzip_disk_buffer</a></b>(void *buffer, size_t buflen) : zzip__new__ ZZIP_DISK * +</code></td></tr><tr><td valign="top"><code><b><a name="zzip_disk_close">zzip_disk_close</a></b>(ZZIP_DISK * disk) + : int +</code></td></tr></table></dt><dd><table width="100%"><tr><td valign="top"><table border="0" width="100%" cellpadding="0" cellspacing="0"><td> <em> turn a filehandle into a mmapped zip disk archive handle</em> </td><td align="right"> <em><small>zzip/mmapped.c</small></em></td></table><p> + The <code>zzip_disk_mmap</code> function uses the given file-descriptor to detect the length of the + file and calls the system <a href="http://www.opengroup.org/onlinepubs/000095399/functions/mmap.html"><code>mmap(2)</code></a> to put it in main memory. If it is + successful then a newly allocated ZZIP_DISK* is returned with + disk->buffer pointing to the mapview of the zipdisk content. +</p><p> + The <code>zzip_disk_mmap</code> function may return null on errors (errno). +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_disk_init</code> function does primary initialization of a disk-buffer struct. +</p><p> + The <code>zzip_disk_init</code> function always returns 0 as success. +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_disk_new</code> function allocates a new disk-buffer with <a href="http://www.opengroup.org/onlinepubs/000095399/functions/malloc.html"><code>malloc(3)</code></a> +</p><p> + The <code>zzip_disk_new</code> function may return null on errors (errno). +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_disk_munmap</code> function is the inverse of <code><a href="#zzip_disk_mmap">zzip_disk_mmap</a></code> and using the system + munmap(2) on the buffer area and <a href="http://www.opengroup.org/onlinepubs/000095399/functions/free.html"><code>free(3)</code></a> on the ZZIP_DISK structure. +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_disk_open</code> function opens the given archive by name and turn the filehandle + to <code><a href="#zzip_disk_mmap">zzip_disk_mmap</a></code> for bringing it to main memory. If it can not + be <a href="http://www.opengroup.org/onlinepubs/000095399/functions/mmap.html"><code>mmap(2)</code></a>'ed then we slurp the whole file into a newly <a href="http://www.opengroup.org/onlinepubs/000095399/functions/malloc.html"><code>malloc(2)</code></a>'ed + memory block. Only if that fails too then we return null. Since handling + of disk->buffer is ambiguous it should not be snatched away please. +</p><p> + The <code>zzip_disk_open</code> function may return null on errors (errno). +</p> +</td></tr><tr><td valign="top"><p> The <code>zzip_disk_buffer</code> function will attach a buffer with a zip image + that was acquired from another source than a file. + Note that if zzip_disk_mmap fails then zzip_disk_open + will fall back and try to read the full file to memory + wrapping a ZZIP_DISK around the memory buffer just as + the <code>zzip_disk_buffer</code> function will do. Note that the <code>zzip_disk_buffer</code> function will not + own the buffer, it will neither be written nor free()d. +</p><p> + The <code>zzip_disk_buffer</code> function may return null (errno). +</p> +</td></tr><tr><td valign="top"><p> + The <code>zzip_disk_close</code> function will release all data needed to access a (mmapped) + zip archive, including any malloc()ed blocks, sharedmem mappings + and it dumps the handle struct as well. +</p><p> + The <code>zzip_disk_close</code> function returns 0 on success (or whatever <code><u>munmap</u></code> says). +</p> +</td></tr></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd><dt><table width="100%"></table></dt><dd><table width="100%"></table></dd></dl> +</body></html> diff --git a/Build/source/libs/zziplib/zziplib-src/m4/ac_sys_largefile_sensitive.m4 b/Build/source/libs/zziplib/zziplib-src/m4/ac_sys_largefile_sensitive.m4 index 235c7f9acaa..6a296df5278 100644 --- a/Build/source/libs/zziplib/zziplib-src/m4/ac_sys_largefile_sensitive.m4 +++ b/Build/source/libs/zziplib/zziplib-src/m4/ac_sys_largefile_sensitive.m4 @@ -8,7 +8,7 @@ dnl dnl This macro builds on top of AC_SYS_LARGEFILE to detect whether dnl special options are neede to make the code use 64bit off_t - in dnl many setups this will also make the code use 64bit off_t -dnl immediatly. +dnl immediately. dnl dnl The common use of a LARGEFILE_SENSITIVE config.h-define is to dnl rename exported functions, usually adding a 64 to the original diff --git a/Build/source/libs/zziplib/zziplib-src/m4/ax_enable_builddir.m4 b/Build/source/libs/zziplib/zziplib-src/m4/ax_enable_builddir.m4 index 81ec64b8539..7c65c2955f1 100644 --- a/Build/source/libs/zziplib/zziplib-src/m4/ax_enable_builddir.m4 +++ b/Build/source/libs/zziplib/zziplib-src/m4/ax_enable_builddir.m4 @@ -36,7 +36,7 @@ dnl lines like '#### $host |$builddir' to recognize the place where to dnl recurse into. Usually, the last one is the only one used. However, dnl almost all targets have an additional "*-all" rule which makes the dnl script to recurse into _all_ variants of the current HOST (!!) -dnl setting. The "-all" suffix can be overriden for the macro as well. +dnl setting. The "-all" suffix can be overridden for the macro as well. dnl dnl a special rule is only given for things like "dist" that will copy dnl the tarball from the builddir to the sourcedir (or $(PUB)) for diff --git a/Build/source/libs/zziplib/zziplib-src/m4/ax_enable_builddir_uname.m4 b/Build/source/libs/zziplib/zziplib-src/m4/ax_enable_builddir_uname.m4 deleted file mode 100644 index df5e2639c17..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/m4/ax_enable_builddir_uname.m4 +++ /dev/null @@ -1,164 +0,0 @@ -dnl /usr/share/aclocal/guidod-cvs/ax_enable_builddir_uname.m4 -dnl @synopsis AX_ENABLE_BUILDDIR_UNAME [(dirstring-or-command [,Makefile.mk])] -dnl -dnl if the current configure was run within the srcdir then we move all -dnl configure-files into a subdir and let the configure steps continue -dnl there. We provide an option --disable-builddir to suppress the move -dnl into a separate builddir. -dnl -dnl Defaults: -dnl -dnl $1 = $build (defaults to `uname -msr`.d) -dnl $2 = Makefile.mk -dnl $3 = -all -dnl -dnl This macro must be called before AM_INIT_AUTOMAKE. -dnl -dnl it creates a default toplevel srcdir Makefile from the information -dnl found in the created toplevel builddir Makefile. It just copies the -dnl variables and rule-targets, each extended with a default -dnl rule-execution that recurses into the build directory of the -dnl current "BUILD". You can override the auto-dection through -dnl `uname -msr | tr " /" "__"`.d at build-time of course, as in -dnl -dnl make BUILD=i386-mingw-cross -dnl -dnl After the default has been created, additional rules can be -dnl appended that will not just recurse into the subdirectories and -dnl only ever exist in the srcdir toplevel makefile - these parts are -dnl read from the $2 = Makefile.mk file -dnl -dnl The automatic rules are usually scanning the toplevel Makefile for -dnl lines like '#### $build |$builddir' to recognize the place where to -dnl recurse into. Usually, the last one is the only one used. However, -dnl almost all targets have an additional "*-all" rule which makes the -dnl script to recurse into _all_ variants of the current BUILD (!!) -dnl setting. The "-all" suffix can be overriden for the macro as well. -dnl -dnl a special rule is only given for things like "dist" that will copy -dnl the tarball from the builddir to the sourcedir (or $(PUB)) for -dnl reason of convenience. -dnl -dnl @category Misc -dnl @author Guido U. Draheim -dnl @version 2005-12-03 -dnl @license GPLWithACException - -AC_DEFUN([AX_ENABLE_BUILDDIR_UNAME],[ -AC_REQUIRE([AC_CANONICAL_HOST])[]dnl -AC_REQUIRE([AX_CONFIGURE_ARGS])[]dnl -AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl -AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl -AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl -SUB="." -AC_ARG_ENABLE([builddir], AC_HELP_STRING( - [--disable-builddir],[disable automatic build in subdir of sources]) - ,[SUB="$enableval"], [SUB="yes"]) -if test ".$ac_srcdir_defaulted" != ".no" ; then -if test ".$srcdir" = ".." ; then - if test -f config.status ; then - AC_MSG_NOTICE(toplevel srcdir already configured... skipping subdir build) - else - test ".$SUB" = "." && SUB="." - test ".$SUB" = ".no" && SUB="." - test ".$BUILD" = "." && BUILD=`uname -msr | tr " /" "__"`.d - test ".$SUB" = ".yes" && SUB="m4_ifval([$1], [$1],[$BUILD])" - if test ".$SUB" != ".." ; then # we know where to go and - AS_MKDIR_P([$SUB]) - echo __.$SUB.__ > $SUB/conftest.tmp - cd $SUB - if grep __.$SUB.__ conftest.tmp >/dev/null 2>/dev/null ; then - rm conftest.tmp - AC_MSG_RESULT([continue configure in default builddir "./$SUB"]) - else - AC_MSG_ERROR([could not change to default builddir "./$SUB"]) - fi - srcdir=`echo "$SUB" | - sed -e 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g;s,[[/]]$,,;'` - # going to restart from subdirectory location - test -f $srcdir/config.log && mv $srcdir/config.log . - test -f $srcdir/confdefs.h && mv $srcdir/confdefs.h . - test -f $srcdir/conftest.log && mv $srcdir/conftest.log . - test -f $srcdir/$cache_file && mv $srcdir/$cache_file . - AC_MSG_RESULT(....exec $SHELL "$srcdir/[$]0" "--srcdir=$srcdir" "--enable-builddir=$SUB" $ac_configure_args) - case "[$]0" in # restart - [/\\]*) eval $SHELL "'[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;; - *) eval $SHELL "'$srcdir/[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;; - esac ; exit $? - fi - fi -fi fi -dnl ac_path_prog uses "set dummy" to override $@ which would defeat the "exec" -AC_PATH_PROG(SED,gsed sed, sed) -AS_VAR_POPDEF([SED])dnl -AS_VAR_POPDEF([SUB])dnl -AC_CONFIG_COMMANDS([buildir],[dnl .............. config.status .............. -AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl -AS_VAR_PUSHDEF([TOP],[top_srcdir])dnl -AS_VAR_PUSHDEF([SRC],[ac_top_srcdir])dnl -AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl -pushdef([END],[Makefile.mk])dnl - SRC="$ax_enable_builddir_srcdir" - if test ".$SUB" = "." ; then - if test -f "$TOP/Makefile" ; then - AC_MSG_NOTICE([skipping TOP/Makefile - left untouched]) - else - AC_MSG_NOTICE([skipping TOP/Makefile - not created]) - fi - else - AC_MSG_NOTICE([create TOP/Makefile guessed from local Makefile]) - x='`' ; cat >$tmp/conftemp.sed <<_EOF -/^\$/n -x -/^\$/bS -x -/\\\\\$/{H;d;} -{H;s/.*//;x;} -bM -:S -x -/\\\\\$/{h;d;} -{h;s/.*//;x;} -:M -s/\\(\\n\\) /\\1 /g -/^ /d -/^[[ ]]*[[\\#]]/d -/^VPATH *=/d -s/^srcdir *=.*/srcdir = ./ -s/^top_srcdir *=.*/top_srcdir = ./ -/[[:=]]/!d -/^\\./d -s/:.*/:/ -/:\$/s/ / /g -/:\$/s/ / /g -/^.*[[=]]/!s%\$% ; (cd \$(BUILD) \\&\\& \$(ISNOTSRCDIR) \\&\\& \$(MAKE) "\$\@") || exit ; \$(MAKE) done "RULE=\$\@"% -_EOF - test ".$USE_MAINTAINER_MODE" = ".no" || \ - cp "$tmp/conftemp.sed" "$SRC/makefile.sed~" ## DEBUGGING - echo 'BUILD=`uname -msr | tr " /" "__"`.d' >$SRC/Makefile - echo 'ISNOTSRCDIR=test ! -f configure' >>$SRC/Makefile - $SED -f $tmp/conftemp.sed Makefile >>$SRC/Makefile - echo 'done: ;@ if grep "$(RULE)-done .*:" Makefile > /dev/null; then dnl - echo $(MAKE) $(RULE)-done ; $(MAKE) $(RULE)-done ; else true ; fi' dnl - >> $SRC/Makefile - if test -f "$SRC/m4_ifval([$2],[$2],[END])" ; then - AC_MSG_NOTICE([extend TOP/Makefile with TOP/m4_ifval([$2],[$2],[END])]) - cat $SRC/END >>$SRC/Makefile - fi - AC_MSG_NOTICE([make uses BUILD=$SUB (on $ax_enable_builddir_host:)]) - fi -popdef([END])dnl -AS_VAR_POPDEF([SED])dnl -AS_VAR_POPDEF([SRC])dnl -AS_VAR_POPDEF([TOP])dnl -AS_VAR_POPDEF([SUB])dnl -],[dnl -ax_enable_builddir_srcdir="$srcdir" # $srcdir -ax_enable_builddir_host="$HOST" # $HOST / $host -ax_enable_builddir_version="$VERSION" # $VERSION -ax_enable_builddir_package="$PACKAGE" # $PACKAGE -ax_enable_builddir_sed="$ax_enable_builddir_sed" # $SED -ax_enable_builddir="$ax_enable_builddir" # $SUB -])dnl -]) - diff --git a/Build/source/libs/zziplib/zziplib-src/m4/ax_set_version_info.m4 b/Build/source/libs/zziplib/zziplib-src/m4/ax_set_version_info.m4 index 83c5fa73f21..20fded0f09a 100644 --- a/Build/source/libs/zziplib/zziplib-src/m4/ax_set_version_info.m4 +++ b/Build/source/libs/zziplib/zziplib-src/m4/ax_set_version_info.m4 @@ -11,7 +11,7 @@ dnl which will form a -version-info in a @VERSION_INFO@ ac_subst while dnl the rest is going to the -release name in a @RELEASE_INFO@ dnl ac_subst. dnl -dnl you should keep these two seperate - the release-name may contain +dnl you should keep these two separate - the release-name may contain dnl alpha-characters and can be modified later with extra release-hints dnl e.g. RELEASE_INFO="$RELEASE_INFO-debug" for a debug version of your dnl lib. The $VERSION_INFO however should not be touched. diff --git a/Build/source/libs/zziplib/zziplib-src/m4/libtool.m4 b/Build/source/libs/zziplib/zziplib-src/m4/libtool.m4 index 39ba996cb96..b8ce6580e16 100644 --- a/Build/source/libs/zziplib/zziplib-src/m4/libtool.m4 +++ b/Build/source/libs/zziplib/zziplib-src/m4/libtool.m4 @@ -603,7 +603,7 @@ configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2008 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." +gives unlimited permission to copy, distribute and modify it." while test $[#] != 0 do diff --git a/Build/source/libs/zziplib/zziplib-src/m4/patch_libtool_to_add_host_cc.m4 b/Build/source/libs/zziplib/zziplib-src/m4/patch_libtool_to_add_host_cc.m4 index 04c06e337bf..ff9247b5efa 100644 --- a/Build/source/libs/zziplib/zziplib-src/m4/patch_libtool_to_add_host_cc.m4 +++ b/Build/source/libs/zziplib/zziplib-src/m4/patch_libtool_to_add_host_cc.m4 @@ -31,7 +31,7 @@ dnl currently in the making. The whole stuff of impgen exe and dnl compiling it on-the-fly, well, it is superflouos then. dnl dnl Since mingw crosscompilers tend to be quite a fresh development it -dnl was agreed to remove the impgen stuff completly from libtool +dnl was agreed to remove the impgen stuff completely from libtool dnl sources. Still however, this macro does not hurt since it does not dnl patch impgen cmds but it just adds HOST_CC which might be useful in dnl other cross-compiling cases as well. Therefore, you can leave it in diff --git a/Build/source/libs/zziplib/zziplib-src/msvc7/README.TXT b/Build/source/libs/zziplib/zziplib-src/msvc7/README.TXT deleted file mode 100644 index dbbd5febabf..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/msvc7/README.TXT +++ /dev/null @@ -1,31 +0,0 @@ -These project files were tested with the -free Microsoft Visual C++ 2005 Express Edition. - -Visual C++ Express does NOT include the Win32 SDK Headers. -They must be downloaded separately as documented in the -installation instructions at Microsoft - consequently that -extra installation must be referenced via a system variable: -Set MSSdk=C:\Program Files\Microsoft Platform SDK - -In order to compile you need a valid Zlib SDK - you can -download it from zlib.org in the archive zlib123-dll.zip - -I had unpacked them to $(zziplibdir)/zlib inside the -toplevel of the zziplib source tree. That SDK does ship -with a "zlib1.dll" runtime and "zdll.lib" import library. - -The new Visual Studio has depracated most of the Win32 API -just as well as most of the Posix API. That provokes a lot -of warning message in surplus of the many warning message -that occur on every implicit conversion between signed and -unsigned types. Other compilers are more clever about -detecting real conversion issues, therefore they are not -going to be "patched away" with an explicit conversion in -the source files (I expect Microsoft to get it right somewhen). - -== Download Places == -download.microsoft.com/download/a/5/f/a5f0d781-e201-4ab6-8c6a-9bb4efed1e1a/ -PSDK-x86.exe = Win32 SDK - online installer -download.microsoft.com/download/A/9/1/A91D6B2B-A798-47DF-9C7E-A97854B7DD18/ -VC.iso = Visual C++ Express CD-image -download.microsoft.com/download/C/6/F/C6F4733B-67C7-4C15-9F21-61F7A3167505/ -VCS.iso = Visual C# Express CD-image diff --git a/Build/source/libs/zziplib/zziplib-src/msvc7/zip.exe b/Build/source/libs/zziplib/zziplib-src/msvc7/zip.exe Binary files differdeleted file mode 100755 index 2c5b268b47d..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/msvc7/zip.exe +++ /dev/null diff --git a/Build/source/libs/zziplib/zziplib-src/msvc8/README.TXT b/Build/source/libs/zziplib/zziplib-src/msvc8/README.TXT index 4767a06787e..3733cb4010c 100644 --- a/Build/source/libs/zziplib/zziplib-src/msvc8/README.TXT +++ b/Build/source/libs/zziplib/zziplib-src/msvc8/README.TXT @@ -13,7 +13,7 @@ I had unpacked them to $(zziplibdir)/zlib inside the toplevel of the zziplib source tree. That SDK does ship with a "zlib1.dll" runtime and "zdll.lib" import library. -The new Visual Studio has depracated most of the Win32 API +The new Visual Studio has deprecated most of the Win32 API just as well as most of the Posix API. That provokes a lot of warning message in surplus of the many warning message that occur on every implicit conversion between signed and diff --git a/Build/source/libs/zziplib/zziplib-src/ports/symbian-S60/zziplib-symbian.zip b/Build/source/libs/zziplib/zziplib-src/ports/symbian-S60/zziplib-symbian.zip Binary files differdeleted file mode 100644 index cb8f83b4df8..00000000000 --- a/Build/source/libs/zziplib/zziplib-src/ports/symbian-S60/zziplib-symbian.zip +++ /dev/null diff --git a/Build/source/libs/zziplib/zziplib-src/test/Makefile.am b/Build/source/libs/zziplib/zziplib-src/test/Makefile.am index 9b3c08a76bf..f493b07b60f 100644 --- a/Build/source/libs/zziplib/zziplib-src/test/Makefile.am +++ b/Build/source/libs/zziplib/zziplib-src/test/Makefile.am @@ -39,7 +39,10 @@ check-local: check-readme $(sfxtests) $(newtests) check-tests: tests tests: @ test -f zziptests.py || cp -s -v $(srcdir)/zziptests.py . - python zziptests.py -v + python zziptests.py --exeext "$(EXEEXT)" --topsrcdir "$(top_srcdir)" +test_%: + @ test -f zziptests.py || cp -s -v $(srcdir)/zziptests.py . + python zziptests.py $@ -vvvv --exeext "$(EXEEXT)" --topsrcdir "$(top_srcdir)" check-readme : $(zzcat) test.zip @ test -f test.zip || $(MAKE) tmp/../test.zip @@ -76,3 +79,4 @@ check-sfx : zzshowme$(EXEEXT) ; if test -s readme.out ; then diff readme.out $(README) \ ; else grep "libzzip-" readme.err || echo "readme.out is empty!" ; fi rm readme.out readme.err + diff --git a/Build/source/libs/zziplib/zziplib-src/test/Makefile.in b/Build/source/libs/zziplib/zziplib-src/test/Makefile.in index 7b6c8ffda8f..5c0f42cf784 100644 --- a/Build/source/libs/zziplib/zziplib-src/test/Makefile.in +++ b/Build/source/libs/zziplib/zziplib-src/test/Makefile.in @@ -674,7 +674,10 @@ check-local: check-readme $(sfxtests) $(newtests) check-tests: tests tests: @ test -f zziptests.py || cp -s -v $(srcdir)/zziptests.py . - python zziptests.py -v + python zziptests.py --exeext "$(EXEEXT)" --topsrcdir "$(top_srcdir)" +test_%: + @ test -f zziptests.py || cp -s -v $(srcdir)/zziptests.py . + python zziptests.py $@ -vvvv --exeext "$(EXEEXT)" --topsrcdir "$(top_srcdir)" check-readme : $(zzcat) test.zip @ test -f test.zip || $(MAKE) tmp/../test.zip diff --git a/Build/source/libs/zziplib/zziplib-src/test/README b/Build/source/libs/zziplib/zziplib-src/test/README index 5668eda043a..22868fa9516 100644 --- a/Build/source/libs/zziplib/zziplib-src/test/README +++ b/Build/source/libs/zziplib/zziplib-src/test/README @@ -24,11 +24,12 @@ LICENSING special (paid) licenses can be negotiated with the copyright holder. HOMEPAGE - The zziplib project is hosted at SourceForge, the complete - documentation can be found at http://zziplib.sf.net - the - SourceForge servers are also used to distribute the sources - of the zziplib project. Releases are announced via the - freshmeat services on http://freshmeat.net/projects/zziplib + The zziplib project has moved to GitHub where you can find the + last release tags now => https://github.com/gdraheim/zziplib + The zziplib project was originally hosted at SourceForge with + the documentation at http://zziplib.sf.net - this is a bit + outdated but the API has not changed much since then. To get + the latest release announcements, watch the GitHub project. INSTALLATION The zziplib sources are built with gnu autotools and they should @@ -39,7 +40,7 @@ INSTALLATION VisualC series of compilers. There should be no problem either when crosscompiling the zziplib for a third host platform. -MAINTAINANCE +MAINTENANCE The zziplib library is intentionally a lightweight interface to zip files. The author take patches but please consider to put complex extensions into separate modules rather than implanting them diff --git a/Build/source/libs/zziplib/zziplib-src/test/test.zip b/Build/source/libs/zziplib/zziplib-src/test/test.zip Binary files differindex 8923726372b..c03b5ca5557 100644 --- a/Build/source/libs/zziplib/zziplib-src/test/test.zip +++ b/Build/source/libs/zziplib/zziplib-src/test/test.zip diff --git a/Build/source/libs/zziplib/zziplib-src/test/zziptests.py b/Build/source/libs/zziplib/zziplib-src/test/zziptests.py index 1ad56367ef2..ae7e64a0b80 100644 --- a/Build/source/libs/zziplib/zziplib-src/test/zziptests.py +++ b/Build/source/libs/zziplib/zziplib-src/test/zziptests.py @@ -1,9 +1,15 @@ import unittest import subprocess import logging +import inspect import os import collections +import urllib +import shutil +import random +import re from fnmatch import fnmatchcase as matches +from cStringIO import StringIO logg = logging.getLogger("test") @@ -25,13 +31,17 @@ def shell(command, shell=True, calls=False, cwd=None, env=None, lang=None, retur command = [ command ] else: sh_command = shell_string(command) + if not env: + env = os.environ.copy() if lang: - if not env: env = os.environ.copy() for name, value in env.items(): if name.startswith("LC_"): env[name] = lang env["LANG"] = lang # defines message format env["LC_ALL"] = lang # other locale formats + build_libs = os.path.dirname(os.path.dirname(os.path.realpath(command[0])))+"/zzip/.libs" + if os.path.isdir(build_libs): + env["LD_LIBRARY_PATH"] = build_libs try: output, errors = "", "" if calls: @@ -64,6 +74,7 @@ def shell(command, shell=True, calls=False, cwd=None, env=None, lang=None, retur for line in errors.split("\n"): if line: logg.warning("ERR: %s", line) + raise subprocess.CalledProcessError(run.returncode, sh_command, output) else: for line in output.split("\n"): if line: @@ -73,55 +84,162 @@ def shell(command, shell=True, calls=False, cwd=None, env=None, lang=None, retur logg.debug("ERR: %s", line) return Shell(run.returncode, output, errors, sh_command) +def get_caller_name(): + frame = inspect.currentframe().f_back.f_back + return frame.f_code.co_name +def get_caller_caller_name(): + frame = inspect.currentframe().f_back.f_back.f_back + return frame.f_code.co_name + +def download_raw(base_url, filename, into, style = "?raw=true"): + return download(base_url, filename, into, style) +def download(base_url, filename, into, style = ""): + data = "tmp.download" + if not os.path.isdir(data): + os.makedirs(data) + subname = urllib.quote_plus(base_url) + subdir = os.path.join(data, subname) + if not os.path.isdir(subdir): + os.makedirs(subdir) + subfile = os.path.join(subdir, filename) + if not os.path.exists(subfile): + logg.info("need %s", subfile) + d = urllib.urlopen(base_url + "/" + filename + style) + f = open(subfile, "w") + f.write(d.read()) + f.close() + # + if not os.path.isdir(into): + os.makedirs(into) + shutil.copy(subfile, into) + return filename + +def output(cmd, shell=True): + run = subprocess.Popen(cmd, shell=shell, stdout=subprocess.PIPE) + out, err = run.communicate() + return out +def grep(pattern, lines): + if isinstance(lines, basestring): + lines = lines.split("\n") + for line in lines: + if re.search(pattern, line.rstrip()): + yield line.rstrip() +def greps(lines, pattern): + return list(grep(pattern, lines)) +def all_errors(lines): + if isinstance(lines, basestring): + lines = lines.split("\n") + for line in lines: + if not line.strip(): + continue + if "DEBUG:" in line: + continue + if "HINT:" in line: + continue + yield line.rstrip() +def errors(lines): + return list(all_errors(lines)) class ZZipTest(unittest.TestCase): @property def t(self): - if not os.path.isdir(testdatadir): - os.makedirs(testdatadir) - return testdatdir + if not os.path.isdir(testdatadir): + os.makedirs(testdatadir) + return testdatdir @property def s(self): return topsrcdir def src(self, name): return os.path.join(self.s, name) def readme(self): - f = open(self.src(readme)) - text = f.read() - f.close() - return text + f = open(self.src(readme)) + text = f.read() + f.close() + return text def mkfile(self, name, content): b = os.path.dirname(name) if not os.path.isdir(b): - os.makedirs(b) + os.makedirs(b) f = open(name, "w") f.write(content) f.close() def bins(self, name): + if name == "unzip": return unzip + if name == "mkzip": return mkzip exe = os.path.join("..", "bins", name) if exeext: exe += exeext return exe - def test_100_make_test0_zip(self): + def gentext(self, size): + random.seed(1234567891234567890) + result = StringIO() + old1 = '' + old2 = '' + for i in xrange(size): + while True: + x = random.choice(" abcdefghijklmnopqrstuvwxyz\n") + if x == old1 or x == old2: continue + old1 = old2 + old2 = x + break + result.write(x) + return result.getvalue() + def caller_testname(self): + name = get_caller_caller_name() + x1 = name.find("_") + if x1 < 0: return name + x2 = name.find("_", x1+1) + if x2 < 0: return name + return name[:x2] + def testname(self, suffix = None): + name = self.caller_testname() + if suffix: + return name + "_" + suffix + return name + def testzip(self, testname = None): + testname = testname or self.caller_testname() + zipname = testname + ".zip" + return zipname + def testdir(self, testname = None): + testname = testname or self.caller_testname() + newdir = "tmp."+testname + if os.path.isdir(newdir): + shutil.rmtree(newdir) + os.makedirs(newdir) + return newdir + def rm_testdir(self, testname = None): + testname = testname or self.caller_testname() + newdir = "tmp."+testname + if os.path.isdir(newdir): + shutil.rmtree(newdir) + return newdir + def rm_testzip(self, testname = None): + testname = testname or self.caller_testname() + zipname = testname + ".zip" + if os.path.exists(zipname): + os.remove(zipname) + return True + ################################################################ + def test_1000_make_test0_zip(self): """ create a test.zip for later tests using standard 'zip' It will fall back to a variant in the source code if 'zip' is not installed on the build host. The content is just the README file that we can check for equality later on. """ zipfile="test0.zip" tmpdir="test0.tmp" - exe=mkzip + exe=self.bins("mkzip") filename = os.path.join(tmpdir,"README") filetext = self.readme() self.mkfile(filename, filetext) shell("{exe} ../{zipfile} README".format(**locals()), cwd=tmpdir) self.assertGreater(os.path.getsize(zipfile), 10) - def test_101_make_test1_zip(self): + def test_10001_make_test1_zip(self): """ create a test1.zip for later tests using standard 'zip' It will fall back to a variant in the source code if 'zip' is not installed on the build host. The archive has 10 generic files that we can check for their content later. """ zipfile="test1.zip" tmpdir="test1.tmp" - exe=mkzip + exe=self.bins("mkzip") for i in [1,2,3,4,5,6,7,8,9]: filename = os.path.join(tmpdir,"file.%i" % i) filetext = "file-%i\n" % i @@ -131,13 +249,13 @@ class ZZipTest(unittest.TestCase): self.mkfile(filename, filetext) shell("{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir) self.assertGreater(os.path.getsize(zipfile), 10) - def test_102_make_test2_zip(self): + def test_10002_make_test2_zip(self): """ create a test2.zip for later tests using standard 'zip' It will NOT fall back to a variant in the source code. The archive has 100 generic files with known content. """ zipfile="test2.zip" tmpdir="test2.tmp" - exe=mkzip + exe=self.bins("mkzip") for i in xrange(100): filename = os.path.join(tmpdir,"file.%02i" % i) filetext = "file-%02i\n" % i @@ -147,13 +265,13 @@ class ZZipTest(unittest.TestCase): self.mkfile(filename, filetext) shell("{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir) self.assertGreater(os.path.getsize(zipfile), 10) - def test_103_make_test3_zip(self): + def test_10003_make_test3_zip(self): """ create a test3.zip for later tests using standard 'zip' It will NOT fall back to a variant in the source code. The archive has 1000 generic files with known content. """ zipfile="test3.zip" tmpdir="test3.tmp" - exe=mkzip + exe=self.bins("mkzip") for i in xrange(1000): filename = os.path.join(tmpdir,"file.%03i" % i) filetext = "file-%03i\n" % i @@ -163,24 +281,48 @@ class ZZipTest(unittest.TestCase): self.mkfile(filename, filetext) shell("{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir) self.assertGreater(os.path.getsize(zipfile), 10) - def test_104_make_test4_zip(self): + def test_10004_make_test4_zip(self): """ create a test4.zip for later tests using standard 'zip' It will NOT fall back to a variant in the source code. - The archive has 1000 generic files with known content - and they are NOT stored compressed in the archive. """ + The archive has 10000 generic files with known content + and they are stored (NOT compressed) in the archive. """ zipfile="test4.zip" tmpdir="test4.tmp" - exe=mkzip - for i in xrange(1000): - filename = os.path.join(tmpdir,"file.%03i" % i) - filetext = "file-%03i\n" % i + exe=self.bins("mkzip") + for i in xrange(10000): + filename = os.path.join(tmpdir,"file%04i.txt" % i) + filetext = "file-%04i\n" % i self.mkfile(filename, filetext) filename = os.path.join(tmpdir,"README") filetext = self.readme() self.mkfile(filename, filetext) shell("{exe} -n README ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir) - self.assertGreater(os.path.getsize(zipfile), 10) - def test_110_make_test0_dat(self): + self.assertGreater(os.path.getsize(zipfile), 1000000) + def test_10005_make_test5_zip(self): + """ create a test5.zip for later tests using standard 'zip' + It will NOT fall back to a variant in the source code. + The archive has files at multiple subdirectories depth + and of varying sizes each. """ + zipfile="test5.zip" + tmpdir="test5.tmp" + exe=self.bins("mkzip") + for depth in xrange(20): + dirpath = "" + for i in xrange(depth): + if i: + dirpath += "subdir%i/" % i + for size in xrange(18): + size = 2 ** size + filetext = self.gentext(size) + filepart = "file%i-%i.txt" % (depth, size) + filename = os.path.join(tmpdir, dirpath + filepart ) + self.mkfile(filename, filetext) + filename = os.path.join(tmpdir,"README") + filetext = self.readme() + self.mkfile(filename, filetext) + shell("{exe} ../{zipfile} -r file* subdir* README".format(**locals()), cwd=tmpdir) + self.assertGreater(os.path.getsize(zipfile), 1000000) + def test_10010_make_test0_dat(self): """ create test.dat from test.zip with xorcopy """ zipfile = "test0.zip" datfile = "test0x.dat" @@ -188,7 +330,7 @@ class ZZipTest(unittest.TestCase): shell("{exe} {zipfile} {datfile}".format(**locals())) self.assertGreater(os.path.getsize(datfile), 10) self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile)) - def test_111_make_test1_dat(self): + def test_10011_make_test1_dat(self): """ create test.dat from test.zip with xorcopy """ zipfile = "test1.zip" datfile = "test1x.dat" @@ -196,7 +338,7 @@ class ZZipTest(unittest.TestCase): shell("{exe} {zipfile} {datfile}".format(**locals())) self.assertGreater(os.path.getsize(datfile), 10) self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile)) - def test_112_make_test2_dat(self): + def test_10012_make_test2_dat(self): """ create test.dat from test.zip with xorcopy """ zipfile = "test2.zip" datfile = "test2x.dat" @@ -204,7 +346,7 @@ class ZZipTest(unittest.TestCase): shell("{exe} {zipfile} {datfile}".format(**locals())) self.assertGreater(os.path.getsize(datfile), 10) self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile)) - def test_113_make_test3_dat(self): + def test_10013_make_test3_dat(self): """ create test.dat from test.zip with xorcopy """ zipfile = "test3.zip" datfile = "test3x.dat" @@ -212,7 +354,7 @@ class ZZipTest(unittest.TestCase): shell("{exe} {zipfile} {datfile}".format(**locals())) self.assertGreater(os.path.getsize(datfile), 10) self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile)) - def test_114_make_test4_dat(self): + def test_10014_make_test4_dat(self): """ create test.dat from test.zip with xorcopy """ zipfile = "test4.zip" datfile = "test4x.dat" @@ -220,42 +362,42 @@ class ZZipTest(unittest.TestCase): shell("{exe} {zipfile} {datfile}".format(**locals())) self.assertGreater(os.path.getsize(datfile), 10) self.assertEqual(os.path.getsize(datfile), os.path.getsize(zipfile)) - def test_200_zziptest_test0_zip(self): + def test_20000_zziptest_test0_zip(self): """ run zziptest on test.zip """ zipfile = "test0.zip" logfile = "test0.log" exe = self.bins("zziptest") shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) - def test_201_zziptest_test1_zip(self): + def test_20001_zziptest_test1_zip(self): """ run zziptest on test.zip """ zipfile = "test1.zip" logfile = "test1.log" exe = self.bins("zziptest") shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) - def test_202_zziptest_test2_zip(self): + def test_20002_zziptest_test2_zip(self): """ run zziptest on test.zip """ zipfile = "test2.zip" logfile = "test2.log" exe = self.bins("zziptest") shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) - def test_203_zziptest_test3_zip(self): + def test_20003_zziptest_test3_zip(self): """ run zziptest on test.zip """ zipfile = "test3.zip" logfile = "test3.log" exe = self.bins("zziptest") shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) - def test_204_zziptest_test4_zip(self): + def test_20004_zziptest_test4_zip(self): """ run zziptest on test.zip """ zipfile = "test4.zip" logfile = "test4.log" exe = self.bins("zziptest") shell("{exe} --quick {zipfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) - def test_210_zzcat_test0_zip(self): + def test_20010_zzcat_test0_zip(self): """ run zzcat on test.zip using just test/README """ zipfile = "test0.zip" getfile = "test0/README" @@ -264,7 +406,7 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} {getfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) self.assertEqual(run.output.split("\n"), self.readme().split("\n")) - def test_211_zzcat_test1_zip(self): + def test_20011_zzcat_test1_zip(self): """ run zzcat on test.zip using just test/README """ zipfile = "test1.zip" getfile = "test1/README" @@ -276,7 +418,7 @@ class ZZipTest(unittest.TestCase): getfile = "test1/file.1" run = shell("{exe} {getfile}".format(**locals())) self.assertEqual("file-1\n", run.output) - def test_212_zzcat_test2_zip(self): + def test_20012_zzcat_test2_zip(self): """ run zzcat on test.zip using just test/README """ zipfile = "test2.zip" getfile = "test2/README" @@ -288,7 +430,7 @@ class ZZipTest(unittest.TestCase): getfile = "test2/file.22" run = shell("{exe} {getfile}".format(**locals())) self.assertEqual("file-22\n", run.output) - def test_213_zzcat_test3_zip(self): + def test_20013_zzcat_test3_zip(self): """ run zzcat on test.zip using just test/README """ zipfile = "test3.zip" getfile = "test3/README" @@ -300,7 +442,7 @@ class ZZipTest(unittest.TestCase): getfile = "test3/file.999" run = shell("{exe} {getfile}".format(**locals())) self.assertEqual("file-999\n", run.output) - def test_214_zzcat_test4_zip(self): + def test_20014_zzcat_test4_zip(self): """ run zzcat on test.zip using just test/README """ zipfile = "test4.zip" getfile = "test4/README" @@ -309,64 +451,64 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} {getfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) self.assertEqual(run.output.split("\n"), self.readme().split("\n")) - getfile = "test4/file.999" + getfile = "test4/file9999.txt" run = shell("{exe} {getfile}".format(**locals())) - self.assertEqual("file-999\n", run.output) - def test_220_zzdir_test0_zip(self): + self.assertEqual("file-9999\n", run.output) + def test_20020_zzdir_test0_zip(self): """ run zzdir on test0.zip using just 'test0' """ zipfile = "test0.zip" getfile = "test0" exe = self.bins("zzdir") run = shell("{exe} {getfile} ".format(**locals())) - self.assertIn(' README ', run.output) - self.assertIn(' deflated ', run.output) + self.assertIn(' README\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertLess(len(run.output), 30) - def test_221_zzdir_test1_zip(self): + def test_20021_zzdir_test1_zip(self): """ run zzdir on test1.zip using just 'test1' """ zipfile = "test1.zip" getfile = "test1" exe = self.bins("zzdir") run = shell("{exe} {getfile} ".format(**locals())) - self.assertIn(' file.1 ', run.output) - self.assertIn(' file.2 ', run.output) - self.assertIn(' file.9 ', run.output) - self.assertIn(' README ', run.output) - self.assertIn(' deflated ', run.output) + self.assertIn(' file.1\n', run.output) + self.assertIn(' file.2\n', run.output) + self.assertIn(' file.9\n', run.output) + self.assertIn(' README\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_222_zzdir_test2_zip(self): + def test_20022_zzdir_test2_zip(self): """ run zzdir on test2.zip using just 'test2' """ zipfile = "test2.zip" getfile = "test2" exe = self.bins("zzdir") run = shell("{exe} {getfile} ".format(**locals())) - self.assertIn(' file.01 ', run.output) - self.assertIn(' file.22 ', run.output) - self.assertIn(' file.99 ', run.output) - self.assertIn(' deflated ', run.output) + self.assertIn(' file.01\n', run.output) + self.assertIn(' file.22\n', run.output) + self.assertIn(' file.99\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_223_zzdir_test3_zip(self): + def test_20023_zzdir_test3_zip(self): """ run zzdir on test3.zip using just 'test3' """ zipfile = "test3.zip" getfile = "test3" exe = self.bins("zzdir") run = shell("{exe} {getfile} ".format(**locals())) - self.assertIn(' file.001 ', run.output) - self.assertIn(' file.222 ', run.output) - self.assertIn(' file.999 ', run.output) - self.assertIn(' deflated ', run.output) + self.assertIn(' file.001\n', run.output) + self.assertIn(' file.222\n', run.output) + self.assertIn(' file.999\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_224_zzdir_test4_zip(self): + def test_20024_zzdir_test4_zip(self): """ run zzdir on test4.zip using just 'test4' """ zipfile = "test4.zip" getfile = "test4" exe = self.bins("zzdir") run = shell("{exe} {getfile} ".format(**locals())) - self.assertIn(' file.001 ', run.output) - self.assertIn(' file.222 ', run.output) - self.assertIn(' file.999 ', run.output) - self.assertNotIn(' deflated ', run.output) + self.assertIn(' file0001.txt\n', run.output) + self.assertIn(' file2222.txt\n', run.output) + self.assertIn(' file9999.txt\n', run.output) + self.assertNotIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_320_zzxordir_test0_dat(self): + def test_20320_zzxordir_test0_dat(self): """ run zzxordir on test0x.dat """ zipfile = "test0x.dat" getfile = "test0x.dat" @@ -377,10 +519,10 @@ class ZZipTest(unittest.TestCase): self.assertIn("did not open test", run.errors) exe = self.bins("zzxordir") run = shell("{exe} {getfile} ".format(**locals())) - self.assertIn(' README ', run.output) - self.assertIn(' deflated ', run.output) + self.assertIn(' README\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertLess(len(run.output), 30) - def test_321_zzxordir_test1_dat(self): + def test_20321_zzxordir_test1_dat(self): """ run zzxordir on test1x.dat using just 'test1x' """ zipfile = "test1x.dat" getfile = "test1x.dat" @@ -391,13 +533,13 @@ class ZZipTest(unittest.TestCase): self.assertIn("did not open test", run.errors) exe = self.bins("zzxordir") run = shell("{exe} {getfile} ".format(**locals())) - self.assertIn(' file.1 ', run.output) - self.assertIn(' file.2 ', run.output) - self.assertIn(' file.9 ', run.output) - self.assertIn(' README ', run.output) - self.assertIn(' deflated ', run.output) + self.assertIn(' file.1\n', run.output) + self.assertIn(' file.2\n', run.output) + self.assertIn(' file.9\n', run.output) + self.assertIn(' README\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_322_zzxordir_test2_dat(self): + def test_20322_zzxordir_test2_dat(self): """ run zzxordir on test2x.dat using just 'test2x' """ zipfile = "test2x.dat" getfile = "test2x" @@ -408,12 +550,12 @@ class ZZipTest(unittest.TestCase): self.assertIn("did not open test", run.errors) exe = self.bins("zzxordir") run = shell("{exe} {getfile} ".format(**locals())) - self.assertIn(' file.01 ', run.output) - self.assertIn(' file.22 ', run.output) - self.assertIn(' file.99 ', run.output) - self.assertIn(' deflated ', run.output) + self.assertIn(' file.01\n', run.output) + self.assertIn(' file.22\n', run.output) + self.assertIn(' file.99\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_323_zzxordir_test3_dat(self): + def test_20323_zzxordir_test3_dat(self): """ run zzxordir on test3x.dat using just 'test3x' """ zipfile = "test3x.dat" getfile = "test3x" @@ -424,12 +566,12 @@ class ZZipTest(unittest.TestCase): self.assertIn("did not open test", run.errors) exe = self.bins("zzxordir") run = shell("{exe} {getfile} ".format(**locals())) - self.assertIn(' file.001 ', run.output) - self.assertIn(' file.222 ', run.output) - self.assertIn(' file.999 ', run.output) - self.assertIn(' deflated ', run.output) + self.assertIn(' file.001\n', run.output) + self.assertIn(' file.222\n', run.output) + self.assertIn(' file.999\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_324_zzxordir_test4_zip(self): + def test_20324_zzxordir_test4_zip(self): """ run zzxordir on test4x.dat using just 'test4x' """ zipfile = "test4x.dat" getfile = "test4x" @@ -440,12 +582,12 @@ class ZZipTest(unittest.TestCase): self.assertIn("did not open test", run.errors) exe = self.bins("zzxordir") run = shell("{exe} {getfile} ".format(**locals())) - self.assertIn(' file.001 ', run.output) - self.assertIn(' file.222 ', run.output) - self.assertIn(' file.999 ', run.output) - self.assertNotIn(' deflated ', run.output) + self.assertIn(' file0001.txt\n', run.output) + self.assertIn(' file2222.txt\n', run.output) + self.assertIn(' file9999.txt\n', run.output) + self.assertNotIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_340_zzxorcat_test0_zip(self): + def test_20340_zzxorcat_test0_zip(self): """ run zzxorcat on testx.zip using just testx/README """ getfile = "test0x/README" logfile = "test0x.readme.txt" @@ -457,7 +599,7 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} {getfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) self.assertEqual(run.output.split("\n"), self.readme().split("\n")) - def test_341_zzxorcat_test1_zip(self): + def test_20341_zzxorcat_test1_zip(self): """ run zzxorcat on testx.zip using just testx/README """ getfile = "test1x/README" logfile = "test1x.readme.txt" @@ -472,7 +614,7 @@ class ZZipTest(unittest.TestCase): getfile = "test1x/file.1" run = shell("{exe} {getfile}".format(**locals())) self.assertEqual("file-1\n", run.output) - def test_342_zzxorcat_test2_zip(self): + def test_20342_zzxorcat_test2_zip(self): """ run zzxorcat on testx.zip using just testx/README """ getfile = "test2x/README" logfile = "test2x.readme.txt" @@ -487,7 +629,7 @@ class ZZipTest(unittest.TestCase): getfile = "test2x/file.22" run = shell("{exe} {getfile}".format(**locals())) self.assertEqual("file-22\n", run.output) - def test_343_zzxorcat_test3_zip(self): + def test_20343_zzxorcat_test3_zip(self): """ run zzxorcat on testx.zip using just testx/README """ getfile = "test3x/README" logfile = "test3x.readme.txt" @@ -502,7 +644,7 @@ class ZZipTest(unittest.TestCase): getfile = "test3x/file.999" run = shell("{exe} {getfile}".format(**locals())) self.assertEqual("file-999\n", run.output) - def test_344_zzxorcat_test4_zip(self): + def test_20344_zzxorcat_test4_zip(self): """ run zzxorcat on testx.zip using just testx/README """ getfile = "test4x/README" logfile = "test4x.readme.txt" @@ -510,11 +652,59 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} {getfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) self.assertEqual(run.output.split("\n"), self.readme().split("\n")) - getfile = "test4x/file.999" + getfile = "test4x/file9999.txt" run = shell("{exe} {getfile}".format(**locals())) - self.assertEqual("file-999\n", run.output) - - def test_400_zzcat_big_test0_zip(self): + self.assertEqual("file-9999\n", run.output) + ##################################################################### + # check unzzip + ##################################################################### + def test_20400_infozip_cat_test0_zip(self): + """ run inzo-zip cat test.zip using just archive README """ + zipfile = "test0.zip" + getfile = "README" + logfile = "test0.readme.pk.txt" + exe = self.bins("unzip") + run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) + self.assertGreater(os.path.getsize(logfile), 10) + self.assertEqual(run.output.split("\n"), self.readme().split("\n")) + def test_20401_infozip_cat_test1_zip(self): + """ run info-zip cat test.zip using just archive README """ + zipfile = "test1.zip" + getfile = "README" + logfile = "test1.readme.pk.txt" + exe = self.bins("unzip") + run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) + self.assertGreater(os.path.getsize(logfile), 10) + self.assertEqual(run.output.split("\n"), self.readme().split("\n")) + getfile = "file.1" + run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) + self.assertEqual("file-1\n", run.output) + def test_20402_infozip_cat_test2_zip(self): + """ run info-zip cat test.zip using just archive README """ + zipfile = "test2.zip" + getfile = "README" + logfile = "test2.readme.pk.txt" + exe = self.bins("unzip") + run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) + self.assertGreater(os.path.getsize(logfile), 10) + self.assertEqual(run.output.split("\n"), self.readme().split("\n")) + getfile = "file.22" + run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) + self.assertEqual("file-22\n", run.output) + def test_20405_zzcat_big_test5_zip(self): + """ run info-zip cat test.zip using archive README """ + zipfile = "test5.zip" + getfile = "README" + logfile = "test5.readme.pk.txt" + exe = self.bins("unzip") + run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) + self.assertGreater(os.path.getsize(logfile), 10) + self.assertEqual(run.output.split("\n"), self.readme().split("\n")) + getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt" + compare = self.gentext(1024) + run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) + self.assertEqual(compare, run.output) + def test_20410_zzcat_big_test0_zip(self): """ run zzcat-big on test.zip using just archive README """ zipfile = "test0.zip" getfile = "README" @@ -523,7 +713,7 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) self.assertEqual(run.output.split("\n"), self.readme().split("\n")) - def test_401_zzcat_big_test1_zip(self): + def test_20411_zzcat_big_test1_zip(self): """ run zzcat-big on test.zip using just archive README """ zipfile = "test1.zip" getfile = "README" @@ -535,7 +725,7 @@ class ZZipTest(unittest.TestCase): getfile = "file.1" run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) self.assertEqual("file-1\n", run.output) - def test_402_zzcat_big_test2_zip(self): + def test_20412_zzcat_big_test2_zip(self): """ run zzcat-seeke on test.zip using just archive README """ zipfile = "test2.zip" getfile = "README" @@ -547,7 +737,20 @@ class ZZipTest(unittest.TestCase): getfile = "file.22" run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) self.assertEqual("file-22\n", run.output) - def test_410_zzcat_mem_test0_zip(self): + def test_20415_zzcat_big_test5_zip(self): + """ run zzcat-big on test.zip using archive README """ + zipfile = "test5.zip" + getfile = "README" + logfile = "test5.readme.zap.txt" + exe = self.bins("unzzip-big") + run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) + self.assertGreater(os.path.getsize(logfile), 10) + self.assertEqual(run.output.split("\n"), self.readme().split("\n")) + getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt" + compare = self.gentext(1024) + run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) + self.assertEqual(compare, run.output) + def test_20420_zzcat_mem_test0_zip(self): """ run zzcat-mem on test.zip using just archive README """ zipfile = "test0.zip" getfile = "README" @@ -556,7 +759,7 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) self.assertEqual(run.output.split("\n"), self.readme().split("\n")) - def test_411_zzcat_mem_test1_zip(self): + def test_20421_zzcat_mem_test1_zip(self): """ run zzcat-mem on test.zip using archive README """ zipfile = "test1.zip" getfile = "README" @@ -568,7 +771,7 @@ class ZZipTest(unittest.TestCase): getfile = "file.1" run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) self.assertEqual("file-1\n", run.output) - def test_412_zzcat_mem_test2_zip(self): + def test_20422_zzcat_mem_test2_zip(self): """ run zzcat-mem on test.zip using archive README """ zipfile = "test2.zip" getfile = "README" @@ -580,7 +783,7 @@ class ZZipTest(unittest.TestCase): getfile = "file.22" run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) self.assertEqual("file-22\n", run.output) - def test_413_zzcat_mem_test3_zip(self): + def test_20423_zzcat_mem_test3_zip(self): """ run zzcat-mem on test.zip using archive README """ zipfile = "test3.zip" getfile = "README" @@ -592,7 +795,7 @@ class ZZipTest(unittest.TestCase): getfile = "file.999" run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) self.assertEqual("file-999\n", run.output) - def test_414_zzcat_mem_test4_zip(self): + def test_20424_zzcat_mem_test4_zip(self): """ run zzcat-mem on test.zip using archive README """ zipfile = "test4.zip" getfile = "README" @@ -601,10 +804,23 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) self.assertEqual(run.output.split("\n"), self.readme().split("\n")) - getfile = "file.999" + getfile = "file9999.txt" run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) - self.assertEqual("file-999\n", run.output) - def test_420_zzcat_mix_test0_zip(self): + self.assertEqual("file-9999\n", run.output) + def test_20425_zzcat_mem_test5_zip(self): + """ run zzcat-mem on test.zip using archive README """ + zipfile = "test5.zip" + getfile = "README" + logfile = "test5.readme.zap.txt" + exe = self.bins("unzzip-mem") + run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) + self.assertGreater(os.path.getsize(logfile), 10) + self.assertEqual(run.output.split("\n"), self.readme().split("\n")) + getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt" + compare = self.gentext(1024) + run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) + self.assertEqual(compare, run.output) + def test_20430_zzcat_mix_test0_zip(self): """ run zzcat-mix on test.zip using just archive README """ zipfile = "test0.zip" getfile = "README" @@ -613,7 +829,7 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) self.assertEqual(run.output.split("\n"), self.readme().split("\n")) - def test_421_zzcat_mix_test1_zip(self): + def test_20431_zzcat_mix_test1_zip(self): """ run zzcat-mix on test.zip using archive README """ zipfile = "test1.zip" getfile = "README" @@ -625,7 +841,7 @@ class ZZipTest(unittest.TestCase): getfile = "file.1" run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) self.assertEqual("file-1\n", run.output) - def test_422_zzcat_mix_test2_zip(self): + def test_20432_zzcat_mix_test2_zip(self): """ run zzcat-mix on test.zip using archive README """ zipfile = "test2.zip" getfile = "README" @@ -637,7 +853,7 @@ class ZZipTest(unittest.TestCase): getfile = "file.22" run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) self.assertEqual("file-22\n", run.output) - def test_423_zzcat_mix_test3_zip(self): + def test_20433_zzcat_mix_test3_zip(self): """ run zzcat-mix on test.zip using archive README """ zipfile = "test3.zip" getfile = "README" @@ -649,7 +865,7 @@ class ZZipTest(unittest.TestCase): getfile = "file.999" run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) self.assertEqual("file-999\n", run.output) - def test_424_zzcat_mix_test4_zip(self): + def test_20434_zzcat_mix_test4_zip(self): """ run zzcat-mix on test.zip using archive README """ zipfile = "test4.zip" getfile = "README" @@ -658,10 +874,23 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) self.assertEqual(run.output.split("\n"), self.readme().split("\n")) - getfile = "file.999" + getfile = "file9999.txt" run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) - self.assertEqual("file-999\n", run.output) - def test_440_zzcat_zap_test0_zip(self): + self.assertEqual("file-9999\n", run.output) + def test_20435_zzcat_mix_test5_zip(self): + """ run zzcat-mix on test.zip using archive README """ + zipfile = "test5.zip" + getfile = "README" + logfile = "test5.readme.zap.txt" + exe = self.bins("unzzip-mix") + run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) + self.assertGreater(os.path.getsize(logfile), 10) + self.assertEqual(run.output.split("\n"), self.readme().split("\n")) + getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt" + compare = self.gentext(1024) + run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) + self.assertEqual(compare, run.output) + def test_20440_zzcat_zap_test0_zip(self): """ run zzcat-zap on test.zip using just archive README """ zipfile = "test0.zip" getfile = "README" @@ -670,7 +899,7 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) self.assertEqual(run.output.split("\n"), self.readme().split("\n")) - def test_441_zzcat_zap_test1_zip(self): + def test_20441_zzcat_zap_test1_zip(self): """ run zzcat-zap on test.zip using archive README """ zipfile = "test1.zip" getfile = "README" @@ -682,7 +911,7 @@ class ZZipTest(unittest.TestCase): getfile = "file.1" run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) self.assertEqual("file-1\n", run.output) - def test_442_zzcat_zap_test2_zip(self): + def test_20442_zzcat_zap_test2_zip(self): """ run zzcat-zap on test.zip using archive README """ zipfile = "test2.zip" getfile = "README" @@ -694,7 +923,7 @@ class ZZipTest(unittest.TestCase): getfile = "file.22" run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) self.assertEqual("file-22\n", run.output) - def test_443_zzcat_zap_test3_zip(self): + def test_20443_zzcat_zap_test3_zip(self): """ run zzcat-zap on test.zip using archive README """ zipfile = "test3.zip" getfile = "README" @@ -706,7 +935,7 @@ class ZZipTest(unittest.TestCase): getfile = "file.999" run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) self.assertEqual("file-999\n", run.output) - def test_444_zzcat_zap_test4_zip(self): + def test_20444_zzcat_zap_test4_zip(self): """ run zzcat-zap on test.zip using archive README """ zipfile = "test4.zip" getfile = "README" @@ -715,228 +944,2078 @@ class ZZipTest(unittest.TestCase): run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) self.assertGreater(os.path.getsize(logfile), 10) self.assertEqual(run.output.split("\n"), self.readme().split("\n")) - getfile = "file.999" + getfile = "file9999.txt" run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) - self.assertEqual("file-999\n", run.output) + self.assertEqual("file-9999\n", run.output) + def test_20445_zzcat_zap_test5_zip(self): + """ run zzcat-zap on test.zip using archive README """ + zipfile = "test5.zip" + getfile = "README" + logfile = "test5.readme.zap.txt" + exe = self.bins("unzzip") + run = shell("{exe} -p {zipfile} {getfile} | tee {logfile}".format(**locals())) + self.assertGreater(os.path.getsize(logfile), 10) + self.assertEqual(run.output.split("\n"), self.readme().split("\n")) + getfile = "subdir1/subdir2/subdir3/subdir4/subdir5/subdir6/file7-1024.txt" + compare = self.gentext(1024) + run = shell("{exe} -p {zipfile} {getfile}".format(**locals())) + self.assertEqual(compare, run.output) - def test_500_zzdir_big_test0_zip(self): + def test_20500_infozipdir_test0_zip(self): + """ run info-zip dir test0.zip """ + zipfile = "test0.zip" + getfile = "test0.zip" + exe = self.bins("unzip") + run = shell("{exe} -l {getfile} ".format(**locals())) + self.assertIn(' README\n', run.output) + self.assertLess(len(run.output), 230) + def test_20501_infozipdir_test1_zip(self): + """ run info-zip dir test1.zip """ + zipfile = "test1.zip" + getfile = "test1.zip" + exe = self.bins("unzip") + run = shell("{exe} -l {getfile} ".format(**locals())) + self.assertIn(' file.1\n', run.output) + self.assertIn(' file.2\n', run.output) + self.assertIn(' file.9\n', run.output) + self.assertIn(' README\n', run.output) + def test_20502_infozipdir_big_test2_zip(self): + """ run info-zip dir test2.zip """ + zipfile = "test2.zip" + getfile = "test2.zip" + exe = self.bins("unzip") + run = shell("{exe} -l {getfile} ".format(**locals())) + self.assertIn(' file.01\n', run.output) + self.assertIn(' file.22\n', run.output) + self.assertIn(' file.99\n', run.output) + def test_20503_infozipdir_big_test3_zip(self): + """ run info-zip dir test3.zip """ + zipfile = "test3.zip" + getfile = "test3.zip" + exe = self.bins("unzip") + run = shell("{exe} -l {getfile} ".format(**locals())) + self.assertIn(' file.001\n', run.output) + self.assertIn(' file.222\n', run.output) + self.assertIn(' file.999\n', run.output) + def test_20504_infozipdir_big_test4_zip(self): + """ run info-zip dir test4.zip """ + zipfile = "test4.zip" + getfile = "test4.zip" + exe = self.bins("unzip") + run = shell("{exe} -l {getfile} ".format(**locals())) + self.assertIn(' file0001.txt\n', run.output) + self.assertIn(' file2222.txt\n', run.output) + self.assertIn(' file9999.txt\n', run.output) + def test_20505_infozipdir_big_test5_zip(self): + """ run info-zip dir on test5.zip """ + zipfile = "test5.zip" + getfile = "test5.zip" + exe = self.bins("unzzip-mix") + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn('/subdir14/file15-128.txt\n', run.output) + self.assertIn('/subdir5/subdir6/', run.output) + self.assertIn(' defl:N ', run.output) + self.assertIn(' stored ', run.output) + def test_20510_zzdir_big_test0_zip(self): """ run zzdir-big on test0.zip """ zipfile = "test0.zip" getfile = "test0.zip" exe = self.bins("unzzip-big") run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' README ', run.output) + self.assertIn(' README\n', run.output) self.assertLess(len(run.output), 30) - def test_501_zzdir_big_test1_zip(self): + def test_20511_zzdir_big_test1_zip(self): """ run zzdir-big on test1.zip """ zipfile = "test1.zip" getfile = "test1.zip" exe = self.bins("unzzip-big") run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.1 ', run.output) - self.assertIn(' file.2 ', run.output) - self.assertIn(' file.9 ', run.output) - self.assertIn(' README ', run.output) - def test_502_zzdir_big_test2_zip(self): + self.assertIn(' file.1\n', run.output) + self.assertIn(' file.2\n', run.output) + self.assertIn(' file.9\n', run.output) + self.assertIn(' README\n', run.output) + def test_20512_zzdir_big_test2_zip(self): """ run zzdir-big on test2.zip """ zipfile = "test2.zip" getfile = "test2.zip" exe = self.bins("unzzip-big") run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.01 ', run.output) - self.assertIn(' file.22 ', run.output) - self.assertIn(' file.99 ', run.output) - def test_503_zzdir_big_test3_zip(self): + self.assertIn(' file.01\n', run.output) + self.assertIn(' file.22\n', run.output) + self.assertIn(' file.99\n', run.output) + def test_20513_zzdir_big_test3_zip(self): """ run zzdir-big on test3.zip """ zipfile = "test3.zip" getfile = "test3.zip" exe = self.bins("unzzip-big") run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.001 ', run.output) - self.assertIn(' file.222 ', run.output) - self.assertIn(' file.999 ', run.output) - def test_504_zzdir_big_test4_zip(self): + self.assertIn(' file.001\n', run.output) + self.assertIn(' file.222\n', run.output) + self.assertIn(' file.999\n', run.output) + def test_20514_zzdir_big_test4_zip(self): """ run zzdir-big on test4.zip """ zipfile = "test4.zip" getfile = "test4.zip" exe = self.bins("unzzip-big") run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.001 ', run.output) - self.assertIn(' file.222 ', run.output) - self.assertIn(' file.999 ', run.output) - def test_510_zzdir_mem_test0_zip(self): + self.assertIn(' file0001.txt\n', run.output) + self.assertIn(' file2222.txt\n', run.output) + self.assertIn(' file9999.txt\n', run.output) + def test_20515_zzdir_big_test5_zip(self): + """ run zzdir-big on test5.zip """ + zipfile = "test5.zip" + getfile = "test5.zip" + exe = self.bins("unzzip-mix") + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn('/subdir14/file15-128.txt\n', run.output) + self.assertIn('/subdir5/subdir6/', run.output) + self.assertIn(' defl:N ', run.output) + self.assertIn(' stored ', run.output) + def test_20520_zzdir_mem_test0_zip(self): """ run zzdir-mem on test0.zip """ zipfile = "test0.zip" getfile = "test0.zip" exe = self.bins("unzzip-mem") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' README ', run.output) - self.assertIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' README\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertLess(len(run.output), 30) - def test_511_zzdir_mem_test1_zip(self): + def test_20521_zzdir_mem_test1_zip(self): """ run zzdir-mem on test1.zip """ zipfile = "test1.zip" getfile = "test1.zip" exe = self.bins("unzzip-mem") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.1 ', run.output) - self.assertIn(' file.2 ', run.output) - self.assertIn(' file.9 ', run.output) - self.assertIn(' README ', run.output) - self.assertIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' file.1\n', run.output) + self.assertIn(' file.2\n', run.output) + self.assertIn(' file.9\n', run.output) + self.assertIn(' README\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_512_zzdir_mem_test2_zip(self): + def test_20522_zzdir_mem_test2_zip(self): """ run zzdir-mem on test2.zip """ zipfile = "test2.zip" getfile = "test2.zip" exe = self.bins("unzzip-mem") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.01 ', run.output) - self.assertIn(' file.22 ', run.output) - self.assertIn(' file.99 ', run.output) - self.assertIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' file.01\n', run.output) + self.assertIn(' file.22\n', run.output) + self.assertIn(' file.99\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_513_zzdir_mem_test3_zip(self): + def test_20523_zzdir_mem_test3_zip(self): """ run zzdir-mem on test3.zip """ zipfile = "test3.zip" getfile = "test3.zip" exe = self.bins("unzzip-mem") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.001 ', run.output) - self.assertIn(' file.222 ', run.output) - self.assertIn(' file.999 ', run.output) - self.assertIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' file.001\n', run.output) + self.assertIn(' file.222\n', run.output) + self.assertIn(' file.999\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_514_zzdir_mem_test4_zip(self): + def test_20524_zzdir_mem_test4_zip(self): """ run zzdir-mem on test4.zip """ zipfile = "test4.zip" getfile = "test4.zip" exe = self.bins("unzzip-mem") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.001 ', run.output) - self.assertIn(' file.222 ', run.output) - self.assertIn(' file.999 ', run.output) - self.assertNotIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' file0001.txt\n', run.output) + self.assertIn(' file2222.txt\n', run.output) + self.assertIn(' file9999.txt\n', run.output) + self.assertNotIn(' defl:N ', run.output) + self.assertIn(' stored ', run.output) + def test_20525_zzdir_mem_test5_zip(self): + """ run zzdir-mem on test5.zip """ + zipfile = "test5.zip" + getfile = "test5.zip" + exe = self.bins("unzzip-mix") + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn('/subdir14/file15-128.txt\n', run.output) + self.assertIn('/subdir5/subdir6/', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_520_zzdir_mix_test0_zip(self): + def test_20530_zzdir_mix_test0_zip(self): """ run zzdir-mix on test0.zip """ # self.skipTest("todo") zipfile = "test0.zip" getfile = "test0.zip" exe = self.bins("unzzip-mix") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' README ', run.output) - self.assertIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' README\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertLess(len(run.output), 30) - def test_521_zzdir_mix_test1_zip(self): + def test_20531_zzdir_mix_test1_zip(self): """ run zzdir-mix on test1.zip """ zipfile = "test1.zip" getfile = "test1.zip" exe = self.bins("unzzip-mix") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.1 ', run.output) - self.assertIn(' file.2 ', run.output) - self.assertIn(' file.9 ', run.output) - self.assertIn(' README ', run.output) - self.assertIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' file.1\n', run.output) + self.assertIn(' file.2\n', run.output) + self.assertIn(' file.9\n', run.output) + self.assertIn(' README\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_522_zzdir_mix_test2_zip(self): + def test_20532_zzdir_mix_test2_zip(self): """ run zzdir-mix on test2.zip """ zipfile = "test2.zip" getfile = "test2.zip" exe = self.bins("unzzip-mix") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.01 ', run.output) - self.assertIn(' file.22 ', run.output) - self.assertIn(' file.99 ', run.output) - self.assertIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' file.01\n', run.output) + self.assertIn(' file.22\n', run.output) + self.assertIn(' file.99\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_523_zzdir_mix_test3_zip(self): + def test_20533_zzdir_mix_test3_zip(self): """ run zzdir-mix on test3.zip """ zipfile = "test3.zip" getfile = "test3.zip" exe = self.bins("unzzip-mix") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.001 ', run.output) - self.assertIn(' file.222 ', run.output) - self.assertIn(' file.999 ', run.output) - self.assertIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' file.001\n', run.output) + self.assertIn(' file.222\n', run.output) + self.assertIn(' file.999\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_524_zzdir_mix_test4_zip(self): + def test_20534_zzdir_mix_test4_zip(self): """ run zzdir-mix on test4.zip """ zipfile = "test4.zip" getfile = "test4.zip" exe = self.bins("unzzip-mix") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.001 ', run.output) - self.assertIn(' file.222 ', run.output) - self.assertIn(' file.999 ', run.output) - self.assertNotIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' file0001.txt\n', run.output) + self.assertIn(' file2222.txt\n', run.output) + self.assertIn(' file9999.txt\n', run.output) + self.assertNotIn(' defl:N ', run.output) + self.assertIn(' stored ', run.output) + def test_20535_zzdir_mix_test5_zip(self): + """ run zzdir-mix on test5.zip """ + zipfile = "test5.zip" + getfile = "test5.zip" + exe = self.bins("unzzip-mix") + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn('/subdir14/file15-128.txt\n', run.output) + self.assertIn('/subdir5/subdir6/', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_540_zzdir_zap_test0_zip(self): + def test_20540_zzdir_zap_test0_zip(self): """ run zzdir-zap on test0.zip """ zipfile = "test0.zip" getfile = "test0.zip" exe = self.bins("unzzip") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' README ', run.output) - self.assertIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' README\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertLess(len(run.output), 30) - def test_541_zzdir_zap_test1_zip(self): + def test_20541_zzdir_zap_test1_zip(self): """ run zzdir-zap on test1.zip """ zipfile = "test1.zip" getfile = "test1.zip" exe = self.bins("unzzip") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.1 ', run.output) - self.assertIn(' file.2 ', run.output) - self.assertIn(' file.9 ', run.output) - self.assertIn(' README ', run.output) - self.assertIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' file.1\n', run.output) + self.assertIn(' file.2\n', run.output) + self.assertIn(' file.9\n', run.output) + self.assertIn(' README\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_542_zzdir_zap_test2_zip(self): + def test_20542_zzdir_zap_test2_zip(self): """ run zzdir-zap on test2.zip """ zipfile = "test2.zip" getfile = "test2.zip" exe = self.bins("unzzip") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.01 ', run.output) - self.assertIn(' file.22 ', run.output) - self.assertIn(' file.99 ', run.output) - self.assertIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' file.01\n', run.output) + self.assertIn(' file.22\n', run.output) + self.assertIn(' file.99\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_543_zzdir_zap_test3_zip(self): + def test_20543_zzdir_zap_test3_zip(self): """ run zzdir-zap on test3.zip """ zipfile = "test3.zip" getfile = "test3.zip" exe = self.bins("unzzip") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.001 ', run.output) - self.assertIn(' file.222 ', run.output) - self.assertIn(' file.999 ', run.output) - self.assertIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' file.001\n', run.output) + self.assertIn(' file.222\n', run.output) + self.assertIn(' file.999\n', run.output) + self.assertIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) - def test_544_zzdir_zap_test4_zip(self): + def test_20544_zzdir_zap_test4_zip(self): """ run zzdir-zap on test4.zip """ zipfile = "test4.zip" getfile = "test4.zip" exe = self.bins("unzzip") - run = shell("{exe} -l {getfile} ".format(**locals())) - self.assertIn(' file.001 ', run.output) - self.assertIn(' file.222 ', run.output) - self.assertIn(' file.999 ', run.output) - self.assertNotIn(' deflated ', run.output) + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn(' file0001.txt\n', run.output) + self.assertIn(' file2222.txt\n', run.output) + self.assertIn(' file9999.txt\n', run.output) + self.assertNotIn(' defl:N ', run.output) self.assertIn(' stored ', run.output) + def test_20545_zzdir_zap_test5_zip(self): + """ run zzdir-zap on test5.zip """ + zipfile = "test5.zip" + getfile = "test5.zip" + exe = self.bins("unzzip") + run = shell("{exe} -v {getfile} ".format(**locals())) + self.assertIn('/subdir14/file15-128.txt\n', run.output) + self.assertIn('/subdir5/subdir6/', run.output) + self.assertIn(' defl:N ', run.output) + self.assertIn(' stored ', run.output) + def test_20595_zzextract_zap_test5_zip(self): + """ run zzextract-zap on test5.zip + => coughs up a SEGFAULT in zzip_dir_close() ?!?""" + self.rm_testdir() + zipfile = "test5.zip" + getfile = "test5.zip" + tmpdir = self.testdir() + exe = self.bins("unzzip") + run = shell("cd {tmpdir} && ../{exe} ../{getfile} ".format(**locals())); + self.assertTrue(tmpdir+'/subdir1/subdir2/file3-1024.txt') + # self.rm_testdir() + + url_CVE_2017_5977 = "https://github.com/asarubbo/poc/blob/master" + zip_CVE_2017_5977 = "00153-zziplib-invalidread-zzip_mem_entry_extra_block" + def test_59770_infozipdir_CVE_2017_5977(self): + """ run info-zip dir test0.zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5977 + file_url = self.url_CVE_2017_5977 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 2]) + self.assertIn(" didn't find end-of-central-dir signature at end of central dir", run.errors) + self.assertIn(" 2 extra bytes at beginning or within zipfile", run.errors) + self.assertLess(len(run.output), 280) + # + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 90) + self.assertLess(len(errors(run.errors)), 900) + self.assertIn('test: mismatching "local" filename', run.errors) + self.assertIn('test: unknown compression method', run.errors) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) + self.rm_testdir() + def test_59771_zzipdir_big_CVE_2017_5977(self): + """ run info-zip -l $(CVE_2017_5977).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5977 + file_url = self.url_CVE_2017_5977 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" stored test", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) + self.rm_testdir() + def test_59772_zzipdir_mem_CVE_2017_5977(self): + """ run unzzip-mem -l $(CVE_2017_5977).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5977 + file_url = self.url_CVE_2017_5977 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" 3 test", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.rm_testdir() + def test_59773_zzipdir_mix_CVE_2017_5977(self): + """ run unzzip-mix -l $(CVE_2017_5977).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5977 + file_url = self.url_CVE_2017_5977 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" 3 test", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) + self.rm_testdir() + def test_59774_zzipdir_zap_CVE_2017_5977(self): + """ run unzzip -l $(CVE_2017_5977).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5977 + file_url = self.url_CVE_2017_5977 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 255]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" 3 test", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) # TODO + self.rm_testdir() + def test_59779(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5977 + file_url = self.url_CVE_2017_5977 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 163) + + url_CVE_2017_5978 = "https://github.com/asarubbo/poc/blob/master" + zip_CVE_2017_5978 = "00156-zziplib-oobread-zzip_mem_entry_new" + def test_59780_infozipdir_CVE_2017_5978(self): + """ run info-zip dir test0.zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5978 + file_url = self.url_CVE_2017_5978 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 3]) + self.assertIn(' missing 4608 bytes in zipfile', run.errors) + self.assertIn(' attempt to seek before beginning of zipfile', run.errors) + self.assertLess(len(run.output), 80) + self.assertLess(len(errors(run.errors)), 430) + # + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [3]) + self.assertLess(len(run.output), 90) + self.assertLess(len(errors(run.errors)), 900) + self.assertIn('attempt to seek before beginning of zipfile', run.errors) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_59781_zzipdir_big_CVE_2017_5978(self): + """ run info-zip -l $(CVE_2017_5978).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5978 + file_url = self.url_CVE_2017_5978 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" stored (null)", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,1]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertFalse(os.path.exists(tmpdir+"/test")) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) + self.rm_testdir() + def test_59782_zzipdir_mem_CVE_2017_5978(self): + """ run unzzip-mem -l $(CVE_2017_5978).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5978 + file_url = self.url_CVE_2017_5978 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 180) + self.assertIn("zzip_mem_disk_load : unable to load entry", run.errors) + self.assertIn("zzip_mem_disk_open : unable to load disk", run.errors) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 300) + if grep("DEBUG:", run.errors): + self.assertIn("findfirst (nil)", run.errors) + self.assertFalse(os.path.exists(tmpdir+"/test")) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) + self.rm_testdir() + def test_59783_zzipdir_mix_CVE_2017_5978(self): + """ run unzzip-mix -l $(CVE_2017_5978).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5978 + file_url = self.url_CVE_2017_5978 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 180) + self.assertTrue(greps(run.errors, "Invalid or")) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 300) + self.assertTrue(greps(run.errors, "Invalid or")) + self.assertFalse(os.path.exists(tmpdir+"/test")) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) + self.rm_testdir() + def test_59784_zzipdir_zap_CVE_2017_5978(self): + """ run unzzip -l $(CVE_2017_5978).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5978 + file_url = self.url_CVE_2017_5978 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [3]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 180) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 300) + self.assertTrue(greps(run.errors, "Zipfile corrupted")) + self.assertFalse(os.path.exists(tmpdir+"/test")) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) + self.rm_testdir() + def test_59789(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5978 + file_url = self.url_CVE_2017_5978 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 161) + + url_CVE_2017_5979 = "https://github.com/asarubbo/poc/blob/master" + zip_CVE_2017_5979 = "00157-zziplib-nullptr-prescan_entry" + def test_59790_infozipdir_CVE_2017_5979(self): + """ run info-zip dir test0.zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5979 + file_url = self.url_CVE_2017_5979 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertIn(' 1 file', run.output) + self.assertLess(len(run.output), 330) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 90) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn('extracting: a', run.output) + self.assertEqual(os.path.getsize(tmpdir+"/a"), 3) + self.rm_testdir() + def test_59791_zzipdir_big_CVE_2017_5979(self): + """ run info-zip -l $(CVE_2017_5979).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5979 + file_url = self.url_CVE_2017_5979 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" stored a", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertEqual(os.path.getsize(tmpdir+"/a"), 3) + self.rm_testdir() + def test_59792_zzipdir_mem_CVE_2017_5979(self): + """ run unzzip-mem -l $(CVE_2017_5979).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5979 + file_url = self.url_CVE_2017_5979 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" 3 a", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertEqual(os.path.getsize(tmpdir+"/a"), 3) + self.rm_testdir() + def test_59793_zzipdir_mix_CVE_2017_5979(self): + """ run unzzip-mix -l $(CVE_2017_5979).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5979 + file_url = self.url_CVE_2017_5979 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" 3 a", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 20) + self.assertEqual(os.path.getsize(tmpdir+"/a"), 0) # FIXME + # self.assertEqual(os.path.getsize(tmpdir+"/a"), 3) # FIXME + self.rm_testdir() + def test_59794_zzipdir_zap_CVE_2017_5979(self): + """ run unzzip -l $(CVE_2017_5979).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5979 + file_url = self.url_CVE_2017_5979 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 255]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" 3 a", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 20) + self.assertEqual(os.path.getsize(tmpdir+"/a"), 3) + self.rm_testdir() + def test_59799(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5979 + file_url = self.url_CVE_2017_5979 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 155) + + + url_CVE_2017_5974 = "https://github.com/asarubbo/poc/blob/master" + zip_CVE_2017_5974 = "00150-zziplib-heapoverflow-__zzip_get32" + def test_59740_infozipdir_CVE_2017_5974(self): + """ run info-zip dir test0.zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5974 + file_url = self.url_CVE_2017_5974 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 9]) + self.assertIn(' 1 file', run.output) + self.assertLess(len(run.output), 330) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 90) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" extracting: test", run.output) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.rm_testdir() + def test_59741_zzipdir_big_CVE_2017_5974(self): + """ run unzzip-big -l $(CVE_2017_5974).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5974 + file_url = self.url_CVE_2017_5974 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" stored test", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.rm_testdir() + def test_59742_zzipdir_mem_CVE_2017_5974(self): + """ run unzzip-mem -l $(CVE_2017_5974).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5974 + file_url = self.url_CVE_2017_5974 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" 3 test", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.rm_testdir() + def test_59743_zzipdir_mix_CVE_2017_5974(self): + """ run unzzip-mix -l $(CVE_2017_5974).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5974 + file_url = self.url_CVE_2017_5974 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" 3 test", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) # FIXME + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) # FIXME + self.rm_testdir() + def test_59744_zzipdir_zap_CVE_2017_5974(self): + """ run unzzip -l $(CVE_2017_5974).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5974 + file_url = self.url_CVE_2017_5974 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 255]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" 3 test", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.rm_testdir() + def test_59749(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5974 + file_url = self.url_CVE_2017_5974 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 161) + + url_CVE_2017_5975 = "https://github.com/asarubbo/poc/blob/master" + zip_CVE_2017_5975 = "00151-zziplib-heapoverflow-__zzip_get64" + def test_59750_infozipdir_CVE_2017_5975(self): + """ run info-zip dir test0.zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5975 + file_url = self.url_CVE_2017_5975 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 2]) + self.assertIn(' missing 10 bytes in zipfile', run.errors) + self.assertIn("didn't find end-of-central-dir signature at end of central dir", run.errors) + self.assertIn(' 1 file', run.output) + self.assertLess(len(run.output), 330) + self.assertLess(len(errors(run.errors)), 430) + # + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 90) + self.assertLess(len(errors(run.errors)), 900) + self.assertIn('file #1: bad zipfile offset (local header sig): 127', run.errors) + #self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_59751_zzipdir_big_CVE_2017_5975(self): + """ run info-zip -l $(CVE_2017_5975).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5975 + file_url = self.url_CVE_2017_5975 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" stored test", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) # TODO + self.rm_testdir() + def test_59752_zzipdir_mem_CVE_2017_5975(self): + """ run unzzip-mem -l $(CVE_2017_5975).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5975 + file_url = self.url_CVE_2017_5975 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 180) + self.assertIn("zzip_mem_disk_load : unable to load entry", run.errors) + self.assertIn("zzip_mem_disk_open : unable to load disk", run.errors) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 200) + if grep("DEBUG:", run.errors): + self.assertIn("findfirst (nil)", run.errors) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_59753_zzipdir_mix_CVE_2017_5975(self): + """ run unzzip-mix -l $(CVE_2017_5975).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5975 + file_url = self.url_CVE_2017_5975 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 180) + self.assertTrue(greps(run.errors, "Invalid or")) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 200) + self.assertTrue(greps(run.errors, "Invalid or")) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_59754_zzipdir_zap_CVE_2017_5975(self): + """ run unzzip -l $(CVE_2017_5975).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5975 + file_url = self.url_CVE_2017_5975 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 180) + self.assertIn(": Success", run.errors) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 200) + self.assertTrue(greps(run.errors, "Zipfile corrupted")) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_59759(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5975 + file_url = self.url_CVE_2017_5975 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 151) + + + url_CVE_2017_5976 = "https://github.com/asarubbo/poc/blob/master" + zip_CVE_2017_5976 = "00152-zziplib-heapoverflow-zzip_mem_entry_extra_block" + def test_59760_infozipdir_CVE_2017_5976(self): + """ run info-zip dir test0.zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5976 + file_url = self.url_CVE_2017_5976 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 2]) + self.assertIn(' 27 extra bytes at beginning or within zipfile', run.errors) + self.assertIn("didn't find end-of-central-dir signature at end of central dir", run.errors) + self.assertIn(' 1 file', run.output) + self.assertLess(len(run.output), 330) + self.assertLess(len(errors(run.errors)), 500) + # + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 190) + self.assertLess(len(errors(run.errors)), 900) + self.assertIn("extracting: test", run.output) + self.assertIn('-27 bytes too long', run.errors) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + # self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_59761_zzipdir_big_CVE_2017_5976(self): + """ run info-zip -l $(CVE_2017_5976).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5976 + file_url = self.url_CVE_2017_5976 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" stored test", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.rm_testdir() + def test_59762_zzipdir_mem_CVE_2017_5976(self): + """ run unzzip-mem -l $(CVE_2017_5976).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5976 + file_url = self.url_CVE_2017_5976 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn("3 test", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 30) # TODO + self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.rm_testdir() + def test_59763_zzipdir_mix_CVE_2017_5976(self): + """ run unzzip-mix -l $(CVE_2017_5976).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5976 + file_url = self.url_CVE_2017_5976 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn("3 test", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 30) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 0) # FIXME + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) # FIXME + self.rm_testdir() + def test_59764_zzipdir_zap_CVE_2017_5976(self): + """ run unzzip -l $(CVE_2017_5976).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5976 + file_url = self.url_CVE_2017_5976 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 255]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn("3 test", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 30) + self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.rm_testdir() + def test_59769(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5976 + file_url = self.url_CVE_2017_5976 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 188) + + url_CVE_2017_5980 = "https://github.com/asarubbo/poc/blob/master" + zip_CVE_2017_5980 = "00154-zziplib-nullptr-zzip_mem_entry_new" + def test_59800_infozipdir_CVE_2017_5980(self): + """ run info-zip dir test0.zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5980 + file_url = self.url_CVE_2017_5980 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 2]) + self.assertIn(' missing 6 bytes in zipfile', run.errors) + self.assertIn("didn't find end-of-central-dir signature at end of central dir", run.errors) + self.assertIn(' 1 file', run.output) + self.assertLess(len(run.output), 330) + self.assertLess(len(errors(run.errors)), 500) + # + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [3]) + self.assertLess(len(run.output), 90) + self.assertLess(len(errors(run.errors)), 900) + self.assertIn('file #1: bad zipfile offset (lseek)', run.errors) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_59801_zzipdir_big_CVE_2017_5980(self): + """ run info-zip -l $(CVE_2017_5980).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5980 + file_url = self.url_CVE_2017_5980 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + self.assertIn(" stored (null)", run.output) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,1]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_59802_zzipdir_mem_CVE_2017_5980(self): + """ run unzzip-mem -l $(CVE_2017_5980).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5980 + file_url = self.url_CVE_2017_5980 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzipdir-mem") + run = shell("{exe} {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,127,-11]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 180) + # self.assertTrue(greps(run.errors, "unable to load disk")) + # + exe = self.bins("unzzipcat-mem") + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 200) + self.assertFalse(os.path.exists(tmpdir+"/test")) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.rm_testdir() + def test_59803_zzipdir_mix_CVE_2017_5980(self): + """ run unzzip-mix -l $(CVE_2017_5980).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5980 + file_url = self.url_CVE_2017_5980 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 180) + self.assertTrue(greps(run.errors, "Invalid or")) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 200) + self.assertFalse(os.path.exists(tmpdir+"/test")) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.rm_testdir() + def test_59804_zzipdir_zap_CVE_2017_5980(self): + """ run unzzip -l $(CVE_2017_5980).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5980 + file_url = self.url_CVE_2017_5980 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [3]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 180) + self.assertIn(": Success", run.errors) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [3]) # TODO + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 200) + self.assertFalse(os.path.exists(tmpdir+"/test")) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.rm_testdir() + def test_59809(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5980 + file_url = self.url_CVE_2017_5980 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 155) + + + url_CVE_2017_5981 = "https://github.com/asarubbo/poc/blob/master" + zip_CVE_2017_5981 = "00161-zziplib-assertionfailure-seeko_C" + def test_59810_infozipdir_CVE_2017_5981(self): + """ run info-zip dir test0.zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5981 + file_url = self.url_CVE_2017_5981 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 3]) + self.assertIn(' missing 4 bytes in zipfile', run.errors) + self.assertIn("zipfile corrupt", run.errors) + self.assertLess(len(run.output), 80) + self.assertLess(len(errors(run.errors)), 500) + # + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [3]) + self.assertLess(len(run.output), 90) + self.assertLess(len(errors(run.errors)), 500) + self.assertIn('zipfile corrupt.', run.errors) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_59811_zzipdir_big_CVE_2017_5981(self): + """ run info-zip -l $(CVE_2017_5981).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5981 + file_url = self.url_CVE_2017_5981 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_59812_zzipdir_mem_CVE_2017_5981(self): + """ run unzzip-mem -l $(CVE_2017_5981).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5981 + file_url = self.url_CVE_2017_5981 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_59813_zzipdir_mix_CVE_2017_5981(self): + """ run unzzip-mix -l $(CVE_2017_5981).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5981 + file_url = self.url_CVE_2017_5981 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 1) + self.assertTrue(greps(run.errors, "Invalid or")) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_59814_zzipdir_zap_CVE_2017_5981(self): + """ run unzzip-zap -l $(CVE_2017_5981).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5981 + file_url = self.url_CVE_2017_5981 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 80) + self.assertIn(": Success", run.errors) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_59819(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2017_5981 + file_url = self.url_CVE_2017_5981 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 157) + + url_CVE_2018_10 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib" + zip_CVE_2018_10 = "zziplib_0-13-67_zzdir_invalid-memory-access_main.zip" + def test_63010(self): + """ info unzip -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_10 + file_url = self.url_CVE_2018_10 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 9]) + self.assertIn("End-of-central-directory signature not found", run.errors) + self.assertLess(len(run.output), 80) + self.assertLess(len(errors(run.errors)), 600) + # + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [9]) + self.assertLess(len(run.output), 90) + self.assertLess(len(errors(run.errors)), 600) + self.assertIn('End-of-central-directory signature not found', run.errors) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_63011(self): + """ unzzip-big -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_10 + file_url = self.url_CVE_2018_10 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_63012(self): + """ unzzip-mem -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_10 + file_url = self.url_CVE_2018_10 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_63013(self): + """ unzzip-mix -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_10 + file_url = self.url_CVE_2018_10 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 1) + self.assertTrue(greps(run.errors, "Invalid or")) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_63014(self): + """ unzzip-zap -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_10 + file_url = self.url_CVE_2018_10 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 80) + self.assertIn(": Success", run.errors) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_63018(self): + """ zzdir on $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_10 + file_url = self.url_CVE_2018_10 + download_raw(file_url, filename, tmpdir) + exe = self.bins("zzdir") + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [1]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 80) + self.assertTrue(greps(run.errors, "Invalid or")) + def test_63019(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_10 + file_url = self.url_CVE_2018_10 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 188) + + url_CVE_2018_11 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib" + zip_CVE_2018_11 = "zziplib_0-13-67_unzzip_infinite-loop_unzzip_cat_file.zip" + def test_63110(self): + """ info unzip -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_11 + file_url = self.url_CVE_2018_11 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 9]) + self.assertIn("End-of-central-directory signature not found", run.errors) + self.assertLess(len(run.output), 90) + self.assertLess(len(errors(run.errors)), 600) + # + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [9]) + self.assertLess(len(run.output), 90) + self.assertLess(len(errors(run.errors)), 600) + self.assertIn('End-of-central-directory signature not found', run.errors) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_63111(self): + """ unzzip-big -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_11 + file_url = self.url_CVE_2018_11 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_63112(self): + """ unzzip-mem -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_11 + file_url = self.url_CVE_2018_11 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_63113(self): + """ unzzip-mix -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_11 + file_url = self.url_CVE_2018_11 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 1) + self.assertTrue(greps(run.errors, "Invalid or")) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_63114(self): + """ unzzip-zap -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_11 + file_url = self.url_CVE_2018_11 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 90) + self.assertIn(": Success", run.errors) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + # + run = shell("cd {tmpdir} && ../{exe} -p {filename} ".format(**locals()), + returncodes = [0,3]) + self.rm_testdir() + def test_63119(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_11 + file_url = self.url_CVE_2018_11 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 280) + + url_CVE_2018_12 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib" + zip_CVE_2018_12 = "zziplib_0-13-67_unzip-mem_buffer-access-with-incorrect-length-value_zzip_disk_fread.zip" + def test_63810(self): + """ info unzip -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_12 + file_url = self.url_CVE_2018_12 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [2]) + self.assertIn('reported length of central directory', run.errors) + self.assertLess(len(run.output), 300) + self.assertLess(len(errors(run.errors)), 800) + # + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 300) + self.assertLess(len(errors(run.errors)), 800) + self.assertIn('reported length of central directory', run.errors) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_63811(self): + """ unzzip-big -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_12 + file_url = self.url_CVE_2018_12 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 20) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_63812(self): + """ unzzip-mem -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_12 + file_url = self.url_CVE_2018_12 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_63813(self): + """ unzzip-mix -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_12 + file_url = self.url_CVE_2018_12 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 1) + self.assertTrue(grep(run.errors, "central directory not found")) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_63814(self): + """ unzzip-zap -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_12 + file_url = self.url_CVE_2018_12 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 200) + self.assertIn(": Success", run.errors) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_63819(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_12 + file_url = self.url_CVE_2018_12 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 152) + + url_CVE_2018_14 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib" + zip_CVE_2018_14 = "zziplib_0-13-67_zzdir_memory-alignment-errors___zzip_fetch_disk_trailer.zip" + def test_64840(self): + """ info unzip -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_14 + file_url = self.url_CVE_2018_14 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [3]) + self.assertIn("attempt to seek before beginning of zipfile", run.errors) + self.assertLess(len(run.output), 200) + self.assertLess(len(errors(run.errors)), 800) + # + exe = self.bins("unzip") + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [3]) + self.assertLess(len(run.output), 200) + self.assertLess(len(errors(run.errors)), 800) + self.assertIn('attempt to seek before beginning of zipfile', run.errors) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_64841(self): + """ unzzip-big -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_14 + file_url = self.url_CVE_2018_14 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_64842(self): + """ unzzip-mem -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_14 + file_url = self.url_CVE_2018_14 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_64843(self): + """ unzzip-mix -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_14 + file_url = self.url_CVE_2018_14 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 2]) + self.assertLess(len(run.output), 1) + self.assertTrue(greps(run.errors, "Invalid or")) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_64844(self): + """ unzzip-zap -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_14 + file_url = self.url_CVE_2018_14 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 3]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 200) + self.assertIn(": Success", run.errors) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_64848(self): + """ zzdir $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_14 + file_url = self.url_CVE_2018_14 + download_raw(file_url, filename, tmpdir) + exe = self.bins("zzdir") + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [1]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 200) + self.assertTrue(greps(run.errors, "Invalid or")) + self.rm_testdir() + def test_64849(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_14 + file_url = self.url_CVE_2018_14 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 56) + + url_CVE_2018_15 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib" + zip_CVE_2018_15 = "zziplib_0-13-67_unzip-mem_memory-alignment-errors_zzip_disk_findfirst.zip" + def test_65400(self): + """ info unzip -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_15 + file_url = self.url_CVE_2018_15 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [2]) + self.assertIn("reported length of central directory", run.errors) + self.assertLess(len(run.output), 300) + self.assertLess(len(errors(run.errors)), 800) + # + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 300) + self.assertLess(len(errors(run.errors)), 800) + self.assertIn('reported length of central directory', run.errors) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_65401(self): + """ unzzip-big -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_15 + file_url = self.url_CVE_2018_15 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 15) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_65402(self): + """ unzzip-mem -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_15 + file_url = self.url_CVE_2018_15 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_65403(self): + """ unzzip-mix -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_15 + file_url = self.url_CVE_2018_15 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 1) + self.assertTrue(greps(run.errors, "Invalid or")) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_65404(self): + """ unzzip-zap -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_15 + file_url = self.url_CVE_2018_15 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 3]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 200) + self.assertIn(": Success", run.errors) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_65409(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_15 + file_url = self.url_CVE_2018_15 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 141) + + url_CVE_2018_16 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib" + zip_CVE_2018_16 = "zziplib_0-13-67_unzzip_memory-aligment-errors___zzip_fetch_disk_trailer.zip" + def test_65410(self): + """ info unzip -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_16 + file_url = self.url_CVE_2018_16 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 9]) + self.assertIn("End-of-central-directory signature not found", run.errors) + self.assertLess(len(run.output), 200) + self.assertLess(len(errors(run.errors)), 800) + # + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [9]) + self.assertLess(len(run.output), 200) + self.assertLess(len(errors(run.errors)), 800) + self.assertIn('End-of-central-directory signature not found', run.errors) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_65411(self): + """ unzzip-big -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_16 + file_url = self.url_CVE_2018_16 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_65412(self): + """ unzzip-mem -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_16 + file_url = self.url_CVE_2018_16 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_65413(self): + """ unzzip-mix -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_16 + file_url = self.url_CVE_2018_16 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 1) + self.assertTrue(greps(run.errors, "Invalid or")) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_65414(self): + """ unzzip-zap -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_16 + file_url = self.url_CVE_2018_16 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 3]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 200) + self.assertIn(": Success", run.errors) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + self.assertTrue(greps(run.errors, "Zipfile corrupted")) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + # + run = shell("cd {tmpdir} && ../{exe} -p {filename} ".format(**locals()), + returncodes = [0,3]) + self.assertTrue(greps(run.errors, "Zipfile corrupted")) + self.rm_testdir() + def test_65419(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_16 + file_url = self.url_CVE_2018_16 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 124) + + url_CVE_2018_17 = "https://github.com/ProbeFuzzer/poc/blob/master/zziplib" + zip_CVE_2018_17 = "zziplib_0-13-67_unzip-mem_memory-alignment-errors_zzip_disk_findfirst_64.zip" + def test_65420(self): + """ info unzip -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_17 + file_url = self.url_CVE_2018_17 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 9]) + self.assertIn("End-of-central-directory signature not found", run.errors) + self.assertLess(len(run.output), 200) + self.assertLess(len(errors(run.errors)), 800) + # + run = shell("cd {tmpdir} && {exe} -o {filename}".format(**locals()), + returncodes = [9]) + self.assertLess(len(run.output), 200) + self.assertLess(len(errors(run.errors)), 800) + self.assertIn('End-of-central-directory signature not found', run.errors) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_65421(self): + """ unzzip-big -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_17 + file_url = self.url_CVE_2018_17 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-big") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 1) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_65422(self): + """ unzzip-mem -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_17 + file_url = self.url_CVE_2018_17 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mem") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0]) + self.assertLess(len(run.output), 50) + self.assertLess(len(errors(run.errors)), 1) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [2]) + self.assertLess(len(run.output), 30) + self.assertLess(len(errors(run.errors)), 10) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + # + run = shell("cd {tmpdir} && ../{exe} -p {filename} ".format(**locals()), + returncodes = [2]) + # self.rm_testdir() + def test_65423(self): + """ unzzip-mix -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_17 + file_url = self.url_CVE_2018_17 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip-mix") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 1) + self.assertTrue(greps(run.errors, "Invalid or")) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,2]) + self.assertLess(len(run.output), 30) + self.assertTrue(greps(run.errors, "Invalid or")) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_65424(self): + """ unzzip-zap -l $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_17 + file_url = self.url_CVE_2018_17 + download_raw(file_url, filename, tmpdir) + exe = self.bins("unzzip") + run = shell("{exe} -l {tmpdir}/{filename} ".format(**locals()), + returncodes = [0, 3]) + self.assertLess(len(run.output), 1) + self.assertLess(len(errors(run.errors)), 200) + self.assertIn(": Success", run.errors) + # + run = shell("cd {tmpdir} && ../{exe} {filename} ".format(**locals()), + returncodes = [0,3]) + self.assertLess(len(run.output), 30) + self.assertTrue(greps(run.errors, "Zipfile corrupted")) + # self.assertEqual(os.path.getsize(tmpdir+"/test"), 3) + self.assertFalse(os.path.exists(tmpdir+"/test")) + self.rm_testdir() + def test_65429(self): + """ check $(CVE).zip """ + tmpdir = self.testdir() + filename = self.zip_CVE_2018_17 + file_url = self.url_CVE_2018_17 + download_raw(file_url, filename, tmpdir) + shell("ls -l {tmpdir}/{filename}".format(**locals())) + size = os.path.getsize(os.path.join(tmpdir, filename)) + self.assertEqual(size, 360) + - def test_900_make_test1w_zip(self): + def test_91000_zzshowme_check_sfx(self): + """ create an *.exe that can extract its own zip content """ + exe=self.bins("mkzip") + exefile = "tmp.zzshowme" + exeext + libstub = ".libs/zzipself" + exeext + txtfile_name = readme + txtfile = self.src(readme) + # add the extract-stub so we have reserved the size + run = shell("{exe} -0 -j {exefile}.zip {libstub}".format(**locals())) + self.assertFalse(run.returncode) + # add the actual content which may now be compressed + run = shell("{exe} -9 -j {exefile}.zip {txtfile}".format(**locals())) + self.assertFalse(run.returncode) + # rename .zip to .exe and put the extract-stub at the start + shutil.copy(exefile+".zip", exefile) + setstub="./zzipsetstub" + exeext + run = shell("{setstub} {exefile} {libstub}".format(**locals())) + self.assertFalse(run.returncode) + os.chmod(exefile, 0755) + # now ask the new .exe to show some of its own content + run = shell("./{exefile} {txtfile_name}".format(**locals())) + self.assertFalse(run.returncode) + txt = open(txtfile).read() + self.assertEqual(txt.split("\n"), run.output.split("\n")) + + def test_99000_make_test1w_zip(self): """ create a test1w.zip using zzip/write functions. """ exe=self.bins("zzip") run = shell("{exe} --version".format(**locals())) if "- NO -" in run.output: self.skipTest("- NO -D_ZZIP_ENABLE_WRITE") return - zipfile="test1w.zip" - tmpdir="test1w.tmp" + zipfile=self.testzip() + tmpdir=self.testdir() exe=self.bins("zzip") for i in [1,2,3,4,5,6,7,8,9]: filename = os.path.join(tmpdir,"file.%i" % i) @@ -945,8 +3024,7 @@ class ZZipTest(unittest.TestCase): filename = os.path.join(tmpdir,"README") filetext = self.readme() self.mkfile(filename, filetext) - try: os.remove(zipfile) - except: pass + self.rm_zipfile() shell("../{exe} ../{zipfile} ??*.* README".format(**locals()), cwd=tmpdir) self.assertGreater(os.path.getsize(zipfile), 10) diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.am b/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.am index 0319cc80fa5..5f333fbea61 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.am +++ b/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.am @@ -8,7 +8,7 @@ zzipdir = ${includedir}/zzip zzip_HEADERS = $(libzzip_la_headers) \ $(libzzipmmapped_la_headers) \ $(libzzipfseeko_la_headers) -noinst_HEADERS = __debug.h __hints.h __mmap.h __dirent.h __fnmatch.h +noinst_HEADERS = __debug.h __hints.h __mmap.h __dirent.h __fnmatch.h __string.h __mkdir.h __errno.h # VERSION_INFO=@VERSION_INFO@ RELEASE_INFO=@RELEASE_INFO@ diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.in b/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.in index 03ee59755cf..8a835ab1bc7 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.in +++ b/Build/source/libs/zziplib/zziplib-src/zzip/Makefile.in @@ -397,7 +397,7 @@ zzip_HEADERS = $(libzzip_la_headers) \ $(libzzipmmapped_la_headers) \ $(libzzipfseeko_la_headers) -noinst_HEADERS = __debug.h __hints.h __mmap.h __dirent.h __fnmatch.h +noinst_HEADERS = __debug.h __hints.h __mmap.h __dirent.h __fnmatch.h __string.h __mkdir.h __errno.h # libzzip_la_SOURCES = \ zip.c \ diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/__debug.h b/Build/source/libs/zziplib/zziplib-src/zzip/__debug.h index 13c7d895443..b79e5587f64 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/__debug.h +++ b/Build/source/libs/zziplib/zziplib-src/zzip/__debug.h @@ -8,61 +8,68 @@ #ifdef DEBUG #include <stdio.h> -#define DBG1(X1) ZZIP_FOR1 { \ +#define MSG1(X1) ZZIP_FOR1 { \ fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \ ); } ZZIP_END1 -#define DBG2(X1,X2) ZZIP_FOR1 { \ +#define MSG2(X1,X2) ZZIP_FOR1 { \ fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \ ,X2);} ZZIP_END1 -#define DBG3(X1,X2,X3) ZZIP_FOR1 { \ +#define MSG3(X1,X2,X3) ZZIP_FOR1 { \ fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \ ,X2,X3); } ZZIP_END1 -#define DBG4(X1,X2,X3,X4) ZZIP_FOR1 { \ +#define MSG4(X1,X2,X3,X4) ZZIP_FOR1 { \ fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \ ,X2,X3,X4); } ZZIP_END1 -#define DBG5(X1,X2,X3,X4,X5) ZZIP_FOR1 { \ +#define MSG5(X1,X2,X3,X4,X5) ZZIP_FOR1 { \ fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \ ,X2,X3,X4,X5); } ZZIP_END1 -#define DBG6(X1,X2,X3,X4,X5,X6) ZZIP_FOR1 { \ +#define MSG6(X1,X2,X3,X4,X5,X6) ZZIP_FOR1 { \ fprintf(stderr,"\n%s:%i:"X1"\n", ZZIP_FUNC,__LINE__ \ ,X2,X3,X4,X5,X6); } ZZIP_END1 #else -#define DBG1(X1) {} -#define DBG2(X1,X2) {} -#define DBG3(X1,X2,X3) {} -#define DBG4(X1,X2,X3,X4) {} -#define DBG5(X1,X2,X3,X4,X5) {} -#define DBG6(X1,X2,X3,X4,X5,X6) {} +#define MSG1(X1) {} +#define MSG2(X1,X2) {} +#define MSG3(X1,X2,X3) {} +#define MSG4(X1,X2,X3,X4) {} +#define MSG5(X1,X2,X3,X4,X5) {} +#define MSG6(X1,X2,X3,X4,X5,X6) {} #endif -#define HINT1(X1) DBG1("HINT: " X1) -#define HINT2(X1,X2) DBG2("HINT: " X1,X2) -#define HINT3(X1,X2,X3) DBG3("HINT: " X1,X2,X3) -#define HINT4(X1,X2,X3,X4) DBG4("HINT: " X1,X2,X3,X4) -#define HINT5(X1,X2,X3,X4,X5) DBG5("HINT: " X1,X2,X3,X4,X5) -#define HINT6(X1,X2,X3,X4,X5,X6) DBG6("HINT: " X1,X2,X3,X4,X5,X6) +#define DBG1(X1) MSG1("DEBUG: " X1) +#define DBG2(X1,X2) MSG2("DEBUG: " X1,X2) +#define DBG3(X1,X2,X3) MSG3("DEBUG: " X1,X2,X3) +#define DBG4(X1,X2,X3,X4) MSG4("DEBUG: " X1,X2,X3,X4) +#define DBG5(X1,X2,X3,X4,X5) MSG5("DEBUG: " X1,X2,X3,X4,X5) +#define DBG6(X1,X2,X3,X4,X5,X6) MSG6("DEBUG: " X1,X2,X3,X4,X5,X6) -#define NOTE1(X1) DBG1("NOTE: " X1) -#define NOTE2(X1,X2) DBG2("NOTE: " X1,X2) -#define NOTE3(X1,X2,X3) DBG3("NOTE: " X1,X2,X3) -#define NOTE4(X1,X2,X3,X4) DBG4("NOTE: " X1,X2,X3,X4) -#define NOTE5(X1,X2,X3,X4,X5) DBG5("NOTE: " X1,X2,X3,X4,X5) -#define NOTE6(X1,X2,X3,X4,X5,X6) DBG6("NOTE: " X1,X2,X3,X4,X5,X6) +#define HINT1(X1) MSG1("HINT: " X1) +#define HINT2(X1,X2) MSG2("HINT: " X1,X2) +#define HINT3(X1,X2,X3) MSG3("HINT: " X1,X2,X3) +#define HINT4(X1,X2,X3,X4) MSG4("HINT: " X1,X2,X3,X4) +#define HINT5(X1,X2,X3,X4,X5) MSG5("HINT: " X1,X2,X3,X4,X5) +#define HINT6(X1,X2,X3,X4,X5,X6) MSG6("HINT: " X1,X2,X3,X4,X5,X6) -#define WARN1(X1) DBG1("WARN: " X1) -#define WARN2(X1,X2) DBG2("WARN: " X1,X2) -#define WARN3(X1,X2,X3) DBG3("WARN: " X1,X2,X3) -#define WARN4(X1,X2,X3,X4) DBG4("WARN: " X1,X2,X3,X4) -#define WARN5(X1,X2,X3,X4,X5) DBG5("WARN: " X1,X2,X3,X4,X5) -#define WARN6(X1,X2,X3,X4,X5,X6) DBG6("WARN: " X1,X2,X3,X4,X5,X6) +#define NOTE1(X1) MSG1("NOTE: " X1) +#define NOTE2(X1,X2) MSG2("NOTE: " X1,X2) +#define NOTE3(X1,X2,X3) MSG3("NOTE: " X1,X2,X3) +#define NOTE4(X1,X2,X3,X4) MSG4("NOTE: " X1,X2,X3,X4) +#define NOTE5(X1,X2,X3,X4,X5) MSG5("NOTE: " X1,X2,X3,X4,X5) +#define NOTE6(X1,X2,X3,X4,X5,X6) MSG6("NOTE: " X1,X2,X3,X4,X5,X6) -#define FAIL1(X1) DBG1("FAIL: " X1) -#define FAIL2(X1,X2) DBG2("FAIL: " X1,X2) -#define FAIL3(X1,X2,X3) DBG3("FAIL: " X1,X2,X3) -#define FAIL4(X1,X2,X3,X4) DBG4("FAIL: " X1,X2,X3,X4) -#define FAIL5(X1,X2,X3,X4,X5) DBG5("FAIL: " X1,X2,X3,X4,X5) -#define FAIL6(X1,X2,X3,X4,X5,X6) DBG6("FAIL: " X1,X2,X3,X4,X5,X6) +#define WARN1(X1) MSG1("WARN: " X1) +#define WARN2(X1,X2) MSG2("WARN: " X1,X2) +#define WARN3(X1,X2,X3) MSG3("WARN: " X1,X2,X3) +#define WARN4(X1,X2,X3,X4) MSG4("WARN: " X1,X2,X3,X4) +#define WARN5(X1,X2,X3,X4,X5) MSG5("WARN: " X1,X2,X3,X4,X5) +#define WARN6(X1,X2,X3,X4,X5,X6) MSG6("WARN: " X1,X2,X3,X4,X5,X6) + +#define FAIL1(X1) MSG1("FAIL: " X1) +#define FAIL2(X1,X2) MSG2("FAIL: " X1,X2) +#define FAIL3(X1,X2,X3) MSG3("FAIL: " X1,X2,X3) +#define FAIL4(X1,X2,X3,X4) MSG4("FAIL: " X1,X2,X3,X4) +#define FAIL5(X1,X2,X3,X4,X5) MSG5("FAIL: " X1,X2,X3,X4,X5) +#define FAIL6(X1,X2,X3,X4,X5,X6) MSG6("FAIL: " X1,X2,X3,X4,X5,X6) diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/__errno.h b/Build/source/libs/zziplib/zziplib-src/zzip/__errno.h new file mode 100644 index 00000000000..d66ac3f7154 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/zzip/__errno.h @@ -0,0 +1,11 @@ +#ifndef __ZZIP_INTERNAL_ERRNO_H +#define __ZZIP_INTERNAL_ERRNO_H + +#include <errno.h> + +/* Mingw cross compile fix */ +#ifndef EBADMSG +#define EBADMSG 74 +#endif + +#endif diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/__fnmatch.h b/Build/source/libs/zziplib/zziplib-src/zzip/__fnmatch.h index 340dbaa2c8c..59cea887682 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/__fnmatch.h +++ b/Build/source/libs/zziplib/zziplib-src/zzip/__fnmatch.h @@ -13,18 +13,14 @@ #ifdef ZZIP_HAVE_FNMATCH_H #define _zzip_fnmatch fnmatch # ifdef FNM_CASEFOLD -# define _zzip_fnmatch_CASEFOLD FNM_CASEFOLD +# define _zzip_FNM_CASEFOLD FNM_CASEFOLD # else -# define _zzip_fnmatch_CASEFOLD 0 +# define _zzip_FNM_CASEFOLD 0 # endif #else -# define _zzip_fnmatch_CASEFOLD 0 +# define _zzip_FNM_CASEFOLD 0 /* if your system does not have fnmatch, we fall back to strcmp: */ -static int _zzip_fnmatch(char* pattern, char* string, int flags) -{ - fprintf (stderr, "<zzip:mmapped:strcmp>"); - return strcmp (pattern, string); -} +#define _zzip_fnmatch(x,y,z) strcmp ((x),(y)) #endif #endif diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/__hints.h b/Build/source/libs/zziplib/zziplib-src/zzip/__hints.h index d071c4ebd7f..1d2eef0b455 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/__hints.h +++ b/Build/source/libs/zziplib/zziplib-src/zzip/__hints.h @@ -94,7 +94,7 @@ # endif #endif -/* resolve references to this function during pre-linking the libary */ +/* resolve references to this function during pre-linking the library */ #ifndef ZZIP_GNUC_LIB_PROTECTED # if ZZIP_GNUC_ATLEAST(3,1) # define ZZIP_GNUC_LIB_PROTECTED __attribute__((visiblity("protected"))) diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/__mkdir.h b/Build/source/libs/zziplib/zziplib-src/zzip/__mkdir.h new file mode 100644 index 00000000000..c1bffa44454 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/zzip/__mkdir.h @@ -0,0 +1,12 @@ +#ifndef __ZZIP_INTERNAL_MKDIR_H +#define __ZZIP_INTERNAL_MKDIR_H + +#include <zzip/conf.h> + +# ifdef ZZIP_HAVE_DIRECT_H +# define _zzip_mkdir(a,b) mkdir(a) +# else +# define _zzip_mkdir mkdir +# endif + +#endif diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/__string.h b/Build/source/libs/zziplib/zziplib-src/zzip/__string.h new file mode 100644 index 00000000000..351b0c14162 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/zzip/__string.h @@ -0,0 +1,67 @@ +#ifndef __ZZIP_INTERNAL_STRING_H +#define __ZZIP_INTERNAL_STRING_H + +#ifdef __linux__ +#define _GNU_SOURCE _glibc_developers_are_idiots_to_call_strndup_gnu_specific_ +#endif + +#include <zzip/conf.h> + +#if defined ZZIP_HAVE_STRING_H +#include <string.h> +#elif defined ZZIP_HAVE_STRINGS_H +#include <strings.h> +#endif + + +#if defined ZZIP_HAVE_STRNDUP || defined strndup +#define _zzip_strndup strndup +#else + +/* if your system does not have strndup: */ +zzip__new__ static char * +_zzip_strndup(char const *p, size_t maxlen) +{ + if (p == NULL) + { + return p; + } else + { + size_t len = strnlen(p, maxlen); + char* r = malloc(len + 1); + if (r == NULL) + return NULL; /* errno = ENOMEM */ + r[len] = '\0'; + return memcpy(r, p, len); + } +} +#endif + +#if defined ZZIP_HAVE_STRCASECMP || defined strcasecmp +#define _zzip_strcasecmp strcasecmp +#else + +/* if your system does not have strcasecmp: */ +static int +_zzip_strcasecmp(char *__zzip_restrict a, char *_zzip_restrict b) +{ + if (! a) + return (b) ? 1 : 0; + if (! b) + return -1; + while (1) + { + int v = tolower(*a) - tolower(*b); + if (v) + return v; + if (! *a) + return 1; + if (! *b) + return -1; + a++; + b++; + } +} +#endif + +#endif diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/file.c b/Build/source/libs/zziplib/zziplib-src/zzip/file.c index f7c5fa89725..fb91d9815d0 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/file.c +++ b/Build/source/libs/zziplib/zziplib-src/zzip/file.c @@ -577,7 +577,7 @@ zzip_fopen(zzip_char_t * filename, zzip_char_t * mode) * Per default, the old file stream is closed and only the internal * structures associated with it are kept. These internal structures * may be reused for the return value, and this is a lot quicker when - * the filename matches a zipped file that is incidently in the very + * the filename matches a zipped file that is incidentally in the very * same zip arch as the old filename wrapped in the stream struct. * * That's simply because the zip arch's central directory does not diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/fseeko.c b/Build/source/libs/zziplib/zziplib-src/zzip/fseeko.c index ba19b436fb0..33794927606 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/fseeko.c +++ b/Build/source/libs/zziplib/zziplib-src/zzip/fseeko.c @@ -35,6 +35,7 @@ #include <zzip/fetch.h> #include <zzip/__mmap.h> #include <zzip/__fnmatch.h> +#include <zzip/__errno.h> #include <stdlib.h> #include <sys/stat.h> @@ -78,10 +79,10 @@ #define PAGESIZE 8192 #ifdef DEBUG -#define debug1(msg) do { fprintf(stderr, "%s : " msg "\n", __func__); } while(0) -#define debug2(msg, arg1) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1); } while(0) -#define debug3(msg, arg1, arg2) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1, arg2); } while(0) -#define debug4(msg, arg1, arg2, arg3) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1, arg2, arg3); } while(0) +#define debug1(msg) do { fprintf(stderr, "DEBUG: %s : " msg "\n", __func__); } while(0) +#define debug2(msg, arg1) do { fprintf(stderr, "DEBUG: %s : " msg "\n", __func__, arg1); } while(0) +#define debug3(msg, arg1, arg2) do { fprintf(stderr, "DEBUG: %s : " msg "\n", __func__, arg1, arg2); } while(0) +#define debug4(msg, arg1, arg2, arg3) do { fprintf(stderr, "DEBUG: %s : " msg "\n", __func__, arg1, arg2, arg3); } while(0) #else #define debug1(msg) #define debug2(msg, arg1) @@ -97,7 +98,7 @@ * This functions read the correspoding struct zzip_file_header from * the zip disk of the given "entry". The returned off_t points to the * end of the file_header where the current fseek pointer has stopped. - * This is used to immediatly parse out any filename/extras block following + * This is used to immediately parse out any filename/extras block following * the file_header. * * Returns zero on error. (errno = EINVAL|EBADMSG|EBADF|EIO) @@ -319,7 +320,7 @@ zzip_entry_findfirst(FILE * disk) } /* we read out chunks of 8 KiB in the hope to match disk granularity */ ___ zzip_off_t pagesize = PAGESIZE; /* getpagesize() */ - ___ ZZIP_ENTRY *entry = malloc(sizeof(*entry)); + ___ ZZIP_ENTRY *entry = calloc(1, sizeof(*entry)); if (! entry) goto error0; /* ENOMEM */ ___ unsigned char *buffer = malloc(pagesize); @@ -808,7 +809,7 @@ zzip_entry_fread(void *ptr, zzip_size_t sized, zzip_size_t nmemb, file->entry->diskfile); file->zlib.next_in = file->buffer; file->dataoff += file->zlib.avail_in; - debug2("remaing compressed fread %lli", (long long) file->zlib.avail_in); + debug2("remaining compressed fread %lli", (long long) file->zlib.avail_in); } if (! file->zlib.avail_in) { diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/fseeko.h b/Build/source/libs/zziplib/zziplib-src/zzip/fseeko.h index c790cf6a3af..96faa011a4a 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/fseeko.h +++ b/Build/source/libs/zziplib/zziplib-src/zzip/fseeko.h @@ -99,6 +99,7 @@ struct zzip_entry : public struct zzip_disk_entry zzip_off_t zz_offset; /* or zip64 extension block */ int zz_diskstart; }; +# define zzip_entry_d(_p) (_p) # else struct zzip_entry /* : struct zzip_disk_entry */ { @@ -113,9 +114,38 @@ struct zzip_entry /* : struct zzip_disk_entry */ zzip_off_t zz_offset; /* or zip64 extension block */ int zz_diskstart; }; +# define zzip_entry_d(_p) (&(_p)->head) # endif /* __cplusplus */ # endif /* _ZZIP_MEM_ENTRY_PRIVATE */ +#ifdef _ZZIP_ENTRY_STRUCT +/* zzip_entry is-a zip_disk_entry => fetch.h */ +#define zzip_entry_csize(__p) ((zzip_size_t) \ + zzip_disk_entry_get_csize(zzip_entry_d(__p))) +#define zzip_entry_usize(__p) ((zzip_size_t) \ + zzip_disk_entry_get_usize(zzip_entry_d(__p))) +#define zzip_entry_compr(__p) ( \ + zzip_disk_entry_get_compr(zzip_entry_d(__p))) +#define zzip_entry_flags(__p) ( \ + zzip_disk_entry_get_flags(zzip_entry_d(__p))) +#define zzip_entry_namlen(__p) ((zzip_size_t) \ + zzip_disk_entry_get_namlen(zzip_entry_d(__p))) +#define zzip_entry_extras(__p) ((zzip_size_t) \ + zzip_disk_entry_get_extras(zzip_entry_d(__p))) +#define zzip_entry_comment(__p) ((zzip_size_t) \ + zzip_disk_entry_get_comment(zzip_entry_d(__p))) +#define zzip_entry_diskstart(__p) ((int) \ + zzip_disk_entry_get_diskstart(zzip_entry_d(__p))) +#define zzip_entry_filetype(__p) ((int) \ + zzip_disk_entry_get_filetype(zzip_entry_d(__p))) +#define zzip_entry_filemode(__p) ((int) \ + zzip_disk_entry_get_filemode(zzip_entry_d(__p))) +#define zzip_entry_fileoffset(__p) ((zzip_off_t) \ + zzip_disk_entry_get_offset(zzip_entry_d(__p))) +#define zzip_entry_sizeof_tail(__p) ((zzip_size_t) \ + zzip_disk_entry_sizeof_tails(zzip_entry_d(__p))) +#endif + #ifdef __cplusplus extern "C" { } diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/info.c b/Build/source/libs/zziplib/zziplib-src/zzip/info.c index 70d393deff8..ab226bc9a20 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/info.c +++ b/Build/source/libs/zziplib/zziplib-src/zzip/info.c @@ -58,6 +58,10 @@ zzip_dirfd(ZZIP_DIR * dir) return dir->fd; } +static const char* comprlevel[] = { + "stored", "shrunk", "redu:1", "redu:2", "redu:3", "redu:4", + "impl:N", "toknze", "defl:N", "defl:B", "impl:B" }; + /** * return static const string of the known compression methods, * otherwise just "zipped" is returned @@ -65,46 +69,34 @@ zzip_dirfd(ZZIP_DIR * dir) zzip_char_t * zzip_compr_str(int compr) { - switch (compr) + if (0 <= compr && compr < sizeof(comprlevel)) + { + return comprlevel[compr]; + } else if (0 < compr && compr < 256) + { + return "zipped"; + } else { - /* *INDENT-OFF* */ - case ZZIP_IS_STORED: return "stored"; - case ZZIP_IS_SHRUNK: return "shrunk"; - case ZZIP_IS_REDUCEDx1: - case ZZIP_IS_REDUCEDx2: - case ZZIP_IS_REDUCEDx3: - case ZZIP_IS_REDUCEDx4: return "reduced"; - case ZZIP_IS_IMPLODED: return "imploded"; - case ZZIP_IS_TOKENIZED: return "tokenized"; - case ZZIP_IS_DEFLATED: return "deflated"; - case ZZIP_IS_DEFLATED_BETTER: return "deflatedX"; - case ZZIP_IS_IMPLODED_BETTER: return "implodedX"; - default: - if (0 < compr && compr < 256) return "zipped"; - else - { # ifdef S_ISDIR - if (S_ISDIR(compr)) return "directory"; + if (S_ISDIR(compr)) return "directory"; # endif # ifdef S_ISCHR - if (S_ISCHR(compr)) return "is/chr"; + if (S_ISCHR(compr)) return "is/chr"; # endif # ifdef S_ISBLK - if (S_ISBLK(compr)) return "is/blk"; + if (S_ISBLK(compr)) return "is/blk"; # endif # ifdef S_ISFIFO - if (S_ISFIFO(compr)) return "is/fifo"; + if (S_ISFIFO(compr)) return "is/fifo"; # endif # ifdef S_ISSOCK - if (S_ISSOCK(compr)) return "is/sock"; + if (S_ISSOCK(compr)) return "is/sock"; # endif # ifdef S_ISLNK - if (S_ISLNK(compr)) return "is/lnk"; + if (S_ISLNK(compr)) return "is/lnk"; # endif - return "special"; - } - /* *INDENT-ON* */ - } /*switch */ + return "special"; + } } /** => zzip_file_real diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/lib.h b/Build/source/libs/zziplib/zziplib-src/zzip/lib.h index 2d83f239b87..b09a1302829 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/lib.h +++ b/Build/source/libs/zziplib/zziplib-src/zzip/lib.h @@ -76,7 +76,7 @@ ZZIP_DIR* zzip_dir_fdopen_ext_io(int fd, zzip_error_t * errorcode_p, zzip_strings_t* ext, const zzip_plugin_io_t io); -ZZIP_DIR* /*depracated*/ +ZZIP_DIR* /*deprecated*/ zzip_dir_alloc_ext_io (zzip_strings_t* ext, const zzip_plugin_io_t io); #ifdef __cplusplus diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/memdisk.c b/Build/source/libs/zziplib/zziplib-src/zzip/memdisk.c index 0b07da7db55..29b2a1b1b05 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/memdisk.c +++ b/Build/source/libs/zziplib/zziplib-src/zzip/memdisk.c @@ -33,16 +33,17 @@ #include <zzip/mmapped.h> #include <zzip/memdisk.h> #include <zzip/__fnmatch.h> +#include <zzip/__errno.h> #define ___ { #define ____ } #define DEBUG 1 #ifdef DEBUG -#define debug1(msg) do { fprintf(stderr, "%s : " msg "\n", __func__); } while(0) -#define debug2(msg, arg1) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1); } while(0) -#define debug3(msg, arg1, arg2) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1, arg2); } while(0) -#define debug4(msg, arg1, arg2, arg3) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1, arg2, arg3); } while(0) +#define debug1(msg) do { fprintf(stderr, "DEBUG: %s : " msg "\n", __func__); } while(0) +#define debug2(msg, arg1) do { fprintf(stderr, "DEBUG: %s : " msg "\n", __func__, arg1); } while(0) +#define debug3(msg, arg1, arg2) do { fprintf(stderr, "DEBUG: %s : " msg "\n", __func__, arg1, arg2); } while(0) +#define debug4(msg, arg1, arg2, arg3) do { fprintf(stderr, "DEBUG: %s : " msg "\n", __func__, arg1, arg2, arg3); } while(0) #else #define debug1(msg) #define debug2(msg, arg1) @@ -50,17 +51,6 @@ #define debug4(msg, arg1, arg2, arg3) #endif -static const char *error[] = { - "Ok", -# define _zzip_mem_disk_open_fail 1 - "zzip_mem_disk_open: zzip_disk_open did fail", -# define _zzip_mem_disk_fdopen_fail 2 - "zzip_mem_disk_fdopen: zzip_disk_mmap did fail" -# define _zzip_mem_disk_buffer_fail 3 - "zzip_mem_disk_buffer: zzip_disk_buffer did fail", - 0 -}; - #define ZZIP_EXTRA_zip64 0x0001 typedef struct _zzip_extra_zip64 { /* ZIP64 extended information extra field */ @@ -92,7 +82,10 @@ zzip_mem_disk_open(char *filename) { ZZIP_DISK *disk = zzip_disk_open(filename); if (! disk) - { perror(error[_zzip_mem_disk_open_fail]); return 0; } + { + debug2("can not open disk file %s", filename); + return 0; + } ___ ZZIP_MEM_DISK *dir = zzip_mem_disk_new(); if (zzip_mem_disk_load(dir, disk) == -1) { @@ -109,9 +102,15 @@ zzip_mem_disk_fdopen(int fd) { ZZIP_DISK *disk = zzip_disk_mmap(fd); if (! disk) - { perror(error[_zzip_mem_disk_fdopen_fail]); return 0; } + { + debug2("can not open disk fd %i", fd); + return 0; + } ___ ZZIP_MEM_DISK *dir = zzip_mem_disk_new(); - zzip_mem_disk_load(dir, disk); + if (zzip_mem_disk_load(dir, disk) == -1) + { + debug2("unable to load disk fd %s", fd); + } return dir; ____; } @@ -123,9 +122,15 @@ zzip_mem_disk_buffer(char *buffer, size_t buflen) { ZZIP_DISK *disk = zzip_disk_buffer(buffer, buflen); if (! disk) - { perror(error[_zzip_mem_disk_buffer_fail]); return 0; } + { + debug2("can not open disk buf %p", buffer); + return 0; + } ___ ZZIP_MEM_DISK *dir = zzip_mem_disk_new(); - zzip_mem_disk_load(dir, disk); + if (zzip_mem_disk_load(dir, disk) == -1) + { + debug2("unable to load disk buf %p", buffer); + } return dir; ____; } @@ -209,6 +214,14 @@ zzip_mem_entry_new(ZZIP_DISK * disk, ZZIP_DISK_ENTRY * entry) item->zz_diskstart = zzip_disk_entry_get_diskstart(entry); item->zz_filetype = zzip_disk_entry_get_filetype(entry); + /* + * If the file is uncompressed, zz_csize and zz_usize should be the same + * If they are not, we cannot guarantee that either is correct, so ... + */ + if (item->zz_compr == ZZIP_IS_STORED && item->zz_csize != item->zz_usize) + { + goto error; + } /* zz_comment and zz_name are empty strings if not present on disk */ if (! item->zz_comment || ! item->zz_name) { @@ -221,34 +234,39 @@ zzip_mem_entry_new(ZZIP_DISK * disk, ZZIP_DISK_ENTRY * entry) zzip_size_t /* */ ext2_len = zzip_file_header_get_extras(header); char *_zzip_restrict ext2_ptr = zzip_file_header_to_extras(header); - if (ext1_ptr + ext1_len >= disk->endbuf || - ext2_ptr + ext2_len >= disk->endbuf) + if (ext1_len > 0 && ext1_len <= 65535) { - errno = EBADMSG; /* format error CVE-2017-5978 */ - goto error; /* zzip_mem_entry_free(item); return 0; */ - } - - if (ext1_len) - { - void *mem = malloc(ext1_len); - if (! mem) goto error; /* errno = ENOMEM */ - item->zz_ext[1] = mem; - item->zz_extlen[1] = ext1_len; - memcpy(mem, ext1_ptr, ext1_len); + if (ext1_ptr + ext1_len >= disk->endbuf) + { + errno = EBADMSG; + goto error; /* zzip_mem_entry_free(item); return 0; */ + } else { + void *mem = malloc(ext1_len); + if (! mem) goto error; /* errno = ENOMEM */ + item->zz_ext[1] = mem; + item->zz_extlen[1] = ext1_len; + memcpy(mem, ext1_ptr, ext1_len); + } } - if (ext2_len) + if (ext2_len > 0 && ext2_len <= 65535) { - void *mem = malloc(ext2_len); - if (! mem) goto error; /* errno = ENOMEM */ - item->zz_ext[2] = mem; - item->zz_extlen[2] = ext2_len; - memcpy(mem, ext2_ptr, ext2_len); + if (ext2_ptr + ext2_len >= disk->endbuf) + { + errno = EBADMSG; + goto error; /* zzip_mem_entry_free(item); return 0; */ + } else { + void *mem = malloc(ext2_len); + if (! mem) goto error; /* errno = ENOMEM */ + item->zz_ext[2] = mem; + item->zz_extlen[2] = ext2_len; + memcpy(mem, ext2_ptr, ext2_len); + } } } { /* override sizes/offsets with zip64 values for largefile support */ zzip_extra_zip64 *block = (zzip_extra_zip64 *) - zzip_mem_entry_extra_block(item, ZZIP_EXTRA_zip64); + zzip_mem_entry_find_extra_block(item, ZZIP_EXTRA_zip64, sizeof(zzip_extra_zip64)); if (block) { item->zz_usize = ZZIP_GET64(block->z_usize); @@ -269,12 +287,26 @@ error: ____; } +/** => zzip_mem_entry_find_extra_block. + * + * Note that for this function only the block_header is asserted + * to be completely in memory, so the returned pointer should be checked. + */ +ZZIP_EXTRA_BLOCK * +zzip_mem_entry_extra_block(ZZIP_MEM_ENTRY * entry, short datatype) +{ + return zzip_mem_entry_find_extra_block(entry, datatype, 16); +} + /* find an extra block for the given datatype code. * The returned EXTRA_BLOCK is still in disk-encoding but * already a pointer into an allocated heap space block. + * + * The second argument of this function ensures that the + * complete datasize is in memory. */ ZZIP_EXTRA_BLOCK * -zzip_mem_entry_extra_block(ZZIP_MEM_ENTRY * entry, short datatype) +zzip_mem_entry_find_extra_block(ZZIP_MEM_ENTRY * entry, short datatype, zzip_size_t blocksize) { int i = 2; while (1) @@ -287,7 +319,10 @@ zzip_mem_entry_extra_block(ZZIP_MEM_ENTRY * entry, short datatype) { if (datatype == zzip_extra_block_get_datatype(ext)) { - return ((ZZIP_EXTRA_BLOCK*) ext); + if (blocksize <= zzip_extra_block_get_datasize(ext) + zzip_extra_block_headerlength) + { + return ((ZZIP_EXTRA_BLOCK*) ext); + } } /* skip to start of next extra_block */ ___ zzip_size_t datasize = zzip_extra_block_get_datasize(ext); @@ -348,7 +383,7 @@ zzip_mem_disk_close(ZZIP_MEM_DISK * _zzip_restrict dir) static void foo(short zz_datatype) { - /* Header IDs of 0 thru 31 are reserved for use by PKWARE.(APPNOTE.TXT) */ + /* Header IDs of 0 through 31 are reserved for use by PKWARE.(APPNOTE.TXT) */ switch (zz_datatype) { /* *INDENT-OFF* */ diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/memdisk.h b/Build/source/libs/zziplib/zziplib-src/zzip/memdisk.h index 850d7ed4de7..5cf0eced460 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/memdisk.h +++ b/Build/source/libs/zziplib/zziplib-src/zzip/memdisk.h @@ -9,6 +9,7 @@ #include <zzip/types.h> #include <zzip/mmapped.h> +#include <zzip/__hints.h> #ifdef __cplusplus extern "C" { @@ -43,7 +44,9 @@ zzip_mem_disk_load (ZZIP_MEM_DISK* dir, ZZIP_DISK* disk); zzip_mem_disk_extern void zzip_mem_disk_unload (ZZIP_MEM_DISK* dir); ZZIP_EXTRA_BLOCK* -zzip_mem_entry_extra_block (ZZIP_MEM_ENTRY* entry, short datatype); +zzip_mem_entry_extra_block (ZZIP_MEM_ENTRY* entry, short datatype) ZZIP_GNUC_DEPRECATED; +ZZIP_EXTRA_BLOCK* +zzip_mem_entry_find_extra_block (ZZIP_MEM_ENTRY* entry, short datatype, zzip_size_t blocksize); #ifdef USE_INLINE _zzip_inline ZZIP_DISK* zzip_disk (ZZIP_MEM_DISK* dir) { return dir->disk; } @@ -73,9 +76,9 @@ struct _zzip_mem_entry { zzip_size_t zz_extlen[3]; /* the extra blocks are NOT converted */ }; -#define _zzip_mem_disk_findfirst(_d_) ((_d_)->list) -#define _zzip_mem_disk_findnext(_d_,_e_) (!(_e_)?(_d_)->list:(_e_)->zz_next) -#define _zzip_mem_entry_findnext(_e_) ((_e_)->zz_next) +#define _zzip_mem_disk_findfirst(_d_) (!(_d_) ? 0 : ((_d_)->list)) +#define _zzip_mem_disk_findnext(_d_,_e_) (!(_e_) ? (!(_d_) ? 0 : ((_d_)->list)) : ((_e_)->zz_next)) +#define _zzip_mem_entry_findnext(_e_) (!(_e_) ? 0 : ((_e_)->zz_next)) #ifndef USE_INLINE #define zzip_mem_disk_findfirst _zzip_mem_disk_findfirst @@ -97,10 +100,10 @@ zzip_mem_entry_findnext(ZZIP_MEM_ENTRY* entry) { return _zzip_mem_entry_findnext(entry); } #endif -#define _zzip_mem_entry_to_name(_e_) ((_e_)->zz_name) -#define _zzip_mem_entry_to_comment(_e_) ((_e_)->zz_comment) -#define _zzip_mem_entry_strdup_name(_e_) (strdup((_e_)->zz_name)) -#define _zzip_mem_entry_to_data(_e_) ((_e_)->zz_data) +#define _zzip_mem_entry_to_name(_e_) (!(_e_) ? 0 : ((_e_)->zz_name)) +#define _zzip_mem_entry_to_comment(_e_) (!(_e_) ? 0 : ((_e_)->zz_comment)) +#define _zzip_mem_entry_strdup_name(_e_) (!(_e_) ? 0 : (strdup((_e_)->zz_name))) +#define _zzip_mem_entry_to_data(_e_) (!(_e_) ? 0 : ((_e_)->zz_data)) #ifndef USE_INLINE #define zzip_mem_entry_to_name _zzip_mem_entry_to_name diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/mmapped.c b/Build/source/libs/zziplib/zziplib-src/zzip/mmapped.c index 67f293fb0d1..c61fc5656b6 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/mmapped.c +++ b/Build/source/libs/zziplib/zziplib-src/zzip/mmapped.c @@ -30,8 +30,11 @@ #include <zzip/mmapped.h> #include <zzip/format.h> #include <zzip/fetch.h> +#include <zzip/__debug.h> #include <zzip/__mmap.h> +#include <zzip/__string.h> #include <zzip/__fnmatch.h> +#include <zzip/__errno.h> #include <stdlib.h> #include <sys/stat.h> @@ -57,18 +60,6 @@ #define ____ } #endif -#ifdef DEBUG -#define debug1(msg) do { fprintf(stderr, "%s : " msg "\n", __func__); } while(0) -#define debug2(msg, arg1) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1); } while(0) -#define debug3(msg, arg1, arg2) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1, arg2); } while(0) -#define debug4(msg, arg1, arg2, arg3) do { fprintf(stderr, "%s : " msg "\n", __func__, arg1, arg2, arg3); } while(0) -#else -#define debug1(msg) -#define debug2(msg, arg1) -#define debug3(msg, arg1, arg2) -#define debug4(msg, arg1, arg2, arg3) -#endif - /** => zzip_disk_mmap * This function does primary initialization of a disk-buffer struct. * @@ -151,7 +142,7 @@ zzip_disk_munmap(ZZIP_DISK * disk) * to => zzip_disk_mmap for bringing it to main memory. If it can not * be => mmap(2)'ed then we slurp the whole file into a newly => malloc(2)'ed * memory block. Only if that fails too then we return null. Since handling - * of disk->buffer is ambigous it should not be snatched away please. + * of disk->buffer is ambiguous it should not be snatched away please. * * This function may return null on errors (errno). */ @@ -225,7 +216,7 @@ zzip_disk_buffer(void *buffer, size_t buflen) { * zip archive, including any malloc()ed blocks, sharedmem mappings * and it dumps the handle struct as well. * - * This function returns 0 on sucess (or whatever => munmap says). + * This function returns 0 on success (or whatever => munmap says). */ int zzip_disk_close(ZZIP_DISK * disk) @@ -241,55 +232,8 @@ zzip_disk_close(ZZIP_DISK * disk) } /* ====================================================================== */ - /* helper functions */ -#ifdef ZZIP_HAVE_STRNDUP -#define _zzip_strndup strndup -#else - -/* if your system does not have strndup: */ -zzip__new__ static char * -_zzip_strndup(char *p, size_t maxlen) -{ - if (! p) - return 0; - ___ zzip_byte_t *r = malloc(maxlen + 1); - if (! r) - return r; - strncpy(r, p, maxlen); - r[maxlen] = '\0'; - return r; - ____; -} -#endif - -#if defined ZZIP_HAVE_STRCASECMP || defined strcasecmp -#define _zzip_strcasecmp strcasecmp -#else - -/* if your system does not have strcasecmp: */ -static int -_zzip_strcasecmp(char *__zzip_restrict a, char *_zzip_restrict b) -{ - if (! a) - return (b) ? 1 : 0; - if (! b) - return -1; - while (1) - { - int v = tolower(*a) - tolower(*b); - if (v) - return v; - if (! *a) - return 1; - if (! *b) - return -1; - a++; - b++; - } -} -#endif /** helper functions for (mmapped) zip access api * @@ -453,16 +397,16 @@ zzip_disk_entry_strdup_comment(ZZIP_DISK * disk, struct zzip_disk_entry *entry) struct zzip_disk_entry * zzip_disk_findfirst(ZZIP_DISK * disk) { - debug1("findfirst"); + DBG1("findfirst"); if (! disk) { - debug1("non arg"); + DBG1("non arg"); errno = EINVAL; return 0; } if (disk->buffer > disk->endbuf - sizeof(struct zzip_disk_trailer)) { - debug1("not enough data for a disk trailer"); + DBG1("not enough data for a disk trailer"); errno = EBADMSG; return 0; } @@ -475,12 +419,12 @@ zzip_disk_findfirst(ZZIP_DISK * disk) struct zzip_disk_trailer *trailer = (struct zzip_disk_trailer *) p; zzip_size_t rootseek = zzip_disk_trailer_get_rootseek(trailer); root = disk->buffer + rootseek; - debug2("disk rootseek at %lli", (long long)rootseek); + DBG2("disk rootseek at %lli", (long long)rootseek); if (root > p) { /* the first disk_entry is after the disk_trailer? can't be! */ zzip_size_t rootsize = zzip_disk_trailer_get_rootsize(trailer); - debug2("have rootsize at %lli", (long long)rootsize); + DBG2("have rootsize at %lli", (long long)rootsize); if (disk->buffer + rootsize > p) continue; /* a common brokeness that can be fixed: we just assume the @@ -493,12 +437,12 @@ zzip_disk_findfirst(ZZIP_DISK * disk) (struct zzip_disk64_trailer *) p; if (sizeof(void *) < 8) { - debug1("disk64 trailer in non-largefile part"); + DBG1("disk64 trailer in non-largefile part"); errno = EFBIG; return 0; } zzip_size_t rootseek = zzip_disk64_trailer_get_rootseek(trailer); - debug2("disk64 rootseek at %lli", (long long)rootseek); + DBG2("disk64 rootseek at %lli", (long long)rootseek); root = disk->buffer + rootseek; if (root > p) continue; @@ -507,16 +451,16 @@ zzip_disk_findfirst(ZZIP_DISK * disk) continue; } - debug4("buffer %p root %p endbuf %p", disk->buffer, root, disk->endbuf); + DBG4("buffer %p root %p endbuf %p", disk->buffer, root, disk->endbuf); if (root < disk->buffer) { - debug1("root before buffer should be impossible"); + DBG1("root before buffer should be impossible"); errno = EBADMSG; return 0; } if (zzip_disk_entry_check_magic(root)) { - debug1("found the disk root"); + DBG2("found the disk root %p", root); return (struct zzip_disk_entry *) root; } } ____; @@ -630,7 +574,7 @@ zzip_disk_findmatch(ZZIP_DISK * disk, char *filespec, { compare = (zzip_fnmatch_fn_t) _zzip_fnmatch; if (disk->flags & ZZIP_DISK_FLAGS_MATCH_NOCASE) - flags |= _zzip_fnmatch_CASEFOLD; + flags |= _zzip_FNM_CASEFOLD; } for (; entry; entry = zzip_disk_findnext(disk, entry)) { @@ -682,7 +626,13 @@ zzip_disk_entry_fopen(ZZIP_DISK * disk, ZZIP_DISK_ENTRY * entry) file->avail = zzip_file_header_usize(header); if (! file->avail || zzip_file_header_data_stored(header)) - { file->stored = zzip_file_header_to_data (header); return file; } + { + file->stored = zzip_file_header_to_data (header); + DBG2("stored size %i", (int) file->avail); + if (file->stored + file->avail >= disk->endbuf) + goto error; + return file; + } file->stored = 0; file->zlib.opaque = 0; @@ -691,15 +641,20 @@ zzip_disk_entry_fopen(ZZIP_DISK * disk, ZZIP_DISK_ENTRY * entry) file->zlib.avail_in = zzip_file_header_csize(header); file->zlib.next_in = zzip_file_header_to_data(header); - if (! zzip_file_header_data_deflated(header) || - inflateInit2(&file->zlib, -MAX_WBITS) != Z_OK) - { - free (file); - errno = EBADMSG; - return 0; - } + DBG2("compressed size %i", (int) file->zlib.avail_in); + if (file->zlib.next_in + file->zlib.avail_in >= disk->endbuf) + goto error; + + if (! zzip_file_header_data_deflated(header)) + goto error; + if (inflateInit2(&file->zlib, -MAX_WBITS) != Z_OK) + goto error; return file; +error: + free (file); + errno = EBADMSG; + return 0; ____; } @@ -738,6 +693,12 @@ zzip_disk_fread(void *ptr, zzip_size_t sized, zzip_size_t nmemb, size = file->avail; if (file->stored) { + if (file->stored + size >= file->endbuf) + { + DBG1("try to read beyond end of file"); + return 0; /* ESPIPE */ + } + DBG3("copy stored %p %i", file->stored, (int)size); memcpy(ptr, file->stored, size); file->stored += size; file->avail -= size; diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/mmapped.h b/Build/source/libs/zziplib/zziplib-src/zzip/mmapped.h index 00e6c5537e7..652ad293233 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/mmapped.h +++ b/Build/source/libs/zziplib/zziplib-src/zzip/mmapped.h @@ -28,7 +28,7 @@ typedef struct zzip_disk ZZIP_DISK; /* we expose this structure so third party applications can augment * on them. The mmapped zip access usually just needs the two pointers - * specifying the mmapped area, whereever you have that from. + * specifying the mmapped area, wherever you have that from. */ struct zzip_disk { diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/write.c b/Build/source/libs/zziplib/zziplib-src/zzip/write.c index cc09c5b9e81..cfec8164931 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/write.c +++ b/Build/source/libs/zziplib/zziplib-src/zzip/write.c @@ -1,4 +1,3 @@ - /* * The write-support in zziplib is not a full-flegded interface to the * internals that zip file-header or zip archive an contain. It's @@ -6,7 +5,7 @@ * where time-stamps are rather unimportant. Here we can create an * archive with filenames and their data portions, possibly obfuscated. * - * DONT USE THIS + * DON'T USE THIS * * The write support is supposed to be added directly into the main * zziplib but it has not been implemented so far. It does however @@ -43,6 +42,7 @@ #include <zzip/format.h> #include <zzip/plugin.h> +#include <zzip/__mkdir.h> #include <zzip/__debug.h> #define ___ { @@ -71,12 +71,6 @@ # define S_IRWXO 00007 # endif -# ifdef ZZIP_HAVE_DIRECT_H -# define _mkdir(a,b) mkdir(a) -# else -# define _mkdir mkdir -# endif - /** create a new zip archive for writing * * This function will create a new zip archive. The returned parameter @@ -136,7 +130,7 @@ zzip_dir_creat_ext_io(zzip_char_t * name, int o_mode, /* not implemented - however, we respect that a null argument to * zzip_mkdir and zzip_creat works, so we silently still do the mkdir */ - if (! _mkdir(name, o_mode) || errno == EEXIST) + if (! _zzip_mkdir(name, o_mode) || errno == EEXIST) errno = EROFS; return 0; } else @@ -218,7 +212,7 @@ zzip_createdir(zzip_char_t * name, int o_mode) { if (o_mode & S_IWGRP) { - if (-1 == _mkdir(name, o_mode) && errno != EEXIST) /* fail */ + if (-1 == _zzip_mkdir(name, o_mode) && errno != EEXIST) /* fail */ return 0; return zzip_opendir(name); } else @@ -261,7 +255,7 @@ int zzip_file_mkdir(ZZIP_DIR * dir, zzip_char_t * name, int o_mode) { if (! dir) - return _mkdir(name, o_mode); + return _zzip_mkdir(name, o_mode); if (! _ZZIP_TRY) { /* not implemented */ diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/zip.c b/Build/source/libs/zziplib/zziplib-src/zzip/zip.c index fbca9951d17..d0b2d6e4196 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/zip.c +++ b/Build/source/libs/zziplib/zziplib-src/zzip/zip.c @@ -320,6 +320,12 @@ __zzip_fetch_disk_trailer(int fd, zzip_off_t filesize, # endif __fixup_rootseek(offset + tail - mapped, trailer); + /* + * "extract data from files archived in a single zip file." + * So the file offsets must be within the current ZIP archive! + */ + if (trailer->zz_rootseek >= filesize || (trailer->zz_rootseek + trailer->zz_rootsize) >= filesize) + return(ZZIP_CORRUPTED); { return(0); } } else if ((*tail == 'P') && end - tail >= @@ -338,6 +344,12 @@ __zzip_fetch_disk_trailer(int fd, zzip_off_t filesize, zzip_disk64_trailer_finalentries(orig); trailer->zz_rootseek = zzip_disk64_trailer_rootseek(orig); trailer->zz_rootsize = zzip_disk64_trailer_rootsize(orig); + /* + * "extract data from files archived in a single zip file." + * So the file offsets must be within the current ZIP archive! + */ + if (trailer->zz_rootseek >= filesize || (trailer->zz_rootseek + trailer->zz_rootsize) >= filesize) + return(ZZIP_CORRUPTED); { return(0); } # endif } @@ -630,7 +642,7 @@ zzip_dir_alloc(zzip_strings_t * fileext) * are helper functions used implicitly in other zzipcalls * e.g. => zzip_dir_close = zzip_close * - * returns zero on sucess + * returns zero on success * returns the refcount when files are attached. */ int diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/zzip-zlib-config.pc b/Build/source/libs/zziplib/zziplib-src/zzip/zzip-zlib-config.pc new file mode 100644 index 00000000000..39097d41dfa --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/zzip/zzip-zlib-config.pc @@ -0,0 +1,8 @@ +zlib_libs= -lz +zlib_cflags= + +Name: zzip-zlib-config +Version: 1.2.8 +Description: ZLib Config (for ZZipLib) +Libs: ${zlib_libs} +Cflags: ${zlib_cflags} diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/zzip.h b/Build/source/libs/zziplib/zziplib-src/zzip/zzip.h index 6f6788f7113..3941acc7011 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzip/zzip.h +++ b/Build/source/libs/zziplib/zziplib-src/zzip/zzip.h @@ -163,7 +163,7 @@ _zzip_export void zzip_seekdir(ZZIP_DIR * dir, zzip_off_t offset); /* - * 'opening', 'closing' and reading invidual files in zip archive. + * 'opening', 'closing' and reading individual files in zip archive. * zzip/file.c */ _zzip_export diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/zzipfseeko.pc b/Build/source/libs/zziplib/zziplib-src/zzip/zzipfseeko.pc new file mode 100644 index 00000000000..336240cc427 --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/zzip/zzipfseeko.pc @@ -0,0 +1,18 @@ +# generated by configure / remove this line to disable regeneration +prefix=/usr/local +exec_prefix=${prefix} +bindir=${exec_prefix}/bin +libdir=${exec_prefix}/lib64 +datarootdir=${prefix}/share +datadir=${datarootdir} +sysconfdir=${prefix}/etc +includedir=${prefix}/include +package=zzipfseeko +suffix= + +Name: zzipfseeko +Description: ZZipLib - libZ-based ZIP-access Library with an Easy-to-Use API +Version: 0.13.68 +Requires: zzip-zlib-config +Libs: -L${libdir} -lzzipfseeko +Cflags: -I${includedir} diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/zziplib.pc b/Build/source/libs/zziplib/zziplib-src/zzip/zziplib.pc new file mode 100644 index 00000000000..21eb50234af --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/zzip/zziplib.pc @@ -0,0 +1,18 @@ +# generated by configure / remove this line to disable regeneration +prefix=/usr/local +exec_prefix=${prefix} +bindir=${exec_prefix}/bin +libdir=${exec_prefix}/lib64 +datarootdir=${prefix}/share +datadir=${datarootdir} +sysconfdir=${prefix}/etc +includedir=${prefix}/include +package=zziplib +suffix= + +Name: zziplib +Description: ZZipLib - libZ-based ZIP-access Library with an Easy-to-Use API +Version: 0.13.68 +Requires: zzip-zlib-config +Libs: -L${libdir} -lzzip +Cflags: -I${includedir} diff --git a/Build/source/libs/zziplib/zziplib-src/zzip/zzipmmapped.pc b/Build/source/libs/zziplib/zziplib-src/zzip/zzipmmapped.pc new file mode 100644 index 00000000000..e4e99a086be --- /dev/null +++ b/Build/source/libs/zziplib/zziplib-src/zzip/zzipmmapped.pc @@ -0,0 +1,18 @@ +# generated by configure / remove this line to disable regeneration +prefix=/usr/local +exec_prefix=${prefix} +bindir=${exec_prefix}/bin +libdir=${exec_prefix}/lib64 +datarootdir=${prefix}/share +datadir=${datarootdir} +sysconfdir=${prefix}/etc +includedir=${prefix}/include +package=zzipmmapped +suffix= + +Name: zzipmmapped +Description: ZZipLib - libZ-based ZIP-access Library with an Easy-to-Use API +Version: 0.13.68 +Requires: zzip-zlib-config +Libs: -L${libdir} -lzzipmmapped +Cflags: -I${includedir} diff --git a/Build/source/libs/zziplib/zziplib-src/zziplib.spec b/Build/source/libs/zziplib/zziplib-src/zziplib.spec index e40f2c56ef0..465b2bc9242 100644 --- a/Build/source/libs/zziplib/zziplib-src/zziplib.spec +++ b/Build/source/libs/zziplib/zziplib-src/zziplib.spec @@ -1,11 +1,11 @@ # norootforbuild Summary: ZZipLib - libZ-based ZIP-access Library with an Easy-to-Use API Name: zziplib -Version: 0.13.65 +Version: 0.13.68 Release: 1 License: LGPLv2.1+ Group: System/Libraries -URL: http://zziplib.sf.net +URL: https://github.com/gdraheim/zziplib Vendor: Guido Draheim <guidod@gmx.de> Source0: https://github.com/gdraheim/zziplib/archive/v%{version}.tar.gz BuildRoot: /var/tmp/%{name}-%{version}-%{release} diff --git a/Build/source/libs/zziplib/zziplib-src/zzipwrap/zzipwrap.pc b/Build/source/libs/zziplib/zziplib-src/zzipwrap/zzipwrap.pc index 281188693de..167179a7ffd 100644 --- a/Build/source/libs/zziplib/zziplib-src/zzipwrap/zzipwrap.pc +++ b/Build/source/libs/zziplib/zziplib-src/zzipwrap/zzipwrap.pc @@ -1,9 +1,9 @@ prefix=/usr/local -libdir=/usr/local/lib +libdir=/usr/local/lib64 includedir=/usr/local/include Name: zzipwrap -Version: 0.13.24 +Version: 0.13.68 Description: Callback Wrappers for ZZipLib Requires: zziplib Libs: -L${libdir} -lzzipwrap |