hrev48851 adds 1 changeset to branch 'master' old head: 1f68e420ccdd1ce281206fac74a3b5eea1cbaae8 new head: 22d29642fb6cd2efd7a983b98c265ccce4033035 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=22d29642fb6c+%5E1f68e420ccdd ---------------------------------------------------------------------------- 22d29642fb6c: Add packages for zip and use them. * remove zip Jamfile from the build and from the tree * clean up image and package definitions. * added zip in regular builds. [ Jérôme Duval <jerome.duval@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev48851 Commit: 22d29642fb6cd2efd7a983b98c265ccce4033035 URL: http://cgit.haiku-os.org/haiku/commit/?id=22d29642fb6c Author: Jérôme Duval <jerome.duval@xxxxxxxxx> Date: Mon Mar 2 20:27:26 2015 UTC ---------------------------------------------------------------------------- 50 files changed, 8 insertions(+), 17477 deletions(-) Jamfile | 2 +- build/jam/images/definitions/minimum | 2 +- build/jam/repositories/HaikuPorts/x86 | 2 + build/jam/repositories/HaikuPorts/x86_64 | 2 + build/jam/repositories/HaikuPorts/x86_gcc2 | 2 + src/bin/Jamfile | 1 - src/bin/zip/Jamfile | 56 - src/bin/zip/LICENSE | 49 - src/bin/zip/api.c | 494 ----- src/bin/zip/api.h | 152 -- src/bin/zip/beos.c | 959 ---------- src/bin/zip/beos/osdep.h | 59 - src/bin/zip/beos/zipup.h | 19 - src/bin/zip/beos_.c | 2 - src/bin/zip/crc32.c | 64 - src/bin/zip/crc_i386.S | 232 --- src/bin/zip/crctab.c | 227 --- src/bin/zip/crypt.c | 598 ------ src/bin/zip/crypt.h | 178 -- src/bin/zip/crypt_.c | 2 - src/bin/zip/deflate.c | 908 --------- src/bin/zip/ebcdic.h | 284 --- src/bin/zip/fileio.c | 1045 ---------- src/bin/zip/fileio_.c | 2 - src/bin/zip/globals.c | 97 - src/bin/zip/match.S | 407 ---- src/bin/zip/mktime.c | 257 --- src/bin/zip/revision.h | 122 -- src/bin/zip/tailor.h | 499 ----- src/bin/zip/trees.c | 1458 -------------- src/bin/zip/ttyio.c | 700 ------- src/bin/zip/ttyio.h | 227 --- src/bin/zip/util.c | 781 -------- src/bin/zip/util_.c | 2 - src/bin/zip/zip.c | 2434 ------------------------ src/bin/zip/zip.h | 568 ------ src/bin/zip/zip.rdef | 11 - src/bin/zip/zipcloak.c | 430 ----- src/bin/zip/ziperr.h | 67 - src/bin/zip/zipfile.c | 1509 --------------- src/bin/zip/zipfile_.c | 2 - src/bin/zip/zipnote.c | 526 ----- src/bin/zip/zipsplit.c | 828 -------- src/bin/zip/zipup.c | 1195 ------------ src/data/package_infos/arm/haiku | 4 - src/data/package_infos/m68k/haiku | 4 - src/data/package_infos/ppc/haiku | 4 - src/data/package_infos/x86/haiku | 4 - src/data/package_infos/x86_64/haiku | 4 - src/data/package_infos/x86_gcc2/haiku | 4 - ---------------------------------------------------------------------------- diff --git a/Jamfile b/Jamfile index 5a05b78..f32d083 100644 --- a/Jamfile +++ b/Jamfile @@ -29,7 +29,7 @@ AddHaikuImagePackages [ FFilterByBuildFeatures bzip2 ctags ffmpeg findutils gawk glu grep gutenprint jasper jpeg less libicns libpng libpng16 libwebp mesa mesa_devel mesa_swrast sed sharutils - tar tiff unzip wget which + tar tiff unzip wget which zip }@ ] ; if $(HAIKU_PACKAGING_ARCHS[1]) != x86_gcc2 { diff --git a/build/jam/images/definitions/minimum b/build/jam/images/definitions/minimum index 365dfed..f6c25c8 100644 --- a/build/jam/images/definitions/minimum +++ b/build/jam/images/definitions/minimum @@ -34,7 +34,7 @@ SYSTEM_BIN = [ FFilterByBuildFeatures uptime urlwrapper useradd userdel version vmstat waitfor watch writembr@x86,x86_64 xres - zdiff zforce zgrep zip zipcloak zipnote zipsplit zmore znew + zdiff zforce zgrep zmore znew ] ; SYSTEM_APPS = [ FFilterByBuildFeatures diff --git a/build/jam/repositories/HaikuPorts/x86 b/build/jam/repositories/HaikuPorts/x86 index 404c0ed..e02f4ad 100644 --- a/build/jam/repositories/HaikuPorts/x86 +++ b/build/jam/repositories/HaikuPorts/x86 @@ -206,6 +206,7 @@ RemotePackageRepository HaikuPorts xml_parser-2.36-1 xz_utils-5.0.4-1 yasm-1.2.0-3 + zip-3.0-1 zlib-1.2.8-4 zlib_devel-1.2.8-4 @@ -408,6 +409,7 @@ RemotePackageRepository HaikuPorts yasm xml_parser xz_utils + zip zlib : # debuginfo packages diff --git a/build/jam/repositories/HaikuPorts/x86_64 b/build/jam/repositories/HaikuPorts/x86_64 index 2eb8ed1..a766662 100644 --- a/build/jam/repositories/HaikuPorts/x86_64 +++ b/build/jam/repositories/HaikuPorts/x86_64 @@ -218,6 +218,7 @@ RemotePackageRepository HaikuPorts xz_utils-5.0.6-1 xz_utils_devel-5.0.6-1 yasm-1.2.0-3 + zip-3.0-1 zlib-1.2.8-4 zlib_devel-1.2.8-4 @@ -348,6 +349,7 @@ RemotePackageRepository HaikuPorts yasm xml_parser xz_utils + zip zlib : # debuginfo packages diff --git a/build/jam/repositories/HaikuPorts/x86_gcc2 b/build/jam/repositories/HaikuPorts/x86_gcc2 index 2e727bb..99da9db 100644 --- a/build/jam/repositories/HaikuPorts/x86_gcc2 +++ b/build/jam/repositories/HaikuPorts/x86_gcc2 @@ -391,6 +391,7 @@ RemotePackageRepository HaikuPorts yab-1.7.02-2 yab_ide-2.2.2-1 yasm-1.2.0-3 + zip-3.0-1 zlib-1.2.8-4 zlib_devel-1.2.8-4 zsh-5.0.7-1 @@ -1032,6 +1033,7 @@ RemotePackageRepository HaikuPorts xproto xrick xz_utils_x86 + zip zlib zsh : diff --git a/src/bin/Jamfile b/src/bin/Jamfile index 5ea4cf5..e248b61 100644 --- a/src/bin/Jamfile +++ b/src/bin/Jamfile @@ -297,7 +297,6 @@ SubInclude HAIKU_TOP src bin debug ; SubInclude HAIKU_TOP src bin network ; # Compression command line tools -SubInclude HAIKU_TOP src bin zip ; SubInclude HAIKU_TOP src bin gzip ; # Other stuff diff --git a/src/bin/zip/Jamfile b/src/bin/zip/Jamfile deleted file mode 100644 index deb1c92..0000000 --- a/src/bin/zip/Jamfile +++ /dev/null @@ -1,56 +0,0 @@ -SubDir HAIKU_TOP src bin zip ; - -local zip_rsrc = [ FGristFiles zip.rsrc ] ; -ResComp $(zip_rsrc) : [ FGristFiles zip.rdef ] ; - -local common_files = - globals.c - ; - -local common_files2 = - crctab.c - ttyio.c - ; - -local util_files = - beos_.c - fileio_.c - util_.c - zipfile_.c - ; - -Objects $(common_files) $(common_files2) $(util_files) ; - -BinCommand zip : - [ FGristFiles $(common_files:S=.o) $(common_files2:S=.o) ] - beos.c - crc32.c - crypt.c - deflate.c - fileio.c - trees.c - util.c - zip.c - zipfile.c - zipup.c - : be : zip.rsrc -; - -BinCommand zipcloak : - crypt_.c - zipcloak.c - [ FGristFiles $(common_files:S=.o) $(common_files2:S=.o) $(util_files:S=.o) ] - : be : zip.rsrc -; - -BinCommand zipnote : - zipnote.c - [ FGristFiles $(common_files:S=.o) $(util_files:S=.o) ] - : be : zip.rsrc -; - -BinCommand zipsplit : - zipsplit.c - [ FGristFiles $(common_files:S=.o) $(util_files:S=.o) ] - : be : zip.rsrc -; diff --git a/src/bin/zip/LICENSE b/src/bin/zip/LICENSE deleted file mode 100644 index f71e7e3..0000000 --- a/src/bin/zip/LICENSE +++ /dev/null @@ -1,49 +0,0 @@ -This is version 1999-Oct-05 of the Info-ZIP copyright and license. -The definitive version of this document should be available at -ftp://ftp.cdrom.com/pub/infozip/license.html indefinitely. - - -Copyright (c) 1990-1999 Info-ZIP. All rights reserved. - -For the purposes of this copyright and license, "Info-ZIP" is defined as -the following set of individuals: - - Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois, - Jean-loup Gailly, Hunter Goatley, Ian Gorman, Chris Herborth, Dirk Haase, - Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz, David Kirschbaum, - Johnny Lee, Onno van der Linden, Igor Mandrichenko, Steve P. Miller, - Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs, Kai Uwe Rommel, - Steve Salisbury, Dave Smith, Christian Spieler, Antoine Verheijen, - Paul von Behren, Rich Wales, Mike White - -This software is provided "as is," without warranty of any kind, express -or implied. In no event shall Info-ZIP or its contributors be held liable -for any direct, indirect, incidental, special or consequential damages -arising out of the use of or inability to use this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - - 1. Redistributions of source code must retain the above copyright notice, - definition, disclaimer, and this list of conditions. - - 2. Redistributions in binary form must reproduce the above copyright - notice, definition, disclaimer, and this list of conditions in - documentation and/or other materials provided with the distribution. - - 3. Altered versions--including, but not limited to, ports to new operating - systems, existing ports with new graphical interfaces, and dynamic, - shared, or static library versions--must be plainly marked as such - and must not be misrepresented as being the original source. Such - altered versions also must not be misrepresented as being Info-ZIP - releases--including, but not limited to, labeling of the altered - versions with the names "Info-ZIP" (or any variation thereof, including, - but not limited to, different capitalizations), "Pocket UnZip," "WiZ" - or "MacZip" without the explicit permission of Info-ZIP. Such altered - versions are further prohibited from misrepresentative use of the - Zip-Bugs or Info-ZIP e-mail addresses or of the Info-ZIP URL(s). - - 4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip," - "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its own source and - binary releases. diff --git a/src/bin/zip/api.c b/src/bin/zip/api.c deleted file mode 100644 index fc35b60..0000000 --- a/src/bin/zip/api.c +++ /dev/null @@ -1,494 +0,0 @@ -/* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. - - See the accompanying file LICENSE, version 2004-May-22 or later - (the contents of which are also included in zip.h) for terms of use. - If, for some reason, both of these files are missing, the Info-ZIP license - also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html -*/ -/*--------------------------------------------------------------------------- - - api.c - - This module supplies a Zip dll engine for use directly from C/C++ - programs. - - The entry points are: - - ZpVer *ZpVersion(void); - int EXPENTRY ZpInit(LPZIPUSERFUNCTIONS lpZipUserFunc); - BOOL EXPENTRY ZpSetOptions(LPZPOPT Opts); - ZPOPT EXPENTRY ZpGetOptions(void); - int EXPENTRY ZpArchive(ZCL C); - - This module is currently only used by the Windows dll, and is not used at - all by any of the other platforms, although it should be easy enough to - implement this on most platforms. - - ---------------------------------------------------------------------------*/ -#define __API_C - -#ifdef WINDLL -# include <windows.h> -# include "windll/windll.h" -#endif - -#ifdef OS2 -# define INCL_DOSMEMMGR -# include <os2.h> -#endif - -#ifdef __BORLANDC__ -#include <dir.h> -#endif -#include <direct.h> -#include <ctype.h> -#include "api.h" /* this includes zip.h */ -#include "crypt.h" -#include "revision.h" -#ifdef USE_ZLIB -# include "zlib.h" -#endif - - -DLLPRNT *lpZipPrint; -DLLPASSWORD *lpZipPassword; -extern DLLCOMMENT *lpComment; -ZIPUSERFUNCTIONS ZipUserFunctions, far * lpZipUserFunctions; - -int ZipRet; - -/* ------------------------------------------------- */ -/* Visual Basic converts strings from VB native Unicode to - byte strings when passing to dlls. It seems that any - strings pointed to in structures are converted and the - conversion passed to the dll, but when the dll call - returns the converted strings are garbage collected - unless the debugger prevents it. This leaves the - pointers going to memory that may have been reused - by the time the following dll call is made. This - affects the strings in the Options stucture. - - The following kluge stores the strings locally in - the dll between calls. A better fix is to redesign - the api interface so that strings in structures are - removed or are passed in the same call they are used. EG - -/* oversized to be sure */ -#define MAX_ZIP_DATE_LEN 50 -#define MAX_ZIP_DIR_PATH_LEN 4098 - -char szDate[MAX_ZIP_DATE_LEN + 1]; -char szRootDir[MAX_ZIP_DIR_PATH_LEN + 1]; -char szTempDir[MAX_ZIP_DIR_PATH_LEN + 1]; -/* ------------------------------------------------- */ - -/* Local forward declarations */ -extern int zipmain OF((int, char **)); -int AllocMemory(int, char *, char *); - -ZPOPT Options; -char **argVee; -int argCee; - -/*--------------------------------------------------------------------------- - Local functions - ---------------------------------------------------------------------------*/ - -int AllocMemory(int i, char *cmd, char *str) -{ -int j; -if ((argVee[i] = (char *) malloc( sizeof(char) * strlen(cmd)+1 )) == NULL) - { - for (j = 0; j < i; j++) - { - free (argVee[j]); - argVee[j] = NULL; - } - free(argVee); - fprintf(stdout, "Unable to allocate memory in zip library at %s\n", str); - return ZE_MEM; - } -strcpy( argVee[i], cmd ); -return ZE_OK; -} - -/*--------------------------------------------------------------------------- - Documented API entry points - ---------------------------------------------------------------------------*/ - -int EXPENTRY ZpInit(LPZIPUSERFUNCTIONS lpZipUserFunc) -{ -ZipUserFunctions = *lpZipUserFunc; -lpZipUserFunctions = &ZipUserFunctions; - -if (!lpZipUserFunctions->print || - !lpZipUserFunctions->comment) - return FALSE; - -return TRUE; -} - -BOOL EXPENTRY ZpSetOptions(LPZPOPT Opts) -{ -/* copy the structure including pointers to strings */ -Options = *Opts; - -/* fix for calling dll from VB - 2002-11-25 */ -/* make copies of strings in structure if not NULL passed for empty string */ -if (Options.Date) { - szDate[0] = '\0'; - strncat(szDate, Options.Date, MAX_ZIP_DATE_LEN); - Options.Date = szDate; -} -if (Options.szRootDir) { - szRootDir[0] = '\0'; - strncat(szRootDir, Options.szRootDir, MAX_ZIP_DIR_PATH_LEN); - Options.szRootDir = szRootDir; -} -if (Options.szTempDir) { - szTempDir[0] = '\0'; - strncat(szTempDir, Options.szTempDir, MAX_ZIP_DIR_PATH_LEN); - Options.szTempDir = szTempDir; -} - -return TRUE; -} - -ZPOPT EXPENTRY ZpGetOptions(void) -{ -#if CRYPT -Options.fEncryption = TRUE; -#else -Options.fEncryption = FALSE; -#endif -return Options; -} - -int EXPENTRY ZpArchive(ZCL C) -/* Add, update, freshen, or delete zip entries in a zip file. See the - command help in help() zip.c */ -{ -int i, k, j, m; -char szOrigDir[PATH_MAX]; - -argCee = 0; -/* malloc additional 26 to allow for additional command line arguments */ -if ((argVee = (char **)malloc((C.argc+26)*sizeof(char *))) == NULL) - { - fprintf(stdout, "Unable to allocate memory in zip dll\n"); - return ZE_MEM; - } -if ((argVee[argCee] = (char *) malloc( sizeof(char) * strlen("wiz.exe")+1 )) == NULL) - { - free(argVee); - fprintf(stdout, "Unable to allocate memory in zip dll\n"); - return ZE_MEM; - } -strcpy( argVee[argCee], "wiz.exe" ); -argCee++; - -/* Set compression level efficacy -0...-9 */ -if (AllocMemory(argCee, "-0", "Compression") != ZE_OK) - return ZE_MEM; -argVee[argCee][1] = Options.fLevel; -argCee++; - -if (Options.fOffsets) /* Update offsets for SFX prefix */ - { - if (AllocMemory(argCee, "-A", "Offsets") != ZE_OK) - return ZE_MEM; - argCee++; - } -if (Options.fDeleteEntries) /* Delete files from zip file -d */ - { - if (AllocMemory(argCee, "-d", "Delete") != ZE_OK) - return ZE_MEM; - argCee++; - } -if (Options.fNoDirEntries) /* Do not add directory entries -D */ - { - if (AllocMemory(argCee, "-D", "No Dir Entries") != ZE_OK) - return ZE_MEM; - argCee++; - } -if (Options.fFreshen) /* Freshen zip file--overwrite only -f */ - { - if (AllocMemory(argCee, "-f", "Freshen") != ZE_OK) - return ZE_MEM; - argCee++; - } -if (Options.fRepair) /* Fix archive -F or -FF */ - { - if (Options.fRepair == 1) - { - if (AllocMemory(argCee, "-F", "Repair") != ZE_OK) - return ZE_MEM; - } - else - { - if (AllocMemory(argCee, "-FF", "Repair") != ZE_OK) - return ZE_MEM; - } - argCee++; - } -if (Options.fGrow) /* Allow appending to a zip file -g */ - { - if (AllocMemory(argCee, "-g", "Appending") != ZE_OK) - return ZE_MEM; - argCee++; - } -if (Options.fJunkDir) /* Junk directory names -j */ - { - if (AllocMemory(argCee, "-j", "Junk Dir Names") != ZE_OK) - return ZE_MEM; - argCee++; - } -if (Options.fEncrypt) /* encrypt -e */ - { - if (AllocMemory(argCee, "-e", "Encrypt") != ZE_OK) - return ZE_MEM; - argCee++; - } -if (Options.fJunkSFX) /* Junk sfx prefix */ - { - if (AllocMemory(argCee, "-J", "Junk SFX") != ZE_OK) - return ZE_MEM; - argCee++; - } - -if (Options.fForce) /* Make entries using DOS names (k for Katz) -k */ - { - if (AllocMemory(argCee, "-k", "Force DOS") != ZE_OK) - return ZE_MEM; - argCee++; - } - -if (Options.fLF_CRLF) /* Translate LF_CRLF -l */ - { - if (AllocMemory(argCee, "-l", "LF-CRLF") != ZE_OK) - return ZE_MEM; - argCee++; - } -if (Options.fCRLF_LF) /* Translate CR/LF to LF -ll */ - { - if (AllocMemory(argCee, "-ll", "CRLF-LF") != ZE_OK) - return ZE_MEM; - argCee++; - } -if (Options.fMove) /* Delete files added to or updated in zip file -m */ - { - if (AllocMemory(argCee, "-m", "Move") != ZE_OK) - return ZE_MEM; - argCee++; - } - -if (Options.fLatestTime) /* Set zip file time to time of latest file in it -o */ - { - if (AllocMemory(argCee, "-o", "Time") != ZE_OK) - return ZE_MEM; - argCee++; - } - -if (Options.fComment) /* Add archive comment "-z" */ - { - if (AllocMemory(argCee, "-z", "Comment") != ZE_OK) - return ZE_MEM; - argCee++; - } - -if (Options.fQuiet) /* quiet operation -q */ - { - if (AllocMemory(argCee, "-q", "Quiet") != ZE_OK) - return ZE_MEM; - argCee++; - } -if (Options.fSystem) /* include system and hidden files -S */ - { - if (AllocMemory(argCee, "-S", "System") != ZE_OK) - return ZE_MEM; - argCee++; - } -if (Options.fExcludeDate) /* Exclude files newer than specified date -tt */ - { - if ((Options.Date != NULL) && (Options.Date[0] != '\0')) - { - if (AllocMemory(argCee, "-tt", "Date") != ZE_OK) - return ZE_MEM; - argCee++; - if (AllocMemory(argCee, Options.Date, "Date") != ZE_OK) - return ZE_MEM; - argCee++; - } - } - -if (Options.fIncludeDate) /* include files newer than specified date -t */ - { - if ((Options.Date != NULL) && (Options.Date[0] != '\0')) - { - if (AllocMemory(argCee, "-t", "Date") != ZE_OK) - return ZE_MEM; - argCee++; - if (AllocMemory(argCee, Options.Date, "Date") != ZE_OK) - return ZE_MEM; - argCee++; - } - } - -if (Options.fUpdate) /* Update zip file--overwrite only if newer -u */ - { - if (AllocMemory(argCee, "-u", "Update") != ZE_OK) - return ZE_MEM; - argCee++; - } -if (Options.fVerbose) /* Mention oddities in zip file structure -v */ - { - if (AllocMemory(argCee, "-v", "Verbose") != ZE_OK) - return ZE_MEM; - argCee++; - } -if (Options.fVolume) /* Include volume label -$ */ - { - if (AllocMemory(argCee, "-$", "Volume") != ZE_OK) - return ZE_MEM; - argCee++; - } -#ifdef NTSD_EAS /* was WIN32 1/22/2005 EG */ -if (Options.fPrivilege) /* Use privileges -! */ - { - if (AllocMemory(argCee, "-!", "Privileges") != ZE_OK) - return ZE_MEM; - argCee++; - } -#endif -if (Options.fExtra) /* Exclude extra attributes -X */ - { - if (AllocMemory(argCee, "-X", "Extra") != ZE_OK) - return ZE_MEM; - argCee++; - } -if ((Options.szTempDir != NULL) && (Options.szTempDir[0] != '\0') - && Options.fTemp) /* Use temporary directory -b */ - { - if (AllocMemory(argCee, "-b", "Temp dir switch command") != ZE_OK) - return ZE_MEM; - argCee++; - if (AllocMemory(argCee, Options.szTempDir, "Temporary directory") != ZE_OK) - return ZE_MEM; - argCee++; - } -/* -r and -R moved down here to avoid VB problem 1/31/2005 EG */ -if (Options.fRecurse == 1) /* recurse into subdirectories -r */ - { - if (AllocMemory(argCee, "-r", "Recurse -r") != ZE_OK) - return ZE_MEM; - argCee++; - } -else if (Options.fRecurse == 2) /* recurse into subdirectories -R */ - { - if (AllocMemory(argCee, "-R", "Recurse -R") != ZE_OK) - return ZE_MEM; - argCee++; - } -if (AllocMemory(argCee, C.lpszZipFN, "Zip file name") != ZE_OK) - return ZE_MEM; -argCee++; - -getcwd(szOrigDir, PATH_MAX); /* Save current drive and directory */ - -if ((Options.szRootDir != NULL) && (Options.szRootDir[0] != '\0')) - { - chdir(Options.szRootDir); -#ifdef __BORLANDC__ - setdisk(toupper(Options.szRootDir[0]) - 'A'); -#endif - lstrcat(Options.szRootDir, "\\"); /* append trailing \\ */ - if (C.FNV != NULL) - { - for (k = 0; k < C.argc; k++) - { - if (AllocMemory(argCee, C.FNV[k], "Making argv") != ZE_OK) - return ZE_MEM; - if ((strncmp(Options.szRootDir, C.FNV[k], lstrlen(Options.szRootDir))) == 0) - { - m = 0; - for (j = lstrlen(Options.szRootDir); j < lstrlen(C.FNV[k]); j++) - argVee[argCee][m++] = C.FNV[k][j]; - argVee[argCee][m] = '\0'; - } - argCee++; - } - } - } -else - if (C.FNV != NULL) - for (k = 0; k < C.argc; k++) - { - if (AllocMemory(argCee, C.FNV[k], "Making argv") != ZE_OK) - return ZE_MEM; - argCee++; - } - -argVee[argCee] = NULL; - -ZipRet = zipmain(argCee, argVee); - -chdir(szOrigDir); -#ifdef __BORLANDC__ -setdisk(toupper(szOrigDir[0]) - 'A'); -#endif - -/* Free the arguments in the array */ -for (i = 0; i < argCee; i++) - { - free (argVee[i]); - argVee[i] = NULL; - } -/* Then free the array itself */ -free(argVee); - -return ZipRet; -} - -#if CRYPT -int encr_passwd(int modeflag, char *pwbuf, int size, const char *zfn) -{ -return (*lpZipUserFunctions->password)(pwbuf, size, ((modeflag == ZP_PW_VERIFY) ? - "Verify password: " : "Enter password: "), - (char *)zfn); -} -#endif /* CRYPT */ - -void EXPENTRY ZpVersion(ZpVer far * p) /* should be pointer to const struct */ -{ - p->structlen = ZPVER_LEN; - -#ifdef BETA - p->flag = 1; -#else - p->flag = 0; -#endif - lstrcpy(p->betalevel, Z_BETALEVEL); - lstrcpy(p->date, REVDATE); - -#ifdef ZLIB_VERSION - lstrcpy(p->zlib_version, ZLIB_VERSION); - p->flag |= 2; -#else - p->zlib_version[0] = '\0'; -#endif - - p->zip.major = Z_MAJORVER; - p->zip.minor = Z_MINORVER; - p->zip.patchlevel = Z_PATCHLEVEL; - - - p->os2dll.major = D2_MAJORVER; - p->os2dll.minor = D2_MINORVER; - p->os2dll.patchlevel = D2_PATCHLEVEL; - - - p->windll.major = DW_MAJORVER; - p->windll.minor = DW_MINORVER; - p->windll.patchlevel = DW_PATCHLEVEL; -} diff --git a/src/bin/zip/api.h b/src/bin/zip/api.h deleted file mode 100644 index c2c0e8c..0000000 --- a/src/bin/zip/api.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. - - See the accompanying file LICENSE, version 2004-May-22 or later - (the contents of which are also included in zip.h) for terms of use. - If, for some reason, both of these files are missing, the Info-ZIP license - also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html -*/ -/* Only the Windows DLL is currently supported */ -#ifndef _ZIPAPI_H -#define _ZIPAPI_H - -#include "zip.h" - -#ifdef WIN32 -# ifndef PATH_MAX -# define PATH_MAX 260 -# endif -#else -# ifndef PATH_MAX -# define PATH_MAX 128 -# endif -#endif - -#if defined(WINDLL) || defined(API) -#include <windows.h> -/* Porting definations between Win 3.1x and Win32 */ -#ifdef WIN32 -# define far -# define _far -# define __far -# define near -# define _near -# define __near -#endif - -/*--------------------------------------------------------------------------- - Prototypes for public Zip API (DLL) functions. - ---------------------------------------------------------------------------*/ - -#define ZPVER_LEN sizeof(ZpVer) -/* These defines are set to zero for now, until OS/2 comes out - with a dll. - */ -#define D2_MAJORVER 0 -#define D2_MINORVER 0 -#define D2_PATCHLEVEL 0 - -/* intended to be a private struct: */ -typedef struct _zip_ver { - uch major; /* e.g., integer 5 */ - uch minor; /* e.g., 2 */ - uch patchlevel; /* e.g., 0 */ - uch not_used; -} _zip_version_type; - -typedef struct _ZpVer { - ulg structlen; /* length of the struct being passed */ - ulg flag; /* bit 0: is_beta bit 1: uses_zlib */ - char betalevel[10]; /* e.g., "g BETA" or "" */ - char date[20]; /* e.g., "4 Sep 95" (beta) or "4 September 1995" */ - char zlib_version[10]; /* e.g., "0.95" or NULL */ - _zip_version_type zip; - _zip_version_type os2dll; - _zip_version_type windll; -} ZpVer; - -# ifndef EXPENTRY -# define EXPENTRY WINAPI -# endif - -#ifndef DEFINED_ONCE -#define DEFINED_ONCE -typedef int (WINAPI DLLPRNT) (LPSTR, unsigned long); -typedef int (WINAPI DLLPASSWORD) (LPSTR, int, LPCSTR, LPCSTR); -typedef int (WINAPI DLLSERVICE) (LPCSTR, unsigned long); -#endif -typedef int (WINAPI DLLCOMMENT)(LPSTR); - -/* Structures */ - -typedef struct { /* zip options */ -LPSTR Date; /* Date to include after */ -LPSTR szRootDir; /* Directory to use as base for zipping */ -LPSTR szTempDir; /* Temporary directory used during zipping */ -BOOL fTemp; /* Use temporary directory '-b' during zipping */ -BOOL fSuffix; /* include suffixes (not implemented) */ -BOOL fEncrypt; /* encrypt files */ -BOOL fSystem; /* include system and hidden files */ -BOOL fVolume; /* Include volume label */ -BOOL fExtra; /* Exclude extra attributes */ -BOOL fNoDirEntries; /* Do not add directory entries */ -BOOL fExcludeDate; /* Exclude files newer than specified date */ -BOOL fIncludeDate; /* Include only files newer than specified date */ -BOOL fVerbose; /* Mention oddities in zip file structure */ -BOOL fQuiet; /* Quiet operation */ -BOOL fCRLF_LF; /* Translate CR/LF to LF */ -BOOL fLF_CRLF; /* Translate LF to CR/LF */ -BOOL fJunkDir; /* Junk directory names */ -BOOL fGrow; /* Allow appending to a zip file */ -BOOL fForce; /* Make entries using DOS names (k for Katz) */ -BOOL fMove; /* Delete files added or updated in zip file */ -BOOL fDeleteEntries; /* Delete files from zip file */ -BOOL fUpdate; /* Update zip file--overwrite only if newer */ -BOOL fFreshen; /* Freshen zip file--overwrite only */ -BOOL fJunkSFX; /* Junk SFX prefix */ -BOOL fLatestTime; /* Set zip file time to time of latest file in it */ -BOOL fComment; /* Put comment in zip file */ -BOOL fOffsets; /* Update archive offsets for SFX files */ -BOOL fPrivilege; /* Use privileges (WIN32 only) */ -BOOL fEncryption; /* TRUE if encryption supported, else FALSE. - this is a read only flag */ -int fRecurse; /* Recurse into subdirectories. 1 => -r, 2 => -R */ -int fRepair; /* Repair archive. 1 => -F, 2 => -FF */ -char fLevel; /* Compression level (0 - 9) */ -} ZPOPT, _far *LPZPOPT; - -typedef struct { -int argc; /* Count of files to zip */ -LPSTR lpszZipFN; /* name of archive to create/update */ -char **FNV; /* array of file names to zip up */ -} ZCL, _far *LPZCL; - -typedef struct { -DLLPRNT *print; -DLLCOMMENT *comment; -DLLPASSWORD *password; -DLLSERVICE *ServiceApplication; -} ZIPUSERFUNCTIONS, far * LPZIPUSERFUNCTIONS; - -extern LPZIPUSERFUNCTIONS lpZipUserFunctions; - -void EXPENTRY ZpVersion(ZpVer far *); -int EXPENTRY ZpInit(LPZIPUSERFUNCTIONS lpZipUserFunc); -BOOL EXPENTRY ZpSetOptions(LPZPOPT Opts); -ZPOPT EXPENTRY ZpGetOptions(void); -int EXPENTRY ZpArchive(ZCL C); - -#if defined(ZIPLIB) || defined(COM_OBJECT) -# define ydays zp_ydays -#endif - - - -/* Functions not yet supported */ -#if 0 -int EXPENTRY ZpMain (int argc, char **argv); -int EXPENTRY ZpAltMain (int argc, char **argv, ZpInit *init); -#endif -#endif /* WINDLL? || API? */ - -#endif /* _ZIPAPI_H */ diff --git a/src/bin/zip/beos.c b/src/bin/zip/beos.c deleted file mode 100644 index f4b3b01..0000000 --- a/src/bin/zip/beos.c +++ /dev/null @@ -1,959 +0,0 @@ -/* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. - - See the accompanying file LICENSE, version 2004-May-22 or later - (the contents of which are also included in zip.h) for terms of use. - If, for some reason, all these files are missing, the Info-ZIP license - also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html -*/ -/* - - This BeOS-specific file is based on unix.c in the unix directory; changes - by Chris Herborth (chrish@xxxxxxxxx). - -*/ - -#include <OS.h> - -#include "zip.h" - -#ifndef UTIL /* the companion #endif is a bit of ways down ... */ - -#include <time.h> -#include <dirent.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> - -#include <dirent.h> - -#include <kernel/fs_attr.h> -#include <storage/Mime.h> -#include <support/ByteOrder.h> - - -#define PAD 0 -#define PATH_END '/' - -/* Library functions not in (most) header files */ - -#ifdef _POSIX_VERSION -# include <utime.h> -#else - int utime OF((char *, time_t *)); -#endif - -#if !defined(__BEOS__) && !defined(__HAIKU__) -# define open(path, openMode) _kern_open(-1, (path), (openMode), 0) - extern int _kern_open(int fd, const char *path, int openMode, int perms); -#endif - -extern char *label; -local ulg label_time = 0; -local ulg label_mode = 0; -local time_t label_utim = 0; - -/* Local functions */ -local char *readd OF((DIR *)); -local int get_attr_dir( const char *, char **, off_t * ); -local int add_UT_ef( struct zlist far * ); -local int add_Ux_ef( struct zlist far * ); -local int add_Be_ef( struct zlist far * ); - - -#ifdef NO_DIR /* for AT&T 3B1 */ -#include <sys/dir.h> -#ifndef dirent -# define dirent direct -#endif -typedef FILE DIR; -/* -** Apparently originally by Rich Salz. -** Cleaned up and modified by James W. Birdsall. -*/ - -#define opendir(path) fopen(path, "r") - -struct dirent *readdir(dirp) -DIR *dirp; -{ - static struct dirent entry; - - if (dirp == NULL) - return NULL; - for (;;) - if (fread (&entry, sizeof (struct dirent), 1, dirp) == 0) - return NULL; - else if (entry.d_ino) - return (&entry); -} /* end of readdir() */ - -#define closedir(dirp) fclose(dirp) -#endif /* NO_DIR */ - - -local char *readd(d) -DIR *d; /* directory stream to read from */ -/* Return a pointer to the next name in the directory stream d, or NULL if - no more entries or an error occurs. */ -{ - struct dirent *e; - - e = readdir(d); - return e == NULL ? (char *) NULL : e->d_name; -} - -int procname(n, caseflag) -char *n; /* name to process */ -int caseflag; /* true to force case-sensitive match */ -/* Process a name or sh expression to operate on (or exclude). Return - an error code in the ZE_ class. */ -{ - char *a; /* path and name for recursion */ - DIR *d; /* directory stream from opendir() */ - char *e; /* pointer to name from readd() */ - int m; /* matched flag */ - char *p; /* path for recursion */ - struct stat s; /* result of stat() */ - struct zlist far *z; /* steps through zfiles list */ - - if (strcmp(n, "-") == 0) /* if compressing stdin */ - return newname(n, 0, caseflag); - else if (LSSTAT(n, &s)) - { - /* Not a file or directory--search for shell expression in zip file */ - p = ex2in(n, 0, (int *)NULL); /* shouldn't affect matching chars */ - m = 1; - for (z = zfiles; z != NULL; z = z->nxt) { - if (MATCH(p, z->iname, caseflag)) - { - z->mark = pcount ? filter(z->zname, caseflag) : 1; - if (verbose) - fprintf(mesg, "zip diagnostic: %scluding %s\n", - z->mark ? "in" : "ex", z->name); - m = 0; - } - } - free((zvoid *)p); - return m ? ZE_MISS : ZE_OK; - } - - /* Live name--use if file, recurse if directory */ - if ((s.st_mode & S_IFDIR) == 0) - { - /* add or remove name of file */ - if ((m = newname(n, 0, caseflag)) != ZE_OK) - return m; - } else { - /* Add trailing / to the directory name */ - if ((p = malloc(strlen(n)+2)) == NULL) - return ZE_MEM; - if (strcmp(n, ".") == 0) { - *p = '\0'; /* avoid "./" prefix and do not create zip entry */ - } else { - strcpy(p, n); - a = p + strlen(p); - if (a[-1] != '/') - strcpy(a, "/"); - if (dirnames && (m = newname(p, 1, caseflag)) != ZE_OK) { - free((zvoid *)p); - return m; - } - } - /* recurse into directory */ - if (recurse && (d = opendir(n)) != NULL) - { - while ((e = readd(d)) != NULL) { - if (strcmp(e, ".") && strcmp(e, "..")) - { - if ((a = malloc(strlen(p) + strlen(e) + 1)) == NULL) - { - closedir(d); - free((zvoid *)p); - return ZE_MEM; - } - strcat(strcpy(a, p), e); - if ((m = procname(a, caseflag)) != ZE_OK) /* recurse on name */ - { - if (m == ZE_MISS) - zipwarn("name not matched: ", a); - else - ziperr(m, a); - } - free((zvoid *)a); - } - } - closedir(d); - } - free((zvoid *)p); - } /* (s.st_mode & S_IFDIR) == 0) */ - return ZE_OK; -} - -char *ex2in(x, isdir, pdosflag) -char *x; /* external file name */ -int isdir; /* input: x is a directory */ -int *pdosflag; /* output: force MSDOS file attributes? */ -/* Convert the external file name to a zip file name, returning the malloc'ed - string or NULL if not enough memory. */ -{ - char *n; /* internal file name (malloc'ed) */ - char *t; /* shortened name */ - int dosflag; - - dosflag = dosify; /* default for non-DOS and non-OS/2 */ - - /* Find starting point in name before doing malloc */ - for (t = x; *t == '/'; t++) - ; /* strip leading '/' chars to get a relative path */ - while (*t == '.' && t[1] == '/') - t += 2; /* strip redundant leading "./" sections */ - - /* Make changes, if any, to the copied name (leave original intact) */ - if (!pathput) - t = last(t, PATH_END); - - /* Malloc space for internal name and copy it */ - if ((n = malloc(strlen(t) + 1)) == NULL) - return NULL; - strcpy(n, t); - - if (isdir == 42) return n; /* avoid warning on unused variable */ - - if (dosify) - msname(n); - - /* Returned malloc'ed name */ - if (pdosflag) - *pdosflag = dosflag; - return n; -} - - -char *in2ex(n) -char *n; /* internal file name */ -/* Convert the zip file name to an external file name, returning the malloc'ed - string or NULL if not enough memory. */ -{ - char *x; /* external file name */ - - if ((x = malloc(strlen(n) + 1 + PAD)) == NULL) - return NULL; - strcpy(x, n); - return x; -} - -/* - * XXX use ztimbuf in both POSIX and non POSIX cases ? - */ -void stamp(f, d) -char *f; /* name of file to change */ -ulg d; /* dos-style time to change it to */ -/* Set last updated and accessed time of file f to the DOS time d. */ -{ -#ifdef _POSIX_VERSION - struct utimbuf u; /* argument for utime() const ?? */ -#else - time_t u[2]; /* argument for utime() */ -#endif - - /* Convert DOS time to time_t format in u */ -#ifdef _POSIX_VERSION - u.actime = u.modtime = dos2unixtime(d); - utime(f, &u); -#else - u[0] = u[1] = dos2unixtime(d); - utime(f, u); -#endif - -} - -ulg filetime(f, a, n, t) -char *f; /* name of file to get info on */ -ulg *a; /* return value: file attributes */ -long *n; /* return value: file size */ -iztimes *t; /* return value: access, modific. and creation times */ -/* If file *f does not exist, return 0. Else, return the file's last - modified date and time as an MSDOS date and time. The date and - time is returned in a long with the date most significant to allow - unsigned integer comparison of absolute times. Also, if a is not - a NULL pointer, store the file attributes there, with the high two - bytes being the Unix attributes, and the low byte being a mapping - of that to DOS attributes. If n is not NULL, store the file size - there. If t is not NULL, the file's access, modification and creation - times are stored there as UNIX time_t values. - If f is "-", use standard input as the file. If f is a device, return - a file size of -1 */ -{ - struct stat s; /* results of stat() */ - char *name; - unsigned int len = strlen(f); - - if (f == label) { - if (a != NULL) - *a = label_mode; - if (n != NULL) - *n = -2L; /* convention for a label name */ - if (t != NULL) - t->atime = t->mtime = t->ctime = label_utim; - return label_time; - } - - if ((name = malloc(len + 1)) == NULL) { - ZIPERR(ZE_MEM, "filetime"); - } - strcpy(name, f); - if (name[len - 1] == '/') - name[len - 1] = '\0'; - /* not all systems allow stat'ing a file with / appended */ - if (strcmp(f, "-") == 0) { - if (fstat(fileno(stdin), &s) != 0) { - free(name); - error("fstat(stdin)"); - } - } else if (LSSTAT(name, &s) != 0) { - /* Accept about any file kind including directories - * (stored with trailing / with -r option) - */ - free(name); - return 0; - } - - if (a != NULL) { - *a = ((ulg)s.st_mode << 16) | !(s.st_mode & S_IWRITE); - if ((s.st_mode & S_IFMT) == S_IFDIR) { - *a |= MSDOS_DIR_ATTR; - } - } - if (n != NULL) - *n = (s.st_mode & S_IFMT) == S_IFREG ? s.st_size : -1L; - if (t != NULL) { - t->atime = s.st_atime; - t->mtime = s.st_mtime; - t->ctime = s.st_mtime; /* best guess (s.st_ctime: last status change!) */ - } - - free(name); - - return unix2dostime(&s.st_mtime); -} - -/* ---------------------------------------------------------------------- - -Return a malloc()'d buffer containing all of the attributes and their names -for the file specified in name. You have to free() this yourself. The length -of the buffer is also returned. - -If get_attr_dir() fails, the buffer will be NULL, total_size will be 0, -and an error will be returned: - - 0 - no errors occurred - EINVAL - attr_buff was pointing at a buffer - ENOMEM - insufficient memory for attribute buffer - -Other errors are possible (whatever is returned by the fs_attr.h functions). - -PROBLEMS: - -- pointers are 32-bits; attributes are limited to off_t in size so it's - possible to overflow... in practice, this isn't too likely... your - machine will thrash like hell before that happens - -*/ - -#define INITIAL_BUFF_SIZE 65536 - -int get_attr_dir( const char *name, char **attr_buff, off_t *total_size ) -{ - int retval = 0; - int fd; - DIR *fa_dir; - struct dirent *fa_ent; - off_t attrs_size; - off_t this_size; - char *ptr; - struct attr_info fa_info; - struct attr_info big_fa_info; - - retval = 0; - attrs_size = 0; /* gcc still says this is used uninitialized... */ - *total_size = 0; - - /* ----------------------------------------------------------------- */ - /* Sanity-check. */ - if( *attr_buff != NULL ) { - return EINVAL; - } - - /* ----------------------------------------------------------------- */ - /* Can we open the file/directory? */ - /* */ - /* linkput is a zip global; it's set to 1 if we're storing symbolic */ - /* links as symbolic links (instead of storing the thing the link */ - /* points to)... if we're storing the symbolic link as a link, we'll */ - /* want the link's file attributes, otherwise we want the target's. */ - if( linkput ) { - fd = open( name, O_RDONLY | O_NOTRAVERSE ); - } else { - fd = open( name, O_RDONLY ); - } - if( fd < 0 ) { - return errno; - } - - /* ----------------------------------------------------------------- */ - /* Allocate an initial buffer; 64k should usually be enough. */ - *attr_buff = (char *)malloc( INITIAL_BUFF_SIZE ); - ptr = *attr_buff; - if( ptr == NULL ) { - close( fd ); - - return ENOMEM; - } - - /* ----------------------------------------------------------------- */ - /* Open the attributes directory for this file. */ - fa_dir = fs_fopen_attr_dir( fd ); - if( fa_dir == NULL ) { - close( fd ); - - free( ptr ); - *attr_buff = NULL; - - return retval; - } - - /* ----------------------------------------------------------------- */ - /* Read all the attributes; the buffer could grow > 64K if there are */ - /* many and/or they are large. */ - fa_ent = fs_read_attr_dir( fa_dir ); - while( fa_ent != NULL ) { - retval = fs_stat_attr( fd, fa_ent->d_name, &fa_info ); - /* TODO: check retval != 0 */ - - this_size = strlen( fa_ent->d_name ) + 1; - this_size += sizeof( struct attr_info ); - this_size += fa_info.size; - - attrs_size += this_size; - - if( attrs_size > INITIAL_BUFF_SIZE ) { - unsigned long offset = ptr - *attr_buff; - - *attr_buff = (char *)realloc( *attr_buff, attrs_size ); - if( *attr_buff == NULL ) { - retval = fs_close_attr_dir( fa_dir ); - /* TODO: check retval != 0 */ - close( fd ); - - return ENOMEM; - } - - ptr = *attr_buff + offset; - } - - /* Now copy the data for this attribute into the buffer. */ - strcpy( ptr, fa_ent->d_name ); - ptr += strlen( fa_ent->d_name ); - *ptr++ = '\0'; - - /* We need to put a big-endian version of the fa_info data into */ - /* the archive. */ - big_fa_info.type = B_HOST_TO_BENDIAN_INT32( fa_info.type ); - big_fa_info.size = B_HOST_TO_BENDIAN_INT64( fa_info.size ); - memcpy( ptr, &big_fa_info, sizeof( struct attr_info ) ); - ptr += sizeof( struct attr_info ); - - if( fa_info.size > 0 ) { - ssize_t read_bytes; - - read_bytes = fs_read_attr( fd, fa_ent->d_name, fa_info.type, 0, - ptr, fa_info.size ); - if( read_bytes != fa_info.size ) { - /* print a warning about mismatched sizes */ - char buff[80]; - - sprintf( buff, "read %ld, expected %ld", - (long)read_bytes, (long)fa_info.size ); - zipwarn( "attribute size mismatch: ", buff ); - } - - /* Wave my magic wand... this swaps all the Be types to big- */ - /* endian automagically. */ - (void)swap_data( fa_info.type, ptr, fa_info.size, - B_SWAP_HOST_TO_BENDIAN ); - - ptr += fa_info.size; - } - - fa_ent = fs_read_attr_dir( fa_dir ); - } - - /* ----------------------------------------------------------------- */ - /* Close the attribute directory. */ - retval = fs_close_attr_dir( fa_dir ); - /* TODO: check retval != 0 */ - - /* ----------------------------------------------------------------- */ - /* If the buffer is too big, shrink it. */ - if( attrs_size < INITIAL_BUFF_SIZE ) { - *attr_buff = (char *)realloc( *attr_buff, attrs_size ); - if( *attr_buff == NULL ) { - /* This really shouldn't happen... */ - close( fd ); - - return ENOMEM; - } - } - - *total_size = attrs_size; - - close( fd ); - - return 0; -} - -/* ---------------------------------------------------------------------- */ -/* Add a 'UT' extra field to the zlist data pointed to by z. */ - -#define EB_L_UT_SIZE (EB_HEADSIZE + EB_UT_LEN(2)) -#define EB_C_UT_SIZE (EB_HEADSIZE + EB_UT_LEN(1)) - -local int add_UT_ef( struct zlist far *z ) -{ - char *l_ef = NULL; - char *c_ef = NULL; - struct stat s; - -#ifdef IZ_CHECK_TZ - if (!zp_tz_is_valid) - return ZE_OK; /* skip silently if no valid TZ info */ -#endif - - /* We can't work if there's no entry to work on. */ - if( z == NULL ) { - return ZE_LOGIC; - } - - /* Check to make sure we've got enough room in the extra fields. */ - if( z->ext + EB_L_UT_SIZE > USHRT_MAX || - z->cext + EB_C_UT_SIZE > USHRT_MAX ) { - return ZE_MEM; - } - - /* stat() the file (or the symlink) to get the data; if we can't get */ - /* the data, there's no point in trying to fill out the fields. */ - if(LSSTAT( z->name, &s ) ) { - return ZE_OPEN; - } - - /* Allocate memory for the local and central extra fields. */ - if( z->extra && z->ext != 0 ) { - l_ef = (char *)realloc( z->extra, z->ext + EB_L_UT_SIZE ); - } else { - l_ef = (char *)malloc( EB_L_UT_SIZE ); - z->ext = 0; - } - if( l_ef == NULL ) { - return ZE_MEM; - } - z->extra = l_ef; - l_ef += z->ext; - - if( z->cextra && z->cext != 0 ) { - c_ef = (char *)realloc( z->cextra, z->cext + EB_C_UT_SIZE ); - } else { - c_ef = (char *)malloc( EB_C_UT_SIZE ); - z->cext = 0; - } - if( c_ef == NULL ) { - return ZE_MEM; - } - z->cextra = c_ef; - c_ef += z->cext; - - /* Now add the local version of the field. */ - *l_ef++ = 'U'; - *l_ef++ = 'T'; - *l_ef++ = (char)(EB_UT_LEN(2)); /* length of data in local EF */ - *l_ef++ = (char)0; - *l_ef++ = (char)(EB_UT_FL_MTIME | EB_UT_FL_ATIME); - *l_ef++ = (char)(s.st_mtime); - *l_ef++ = (char)(s.st_mtime >> 8); - *l_ef++ = (char)(s.st_mtime >> 16); - *l_ef++ = (char)(s.st_mtime >> 24); - *l_ef++ = (char)(s.st_atime); - *l_ef++ = (char)(s.st_atime >> 8); - *l_ef++ = (char)(s.st_atime >> 16); - *l_ef++ = (char)(s.st_atime >> 24); - - z->ext += EB_L_UT_SIZE; - - /* Now add the central version. */ - memcpy(c_ef, l_ef-EB_L_UT_SIZE, EB_C_UT_SIZE); - c_ef[EB_LEN] = (char)(EB_UT_LEN(1)); /* length of data in central EF */ - - z->cext += EB_C_UT_SIZE; - - return ZE_OK; -} - -/* ---------------------------------------------------------------------- */ -/* Add a 'Ux' extra field to the zlist data pointed to by z. */ - -#define EB_L_UX2_SIZE (EB_HEADSIZE + EB_UX2_MINLEN) -#define EB_C_UX2_SIZE (EB_HEADSIZE) - -local int add_Ux_ef( struct zlist far *z ) -{ - char *l_ef = NULL; - char *c_ef = NULL; - struct stat s; - - /* Check to make sure we've got enough room in the extra fields. */ - if( z->ext + EB_L_UX2_SIZE > USHRT_MAX || - z->cext + EB_C_UX2_SIZE > USHRT_MAX ) { - return ZE_MEM; - } - - /* stat() the file (or the symlink) to get the data; if we can't get */ - /* the data, there's no point in trying to fill out the fields. */ - if(LSSTAT( z->name, &s ) ) { - return ZE_OPEN; - } - - /* Allocate memory for the local and central extra fields. */ - if( z->extra && z->ext != 0 ) { - l_ef = (char *)realloc( z->extra, z->ext + EB_L_UX2_SIZE ); - } else { - l_ef = (char *)malloc( EB_L_UX2_SIZE ); - z->ext = 0; - } - if( l_ef == NULL ) { - return ZE_MEM; - } - z->extra = l_ef; - l_ef += z->ext; - - if( z->cextra && z->cext != 0 ) { - c_ef = (char *)realloc( z->cextra, z->cext + EB_C_UX2_SIZE ); - } else { - c_ef = (char *)malloc( EB_C_UX2_SIZE ); - z->cext = 0; - } - if( c_ef == NULL ) { - return ZE_MEM; - } - z->cextra = c_ef; - c_ef += z->cext; - - /* Now add the local version of the field. */ - *l_ef++ = 'U'; - *l_ef++ = 'x'; - *l_ef++ = (char)(EB_UX2_MINLEN); - *l_ef++ = (char)(EB_UX2_MINLEN >> 8); - *l_ef++ = (char)(s.st_uid); - *l_ef++ = (char)(s.st_uid >> 8); - *l_ef++ = (char)(s.st_gid); - *l_ef++ = (char)(s.st_gid >> 8); - - z->ext += EB_L_UX2_SIZE; - - /* Now add the central version of the field. */ - *c_ef++ = 'U'; - *c_ef++ = 'x'; - *c_ef++ = 0; - *c_ef++ = 0; - - z->cext += EB_C_UX2_SIZE; - - return ZE_OK; -} - -/* ---------------------------------------------------------------------- */ -/* Add a 'Be' extra field to the zlist data pointed to by z. */ - -#define EB_L_BE_SIZE (EB_HEADSIZE + EB_L_BE_LEN) /* + attr size */ -#define EB_C_BE_SIZE (EB_HEADSIZE + EB_C_BE_LEN) - -/* maximum memcompress overhead is the sum of the compression header length */ -/* (6 = ush compression type, ulg CRC) and the worstcase deflate overhead */ -/* when uncompressible data are kept in 2 "stored" blocks (5 per block = */ -/* byte blocktype + 2 * ush blocklength) */ -#define MEMCOMPRESS_OVERHEAD (EB_MEMCMPR_HSIZ + EB_DEFLAT_EXTRA) - -local int add_Be_ef( struct zlist far *z ) -{ - char *l_ef = NULL; - char *c_ef = NULL; - char *attrbuff = NULL; - off_t attrsize = 0; - char *compbuff = NULL; - ush compsize = 0; - uch flags = 0; - - /* Check to make sure we've got enough room in the extra fields. */ - if( z->ext + EB_L_BE_SIZE > USHRT_MAX || - z->cext + EB_C_BE_SIZE > USHRT_MAX ) { - return ZE_MEM; - } - - /* Attempt to load up a buffer full of the file's attributes. */ - { - int retval; - - retval = get_attr_dir( z->name, &attrbuff, &attrsize ); - if( retval != 0 ) { - return ZE_OPEN; - } - if( attrsize == 0 ) { - return ZE_OK; - } - if( attrbuff == NULL ) { - return ZE_LOGIC; - } - - /* Check for way too much data. */ - if( attrsize > (off_t)ULONG_MAX ) { - zipwarn( "uncompressed attributes truncated", "" ); - attrsize = (off_t)(ULONG_MAX - MEMCOMPRESS_OVERHEAD); - } - } - - if( verbose ) { - printf( "\t[in=%lu]", (unsigned long)attrsize ); - } - - /* Try compressing the data */ - compbuff = (char *)malloc( (size_t)attrsize + MEMCOMPRESS_OVERHEAD ); - if( compbuff == NULL ) { - return ZE_MEM; - } - compsize = memcompress( compbuff, - (size_t)attrsize + MEMCOMPRESS_OVERHEAD, - attrbuff, - (size_t)attrsize ); - if( verbose ) { - printf( " [out=%u]", compsize ); - } - - /* Attempt to optimise very small attributes. */ - if( compsize > attrsize ) { - free( compbuff ); - compsize = (ush)attrsize; - compbuff = attrbuff; - - flags = EB_BE_FL_NATURAL; - } else { - free( attrbuff ); - } - - /* Check to see if we really have enough room in the EF for the data. */ - if( ( z->ext + compsize + EB_L_BE_LEN ) > USHRT_MAX ) { - compsize = USHRT_MAX - EB_L_BE_LEN - z->ext; - } - - /* Allocate memory for the local and central extra fields. */ - if( z->extra && z->ext != 0 ) { - l_ef = (char *)realloc( z->extra, z->ext + EB_L_BE_SIZE + compsize ); - } else { - l_ef = (char *)malloc( EB_L_BE_SIZE + compsize ); - z->ext = 0; - } - if( l_ef == NULL ) { - free( compbuff ); - return ZE_MEM; - } - z->extra = l_ef; - l_ef += z->ext; - - if( z->cextra && z->cext != 0 ) { - c_ef = (char *)realloc( z->cextra, z->cext + EB_C_BE_SIZE ); - } else { - c_ef = (char *)malloc( EB_C_BE_SIZE ); - z->cext = 0; - } - if( c_ef == NULL ) { - free( compbuff ); - return ZE_MEM; - } - z->cextra = c_ef; - c_ef += z->cext; - - /* Now add the local version of the field. */ - *l_ef++ = 'B'; - *l_ef++ = 'e'; - *l_ef++ = (char)(compsize + EB_L_BE_LEN); - *l_ef++ = (char)((compsize + EB_L_BE_LEN) >> 8); - *l_ef++ = (char)((unsigned long)attrsize); - *l_ef++ = (char)((unsigned long)attrsize >> 8); - *l_ef++ = (char)((unsigned long)attrsize >> 16); - *l_ef++ = (char)((unsigned long)attrsize >> 24); - *l_ef++ = flags; - memcpy( l_ef, compbuff, (size_t)compsize ); - - z->ext += EB_L_BE_SIZE + compsize; - - /* And the central version. */ - *c_ef++ = 'B'; - *c_ef++ = 'e'; - *c_ef++ = (char)(EB_C_BE_LEN); - *c_ef++ = (char)(EB_C_BE_LEN >> 8); - *c_ef++ = (char)compsize; - *c_ef++ = (char)(compsize >> 8); - *c_ef++ = (char)(compsize >> 16); - *c_ef++ = (char)(compsize >> 24); - *c_ef++ = flags; - - z->cext += EB_C_BE_SIZE; - - free( compbuff ); - - return ZE_OK; -} - -/* Extra field info: - - 'UT' - UNIX time extra field - - 'Ux' - UNIX uid/gid extra field - - 'Be' - BeOS file attributes extra field - - This is done the same way ../unix/unix.c stores the 'UT'/'Ux' fields - (full data in local header, only modification time in central header), - with the 'Be' field added to the end and the size of the 'Be' field - in the central header. - - See the end of beos/osdep.h for a simple explanation of the 'Be' EF - layout. - */ -int set_extra_field(z, z_utim) - struct zlist far *z; - iztimes *z_utim; - /* store full data in local header but just modification time stamp info - in central header */ -{ - int retval; - - /* Tell picky compilers to shut up about unused variables. */ - z_utim = z_utim; - - /* Check to make sure z is valid. */ - if( z == NULL ) { - return ZE_LOGIC; - } - - /* This function is much simpler now that I've moved the extra fields */ - /* out... it simplified the 'Be' code, too. */ - retval = add_UT_ef( z ); - if( retval != ZE_OK ) { - return retval; - } - - retval = add_Ux_ef( z ); - if( retval != ZE_OK ) { - return retval; - } - - retval = add_Be_ef( z ); - if( retval != ZE_OK ) { - return retval; - } - - return ZE_OK; -} - -/* ---------------------------------------------------------------------- */ -/* Set a file's MIME type. */ -void setfiletype( const char *file, const char *type ) -{ - int fd; - attr_info fa; - ssize_t wrote_bytes; - - fd = open( file, O_RDWR ); - if( fd < 0 ) { - zipwarn( "can't open zipfile to write file type", "" ); - return; - } - - fa.type = B_MIME_STRING_TYPE; - fa.size = (off_t)(strlen( type ) + 1); - - wrote_bytes = fs_write_attr( fd, BE_FILE_TYPE_NAME, fa.type, 0, - type, fa.size ); - if( wrote_bytes != (ssize_t)fa.size ) { - zipwarn( "couldn't write complete file type", "" ); - } - - close( fd ); -} - -int deletedir(d) -char *d; /* directory to delete */ -/* Delete the directory *d if it is empty, do nothing otherwise. - Return the result of rmdir(), delete(), or system(). - For VMS, d must be in format [x.y]z.dir;1 (not [x.y.z]). - */ -{ -# ifdef NO_RMDIR - /* code from Greg Roelofs, who horked it from Mark Edwards (unzip) */ - int r, len; - char *s; /* malloc'd string for system command */ - - len = strlen(d); - if ((s = malloc(len + 34)) == NULL) - return 127; - - sprintf(s, "IFS=\" \t\n\" /bin/rmdir %s 2>/dev/null", d); - r = system(s); - free(s); - return r; -# else /* !NO_RMDIR */ - return rmdir(d); -# endif /* ?NO_RMDIR */ -} - -#endif /* !UTIL */ - - -/******************************/ -/* Function version_local() */ -/******************************/ - -void version_local() -{ - static ZCONST char CompiledWith[] = "Compiled with %s%s for %s%s%s%s.\n\n"; - - printf(CompiledWith, - -#ifdef __MWERKS__ - "Metrowerks CodeWarrior", "", -#else -# ifdef __GNUC__ - "gcc ", __VERSION__, -# endif -#endif - - "BeOS", - -#ifdef __POWERPC__ - " (PowerPC)", -#else -# ifdef __INTEL__ - " (x86)", -# else - " (UNKNOWN!)", -# endif -#endif - -#ifdef __DATE__ - " on ", __DATE__ -#else - "", "" -#endif - ); - -} /* end function version_local() */ diff --git a/src/bin/zip/beos/osdep.h b/src/bin/zip/beos/osdep.h deleted file mode 100644 index 0197903..0000000 --- a/src/bin/zip/beos/osdep.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (c) 1990-1999 Info-ZIP. All rights reserved. - - See the accompanying file LICENSE, version 1999-Oct-05 or later - (the contents of which are also included in zip.h) for terms of use. - If, for some reason, both of these files are missing, the Info-ZIP license - also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html -*/ -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> - -#include <support/Errors.h> /* for B_NO_ERROR */ - -#define USE_EF_UT_TIME /* Enable use of "UT" extra field time info */ - -#define EB_L_BE_LEN 5 /* min size is an unsigned long and flag */ -#define EB_C_BE_LEN 5 /* Length of data in local EF and flag. */ - -#define EB_BE_FL_NATURAL 0x01 /* data is 'natural' (not compressed) */ -#define EB_BE_FL_BADBITS 0xfe /* bits currently undefined */ - -#ifndef ZP_NEED_MEMCOMPR -# define ZP_NEED_MEMCOMPR -#endif - -/* Set a file's MIME type. */ -#define BE_FILE_TYPE_NAME "BEOS:TYPE" -void setfiletype( const char *file, const char *type ); - -/* -DR9 'Be' extra-field layout: - -'Be' - signature -ef_size - size of data in this EF (little-endian unsigned short) -full_size - uncompressed data size (little-endian unsigned long) -flag - flags (byte) - flags & EB_BE_FL_NATURAL = the data is not compressed - flags & EB_BE_FL_BADBITS = the data is corrupted or we - can't handle it properly -data - compressed or uncompressed file attribute data - -If flag & EB_BE_FL_NATURAL, the data is not compressed; this optimisation is -necessary to prevent wasted space for files with small attributes (which -appears to be quite common on the Advanced Access DR9 release). In this -case, there should be ( ef_size - EB_L_BE_LEN ) bytes of data, and full_size -should equal ( ef_size - EB_L_BE_LEN ). - -If the data is compressed, there will be ( ef_size - EB_L_BE_LEN ) bytes of -compressed data, and full_size bytes of uncompressed data. - -If a file has absolutely no attributes, there will not be a 'Be' extra field. - -The uncompressed data is arranged like this: - -attr_name\0 - C string -struct attr_info (big-endian) -attr_data (length in attr_info.size) -*/ diff --git a/src/bin/zip/beos/zipup.h b/src/bin/zip/beos/zipup.h deleted file mode 100644 index 40c79eb..0000000 --- a/src/bin/zip/beos/zipup.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - Copyright (c) 1990-1999 Info-ZIP. All rights reserved. - - See the accompanying file LICENSE, version 1999-Oct-05 or later - (the contents of which are also included in zip.h) for terms of use. - If, for some reason, both of these files are missing, the Info-ZIP license - also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html -*/ -#ifndef O_RDONLY -# include <fcntl.h> -#endif -#define fhow O_RDONLY -#define fbad (-1) -typedef int ftype; -#define zopen(n,p) open(n,p) -#define zread(f,b,n) read(f,b,n) -#define zclose(f) close(f) -#define zerr(f) (k == (extent)(-1L)) -#define zstdin 0 diff --git a/src/bin/zip/beos_.c b/src/bin/zip/beos_.c deleted file mode 100644 index aa9ac81..0000000 --- a/src/bin/zip/beos_.c +++ /dev/null @@ -1,2 +0,0 @@ -#define UTIL -#include "beos.c" diff --git a/src/bin/zip/crc32.c b/src/bin/zip/crc32.c deleted file mode 100644 index 0831205..0000000 --- a/src/bin/zip/crc32.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. - - See the accompanying file LICENSE, version 2004-May-22 or later - (the contents of which are also included in zip.h) for terms of use. - If, for some reason, both of these files are missing, the Info-ZIP license - also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html -*/ -/* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* $Id: crc32.c 22782 2007-11-01 01:27:31Z korli $ */ - -#define __CRC32_C /* identifies this source module */ - -#include "zip.h" - -#ifndef USE_ZLIB -#ifndef ASM_CRC - -#ifndef ZCONST -# define ZCONST const -#endif - -#ifdef CRC32 -# undef CRC32 -#endif -#define CRC32(c, b) (crc_table[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8)) -#define DO1(buf) crc = CRC32(crc, *buf++) -#define DO2(buf) DO1(buf); DO1(buf) -#define DO4(buf) DO2(buf); DO2(buf) -#define DO8(buf) DO4(buf); DO4(buf) - -/* ========================================================================= */ -ulg crc32(crc, buf, len) - register ulg crc; /* crc shift register */ - register ZCONST uch *buf; /* pointer to bytes to pump through */ - extent len; /* number of bytes in buf[] */ -/* Run a set of bytes through the crc shift register. If buf is a NULL - pointer, then initialize the crc shift register contents instead. - Return the current crc in either case. */ -{ - register ZCONST ulg near *crc_table; - - if (buf == NULL) return 0L; - - crc_table = get_crc_table(); - - crc = crc ^ 0xffffffffL; -#ifndef NO_UNROLLED_LOOPS - while (len >= 8) { - DO8(buf); - len -= 8; - } -#endif - if (len) do { - DO1(buf); - } while (--len); - return crc ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */ -} -#endif /* !ASM_CRC */ -#endif /* !USE_ZLIB */ diff --git a/src/bin/zip/crc_i386.S b/src/bin/zip/crc_i386.S deleted file mode 100644 index 9add2d4..0000000 --- a/src/bin/zip/crc_i386.S +++ /dev/null @@ -1,232 +0,0 @@ -/* - Copyright (c) 1990-1999 Info-ZIP. All rights reserved. - - See the accompanying file LICENSE, version 1999-Oct-05 or later - (the contents of which are also included in zip.h) for terms of use. - If, for some reason, both of these files are missing, the Info-ZIP license - also may be found at: ftp://ftp.cdrom.com/pub/infozip/license.html -*/ -/* - * crc_i386.S, optimized CRC calculation function for Zip and UnZip, - * created by Paul Kienitz and Christian Spieler. Last revised 24 Dec 98. - * - * GRR 961110: incorporated Scott Field optimizations from win32/crc_i386.asm - * => overall 6% speedup in "unzip -tq" on 9MB zipfile (486-66) - * - * SPC 970402: revised for Rodney Brown's optimizations (32-bit-wide - * aligned reads for most of the data from buffer), can be - * disabled by defining the macro NO_32_BIT_LOADS - * - * SPC 971012: added Rodney Brown's additional tweaks for 32-bit-optimized - * CPUs (like the Pentium Pro, Pentium II, and probably some - * Pentium clones). This optimization is controlled by the - * preprocessor switch "__686" and is disabled by default. - * (This default is based on the assumption that most users - * do not yet work on a Pentium Pro or Pentium II machine ...) - * - * FLAT memory model assumed. Calling interface: - * - args are pushed onto the stack from right to left, - * - return value is given in the EAX register, - * - all other registers (with exception of EFLAGS) are preserved. (With - * GNU C 2.7.x, %edx and %ecx are `scratch' registers, but preserving - * them nevertheless adds only 4 single byte instructions.) - * - * This source generates the function - * ulg crc32(ulg crc, ZCONST uch *buf, ulg len). - * - * The loop unrolling can be disabled by defining the macro NO_UNROLLED_LOOPS. - * This results in shorter code at the expense of reduced performance. - */ - -/* This file is NOT used in conjunction with zlib. */ -#ifndef USE_ZLIB - -/* Preprocess with -DNO_UNDERLINE if your C compiler does not prefix - * external symbols with an underline character '_'. - */ -#if defined(NO_UNDERLINE) || defined(__ELF__) -# define _crc32 crc32 -# define _get_crc_table get_crc_table -#endif -/* Use 16-byte alignment if your assembler supports it. Warning: gas - * uses a log(x) parameter (.align 4 means 16-byte alignment). On SVR4 - * the parameter is a number of bytes. - */ -#ifndef ALIGNMENT -# define ALIGNMENT .align 4,0x90 -#endif - -#if defined(i386) || defined(_i386) || defined(_I386) || defined(__i386) - -/* This version is for 386 Unix, OS/2, MSDOS in 32 bit mode (gcc & gas). - * Warning: it uses the AT&T syntax: mov source,dest - * This file is only optional. If you want to use the C version, - * remove -DASM_CRC from CFLAGS in Makefile and set OBJA to an empty string. - */ - - .file "crc_i386.S" - -#if defined(NO_STD_STACKFRAME) && defined(USE_STD_STACKFRAME) -# undef USE_STACKFRAME -#else - /* The default is to use standard stack frame entry, because it - * results in smaller code! - */ -# ifndef USE_STD_STACKFRAME -# define USE_STD_STACKFRAME -# endif -#endif - -#ifdef USE_STD_STACKFRAME -# define _STD_ENTRY pushl %ebp ; movl %esp,%ebp -# define arg1 8(%ebp) -# define arg2 12(%ebp) -# define arg3 16(%ebp) -# define _STD_LEAVE popl %ebp -#else /* !USE_STD_STACKFRAME */ -# define _STD_ENTRY -# define arg1 24(%esp) -# define arg2 28(%esp) -# define arg3 32(%esp) -# define _STD_LEAVE -#endif /* ?USE_STD_STACKFRAME */ - -/* - * These two (three) macros make up the loop body of the CRC32 cruncher. - * registers modified: - * eax : crc value "c" - * esi : pointer to next data byte (or lword) "buf++" - * registers read: - * edi : pointer to base of crc_table array - * scratch registers: - * ebx : index into crc_table array - * (requires upper three bytes = 0 when __686 is undefined) - */ -#ifndef __686 /* optimize for 386, 486, Pentium */ -#define Do_CRC /* c = (c >> 8) ^ table[c & 0xFF] */\ - movb %al, %bl ;/* tmp = c & 0xFF */\ - shrl $8, %eax ;/* c = (c >> 8) */\ - xorl (%edi, %ebx, 4), %eax ;/* c ^= table[tmp] */ -#else /* __686 : optimize for Pentium Pro and compatible CPUs */ -#define Do_CRC /* c = (c >> 8) ^ table[c & 0xFF] */\ - movzbl %al, %ebx ;/* tmp = c & 0xFF */\ - shrl $8, %eax ;/* c = (c >> 8) */\ - xorl (%edi, %ebx, 4), %eax ;/* c ^=table[tmp] */ -#endif /* ?__686 */ - -#define Do_CRC_byte /* c = (c >> 8) ^ table[(c^*buf++)&0xFF] */\ - xorb (%esi), %al ;/* c ^= *buf */\ - incl %esi ;/* buf++ */\ - Do_CRC - -#ifndef NO_32_BIT_LOADS -#define Do_CRC_lword \ - xorl (%esi), %eax ;/* c ^= *(ulg *)buf */\ - addl $4, %esi ;/* ((ulg *)buf)++ */\ - Do_CRC \ - Do_CRC \ - Do_CRC \ - Do_CRC -#endif /* !NO_32_BIT_LOADS */ - - - .text - - .globl _crc32 - -_crc32: /* ulg crc32(ulg crc, uch *buf, extent len) */ - _STD_ENTRY - pushl %edi - pushl %esi - pushl %ebx - pushl %edx - pushl %ecx - - movl arg2, %esi /* 2nd arg: uch *buf */ - subl %eax, %eax /* > if (!buf) */ - testl %esi, %esi /* > return 0; */ - jz .L_fine /* > else { */ - call _get_crc_table - movl %eax, %edi - movl arg1, %eax /* 1st arg: ulg crc */ -#ifndef __686 - subl %ebx, %ebx /* ebx=0; bl usable as dword */ -#endif - movl arg3, %ecx /* 3rd arg: extent len */ - notl %eax /* > c = ~crc; */ - - testl %ecx, %ecx -#ifndef NO_UNROLLED_LOOPS - jz .L_bail -# ifndef NO_32_BIT_LOADS - /* Assert now have positive length */ -.L_align_loop: - testl $3, %esi /* Align buf on lword boundary */ - jz .L_aligned_now - Do_CRC_byte - decl %ecx - jnz .L_align_loop -.L_aligned_now: -# endif /* !NO_32_BIT_LOADS */ - movl %ecx, %edx /* save len in edx */ - shrl $3, %ecx /* ecx = len / 8 */ - jz .L_No_Eights -/* align loop head at start of 486 internal cache line !! */ - ALIGNMENT -.L_Next_Eight: -# ifndef NO_32_BIT_LOADS - /* Do_CRC_lword */ - xorl (%esi), %eax ;/* c ^= *(ulg *)buf */ - addl $4, %esi ;/* ((ulg *)buf)++ */ - Do_CRC - Do_CRC - Do_CRC - Do_CRC - /* Do_CRC_lword */ - xorl (%esi), %eax ;/* c ^= *(ulg *)buf */ - addl $4, %esi ;/* ((ulg *)buf)++ */ - Do_CRC - Do_CRC - Do_CRC - Do_CRC -# else /* NO_32_BIT_LOADS */ - Do_CRC_byte - Do_CRC_byte - Do_CRC_byte - Do_CRC_byte - Do_CRC_byte - Do_CRC_byte - Do_CRC_byte - Do_CRC_byte -# endif /* ?NO_32_BIT_LOADS */ - decl %ecx - jnz .L_Next_Eight - -.L_No_Eights: - movl %edx, %ecx - andl $7, %ecx /* ecx = len % 8 */ -#endif /* !NO_UNROLLED_LOOPS */ - jz .L_bail /* > if (len) */ -/* align loop head at start of 486 internal cache line !! */ - ALIGNMENT -.L_loupe: /* > do { */ - Do_CRC_byte /* c = CRC32(c, *buf++); */ - decl %ecx /* > } while (--len); */ - jnz .L_loupe - -.L_bail: /* > } */ - notl %eax /* > return ~c; */ -.L_fine: - popl %ecx - popl %edx - popl %ebx - popl %esi - popl %edi - _STD_LEAVE - ret - -#else - error: this asm version is for 386 only -#endif /* i386 || _i386 || _I386 || __i386 */ - -#endif /* !USE_ZLIB */ diff --git a/src/bin/zip/crctab.c b/src/bin/zip/crctab.c deleted file mode 100644 index 3b5c2cb..0000000 --- a/src/bin/zip/crctab.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - Copyright (c) 1990-2005 Info-ZIP. All rights reserved. - - See the accompanying file LICENSE, version 2004-May-22 or later - (the contents of which are also included in zip.h) for terms of use. - If, for some reason, both of these files are missing, the Info-ZIP license - also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html -*/ -/* crctab.c -- supply the CRC table needed for CRC-32 calculations. - * Copyright (C) 1995 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* $Id: crctab.c 22782 2007-11-01 01:27:31Z korli $ */ - -/* - Generate a table for a byte-wise 32-bit CRC calculation on the polynomial: - x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. - - Polynomials over GF(2) are represented in binary, one bit per coefficient, - with the lowest powers in the most significant bit. Then adding polynomials - is just exclusive-or, and multiplying a polynomial by x is a right shift by - one. If we call the above polynomial p, and represent a byte as the - polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, - where a mod b means the remainder after dividing a by b. - - This calculation is done using the shift-register method of multiplying and - taking the remainder. The register is initialized to zero, and for each - incoming bit, x^32 is added mod p to the register if the bit is a one (where - x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by - x (which is shifting right by one and adding x^32 mod p if the bit shifted - out is a one). We start with the highest power (least significant bit) of - q and repeat for all eight bits of q. - - The table is simply the CRC of all possible eight bit values. This is all - the information needed to generate CRC's on data a byte at a time for all - combinations of CRC register values and incoming bytes. -*/ - -#define __CRCTAB_C /* identifies this source module */ - -#include "zip.h" - -#if (!defined(USE_ZLIB) || defined(USE_OWN_CRCTAB)) - -#ifndef ZCONST -# define ZCONST const -#endif - -#ifdef DYNAMIC_CRC_TABLE - -/* ========================================================================= - * Make the crc table. This function is needed only if you want to compute - * the table dynamically. - */ - -local void make_crc_table OF((void)); - -#if (defined(DYNALLOC_CRCTAB) && defined(REENTRANT)) - error: Dynamic allocation of CRC table not safe with reentrant code. -#endif /* DYNALLOC_CRCTAB && REENTRANT */ - -#ifdef DYNALLOC_CRCTAB - local ulg near *crc_table = NULL; -# if 0 /* not used, since sizeof("near *") <= sizeof(int) */ - /* Use this section when access to a "local int" is faster than access to - a "local pointer" (e.g.: i86 16bit code with far pointers). */ - local int crc_table_empty = 1; -# define CRC_TABLE_IS_EMPTY (crc_table_empty != 0) -# define MARK_CRCTAB_FILLED crc_table_empty = 0 -# define MARK_CRCTAB_EMPTY crc_table_empty = 1 -# else - /* Use this section on systems where the size of pointers and ints is - equal (e.g.: all 32bit systems). */ -# define CRC_TABLE_IS_EMPTY (crc_table == NULL) -# define MARK_CRCTAB_FILLED crc_table = crctab_p -# define MARK_CRCTAB_EMPTY crc_table = NULL -# endif -#else /* !DYNALLOC_CRCTAB */ - local ulg near crc_table[256]; - local int crc_table_empty = 1; -# define CRC_TABLE_IS_EMPTY (crc_table_empty != 0) -# define MARK_CRCTAB_FILLED crc_table_empty = 0 -#endif /* ?DYNALLOC_CRCTAB */ - - -local void make_crc_table() -{ - ulg c; /* crc shift register */ - int n; /* counter for all possible eight bit values */ - int k; /* byte being shifted into crc apparatus */ -#ifdef DYNALLOC_CRCTAB - ulg near *crctab_p; /* temporary pointer to allocated crc_table area */ -#else /* !DYNALLOC_CRCTAB */ -# define crctab_p crc_table -#endif /* DYNALLOC_CRCTAB */ - -#ifdef COMPUTE_XOR_PATTERN - /* This piece of code has been left here to explain how the XOR pattern - * used in the creation of the crc_table values can be recomputed. - * For production versions of this function, it is more efficient to - * supply the resultant pattern at compile time. - */ - ulg xor; /* polynomial exclusive-or pattern */ - /* terms of polynomial defining this crc (except x^32): */ - static uch p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; - - /* make exclusive-or pattern from polynomial (0xedb88320L) */ - xor = 0L; - for (i = 0; i < sizeof(p)/sizeof(uch); i++) - xor |= 1L << (31 - p[i]); -#else -# define xor 0xedb88320L -#endif - -#ifdef DYNALLOC_CRCTAB - crctab_p = (ulg near *) nearmalloc (256*sizeof(ulg)); - if (crctab_p == NULL) { - ziperr(ZE_MEM, "crc_table allocation"); - } -#endif /* DYNALLOC_CRCTAB */ - - for (n = 0; n < 256; n++) { - c = (ulg)n; - for (k = 8; k; k--) - c = c & 1 ? xor ^ (c >> 1) : c >> 1; - crctab_p[n] = c; - } - MARK_CRCTAB_FILLED; -} - -#else /* !DYNAMIC_CRC_TABLE */ - -#ifdef DYNALLOC_CRCTAB - error: Inconsistent flags, DYNALLOC_CRCTAB without DYNAMIC_CRC_TABLE. -#endif - -/* ======================================================================== - * Table of CRC-32's of all single-byte values (made by make_crc_table) - */ -local ZCONST ulg near crc_table[256] = { - 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, - 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, - 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, - 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, - 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, - 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, - 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, - 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, - 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, - 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, - 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, - 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, - 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, - 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, - 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, - 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, - 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, - 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, - 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, - 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, - 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, - 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, - 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, - 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, - 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, - 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, - 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, - 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, - 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, - 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, - 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, - 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, - 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, - 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, - 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, - 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, - 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, - 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, - 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, - 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, - 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, - 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, - 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, - 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, - 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, - 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, - 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, - 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, - 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, - 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, - 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, - 0x2d02ef8dL -}; -#endif /* ?DYNAMIC_CRC_TABLE */ - -/* use "OF((void))" here to work around a Borland TC++ 1.0 problem */ -#ifdef USE_ZLIB -ZCONST uLongf *get_crc_table OF((void)) -#else -ZCONST ulg near *get_crc_table OF((void)) -#endif -{ -#ifdef DYNAMIC_CRC_TABLE - if (CRC_TABLE_IS_EMPTY) - make_crc_table(); -#endif -#ifdef USE_ZLIB - return (ZCONST uLongf *)crc_table; -#else - return (ZCONST ulg near *)crc_table; -#endif -} - -#ifdef DYNALLOC_CRCTAB -void free_crc_table() -{ - if (!CRC_TABLE_IS_EMPTY) - { - nearfree((ulg near *)crc_table); - MARK_CRCTAB_EMPTY; - } -} -#endif - -#endif /* !USE_ZLIB || USE_OWN_CRCTAB */ diff --git a/src/bin/zip/crypt.c b/src/bin/zip/crypt.c deleted file mode 100644 index 49bfe7a..0000000 --- a/src/bin/zip/crypt.c +++ /dev/null @@ -1,598 +0,0 @@ -/* - Copyright (c) 1990-2006 Info-ZIP. All rights reserved. - - See the accompanying file LICENSE, version 2005-Feb-10 or later - (the contents of which are also included in (un)zip.h) for terms of use. - If, for some reason, all these files are missing, the Info-ZIP license - also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html -*/ -/* - crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h] - - The main encryption/decryption source code for Info-Zip software was - originally written in Europe. To the best of our knowledge, it can - be freely distributed in both source and object forms from any country, - including the USA under License Exception TSU of the U.S. Export - Administration Regulations (section 740.13(e)) of 6 June 2002. - [ *** diff truncated: 15366 lines dropped *** ]