diff options
Diffstat (limited to 'contrib/minizip')
| -rw-r--r-- | contrib/minizip/Makefile | 50 | ||||
| -rw-r--r-- | contrib/minizip/MiniZip64_Changes.txt | 13 | ||||
| -rw-r--r-- | contrib/minizip/MiniZip64_info.txt | 158 | ||||
| -rw-r--r-- | contrib/minizip/crypt.h | 2 | ||||
| -rw-r--r-- | contrib/minizip/ioapi.c | 2 | ||||
| -rw-r--r-- | contrib/minizip/ioapi.h | 8 | ||||
| -rw-r--r-- | contrib/minizip/iowin32.c | 2 | ||||
| -rw-r--r-- | contrib/minizip/iowin32.h | 2 | ||||
| -rw-r--r-- | contrib/minizip/make_vms.com | 2 | ||||
| -rw-r--r-- | contrib/minizip/miniunz.c | 8 | ||||
| -rw-r--r-- | contrib/minizip/minizip.c | 10 | ||||
| -rw-r--r-- | contrib/minizip/mztools.c | 562 | ||||
| -rw-r--r-- | contrib/minizip/mztools.h | 62 | ||||
| -rw-r--r-- | contrib/minizip/unzip.c | 10 | ||||
| -rw-r--r-- | contrib/minizip/unzip.h | 4 | ||||
| -rw-r--r-- | contrib/minizip/zconf.h | 332 | ||||
| -rw-r--r-- | contrib/minizip/zconf.in.h | 332 | ||||
| -rw-r--r-- | contrib/minizip/zip.c | 44 | ||||
| -rw-r--r-- | contrib/minizip/zip.h | 10 |
19 files changed, 474 insertions, 1139 deletions
diff --git a/contrib/minizip/Makefile b/contrib/minizip/Makefile index fbba3ac..84eaad2 100644 --- a/contrib/minizip/Makefile +++ b/contrib/minizip/Makefile | |||
| @@ -1,25 +1,25 @@ | |||
| 1 | CC=cc | 1 | CC=cc |
| 2 | CFLAGS=-O -I../.. | 2 | CFLAGS=-O -I../.. |
| 3 | 3 | ||
| 4 | UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a | 4 | UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a |
| 5 | ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a | 5 | ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a |
| 6 | 6 | ||
| 7 | .c.o: | 7 | .c.o: |
| 8 | $(CC) -c $(CFLAGS) $*.c | 8 | $(CC) -c $(CFLAGS) $*.c |
| 9 | 9 | ||
| 10 | all: miniunz minizip | 10 | all: miniunz minizip |
| 11 | 11 | ||
| 12 | miniunz: $(UNZ_OBJS) | 12 | miniunz: $(UNZ_OBJS) |
| 13 | $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) | 13 | $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) |
| 14 | 14 | ||
| 15 | minizip: $(ZIP_OBJS) | 15 | minizip: $(ZIP_OBJS) |
| 16 | $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) | 16 | $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) |
| 17 | 17 | ||
| 18 | test: miniunz minizip | 18 | test: miniunz minizip |
| 19 | ./minizip test readme.txt | 19 | ./minizip test readme.txt |
| 20 | ./miniunz -l test.zip | 20 | ./miniunz -l test.zip |
| 21 | mv readme.txt readme.old | 21 | mv readme.txt readme.old |
| 22 | ./miniunz test.zip | 22 | ./miniunz test.zip |
| 23 | 23 | ||
| 24 | clean: | 24 | clean: |
| 25 | /bin/rm -f *.o *~ minizip miniunz | 25 | /bin/rm -f *.o *~ minizip miniunz |
diff --git a/contrib/minizip/MiniZip64_Changes.txt b/contrib/minizip/MiniZip64_Changes.txt index 9d370df..436d8b3 100644 --- a/contrib/minizip/MiniZip64_Changes.txt +++ b/contrib/minizip/MiniZip64_Changes.txt | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | MiniZip64 was derrived from MiniZip at version 1.01f | 2 | MiniZip64 was derrived from MiniZip at version 1.01f |
| 3 | 3 | ||
| 4 | Change in 1.0 (Okt 2009) | 4 | Change in 1.0 (Okt 2009) |
| 5 | - **TODO - Add history** | 5 | - **TODO - Add history** |
| 6 | 6 | ||
| 7 | \ No newline at end of file | ||
diff --git a/contrib/minizip/MiniZip64_info.txt b/contrib/minizip/MiniZip64_info.txt index f4eef25..334b0f0 100644 --- a/contrib/minizip/MiniZip64_info.txt +++ b/contrib/minizip/MiniZip64_info.txt | |||
| @@ -1,79 +1,79 @@ | |||
| 1 | MiniZip64 - Copyright (c) 2009-2010 - Mathias Svensson - Built from MiniZip by Gilles Vollant | 1 | MiniZip64 - Copyright (c) 2009-2010 - Mathias Svensson - Built from MiniZip by Gilles Vollant |
| 2 | 2 | ||
| 3 | Introduction | 3 | Introduction |
| 4 | --------------------- | 4 | --------------------- |
| 5 | MiniZip64 is built from MiniZip by Gilles Vollant ( http://www.winimage.com/zLibDll/minizip.html ) | 5 | MiniZip64 is built from MiniZip by Gilles Vollant ( http://www.winimage.com/zLibDll/minizip.html ) |
| 6 | 6 | ||
| 7 | When adding ZIP64 support into minizip it would result into breaking compatibility with current minizip. | 7 | When adding ZIP64 support into minizip it would result into breaking compatibility with current minizip. |
| 8 | And since breaking compatibility in minizip is not wanted. I decided to create a fork of minizip | 8 | And since breaking compatibility in minizip is not wanted. I decided to create a fork of minizip |
| 9 | and create minizip64. | 9 | and create minizip64. |
| 10 | 10 | ||
| 11 | Even though MiniZip64 is build from MiniZip, all functions and struct's have changed name so that it | 11 | Even though MiniZip64 is build from MiniZip, all functions and struct's have changed name so that it |
| 12 | would not collide with each other. | 12 | would not collide with each other. |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | Background | 15 | Background |
| 16 | --------------------- | 16 | --------------------- |
| 17 | When adding ZIP64 support I found that Even Rouault have added ZIP64 support for unzip.c into minizip | 17 | When adding ZIP64 support I found that Even Rouault have added ZIP64 support for unzip.c into minizip |
| 18 | for a open source project called gdal ( http://www.gdal.org/ ) | 18 | for a open source project called gdal ( http://www.gdal.org/ ) |
| 19 | 19 | ||
| 20 | That was used as a starting point. And after that ZIP64 support was added to zip.c | 20 | That was used as a starting point. And after that ZIP64 support was added to zip.c |
| 21 | some refactoring and code cleanup was also done. | 21 | some refactoring and code cleanup was also done. |
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | Changed from MiniZip to MiniZip64 | 24 | Changed from MiniZip to MiniZip64 |
| 25 | ------------------------------------- | 25 | ------------------------------------- |
| 26 | * Filenames has got a '64' at the end of them . eg unzip.c is now called unzip64.c | 26 | * Filenames has got a '64' at the end of them . eg unzip.c is now called unzip64.c |
| 27 | * Added ZIP64 support for unzip ( by Even Rouault ) | 27 | * Added ZIP64 support for unzip ( by Even Rouault ) |
| 28 | * Added ZIP64 support for zip ( by Mathias Svensson ) | 28 | * Added ZIP64 support for zip ( by Mathias Svensson ) |
| 29 | * Reverted some changed that Even Rouault did. | 29 | * Reverted some changed that Even Rouault did. |
| 30 | * Bunch of patches received from Gulles Vollant that he received for MiniZip from various users. | 30 | * Bunch of patches received from Gulles Vollant that he received for MiniZip from various users. |
| 31 | * Added unzip patch for BZIP Compression method (patch create by Daniel Borca) | 31 | * Added unzip patch for BZIP Compression method (patch create by Daniel Borca) |
| 32 | * Added BZIP Compress method for zip | 32 | * Added BZIP Compress method for zip |
| 33 | * Did some refactoring and code cleanup | 33 | * Did some refactoring and code cleanup |
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | Credits | 36 | Credits |
| 37 | 37 | ||
| 38 | Gilles Vollant - Original MiniZip author | 38 | Gilles Vollant - Original MiniZip author |
| 39 | Even Rouault - ZIP64 unzip Support | 39 | Even Rouault - ZIP64 unzip Support |
| 40 | Daniel Borca - BZip Compression method support in unzip | 40 | Daniel Borca - BZip Compression method support in unzip |
| 41 | Mathias Svensson - ZIP64 zip support | 41 | Mathias Svensson - ZIP64 zip support |
| 42 | Mathias Svensson - BZip Compression method support in zip | 42 | Mathias Svensson - BZip Compression method support in zip |
| 43 | 43 | ||
| 44 | Resources | 44 | Resources |
| 45 | 45 | ||
| 46 | ZipLayout http://result42.com/projects/ZipFileLayout | 46 | ZipLayout http://result42.com/projects/ZipFileLayout |
| 47 | Command line tool for Windows that shows the layout and information of the headers in a zip archive. | 47 | Command line tool for Windows that shows the layout and information of the headers in a zip archive. |
| 48 | Used when debugging and validating the creation of zip files using MiniZip64 | 48 | Used when debugging and validating the creation of zip files using MiniZip64 |
| 49 | 49 | ||
| 50 | 50 | ||
| 51 | ZIP App Note http://www.pkware.com/documents/casestudies/APPNOTE.TXT | 51 | ZIP App Note http://www.pkware.com/documents/casestudies/APPNOTE.TXT |
| 52 | Zip File specification | 52 | Zip File specification |
| 53 | 53 | ||
| 54 | 54 | ||
| 55 | Notes. | 55 | Notes. |
| 56 | * To be able to use BZip compression method in zip64.c or unzip64.c the BZIP2 lib is needed and HAVE_BZIP2 need to be defined. | 56 | * To be able to use BZip compression method in zip64.c or unzip64.c the BZIP2 lib is needed and HAVE_BZIP2 need to be defined. |
| 57 | 57 | ||
| 58 | License | 58 | License |
| 59 | ---------------------------------------------------------- | 59 | ---------------------------------------------------------- |
| 60 | Condition of use and distribution are the same than zlib : | 60 | Condition of use and distribution are the same than zlib : |
| 61 | 61 | ||
| 62 | This software is provided 'as-is', without any express or implied | 62 | This software is provided 'as-is', without any express or implied |
| 63 | warranty. In no event will the authors be held liable for any damages | 63 | warranty. In no event will the authors be held liable for any damages |
| 64 | arising from the use of this software. | 64 | arising from the use of this software. |
| 65 | 65 | ||
| 66 | Permission is granted to anyone to use this software for any purpose, | 66 | Permission is granted to anyone to use this software for any purpose, |
| 67 | including commercial applications, and to alter it and redistribute it | 67 | including commercial applications, and to alter it and redistribute it |
| 68 | freely, subject to the following restrictions: | 68 | freely, subject to the following restrictions: |
| 69 | 69 | ||
| 70 | 1. The origin of this software must not be misrepresented; you must not | 70 | 1. The origin of this software must not be misrepresented; you must not |
| 71 | claim that you wrote the original software. If you use this software | 71 | claim that you wrote the original software. If you use this software |
| 72 | in a product, an acknowledgment in the product documentation would be | 72 | in a product, an acknowledgment in the product documentation would be |
| 73 | appreciated but is not required. | 73 | appreciated but is not required. |
| 74 | 2. Altered source versions must be plainly marked as such, and must not be | 74 | 2. Altered source versions must be plainly marked as such, and must not be |
| 75 | misrepresented as being the original software. | 75 | misrepresented as being the original software. |
| 76 | 3. This notice may not be removed or altered from any source distribution. | 76 | 3. This notice may not be removed or altered from any source distribution. |
| 77 | 77 | ||
| 78 | ---------------------------------------------------------- | 78 | ---------------------------------------------------------- |
| 79 | 79 | ||
diff --git a/contrib/minizip/crypt.h b/contrib/minizip/crypt.h index 679e2a1..a01d08d 100644 --- a/contrib/minizip/crypt.h +++ b/contrib/minizip/crypt.h | |||
| @@ -91,7 +91,7 @@ static int crypthead(const char* passwd, /* password string */ | |||
| 91 | unsigned char* buf, /* where to write header */ | 91 | unsigned char* buf, /* where to write header */ |
| 92 | int bufSize, | 92 | int bufSize, |
| 93 | unsigned long* pkeys, | 93 | unsigned long* pkeys, |
| 94 | const unsigned long* pcrc_32_tab, | 94 | const unsigned long* pcrc_32_tab, |
| 95 | unsigned long crcForCrypting) | 95 | unsigned long crcForCrypting) |
| 96 | { | 96 | { |
| 97 | int n; /* index in random header */ | 97 | int n; /* index in random header */ |
diff --git a/contrib/minizip/ioapi.c b/contrib/minizip/ioapi.c index 36ed0e0..a5f1e0b 100644 --- a/contrib/minizip/ioapi.c +++ b/contrib/minizip/ioapi.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) | 4 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) |
| 5 | 5 | ||
| 6 | Modifications for Zip64 support | 6 | Modifications for Zip64 support |
| 7 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) | 7 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) |
| 8 | 8 | ||
| 9 | For more info read MiniZip_info.txt | 9 | For more info read MiniZip_info.txt |
diff --git a/contrib/minizip/ioapi.h b/contrib/minizip/ioapi.h index f443d82..1c7feb0 100644 --- a/contrib/minizip/ioapi.h +++ b/contrib/minizip/ioapi.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) | 4 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) |
| 5 | 5 | ||
| 6 | Modifications for Zip64 support | 6 | Modifications for Zip64 support |
| 7 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) | 7 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) |
| 8 | 8 | ||
| 9 | For more info read MiniZip_info.txt | 9 | For more info read MiniZip_info.txt |
| @@ -13,7 +13,7 @@ | |||
| 13 | Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this) | 13 | Oct-2009 - Defined ZPOS64_T to fpos_t on windows and u_int64_t on linux. (might need to find a better why for this) |
| 14 | Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux. | 14 | Oct-2009 - Change to fseeko64, ftello64 and fopen64 so large files would work on linux. |
| 15 | More if/def section may be needed to support other platforms | 15 | More if/def section may be needed to support other platforms |
| 16 | Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows. | 16 | Oct-2009 - Defined fxxxx64 calls to normal fopen/ftell/fseek so they would compile on windows. |
| 17 | (but you should use iowin32.c for windows instead) | 17 | (but you should use iowin32.c for windows instead) |
| 18 | 18 | ||
| 19 | */ | 19 | */ |
| @@ -21,7 +21,7 @@ | |||
| 21 | #ifndef _ZLIBIOAPI64_H | 21 | #ifndef _ZLIBIOAPI64_H |
| 22 | #define _ZLIBIOAPI64_H | 22 | #define _ZLIBIOAPI64_H |
| 23 | 23 | ||
| 24 | #ifndef _WIN32 | 24 | #ifndef _WIN32 |
| 25 | 25 | ||
| 26 | // Linux needs this to support file operation on files larger then 4+GB | 26 | // Linux needs this to support file operation on files larger then 4+GB |
| 27 | // But might need better if/def to select just the platforms that needs them. | 27 | // But might need better if/def to select just the platforms that needs them. |
| @@ -60,7 +60,7 @@ | |||
| 60 | #ifdef _WIN32 | 60 | #ifdef _WIN32 |
| 61 | #define ZPOS64_T fpos_t | 61 | #define ZPOS64_T fpos_t |
| 62 | #else | 62 | #else |
| 63 | #include <stdint.h> | 63 | #include <stdint.h> |
| 64 | #define ZPOS64_T uint64_t | 64 | #define ZPOS64_T uint64_t |
| 65 | #endif | 65 | #endif |
| 66 | #endif | 66 | #endif |
diff --git a/contrib/minizip/iowin32.c b/contrib/minizip/iowin32.c index 92b9352..43a5715 100644 --- a/contrib/minizip/iowin32.c +++ b/contrib/minizip/iowin32.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) | 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) |
| 6 | 6 | ||
| 7 | Modifications for Zip64 support | 7 | Modifications for Zip64 support |
| 8 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) | 8 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) |
| 9 | 9 | ||
| 10 | For more info read MiniZip_info.txt | 10 | For more info read MiniZip_info.txt |
diff --git a/contrib/minizip/iowin32.h b/contrib/minizip/iowin32.h index cc77ec4..1b6c533 100644 --- a/contrib/minizip/iowin32.h +++ b/contrib/minizip/iowin32.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) | 5 | Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) |
| 6 | 6 | ||
| 7 | Modifications for Zip64 support | 7 | Modifications for Zip64 support |
| 8 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) | 8 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) |
| 9 | 9 | ||
| 10 | For more info read MiniZip_info.txt | 10 | For more info read MiniZip_info.txt |
diff --git a/contrib/minizip/make_vms.com b/contrib/minizip/make_vms.com index 548ee29..23e1a3a 100644 --- a/contrib/minizip/make_vms.com +++ b/contrib/minizip/make_vms.com | |||
| @@ -12,7 +12,7 @@ $ close zdef | |||
| 12 | $ copy vmsdefs.h,ioapi.h_orig ioapi.h | 12 | $ copy vmsdefs.h,ioapi.h_orig ioapi.h |
| 13 | $ cc/include=[--]/prefix=all ioapi.c | 13 | $ cc/include=[--]/prefix=all ioapi.c |
| 14 | $ cc/include=[--]/prefix=all miniunz.c | 14 | $ cc/include=[--]/prefix=all miniunz.c |
| 15 | $ cc/include=[--]/prefix=all unzip.c | 15 | $ cc/include=[--]/prefix=all unzip.c |
| 16 | $ cc/include=[--]/prefix=all minizip.c | 16 | $ cc/include=[--]/prefix=all minizip.c |
| 17 | $ cc/include=[--]/prefix=all zip.c | 17 | $ cc/include=[--]/prefix=all zip.c |
| 18 | $ link miniunz,unzip,ioapi,[--]libz.olb/lib | 18 | $ link miniunz,unzip,ioapi,[--]libz.olb/lib |
diff --git a/contrib/minizip/miniunz.c b/contrib/minizip/miniunz.c index c0a07ab..cad8ae2 100644 --- a/contrib/minizip/miniunz.c +++ b/contrib/minizip/miniunz.c | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) | 12 | Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) |
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | #ifndef _WIN32 | 15 | #ifndef _WIN32 |
| 16 | #ifndef __USE_FILE_OFFSET64 | 16 | #ifndef __USE_FILE_OFFSET64 |
| 17 | #define __USE_FILE_OFFSET64 | 17 | #define __USE_FILE_OFFSET64 |
| 18 | #endif | 18 | #endif |
| @@ -375,7 +375,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password) | |||
| 375 | 375 | ||
| 376 | printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename); | 376 | printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename); |
| 377 | ret = scanf("%1s",answer); | 377 | ret = scanf("%1s",answer); |
| 378 | if (ret != 1) | 378 | if (ret != 1) |
| 379 | { | 379 | { |
| 380 | exit(EXIT_FAILURE); | 380 | exit(EXIT_FAILURE); |
| 381 | } | 381 | } |
| @@ -627,9 +627,9 @@ int main(argc,argv) | |||
| 627 | else if (opt_do_extract==1) | 627 | else if (opt_do_extract==1) |
| 628 | { | 628 | { |
| 629 | #ifdef _WIN32 | 629 | #ifdef _WIN32 |
| 630 | if (opt_extractdir && _chdir(dirname)) | 630 | if (opt_extractdir && _chdir(dirname)) |
| 631 | #else | 631 | #else |
| 632 | if (opt_extractdir && chdir(dirname)) | 632 | if (opt_extractdir && chdir(dirname)) |
| 633 | #endif | 633 | #endif |
| 634 | { | 634 | { |
| 635 | printf("Error changing into %s, aborting\n", dirname); | 635 | printf("Error changing into %s, aborting\n", dirname); |
diff --git a/contrib/minizip/minizip.c b/contrib/minizip/minizip.c index 4ce33af..ca26091 100644 --- a/contrib/minizip/minizip.c +++ b/contrib/minizip/minizip.c | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | 15 | ||
| 16 | #ifndef _WIN32 | 16 | #ifndef _WIN32 |
| 17 | #ifndef __USE_FILE_OFFSET64 | 17 | #ifndef __USE_FILE_OFFSET64 |
| 18 | #define __USE_FILE_OFFSET64 | 18 | #define __USE_FILE_OFFSET64 |
| 19 | #endif | 19 | #endif |
| @@ -219,15 +219,15 @@ int isLargeFile(const char* filename) | |||
| 219 | int n = fseeko64(pFile, 0, SEEK_END); | 219 | int n = fseeko64(pFile, 0, SEEK_END); |
| 220 | 220 | ||
| 221 | pos = ftello64(pFile); | 221 | pos = ftello64(pFile); |
| 222 | 222 | ||
| 223 | printf("File : %s is %lld bytes\n", filename, pos); | 223 | printf("File : %s is %lld bytes\n", filename, pos); |
| 224 | 224 | ||
| 225 | if(pos >= 0xffffffff) | 225 | if(pos >= 0xffffffff) |
| 226 | largeFile = 1; | 226 | largeFile = 1; |
| 227 | 227 | ||
| 228 | fclose(pFile); | 228 | fclose(pFile); |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | return largeFile; | 231 | return largeFile; |
| 232 | } | 232 | } |
| 233 | 233 | ||
| @@ -406,7 +406,7 @@ int main(argc,argv) | |||
| 406 | */ | 406 | */ |
| 407 | if ((password != NULL) && (err==ZIP_OK)) | 407 | if ((password != NULL) && (err==ZIP_OK)) |
| 408 | err = getFileCrc(filenameinzip,buf,size_buf,&crcFile); | 408 | err = getFileCrc(filenameinzip,buf,size_buf,&crcFile); |
| 409 | 409 | ||
| 410 | zip64 = isLargeFile(filenameinzip); | 410 | zip64 = isLargeFile(filenameinzip); |
| 411 | 411 | ||
| 412 | /* The path name saved, should not include a leading slash. */ | 412 | /* The path name saved, should not include a leading slash. */ |
diff --git a/contrib/minizip/mztools.c b/contrib/minizip/mztools.c index bc5c798..f9092e6 100644 --- a/contrib/minizip/mztools.c +++ b/contrib/minizip/mztools.c | |||
| @@ -1,281 +1,281 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Additional tools for Minizip | 2 | Additional tools for Minizip |
| 3 | Code: Xavier Roche '2004 | 3 | Code: Xavier Roche '2004 |
| 4 | License: Same as ZLIB (www.gzip.org) | 4 | License: Same as ZLIB (www.gzip.org) |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | /* Code */ | 7 | /* Code */ |
| 8 | #include <stdio.h> | 8 | #include <stdio.h> |
| 9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
| 10 | #include <string.h> | 10 | #include <string.h> |
| 11 | #include "zlib.h" | 11 | #include "zlib.h" |
| 12 | #include "unzip.h" | 12 | #include "unzip.h" |
| 13 | 13 | ||
| 14 | #define READ_8(adr) ((unsigned char)*(adr)) | 14 | #define READ_8(adr) ((unsigned char)*(adr)) |
| 15 | #define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) ) | 15 | #define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) ) |
| 16 | #define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) ) | 16 | #define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) ) |
| 17 | 17 | ||
| 18 | #define WRITE_8(buff, n) do { \ | 18 | #define WRITE_8(buff, n) do { \ |
| 19 | *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \ | 19 | *((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \ |
| 20 | } while(0) | 20 | } while(0) |
| 21 | #define WRITE_16(buff, n) do { \ | 21 | #define WRITE_16(buff, n) do { \ |
| 22 | WRITE_8((unsigned char*)(buff), n); \ | 22 | WRITE_8((unsigned char*)(buff), n); \ |
| 23 | WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \ | 23 | WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \ |
| 24 | } while(0) | 24 | } while(0) |
| 25 | #define WRITE_32(buff, n) do { \ | 25 | #define WRITE_32(buff, n) do { \ |
| 26 | WRITE_16((unsigned char*)(buff), (n) & 0xffff); \ | 26 | WRITE_16((unsigned char*)(buff), (n) & 0xffff); \ |
| 27 | WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \ | 27 | WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \ |
| 28 | } while(0) | 28 | } while(0) |
| 29 | 29 | ||
| 30 | extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered) | 30 | extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered) |
| 31 | const char* file; | 31 | const char* file; |
| 32 | const char* fileOut; | 32 | const char* fileOut; |
| 33 | const char* fileOutTmp; | 33 | const char* fileOutTmp; |
| 34 | uLong* nRecovered; | 34 | uLong* nRecovered; |
| 35 | uLong* bytesRecovered; | 35 | uLong* bytesRecovered; |
| 36 | { | 36 | { |
| 37 | int err = Z_OK; | 37 | int err = Z_OK; |
| 38 | FILE* fpZip = fopen(file, "rb"); | 38 | FILE* fpZip = fopen(file, "rb"); |
| 39 | FILE* fpOut = fopen(fileOut, "wb"); | 39 | FILE* fpOut = fopen(fileOut, "wb"); |
| 40 | FILE* fpOutCD = fopen(fileOutTmp, "wb"); | 40 | FILE* fpOutCD = fopen(fileOutTmp, "wb"); |
| 41 | if (fpZip != NULL && fpOut != NULL) { | 41 | if (fpZip != NULL && fpOut != NULL) { |
| 42 | int entries = 0; | 42 | int entries = 0; |
| 43 | uLong totalBytes = 0; | 43 | uLong totalBytes = 0; |
| 44 | char header[30]; | 44 | char header[30]; |
| 45 | char filename[256]; | 45 | char filename[256]; |
| 46 | char extra[1024]; | 46 | char extra[1024]; |
| 47 | int offset = 0; | 47 | int offset = 0; |
| 48 | int offsetCD = 0; | 48 | int offsetCD = 0; |
| 49 | while ( fread(header, 1, 30, fpZip) == 30 ) { | 49 | while ( fread(header, 1, 30, fpZip) == 30 ) { |
| 50 | int currentOffset = offset; | 50 | int currentOffset = offset; |
| 51 | 51 | ||
| 52 | /* File entry */ | 52 | /* File entry */ |
| 53 | if (READ_32(header) == 0x04034b50) { | 53 | if (READ_32(header) == 0x04034b50) { |
| 54 | unsigned int version = READ_16(header + 4); | 54 | unsigned int version = READ_16(header + 4); |
| 55 | unsigned int gpflag = READ_16(header + 6); | 55 | unsigned int gpflag = READ_16(header + 6); |
| 56 | unsigned int method = READ_16(header + 8); | 56 | unsigned int method = READ_16(header + 8); |
| 57 | unsigned int filetime = READ_16(header + 10); | 57 | unsigned int filetime = READ_16(header + 10); |
| 58 | unsigned int filedate = READ_16(header + 12); | 58 | unsigned int filedate = READ_16(header + 12); |
| 59 | unsigned int crc = READ_32(header + 14); /* crc */ | 59 | unsigned int crc = READ_32(header + 14); /* crc */ |
| 60 | unsigned int cpsize = READ_32(header + 18); /* compressed size */ | 60 | unsigned int cpsize = READ_32(header + 18); /* compressed size */ |
| 61 | unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */ | 61 | unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */ |
| 62 | unsigned int fnsize = READ_16(header + 26); /* file name length */ | 62 | unsigned int fnsize = READ_16(header + 26); /* file name length */ |
| 63 | unsigned int extsize = READ_16(header + 28); /* extra field length */ | 63 | unsigned int extsize = READ_16(header + 28); /* extra field length */ |
| 64 | filename[0] = extra[0] = '\0'; | 64 | filename[0] = extra[0] = '\0'; |
| 65 | 65 | ||
| 66 | /* Header */ | 66 | /* Header */ |
| 67 | if (fwrite(header, 1, 30, fpOut) == 30) { | 67 | if (fwrite(header, 1, 30, fpOut) == 30) { |
| 68 | offset += 30; | 68 | offset += 30; |
| 69 | } else { | 69 | } else { |
| 70 | err = Z_ERRNO; | 70 | err = Z_ERRNO; |
| 71 | break; | 71 | break; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | /* Filename */ | 74 | /* Filename */ |
| 75 | if (fnsize > 0) { | 75 | if (fnsize > 0) { |
| 76 | if (fread(filename, 1, fnsize, fpZip) == fnsize) { | 76 | if (fread(filename, 1, fnsize, fpZip) == fnsize) { |
| 77 | if (fwrite(filename, 1, fnsize, fpOut) == fnsize) { | 77 | if (fwrite(filename, 1, fnsize, fpOut) == fnsize) { |
| 78 | offset += fnsize; | 78 | offset += fnsize; |
| 79 | } else { | 79 | } else { |
| 80 | err = Z_ERRNO; | 80 | err = Z_ERRNO; |
| 81 | break; | 81 | break; |
| 82 | } | 82 | } |
| 83 | } else { | 83 | } else { |
| 84 | err = Z_ERRNO; | 84 | err = Z_ERRNO; |
| 85 | break; | 85 | break; |
| 86 | } | 86 | } |
| 87 | } else { | 87 | } else { |
| 88 | err = Z_STREAM_ERROR; | 88 | err = Z_STREAM_ERROR; |
| 89 | break; | 89 | break; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | /* Extra field */ | 92 | /* Extra field */ |
| 93 | if (extsize > 0) { | 93 | if (extsize > 0) { |
| 94 | if (fread(extra, 1, extsize, fpZip) == extsize) { | 94 | if (fread(extra, 1, extsize, fpZip) == extsize) { |
| 95 | if (fwrite(extra, 1, extsize, fpOut) == extsize) { | 95 | if (fwrite(extra, 1, extsize, fpOut) == extsize) { |
| 96 | offset += extsize; | 96 | offset += extsize; |
| 97 | } else { | 97 | } else { |
| 98 | err = Z_ERRNO; | 98 | err = Z_ERRNO; |
| 99 | break; | 99 | break; |
| 100 | } | 100 | } |
| 101 | } else { | 101 | } else { |
| 102 | err = Z_ERRNO; | 102 | err = Z_ERRNO; |
| 103 | break; | 103 | break; |
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | /* Data */ | 107 | /* Data */ |
| 108 | { | 108 | { |
| 109 | int dataSize = cpsize; | 109 | int dataSize = cpsize; |
| 110 | if (dataSize == 0) { | 110 | if (dataSize == 0) { |
| 111 | dataSize = uncpsize; | 111 | dataSize = uncpsize; |
| 112 | } | 112 | } |
| 113 | if (dataSize > 0) { | 113 | if (dataSize > 0) { |
| 114 | char* data = malloc(dataSize); | 114 | char* data = malloc(dataSize); |
| 115 | if (data != NULL) { | 115 | if (data != NULL) { |
| 116 | if ((int)fread(data, 1, dataSize, fpZip) == dataSize) { | 116 | if ((int)fread(data, 1, dataSize, fpZip) == dataSize) { |
| 117 | if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) { | 117 | if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) { |
| 118 | offset += dataSize; | 118 | offset += dataSize; |
| 119 | totalBytes += dataSize; | 119 | totalBytes += dataSize; |
| 120 | } else { | 120 | } else { |
| 121 | err = Z_ERRNO; | 121 | err = Z_ERRNO; |
| 122 | } | 122 | } |
| 123 | } else { | 123 | } else { |
| 124 | err = Z_ERRNO; | 124 | err = Z_ERRNO; |
| 125 | } | 125 | } |
| 126 | free(data); | 126 | free(data); |
| 127 | if (err != Z_OK) { | 127 | if (err != Z_OK) { |
| 128 | break; | 128 | break; |
| 129 | } | 129 | } |
| 130 | } else { | 130 | } else { |
| 131 | err = Z_MEM_ERROR; | 131 | err = Z_MEM_ERROR; |
| 132 | break; | 132 | break; |
| 133 | } | 133 | } |
| 134 | } | 134 | } |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | /* Central directory entry */ | 137 | /* Central directory entry */ |
| 138 | { | 138 | { |
| 139 | char header[46]; | 139 | char header[46]; |
| 140 | char* comment = ""; | 140 | char* comment = ""; |
| 141 | int comsize = (int) strlen(comment); | 141 | int comsize = (int) strlen(comment); |
| 142 | WRITE_32(header, 0x02014b50); | 142 | WRITE_32(header, 0x02014b50); |
| 143 | WRITE_16(header + 4, version); | 143 | WRITE_16(header + 4, version); |
| 144 | WRITE_16(header + 6, version); | 144 | WRITE_16(header + 6, version); |
| 145 | WRITE_16(header + 8, gpflag); | 145 | WRITE_16(header + 8, gpflag); |
| 146 | WRITE_16(header + 10, method); | 146 | WRITE_16(header + 10, method); |
| 147 | WRITE_16(header + 12, filetime); | 147 | WRITE_16(header + 12, filetime); |
| 148 | WRITE_16(header + 14, filedate); | 148 | WRITE_16(header + 14, filedate); |
| 149 | WRITE_32(header + 16, crc); | 149 | WRITE_32(header + 16, crc); |
| 150 | WRITE_32(header + 20, cpsize); | 150 | WRITE_32(header + 20, cpsize); |
| 151 | WRITE_32(header + 24, uncpsize); | 151 | WRITE_32(header + 24, uncpsize); |
| 152 | WRITE_16(header + 28, fnsize); | 152 | WRITE_16(header + 28, fnsize); |
| 153 | WRITE_16(header + 30, extsize); | 153 | WRITE_16(header + 30, extsize); |
| 154 | WRITE_16(header + 32, comsize); | 154 | WRITE_16(header + 32, comsize); |
| 155 | WRITE_16(header + 34, 0); /* disk # */ | 155 | WRITE_16(header + 34, 0); /* disk # */ |
| 156 | WRITE_16(header + 36, 0); /* int attrb */ | 156 | WRITE_16(header + 36, 0); /* int attrb */ |
| 157 | WRITE_32(header + 38, 0); /* ext attrb */ | 157 | WRITE_32(header + 38, 0); /* ext attrb */ |
| 158 | WRITE_32(header + 42, currentOffset); | 158 | WRITE_32(header + 42, currentOffset); |
| 159 | /* Header */ | 159 | /* Header */ |
| 160 | if (fwrite(header, 1, 46, fpOutCD) == 46) { | 160 | if (fwrite(header, 1, 46, fpOutCD) == 46) { |
| 161 | offsetCD += 46; | 161 | offsetCD += 46; |
| 162 | 162 | ||
| 163 | /* Filename */ | 163 | /* Filename */ |
| 164 | if (fnsize > 0) { | 164 | if (fnsize > 0) { |
| 165 | if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) { | 165 | if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) { |
| 166 | offsetCD += fnsize; | 166 | offsetCD += fnsize; |
| 167 | } else { | 167 | } else { |
| 168 | err = Z_ERRNO; | 168 | err = Z_ERRNO; |
| 169 | break; | 169 | break; |
| 170 | } | 170 | } |
| 171 | } else { | 171 | } else { |
| 172 | err = Z_STREAM_ERROR; | 172 | err = Z_STREAM_ERROR; |
| 173 | break; | 173 | break; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | /* Extra field */ | 176 | /* Extra field */ |
| 177 | if (extsize > 0) { | 177 | if (extsize > 0) { |
| 178 | if (fwrite(extra, 1, extsize, fpOutCD) == extsize) { | 178 | if (fwrite(extra, 1, extsize, fpOutCD) == extsize) { |
| 179 | offsetCD += extsize; | 179 | offsetCD += extsize; |
| 180 | } else { | 180 | } else { |
| 181 | err = Z_ERRNO; | 181 | err = Z_ERRNO; |
| 182 | break; | 182 | break; |
| 183 | } | 183 | } |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | /* Comment field */ | 186 | /* Comment field */ |
| 187 | if (comsize > 0) { | 187 | if (comsize > 0) { |
| 188 | if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) { | 188 | if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) { |
| 189 | offsetCD += comsize; | 189 | offsetCD += comsize; |
| 190 | } else { | 190 | } else { |
| 191 | err = Z_ERRNO; | 191 | err = Z_ERRNO; |
| 192 | break; | 192 | break; |
| 193 | } | 193 | } |
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | 196 | ||
| 197 | } else { | 197 | } else { |
| 198 | err = Z_ERRNO; | 198 | err = Z_ERRNO; |
| 199 | break; | 199 | break; |
| 200 | } | 200 | } |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | /* Success */ | 203 | /* Success */ |
| 204 | entries++; | 204 | entries++; |
| 205 | 205 | ||
| 206 | } else { | 206 | } else { |
| 207 | break; | 207 | break; |
| 208 | } | 208 | } |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | /* Final central directory */ | 211 | /* Final central directory */ |
| 212 | { | 212 | { |
| 213 | int entriesZip = entries; | 213 | int entriesZip = entries; |
| 214 | char header[22]; | 214 | char header[22]; |
| 215 | char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools"; | 215 | char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools"; |
| 216 | int comsize = (int) strlen(comment); | 216 | int comsize = (int) strlen(comment); |
| 217 | if (entriesZip > 0xffff) { | 217 | if (entriesZip > 0xffff) { |
| 218 | entriesZip = 0xffff; | 218 | entriesZip = 0xffff; |
| 219 | } | 219 | } |
| 220 | WRITE_32(header, 0x06054b50); | 220 | WRITE_32(header, 0x06054b50); |
| 221 | WRITE_16(header + 4, 0); /* disk # */ | 221 | WRITE_16(header + 4, 0); /* disk # */ |
| 222 | WRITE_16(header + 6, 0); /* disk # */ | 222 | WRITE_16(header + 6, 0); /* disk # */ |
| 223 | WRITE_16(header + 8, entriesZip); /* hack */ | 223 | WRITE_16(header + 8, entriesZip); /* hack */ |
| 224 | WRITE_16(header + 10, entriesZip); /* hack */ | 224 | WRITE_16(header + 10, entriesZip); /* hack */ |
| 225 | WRITE_32(header + 12, offsetCD); /* size of CD */ | 225 | WRITE_32(header + 12, offsetCD); /* size of CD */ |
| 226 | WRITE_32(header + 16, offset); /* offset to CD */ | 226 | WRITE_32(header + 16, offset); /* offset to CD */ |
| 227 | WRITE_16(header + 20, comsize); /* comment */ | 227 | WRITE_16(header + 20, comsize); /* comment */ |
| 228 | 228 | ||
| 229 | /* Header */ | 229 | /* Header */ |
| 230 | if (fwrite(header, 1, 22, fpOutCD) == 22) { | 230 | if (fwrite(header, 1, 22, fpOutCD) == 22) { |
| 231 | 231 | ||
| 232 | /* Comment field */ | 232 | /* Comment field */ |
| 233 | if (comsize > 0) { | 233 | if (comsize > 0) { |
| 234 | if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) { | 234 | if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) { |
| 235 | err = Z_ERRNO; | 235 | err = Z_ERRNO; |
| 236 | } | 236 | } |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | } else { | 239 | } else { |
| 240 | err = Z_ERRNO; | 240 | err = Z_ERRNO; |
| 241 | } | 241 | } |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | /* Final merge (file + central directory) */ | 244 | /* Final merge (file + central directory) */ |
| 245 | fclose(fpOutCD); | 245 | fclose(fpOutCD); |
| 246 | if (err == Z_OK) { | 246 | if (err == Z_OK) { |
| 247 | fpOutCD = fopen(fileOutTmp, "rb"); | 247 | fpOutCD = fopen(fileOutTmp, "rb"); |
| 248 | if (fpOutCD != NULL) { | 248 | if (fpOutCD != NULL) { |
| 249 | int nRead; | 249 | int nRead; |
| 250 | char buffer[8192]; | 250 | char buffer[8192]; |
| 251 | while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) { | 251 | while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) { |
| 252 | if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) { | 252 | if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) { |
| 253 | err = Z_ERRNO; | 253 | err = Z_ERRNO; |
| 254 | break; | 254 | break; |
| 255 | } | 255 | } |
| 256 | } | 256 | } |
| 257 | fclose(fpOutCD); | 257 | fclose(fpOutCD); |
| 258 | } | 258 | } |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | /* Close */ | 261 | /* Close */ |
| 262 | fclose(fpZip); | 262 | fclose(fpZip); |
| 263 | fclose(fpOut); | 263 | fclose(fpOut); |
| 264 | 264 | ||
| 265 | /* Wipe temporary file */ | 265 | /* Wipe temporary file */ |
| 266 | (void)remove(fileOutTmp); | 266 | (void)remove(fileOutTmp); |
| 267 | 267 | ||
| 268 | /* Number of recovered entries */ | 268 | /* Number of recovered entries */ |
| 269 | if (err == Z_OK) { | 269 | if (err == Z_OK) { |
| 270 | if (nRecovered != NULL) { | 270 | if (nRecovered != NULL) { |
| 271 | *nRecovered = entries; | 271 | *nRecovered = entries; |
| 272 | } | 272 | } |
| 273 | if (bytesRecovered != NULL) { | 273 | if (bytesRecovered != NULL) { |
| 274 | *bytesRecovered = totalBytes; | 274 | *bytesRecovered = totalBytes; |
| 275 | } | 275 | } |
| 276 | } | 276 | } |
| 277 | } else { | 277 | } else { |
| 278 | err = Z_STREAM_ERROR; | 278 | err = Z_STREAM_ERROR; |
| 279 | } | 279 | } |
| 280 | return err; | 280 | return err; |
| 281 | } | 281 | } |
diff --git a/contrib/minizip/mztools.h b/contrib/minizip/mztools.h index 82d1597..88b3459 100644 --- a/contrib/minizip/mztools.h +++ b/contrib/minizip/mztools.h | |||
| @@ -1,31 +1,31 @@ | |||
| 1 | /* | 1 | /* |
| 2 | Additional tools for Minizip | 2 | Additional tools for Minizip |
| 3 | Code: Xavier Roche '2004 | 3 | Code: Xavier Roche '2004 |
| 4 | License: Same as ZLIB (www.gzip.org) | 4 | License: Same as ZLIB (www.gzip.org) |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #ifndef _zip_tools_H | 7 | #ifndef _zip_tools_H |
| 8 | #define _zip_tools_H | 8 | #define _zip_tools_H |
| 9 | 9 | ||
| 10 | #ifdef __cplusplus | 10 | #ifdef __cplusplus |
| 11 | extern "C" { | 11 | extern "C" { |
| 12 | #endif | 12 | #endif |
| 13 | 13 | ||
| 14 | #ifndef _ZLIB_H | 14 | #ifndef _ZLIB_H |
| 15 | #include "zlib.h" | 15 | #include "zlib.h" |
| 16 | #endif | 16 | #endif |
| 17 | 17 | ||
| 18 | #include "unzip.h" | 18 | #include "unzip.h" |
| 19 | 19 | ||
| 20 | /* Repair a ZIP file (missing central directory) | 20 | /* Repair a ZIP file (missing central directory) |
| 21 | file: file to recover | 21 | file: file to recover |
| 22 | fileOut: output file after recovery | 22 | fileOut: output file after recovery |
| 23 | fileOutTmp: temporary file name used for recovery | 23 | fileOutTmp: temporary file name used for recovery |
| 24 | */ | 24 | */ |
| 25 | extern int ZEXPORT unzRepair(const char* file, | 25 | extern int ZEXPORT unzRepair(const char* file, |
| 26 | const char* fileOut, | 26 | const char* fileOut, |
| 27 | const char* fileOutTmp, | 27 | const char* fileOutTmp, |
| 28 | uLong* nRecovered, | 28 | uLong* nRecovered, |
| 29 | uLong* bytesRecovered); | 29 | uLong* bytesRecovered); |
| 30 | 30 | ||
| 31 | #endif | 31 | #endif |
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c index 050d506..6a4d104 100644 --- a/contrib/minizip/unzip.c +++ b/contrib/minizip/unzip.c | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | ------------------------------------------------------------------------------------ | 16 | ------------------------------------------------------------------------------------ |
| 17 | Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of | 17 | Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of |
| 18 | compatibility with older software. The following is from the original crypt.c. | 18 | compatibility with older software. The following is from the original crypt.c. |
| 19 | Code woven in by Terry Thorsen 1/2003. | 19 | Code woven in by Terry Thorsen 1/2003. |
| 20 | 20 | ||
| 21 | Copyright (c) 1990-2000 Info-ZIP. All rights reserved. | 21 | Copyright (c) 1990-2000 Info-ZIP. All rights reserved. |
| @@ -45,13 +45,13 @@ | |||
| 45 | 2007-2008 - Even Rouault - Decoration of symbol names unz* -> cpl_unz* | 45 | 2007-2008 - Even Rouault - Decoration of symbol names unz* -> cpl_unz* |
| 46 | 2007-2008 - Even Rouault - Remove old C style function prototypes | 46 | 2007-2008 - Even Rouault - Remove old C style function prototypes |
| 47 | 2007-2008 - Even Rouault - Add unzip support for ZIP64 | 47 | 2007-2008 - Even Rouault - Add unzip support for ZIP64 |
| 48 | 48 | ||
| 49 | Copyright (C) 2007-2008 Even Rouault | 49 | Copyright (C) 2007-2008 Even Rouault |
| 50 | 50 | ||
| 51 | 51 | ||
| 52 | Okt-2009 - Mathias Svensson - Removed cpl_* from symbol names (Even Rouault added them but since this is now moved to a new project (minizip64) I renamed them again). | 52 | Okt-2009 - Mathias Svensson - Removed cpl_* from symbol names (Even Rouault added them but since this is now moved to a new project (minizip64) I renamed them again). |
| 53 | Okt-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G | 53 | Okt-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G |
| 54 | should only read the compressed/uncompressed size from the Zip64 format if | 54 | should only read the compressed/uncompressed size from the Zip64 format if |
| 55 | the size from normal header was 0xFFFFFFFF | 55 | the size from normal header was 0xFFFFFFFF |
| 56 | Okt-2009 - Mathias Svensson - Applied some bug fixes from paches recived from Gilles Vollant | 56 | Okt-2009 - Mathias Svensson - Applied some bug fixes from paches recived from Gilles Vollant |
| 57 | Okt-2009 - Mathias Svensson - Applied support to unzip files with compression mathod BZIP2 (bzip2 lib is required) | 57 | Okt-2009 - Mathias Svensson - Applied support to unzip files with compression mathod BZIP2 (bzip2 lib is required) |
| @@ -1010,7 +1010,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, | |||
| 1010 | if ((err==UNZ_OK) && (file_info.size_file_extra != 0)) | 1010 | if ((err==UNZ_OK) && (file_info.size_file_extra != 0)) |
| 1011 | { | 1011 | { |
| 1012 | uLong acc = 0; | 1012 | uLong acc = 0; |
| 1013 | 1013 | ||
| 1014 | // since lSeek now points to after the extra field we need to move back | 1014 | // since lSeek now points to after the extra field we need to move back |
| 1015 | lSeek -= file_info.size_file_extra; | 1015 | lSeek -= file_info.size_file_extra; |
| 1016 | 1016 | ||
| @@ -1826,7 +1826,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) | |||
| 1826 | pfile_in_zip_read_info->stream.next_out = (Bytef*)pfile_in_zip_read_info->bstream.next_out; | 1826 | pfile_in_zip_read_info->stream.next_out = (Bytef*)pfile_in_zip_read_info->bstream.next_out; |
| 1827 | pfile_in_zip_read_info->stream.avail_out = pfile_in_zip_read_info->bstream.avail_out; | 1827 | pfile_in_zip_read_info->stream.avail_out = pfile_in_zip_read_info->bstream.avail_out; |
| 1828 | pfile_in_zip_read_info->stream.total_out = pfile_in_zip_read_info->bstream.total_out_lo32; | 1828 | pfile_in_zip_read_info->stream.total_out = pfile_in_zip_read_info->bstream.total_out_lo32; |
| 1829 | 1829 | ||
| 1830 | if (err==BZ_STREAM_END) | 1830 | if (err==BZ_STREAM_END) |
| 1831 | return (iRead==0) ? UNZ_EOF : iRead; | 1831 | return (iRead==0) ? UNZ_EOF : iRead; |
| 1832 | if (err!=BZ_OK) | 1832 | if (err!=BZ_OK) |
diff --git a/contrib/minizip/unzip.h b/contrib/minizip/unzip.h index a2e698f..da7fb61 100644 --- a/contrib/minizip/unzip.h +++ b/contrib/minizip/unzip.h | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | For more info read MiniZip_info.txt | 13 | For more info read MiniZip_info.txt |
| 14 | 14 | ||
| 15 | --------------------------------------------------------------------------------- | 15 | --------------------------------------------------------------------------------- |
| 16 | 16 | ||
| 17 | Condition of use and distribution are the same than zlib : | 17 | Condition of use and distribution are the same than zlib : |
| 18 | 18 | ||
| 19 | This software is provided 'as-is', without any express or implied | 19 | This software is provided 'as-is', without any express or implied |
| @@ -36,7 +36,7 @@ | |||
| 36 | 36 | ||
| 37 | Changes | 37 | Changes |
| 38 | 38 | ||
| 39 | See header of unzip64.c | 39 | See header of unzip64.c |
| 40 | 40 | ||
| 41 | */ | 41 | */ |
| 42 | 42 | ||
diff --git a/contrib/minizip/zconf.h b/contrib/minizip/zconf.h deleted file mode 100644 index 03a9431..0000000 --- a/contrib/minizip/zconf.h +++ /dev/null | |||
| @@ -1,332 +0,0 @@ | |||
| 1 | /* zconf.h -- configuration of the zlib compression library | ||
| 2 | * Copyright (C) 1995-2005 Jean-loup Gailly. | ||
| 3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
| 4 | */ | ||
| 5 | |||
| 6 | /* @(#) $Id$ */ | ||
| 7 | |||
| 8 | #ifndef ZCONF_H | ||
| 9 | #define ZCONF_H | ||
| 10 | |||
| 11 | /* | ||
| 12 | * If you *really* need a unique prefix for all types and library functions, | ||
| 13 | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | ||
| 14 | */ | ||
| 15 | #ifdef Z_PREFIX | ||
| 16 | # define deflateInit_ z_deflateInit_ | ||
| 17 | # define deflate z_deflate | ||
| 18 | # define deflateEnd z_deflateEnd | ||
| 19 | # define inflateInit_ z_inflateInit_ | ||
| 20 | # define inflate z_inflate | ||
| 21 | # define inflateEnd z_inflateEnd | ||
| 22 | # define deflateInit2_ z_deflateInit2_ | ||
| 23 | # define deflateSetDictionary z_deflateSetDictionary | ||
| 24 | # define deflateCopy z_deflateCopy | ||
| 25 | # define deflateReset z_deflateReset | ||
| 26 | # define deflateParams z_deflateParams | ||
| 27 | # define deflateBound z_deflateBound | ||
| 28 | # define deflatePrime z_deflatePrime | ||
| 29 | # define inflateInit2_ z_inflateInit2_ | ||
| 30 | # define inflateSetDictionary z_inflateSetDictionary | ||
| 31 | # define inflateSync z_inflateSync | ||
| 32 | # define inflateSyncPoint z_inflateSyncPoint | ||
| 33 | # define inflateCopy z_inflateCopy | ||
| 34 | # define inflateReset z_inflateReset | ||
| 35 | # define inflateBack z_inflateBack | ||
| 36 | # define inflateBackEnd z_inflateBackEnd | ||
| 37 | # define compress z_compress | ||
| 38 | # define compress2 z_compress2 | ||
| 39 | # define compressBound z_compressBound | ||
| 40 | # define uncompress z_uncompress | ||
| 41 | # define adler32 z_adler32 | ||
| 42 | # define crc32 z_crc32 | ||
| 43 | # define get_crc_table z_get_crc_table | ||
| 44 | # define zError z_zError | ||
| 45 | |||
| 46 | # define alloc_func z_alloc_func | ||
| 47 | # define free_func z_free_func | ||
| 48 | # define in_func z_in_func | ||
| 49 | # define out_func z_out_func | ||
| 50 | # define Byte z_Byte | ||
| 51 | # define uInt z_uInt | ||
| 52 | # define uLong z_uLong | ||
| 53 | # define Bytef z_Bytef | ||
| 54 | # define charf z_charf | ||
| 55 | # define intf z_intf | ||
| 56 | # define uIntf z_uIntf | ||
| 57 | # define uLongf z_uLongf | ||
| 58 | # define voidpf z_voidpf | ||
| 59 | # define voidp z_voidp | ||
| 60 | #endif | ||
| 61 | |||
| 62 | #if defined(__MSDOS__) && !defined(MSDOS) | ||
| 63 | # define MSDOS | ||
| 64 | #endif | ||
| 65 | #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) | ||
| 66 | # define OS2 | ||
| 67 | #endif | ||
| 68 | #if defined(_WINDOWS) && !defined(WINDOWS) | ||
| 69 | # define WINDOWS | ||
| 70 | #endif | ||
| 71 | #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) | ||
| 72 | # ifndef WIN32 | ||
| 73 | # define WIN32 | ||
| 74 | # endif | ||
| 75 | #endif | ||
| 76 | #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) | ||
| 77 | # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) | ||
| 78 | # ifndef SYS16BIT | ||
| 79 | # define SYS16BIT | ||
| 80 | # endif | ||
| 81 | # endif | ||
| 82 | #endif | ||
| 83 | |||
| 84 | /* | ||
| 85 | * Compile with -DMAXSEG_64K if the alloc function cannot allocate more | ||
| 86 | * than 64k bytes at a time (needed on systems with 16-bit int). | ||
| 87 | */ | ||
| 88 | #ifdef SYS16BIT | ||
| 89 | # define MAXSEG_64K | ||
| 90 | #endif | ||
| 91 | #ifdef MSDOS | ||
| 92 | # define UNALIGNED_OK | ||
| 93 | #endif | ||
| 94 | |||
| 95 | #ifdef __STDC_VERSION__ | ||
| 96 | # ifndef STDC | ||
| 97 | # define STDC | ||
| 98 | # endif | ||
| 99 | # if __STDC_VERSION__ >= 199901L | ||
| 100 | # ifndef STDC99 | ||
| 101 | # define STDC99 | ||
| 102 | # endif | ||
| 103 | # endif | ||
| 104 | #endif | ||
| 105 | #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) | ||
| 106 | # define STDC | ||
| 107 | #endif | ||
| 108 | #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) | ||
| 109 | # define STDC | ||
| 110 | #endif | ||
| 111 | #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) | ||
| 112 | # define STDC | ||
| 113 | #endif | ||
| 114 | #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) | ||
| 115 | # define STDC | ||
| 116 | #endif | ||
| 117 | |||
| 118 | #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ | ||
| 119 | # define STDC | ||
| 120 | #endif | ||
| 121 | |||
| 122 | #ifndef STDC | ||
| 123 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ | ||
| 124 | # define const /* note: need a more gentle solution here */ | ||
| 125 | # endif | ||
| 126 | #endif | ||
| 127 | |||
| 128 | /* Some Mac compilers merge all .h files incorrectly: */ | ||
| 129 | #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) | ||
| 130 | # define NO_DUMMY_DECL | ||
| 131 | #endif | ||
| 132 | |||
| 133 | /* Maximum value for memLevel in deflateInit2 */ | ||
| 134 | #ifndef MAX_MEM_LEVEL | ||
| 135 | # ifdef MAXSEG_64K | ||
| 136 | # define MAX_MEM_LEVEL 8 | ||
| 137 | # else | ||
| 138 | # define MAX_MEM_LEVEL 9 | ||
| 139 | # endif | ||
| 140 | #endif | ||
| 141 | |||
| 142 | /* Maximum value for windowBits in deflateInit2 and inflateInit2. | ||
| 143 | * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files | ||
| 144 | * created by gzip. (Files created by minigzip can still be extracted by | ||
| 145 | * gzip.) | ||
| 146 | */ | ||
| 147 | #ifndef MAX_WBITS | ||
| 148 | # define MAX_WBITS 15 /* 32K LZ77 window */ | ||
| 149 | #endif | ||
| 150 | |||
| 151 | /* The memory requirements for deflate are (in bytes): | ||
| 152 | (1 << (windowBits+2)) + (1 << (memLevel+9)) | ||
| 153 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) | ||
| 154 | plus a few kilobytes for small objects. For example, if you want to reduce | ||
| 155 | the default memory requirements from 256K to 128K, compile with | ||
| 156 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" | ||
| 157 | Of course this will generally degrade compression (there's no free lunch). | ||
| 158 | |||
| 159 | The memory requirements for inflate are (in bytes) 1 << windowBits | ||
| 160 | that is, 32K for windowBits=15 (default value) plus a few kilobytes | ||
| 161 | for small objects. | ||
| 162 | */ | ||
| 163 | |||
| 164 | /* Type declarations */ | ||
| 165 | |||
| 166 | #ifndef OF /* function prototypes */ | ||
| 167 | # ifdef STDC | ||
| 168 | # define OF(args) args | ||
| 169 | # else | ||
| 170 | # define OF(args) () | ||
| 171 | # endif | ||
| 172 | #endif | ||
| 173 | |||
| 174 | /* The following definitions for FAR are needed only for MSDOS mixed | ||
| 175 | * model programming (small or medium model with some far allocations). | ||
| 176 | * This was tested only with MSC; for other MSDOS compilers you may have | ||
| 177 | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, | ||
| 178 | * just define FAR to be empty. | ||
| 179 | */ | ||
| 180 | #ifdef SYS16BIT | ||
| 181 | # if defined(M_I86SM) || defined(M_I86MM) | ||
| 182 | /* MSC small or medium model */ | ||
| 183 | # define SMALL_MEDIUM | ||
| 184 | # ifdef _MSC_VER | ||
| 185 | # define FAR _far | ||
| 186 | # else | ||
| 187 | # define FAR far | ||
| 188 | # endif | ||
| 189 | # endif | ||
| 190 | # if (defined(__SMALL__) || defined(__MEDIUM__)) | ||
| 191 | /* Turbo C small or medium model */ | ||
| 192 | # define SMALL_MEDIUM | ||
| 193 | # ifdef __BORLANDC__ | ||
| 194 | # define FAR _far | ||
| 195 | # else | ||
| 196 | # define FAR far | ||
| 197 | # endif | ||
| 198 | # endif | ||
| 199 | #endif | ||
| 200 | |||
| 201 | #if defined(WINDOWS) || defined(WIN32) | ||
| 202 | /* If building or using zlib as a DLL, define ZLIB_DLL. | ||
| 203 | * This is not mandatory, but it offers a little performance increase. | ||
| 204 | */ | ||
| 205 | # ifdef ZLIB_DLL | ||
| 206 | # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) | ||
| 207 | # ifdef ZLIB_INTERNAL | ||
| 208 | # define ZEXTERN extern __declspec(dllexport) | ||
| 209 | # else | ||
| 210 | # define ZEXTERN extern __declspec(dllimport) | ||
| 211 | # endif | ||
| 212 | # endif | ||
| 213 | # endif /* ZLIB_DLL */ | ||
| 214 | /* If building or using zlib with the WINAPI/WINAPIV calling convention, | ||
| 215 | * define ZLIB_WINAPI. | ||
| 216 | * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. | ||
| 217 | */ | ||
| 218 | # ifdef ZLIB_WINAPI | ||
| 219 | # ifdef FAR | ||
| 220 | # undef FAR | ||
| 221 | # endif | ||
| 222 | # include <windows.h> | ||
| 223 | /* No need for _export, use ZLIB.DEF instead. */ | ||
| 224 | /* For complete Windows compatibility, use WINAPI, not __stdcall. */ | ||
| 225 | # define ZEXPORT WINAPI | ||
| 226 | # ifdef WIN32 | ||
| 227 | # define ZEXPORTVA WINAPIV | ||
| 228 | # else | ||
| 229 | # define ZEXPORTVA FAR CDECL | ||
| 230 | # endif | ||
| 231 | # endif | ||
| 232 | #endif | ||
| 233 | |||
| 234 | #if defined (__BEOS__) | ||
| 235 | # ifdef ZLIB_DLL | ||
| 236 | # ifdef ZLIB_INTERNAL | ||
| 237 | # define ZEXPORT __declspec(dllexport) | ||
| 238 | # define ZEXPORTVA __declspec(dllexport) | ||
| 239 | # else | ||
| 240 | # define ZEXPORT __declspec(dllimport) | ||
| 241 | # define ZEXPORTVA __declspec(dllimport) | ||
| 242 | # endif | ||
| 243 | # endif | ||
| 244 | #endif | ||
| 245 | |||
| 246 | #ifndef ZEXTERN | ||
| 247 | # define ZEXTERN extern | ||
| 248 | #endif | ||
| 249 | #ifndef ZEXPORT | ||
| 250 | # define ZEXPORT | ||
| 251 | #endif | ||
| 252 | #ifndef ZEXPORTVA | ||
| 253 | # define ZEXPORTVA | ||
| 254 | #endif | ||
| 255 | |||
| 256 | #ifndef FAR | ||
| 257 | # define FAR | ||
| 258 | #endif | ||
| 259 | |||
| 260 | #if !defined(__MACTYPES__) | ||
| 261 | typedef unsigned char Byte; /* 8 bits */ | ||
| 262 | #endif | ||
| 263 | typedef unsigned int uInt; /* 16 bits or more */ | ||
| 264 | typedef unsigned long uLong; /* 32 bits or more */ | ||
| 265 | |||
| 266 | #ifdef SMALL_MEDIUM | ||
| 267 | /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ | ||
| 268 | # define Bytef Byte FAR | ||
| 269 | #else | ||
| 270 | typedef Byte FAR Bytef; | ||
| 271 | #endif | ||
| 272 | typedef char FAR charf; | ||
| 273 | typedef int FAR intf; | ||
| 274 | typedef uInt FAR uIntf; | ||
| 275 | typedef uLong FAR uLongf; | ||
| 276 | |||
| 277 | #ifdef STDC | ||
| 278 | typedef void const *voidpc; | ||
| 279 | typedef void FAR *voidpf; | ||
| 280 | typedef void *voidp; | ||
| 281 | #else | ||
| 282 | typedef Byte const *voidpc; | ||
| 283 | typedef Byte FAR *voidpf; | ||
| 284 | typedef Byte *voidp; | ||
| 285 | #endif | ||
| 286 | |||
| 287 | #if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ | ||
| 288 | # include <sys/types.h> /* for off_t */ | ||
| 289 | # include <unistd.h> /* for SEEK_* and off_t */ | ||
| 290 | # ifdef VMS | ||
| 291 | # include <unixio.h> /* for off_t */ | ||
| 292 | # endif | ||
| 293 | # define z_off_t off_t | ||
| 294 | #endif | ||
| 295 | #ifndef SEEK_SET | ||
| 296 | # define SEEK_SET 0 /* Seek from beginning of file. */ | ||
| 297 | # define SEEK_CUR 1 /* Seek from current position. */ | ||
| 298 | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ | ||
| 299 | #endif | ||
| 300 | #ifndef z_off_t | ||
| 301 | # define z_off_t long | ||
| 302 | #endif | ||
| 303 | |||
| 304 | #if defined(__OS400__) | ||
| 305 | # define NO_vsnprintf | ||
| 306 | #endif | ||
| 307 | |||
| 308 | #if defined(__MVS__) | ||
| 309 | # define NO_vsnprintf | ||
| 310 | # ifdef FAR | ||
| 311 | # undef FAR | ||
| 312 | # endif | ||
| 313 | #endif | ||
| 314 | |||
| 315 | /* MVS linker does not support external names larger than 8 bytes */ | ||
| 316 | #if defined(__MVS__) | ||
| 317 | # pragma map(deflateInit_,"DEIN") | ||
| 318 | # pragma map(deflateInit2_,"DEIN2") | ||
| 319 | # pragma map(deflateEnd,"DEEND") | ||
| 320 | # pragma map(deflateBound,"DEBND") | ||
| 321 | # pragma map(inflateInit_,"ININ") | ||
| 322 | # pragma map(inflateInit2_,"ININ2") | ||
| 323 | # pragma map(inflateEnd,"INEND") | ||
| 324 | # pragma map(inflateSync,"INSY") | ||
| 325 | # pragma map(inflateSetDictionary,"INSEDI") | ||
| 326 | # pragma map(compressBound,"CMBND") | ||
| 327 | # pragma map(inflate_table,"INTABL") | ||
| 328 | # pragma map(inflate_fast,"INFA") | ||
| 329 | # pragma map(inflate_copyright,"INCOPY") | ||
| 330 | #endif | ||
| 331 | |||
| 332 | #endif /* ZCONF_H */ | ||
diff --git a/contrib/minizip/zconf.in.h b/contrib/minizip/zconf.in.h deleted file mode 100644 index 03a9431..0000000 --- a/contrib/minizip/zconf.in.h +++ /dev/null | |||
| @@ -1,332 +0,0 @@ | |||
| 1 | /* zconf.h -- configuration of the zlib compression library | ||
| 2 | * Copyright (C) 1995-2005 Jean-loup Gailly. | ||
| 3 | * For conditions of distribution and use, see copyright notice in zlib.h | ||
| 4 | */ | ||
| 5 | |||
| 6 | /* @(#) $Id$ */ | ||
| 7 | |||
| 8 | #ifndef ZCONF_H | ||
| 9 | #define ZCONF_H | ||
| 10 | |||
| 11 | /* | ||
| 12 | * If you *really* need a unique prefix for all types and library functions, | ||
| 13 | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | ||
| 14 | */ | ||
| 15 | #ifdef Z_PREFIX | ||
| 16 | # define deflateInit_ z_deflateInit_ | ||
| 17 | # define deflate z_deflate | ||
| 18 | # define deflateEnd z_deflateEnd | ||
| 19 | # define inflateInit_ z_inflateInit_ | ||
| 20 | # define inflate z_inflate | ||
| 21 | # define inflateEnd z_inflateEnd | ||
| 22 | # define deflateInit2_ z_deflateInit2_ | ||
| 23 | # define deflateSetDictionary z_deflateSetDictionary | ||
| 24 | # define deflateCopy z_deflateCopy | ||
| 25 | # define deflateReset z_deflateReset | ||
| 26 | # define deflateParams z_deflateParams | ||
| 27 | # define deflateBound z_deflateBound | ||
| 28 | # define deflatePrime z_deflatePrime | ||
| 29 | # define inflateInit2_ z_inflateInit2_ | ||
| 30 | # define inflateSetDictionary z_inflateSetDictionary | ||
| 31 | # define inflateSync z_inflateSync | ||
| 32 | # define inflateSyncPoint z_inflateSyncPoint | ||
| 33 | # define inflateCopy z_inflateCopy | ||
| 34 | # define inflateReset z_inflateReset | ||
| 35 | # define inflateBack z_inflateBack | ||
| 36 | # define inflateBackEnd z_inflateBackEnd | ||
| 37 | # define compress z_compress | ||
| 38 | # define compress2 z_compress2 | ||
| 39 | # define compressBound z_compressBound | ||
| 40 | # define uncompress z_uncompress | ||
| 41 | # define adler32 z_adler32 | ||
| 42 | # define crc32 z_crc32 | ||
| 43 | # define get_crc_table z_get_crc_table | ||
| 44 | # define zError z_zError | ||
| 45 | |||
| 46 | # define alloc_func z_alloc_func | ||
| 47 | # define free_func z_free_func | ||
| 48 | # define in_func z_in_func | ||
| 49 | # define out_func z_out_func | ||
| 50 | # define Byte z_Byte | ||
| 51 | # define uInt z_uInt | ||
| 52 | # define uLong z_uLong | ||
| 53 | # define Bytef z_Bytef | ||
| 54 | # define charf z_charf | ||
| 55 | # define intf z_intf | ||
| 56 | # define uIntf z_uIntf | ||
| 57 | # define uLongf z_uLongf | ||
| 58 | # define voidpf z_voidpf | ||
| 59 | # define voidp z_voidp | ||
| 60 | #endif | ||
| 61 | |||
| 62 | #if defined(__MSDOS__) && !defined(MSDOS) | ||
| 63 | # define MSDOS | ||
| 64 | #endif | ||
| 65 | #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) | ||
| 66 | # define OS2 | ||
| 67 | #endif | ||
| 68 | #if defined(_WINDOWS) && !defined(WINDOWS) | ||
| 69 | # define WINDOWS | ||
| 70 | #endif | ||
| 71 | #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) | ||
| 72 | # ifndef WIN32 | ||
| 73 | # define WIN32 | ||
| 74 | # endif | ||
| 75 | #endif | ||
| 76 | #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) | ||
| 77 | # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) | ||
| 78 | # ifndef SYS16BIT | ||
| 79 | # define SYS16BIT | ||
| 80 | # endif | ||
| 81 | # endif | ||
| 82 | #endif | ||
| 83 | |||
| 84 | /* | ||
| 85 | * Compile with -DMAXSEG_64K if the alloc function cannot allocate more | ||
| 86 | * than 64k bytes at a time (needed on systems with 16-bit int). | ||
| 87 | */ | ||
| 88 | #ifdef SYS16BIT | ||
| 89 | # define MAXSEG_64K | ||
| 90 | #endif | ||
| 91 | #ifdef MSDOS | ||
| 92 | # define UNALIGNED_OK | ||
| 93 | #endif | ||
| 94 | |||
| 95 | #ifdef __STDC_VERSION__ | ||
| 96 | # ifndef STDC | ||
| 97 | # define STDC | ||
| 98 | # endif | ||
| 99 | # if __STDC_VERSION__ >= 199901L | ||
| 100 | # ifndef STDC99 | ||
| 101 | # define STDC99 | ||
| 102 | # endif | ||
| 103 | # endif | ||
| 104 | #endif | ||
| 105 | #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) | ||
| 106 | # define STDC | ||
| 107 | #endif | ||
| 108 | #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) | ||
| 109 | # define STDC | ||
| 110 | #endif | ||
| 111 | #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) | ||
| 112 | # define STDC | ||
| 113 | #endif | ||
| 114 | #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) | ||
| 115 | # define STDC | ||
| 116 | #endif | ||
| 117 | |||
| 118 | #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ | ||
| 119 | # define STDC | ||
| 120 | #endif | ||
| 121 | |||
| 122 | #ifndef STDC | ||
| 123 | # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ | ||
| 124 | # define const /* note: need a more gentle solution here */ | ||
| 125 | # endif | ||
| 126 | #endif | ||
| 127 | |||
| 128 | /* Some Mac compilers merge all .h files incorrectly: */ | ||
| 129 | #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) | ||
| 130 | # define NO_DUMMY_DECL | ||
| 131 | #endif | ||
| 132 | |||
| 133 | /* Maximum value for memLevel in deflateInit2 */ | ||
| 134 | #ifndef MAX_MEM_LEVEL | ||
| 135 | # ifdef MAXSEG_64K | ||
| 136 | # define MAX_MEM_LEVEL 8 | ||
| 137 | # else | ||
| 138 | # define MAX_MEM_LEVEL 9 | ||
| 139 | # endif | ||
| 140 | #endif | ||
| 141 | |||
| 142 | /* Maximum value for windowBits in deflateInit2 and inflateInit2. | ||
| 143 | * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files | ||
| 144 | * created by gzip. (Files created by minigzip can still be extracted by | ||
| 145 | * gzip.) | ||
| 146 | */ | ||
| 147 | #ifndef MAX_WBITS | ||
| 148 | # define MAX_WBITS 15 /* 32K LZ77 window */ | ||
| 149 | #endif | ||
| 150 | |||
| 151 | /* The memory requirements for deflate are (in bytes): | ||
| 152 | (1 << (windowBits+2)) + (1 << (memLevel+9)) | ||
| 153 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) | ||
| 154 | plus a few kilobytes for small objects. For example, if you want to reduce | ||
| 155 | the default memory requirements from 256K to 128K, compile with | ||
| 156 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" | ||
| 157 | Of course this will generally degrade compression (there's no free lunch). | ||
| 158 | |||
| 159 | The memory requirements for inflate are (in bytes) 1 << windowBits | ||
| 160 | that is, 32K for windowBits=15 (default value) plus a few kilobytes | ||
| 161 | for small objects. | ||
| 162 | */ | ||
| 163 | |||
| 164 | /* Type declarations */ | ||
| 165 | |||
| 166 | #ifndef OF /* function prototypes */ | ||
| 167 | # ifdef STDC | ||
| 168 | # define OF(args) args | ||
| 169 | # else | ||
| 170 | # define OF(args) () | ||
| 171 | # endif | ||
| 172 | #endif | ||
| 173 | |||
| 174 | /* The following definitions for FAR are needed only for MSDOS mixed | ||
| 175 | * model programming (small or medium model with some far allocations). | ||
| 176 | * This was tested only with MSC; for other MSDOS compilers you may have | ||
| 177 | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, | ||
| 178 | * just define FAR to be empty. | ||
| 179 | */ | ||
| 180 | #ifdef SYS16BIT | ||
| 181 | # if defined(M_I86SM) || defined(M_I86MM) | ||
| 182 | /* MSC small or medium model */ | ||
| 183 | # define SMALL_MEDIUM | ||
| 184 | # ifdef _MSC_VER | ||
| 185 | # define FAR _far | ||
| 186 | # else | ||
| 187 | # define FAR far | ||
| 188 | # endif | ||
| 189 | # endif | ||
| 190 | # if (defined(__SMALL__) || defined(__MEDIUM__)) | ||
| 191 | /* Turbo C small or medium model */ | ||
| 192 | # define SMALL_MEDIUM | ||
| 193 | # ifdef __BORLANDC__ | ||
| 194 | # define FAR _far | ||
| 195 | # else | ||
| 196 | # define FAR far | ||
| 197 | # endif | ||
| 198 | # endif | ||
| 199 | #endif | ||
| 200 | |||
| 201 | #if defined(WINDOWS) || defined(WIN32) | ||
| 202 | /* If building or using zlib as a DLL, define ZLIB_DLL. | ||
| 203 | * This is not mandatory, but it offers a little performance increase. | ||
| 204 | */ | ||
| 205 | # ifdef ZLIB_DLL | ||
| 206 | # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) | ||
| 207 | # ifdef ZLIB_INTERNAL | ||
| 208 | # define ZEXTERN extern __declspec(dllexport) | ||
| 209 | # else | ||
| 210 | # define ZEXTERN extern __declspec(dllimport) | ||
| 211 | # endif | ||
| 212 | # endif | ||
| 213 | # endif /* ZLIB_DLL */ | ||
| 214 | /* If building or using zlib with the WINAPI/WINAPIV calling convention, | ||
| 215 | * define ZLIB_WINAPI. | ||
| 216 | * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. | ||
| 217 | */ | ||
| 218 | # ifdef ZLIB_WINAPI | ||
| 219 | # ifdef FAR | ||
| 220 | # undef FAR | ||
| 221 | # endif | ||
| 222 | # include <windows.h> | ||
| 223 | /* No need for _export, use ZLIB.DEF instead. */ | ||
| 224 | /* For complete Windows compatibility, use WINAPI, not __stdcall. */ | ||
| 225 | # define ZEXPORT WINAPI | ||
| 226 | # ifdef WIN32 | ||
| 227 | # define ZEXPORTVA WINAPIV | ||
| 228 | # else | ||
| 229 | # define ZEXPORTVA FAR CDECL | ||
| 230 | # endif | ||
| 231 | # endif | ||
| 232 | #endif | ||
| 233 | |||
| 234 | #if defined (__BEOS__) | ||
| 235 | # ifdef ZLIB_DLL | ||
| 236 | # ifdef ZLIB_INTERNAL | ||
| 237 | # define ZEXPORT __declspec(dllexport) | ||
| 238 | # define ZEXPORTVA __declspec(dllexport) | ||
| 239 | # else | ||
| 240 | # define ZEXPORT __declspec(dllimport) | ||
| 241 | # define ZEXPORTVA __declspec(dllimport) | ||
| 242 | # endif | ||
| 243 | # endif | ||
| 244 | #endif | ||
| 245 | |||
| 246 | #ifndef ZEXTERN | ||
| 247 | # define ZEXTERN extern | ||
| 248 | #endif | ||
| 249 | #ifndef ZEXPORT | ||
| 250 | # define ZEXPORT | ||
| 251 | #endif | ||
| 252 | #ifndef ZEXPORTVA | ||
| 253 | # define ZEXPORTVA | ||
| 254 | #endif | ||
| 255 | |||
| 256 | #ifndef FAR | ||
| 257 | # define FAR | ||
| 258 | #endif | ||
| 259 | |||
| 260 | #if !defined(__MACTYPES__) | ||
| 261 | typedef unsigned char Byte; /* 8 bits */ | ||
| 262 | #endif | ||
| 263 | typedef unsigned int uInt; /* 16 bits or more */ | ||
| 264 | typedef unsigned long uLong; /* 32 bits or more */ | ||
| 265 | |||
| 266 | #ifdef SMALL_MEDIUM | ||
| 267 | /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ | ||
| 268 | # define Bytef Byte FAR | ||
| 269 | #else | ||
| 270 | typedef Byte FAR Bytef; | ||
| 271 | #endif | ||
| 272 | typedef char FAR charf; | ||
| 273 | typedef int FAR intf; | ||
| 274 | typedef uInt FAR uIntf; | ||
| 275 | typedef uLong FAR uLongf; | ||
| 276 | |||
| 277 | #ifdef STDC | ||
| 278 | typedef void const *voidpc; | ||
| 279 | typedef void FAR *voidpf; | ||
| 280 | typedef void *voidp; | ||
| 281 | #else | ||
| 282 | typedef Byte const *voidpc; | ||
| 283 | typedef Byte FAR *voidpf; | ||
| 284 | typedef Byte *voidp; | ||
| 285 | #endif | ||
| 286 | |||
| 287 | #if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ | ||
| 288 | # include <sys/types.h> /* for off_t */ | ||
| 289 | # include <unistd.h> /* for SEEK_* and off_t */ | ||
| 290 | # ifdef VMS | ||
| 291 | # include <unixio.h> /* for off_t */ | ||
| 292 | # endif | ||
| 293 | # define z_off_t off_t | ||
| 294 | #endif | ||
| 295 | #ifndef SEEK_SET | ||
| 296 | # define SEEK_SET 0 /* Seek from beginning of file. */ | ||
| 297 | # define SEEK_CUR 1 /* Seek from current position. */ | ||
| 298 | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ | ||
| 299 | #endif | ||
| 300 | #ifndef z_off_t | ||
| 301 | # define z_off_t long | ||
| 302 | #endif | ||
| 303 | |||
| 304 | #if defined(__OS400__) | ||
| 305 | # define NO_vsnprintf | ||
| 306 | #endif | ||
| 307 | |||
| 308 | #if defined(__MVS__) | ||
| 309 | # define NO_vsnprintf | ||
| 310 | # ifdef FAR | ||
| 311 | # undef FAR | ||
| 312 | # endif | ||
| 313 | #endif | ||
| 314 | |||
| 315 | /* MVS linker does not support external names larger than 8 bytes */ | ||
| 316 | #if defined(__MVS__) | ||
| 317 | # pragma map(deflateInit_,"DEIN") | ||
| 318 | # pragma map(deflateInit2_,"DEIN2") | ||
| 319 | # pragma map(deflateEnd,"DEEND") | ||
| 320 | # pragma map(deflateBound,"DEBND") | ||
| 321 | # pragma map(inflateInit_,"ININ") | ||
| 322 | # pragma map(inflateInit2_,"ININ2") | ||
| 323 | # pragma map(inflateEnd,"INEND") | ||
| 324 | # pragma map(inflateSync,"INSY") | ||
| 325 | # pragma map(inflateSetDictionary,"INSEDI") | ||
| 326 | # pragma map(compressBound,"CMBND") | ||
| 327 | # pragma map(inflate_table,"INTABL") | ||
| 328 | # pragma map(inflate_fast,"INFA") | ||
| 329 | # pragma map(inflate_copyright,"INCOPY") | ||
| 330 | #endif | ||
| 331 | |||
| 332 | #endif /* ZCONF_H */ | ||
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c index e12da4c..698dcec 100644 --- a/contrib/minizip/zip.c +++ b/contrib/minizip/zip.c | |||
| @@ -73,7 +73,7 @@ | |||
| 73 | 73 | ||
| 74 | 74 | ||
| 75 | // NOT sure that this work on ALL platform | 75 | // NOT sure that this work on ALL platform |
| 76 | #define MAKEULONG64(a, b) ((ZPOS64_T)(((unsigned long)(a)) | ((ZPOS64_T)((unsigned long)(b))) << 32)) | 76 | #define MAKEULONG64(a, b) ((ZPOS64_T)(((unsigned long)(a)) | ((ZPOS64_T)((unsigned long)(b))) << 32)) |
| 77 | 77 | ||
| 78 | #ifndef SEEK_CUR | 78 | #ifndef SEEK_CUR |
| 79 | #define SEEK_CUR 1 | 79 | #define SEEK_CUR 1 |
| @@ -759,7 +759,7 @@ int LoadCentralDirectoryRecord(zip64_internal* pziinit) | |||
| 759 | number_entry_CD = 0; | 759 | number_entry_CD = 0; |
| 760 | if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &uL)!=ZIP_OK) | 760 | if (zip64local_getShort(&pziinit->z_filefunc, pziinit->filestream, &uL)!=ZIP_OK) |
| 761 | err=ZIP_ERRNO; | 761 | err=ZIP_ERRNO; |
| 762 | else | 762 | else |
| 763 | number_entry_CD = uL; | 763 | number_entry_CD = uL; |
| 764 | 764 | ||
| 765 | if ((number_entry_CD!=number_entry) || (number_disk_with_CD!=0) || (number_disk!=0)) | 765 | if ((number_entry_CD!=number_entry) || (number_disk_with_CD!=0) || (number_disk!=0)) |
| @@ -1021,7 +1021,7 @@ int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_ex | |||
| 1021 | err = ZIP_ERRNO; | 1021 | err = ZIP_ERRNO; |
| 1022 | } | 1022 | } |
| 1023 | 1023 | ||
| 1024 | 1024 | ||
| 1025 | if ((err==ZIP_OK) && (zi->ci.zip64)) | 1025 | if ((err==ZIP_OK) && (zi->ci.zip64)) |
| 1026 | { | 1026 | { |
| 1027 | // write the Zip64 extended info | 1027 | // write the Zip64 extended info |
| @@ -1035,7 +1035,7 @@ int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_ex | |||
| 1035 | 1035 | ||
| 1036 | err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)HeaderID,2); | 1036 | err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)HeaderID,2); |
| 1037 | err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)DataSize,2); | 1037 | err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (short)DataSize,2); |
| 1038 | 1038 | ||
| 1039 | err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8); | 1039 | err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)UncompressedSize,8); |
| 1040 | err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8); | 1040 | err = zip64local_putValue(&zi->z_filefunc, zi->filestream, (ZPOS64_T)CompressedSize,8); |
| 1041 | } | 1041 | } |
| @@ -1044,11 +1044,11 @@ int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_ex | |||
| 1044 | } | 1044 | } |
| 1045 | 1045 | ||
| 1046 | /* | 1046 | /* |
| 1047 | NOTE. | 1047 | NOTE. |
| 1048 | When writing RAW the ZIP64 extended information in extrafield_local and extrafield_global needs to be stripped | 1048 | When writing RAW the ZIP64 extended information in extrafield_local and extrafield_global needs to be stripped |
| 1049 | before calling this function it can be done with zipRemoveExtraInfoBlock | 1049 | before calling this function it can be done with zipRemoveExtraInfoBlock |
| 1050 | 1050 | ||
| 1051 | It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize | 1051 | It is not done here because then we need to realloc a new buffer since parameters are 'const' and I want to minimize |
| 1052 | unnecessary allocations. | 1052 | unnecessary allocations. |
| 1053 | */ | 1053 | */ |
| 1054 | extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, const zip_fileinfo* zipfi, | 1054 | extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, const zip_fileinfo* zipfi, |
| @@ -1106,7 +1106,7 @@ extern int ZEXPORT zipOpenNewFileInZip4_64 (zipFile file, const char* filename, | |||
| 1106 | { | 1106 | { |
| 1107 | if (zipfi->dosDate != 0) | 1107 | if (zipfi->dosDate != 0) |
| 1108 | zi->ci.dosDate = zipfi->dosDate; | 1108 | zi->ci.dosDate = zipfi->dosDate; |
| 1109 | else | 1109 | else |
| 1110 | zi->ci.dosDate = zip64local_TmzDateToDosDate(&zipfi->tmz_date); | 1110 | zi->ci.dosDate = zip64local_TmzDateToDosDate(&zipfi->tmz_date); |
| 1111 | } | 1111 | } |
| 1112 | 1112 | ||
| @@ -1305,7 +1305,7 @@ extern int ZEXPORT zipOpenNewFileInZip3_64(zipFile file, const char* filename, c | |||
| 1305 | windowBits, memLevel, strategy, | 1305 | windowBits, memLevel, strategy, |
| 1306 | password, crcForCrypting, VERSIONMADEBY, 0, zip64); | 1306 | password, crcForCrypting, VERSIONMADEBY, 0, zip64); |
| 1307 | } | 1307 | } |
| 1308 | 1308 | ||
| 1309 | extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi, | 1309 | extern int ZEXPORT zipOpenNewFileInZip2(zipFile file, const char* filename, const zip_fileinfo* zipfi, |
| 1310 | const void* extrafield_local, uInt size_extrafield_local, | 1310 | const void* extrafield_local, uInt size_extrafield_local, |
| 1311 | const void* extrafield_global, uInt size_extrafield_global, | 1311 | const void* extrafield_global, uInt size_extrafield_global, |
| @@ -1393,7 +1393,7 @@ local int zip64FlushWriteBuffer(zip64_internal* zi) | |||
| 1393 | 1393 | ||
| 1394 | 1394 | ||
| 1395 | zi->ci.pos_in_buffered_data = 0; | 1395 | zi->ci.pos_in_buffered_data = 0; |
| 1396 | 1396 | ||
| 1397 | return err; | 1397 | return err; |
| 1398 | } | 1398 | } |
| 1399 | 1399 | ||
| @@ -1581,7 +1581,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s | |||
| 1581 | if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) | 1581 | if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) |
| 1582 | { | 1582 | { |
| 1583 | int tmp_err = deflateEnd(&zi->ci.stream); | 1583 | int tmp_err = deflateEnd(&zi->ci.stream); |
| 1584 | if (err == ZIP_OK) | 1584 | if (err == ZIP_OK) |
| 1585 | err = tmp_err; | 1585 | err = tmp_err; |
| 1586 | zi->ci.stream_initialised = 0; | 1586 | zi->ci.stream_initialised = 0; |
| 1587 | } | 1587 | } |
| @@ -1589,7 +1589,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s | |||
| 1589 | else if((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw)) | 1589 | else if((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw)) |
| 1590 | { | 1590 | { |
| 1591 | int tmperr = BZ2_bzCompressEnd(&zi->ci.bstream); | 1591 | int tmperr = BZ2_bzCompressEnd(&zi->ci.bstream); |
| 1592 | if (err==ZIP_OK) | 1592 | if (err==ZIP_OK) |
| 1593 | err = tmperr; | 1593 | err = tmperr; |
| 1594 | zi->ci.stream_initialised = 0; | 1594 | zi->ci.stream_initialised = 0; |
| 1595 | } | 1595 | } |
| @@ -1662,7 +1662,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s | |||
| 1662 | p += 2; | 1662 | p += 2; |
| 1663 | zip64local_putValue_inmemory(p, datasize, 2); // DataSize | 1663 | zip64local_putValue_inmemory(p, datasize, 2); // DataSize |
| 1664 | p += 2; | 1664 | p += 2; |
| 1665 | 1665 | ||
| 1666 | if(uncompressed_size >= 0xffffffff) | 1666 | if(uncompressed_size >= 0xffffffff) |
| 1667 | { | 1667 | { |
| 1668 | zip64local_putValue_inmemory(p, uncompressed_size, 8); | 1668 | zip64local_putValue_inmemory(p, uncompressed_size, 8); |
| @@ -1680,7 +1680,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s | |||
| 1680 | zip64local_putValue_inmemory(p, zi->ci.pos_local_header, 8); | 1680 | zip64local_putValue_inmemory(p, zi->ci.pos_local_header, 8); |
| 1681 | p += 8; | 1681 | p += 8; |
| 1682 | } | 1682 | } |
| 1683 | 1683 | ||
| 1684 | // Update how much extra free space we got in the memory buffer | 1684 | // Update how much extra free space we got in the memory buffer |
| 1685 | // and increase the centralheader size so the new ZIP64 fields are included | 1685 | // and increase the centralheader size so the new ZIP64 fields are included |
| 1686 | // ( 4 below is the size of HeaderID and DataSize field ) | 1686 | // ( 4 below is the size of HeaderID and DataSize field ) |
| @@ -1691,7 +1691,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s | |||
| 1691 | zi->ci.size_centralExtra += datasize + 4; | 1691 | zi->ci.size_centralExtra += datasize + 4; |
| 1692 | zip64local_putValue_inmemory(zi->ci.central_header+30,(uLong)zi->ci.size_centralExtra,2); | 1692 | zip64local_putValue_inmemory(zi->ci.central_header+30,(uLong)zi->ci.size_centralExtra,2); |
| 1693 | } | 1693 | } |
| 1694 | 1694 | ||
| 1695 | if (err==ZIP_OK) | 1695 | if (err==ZIP_OK) |
| 1696 | err = add_data_in_datablock(&zi->central_dir, zi->ci.central_header, (uLong)zi->ci.size_centralheader); | 1696 | err = add_data_in_datablock(&zi->central_dir, zi->ci.central_header, (uLong)zi->ci.size_centralheader); |
| 1697 | 1697 | ||
| @@ -1752,9 +1752,9 @@ int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eo | |||
| 1752 | { | 1752 | { |
| 1753 | int err = ZIP_OK; | 1753 | int err = ZIP_OK; |
| 1754 | ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writting_offset; | 1754 | ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writting_offset; |
| 1755 | 1755 | ||
| 1756 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDLOCHEADERMAGIC,4); | 1756 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ZIP64ENDLOCHEADERMAGIC,4); |
| 1757 | 1757 | ||
| 1758 | /*num disks*/ | 1758 | /*num disks*/ |
| 1759 | if (err==ZIP_OK) /* number of the disk with the start of the central directory */ | 1759 | if (err==ZIP_OK) /* number of the disk with the start of the central directory */ |
| 1760 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); | 1760 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); |
| @@ -1807,12 +1807,12 @@ int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centra | |||
| 1807 | ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset; | 1807 | ZPOS64_T pos = centraldir_pos_inzip - zi->add_position_when_writting_offset; |
| 1808 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (ZPOS64_T)pos,8); | 1808 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (ZPOS64_T)pos,8); |
| 1809 | } | 1809 | } |
| 1810 | return err; | 1810 | return err; |
| 1811 | } | 1811 | } |
| 1812 | int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) | 1812 | int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip) |
| 1813 | { | 1813 | { |
| 1814 | int err = ZIP_OK; | 1814 | int err = ZIP_OK; |
| 1815 | 1815 | ||
| 1816 | /*signature*/ | 1816 | /*signature*/ |
| 1817 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4); | 1817 | err = zip64local_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4); |
| 1818 | 1818 | ||
| @@ -1861,7 +1861,7 @@ int Write_GlobalComment(zip64_internal* zi, const char* global_comment) | |||
| 1861 | { | 1861 | { |
| 1862 | int err = ZIP_OK; | 1862 | int err = ZIP_OK; |
| 1863 | uInt size_global_comment = 0; | 1863 | uInt size_global_comment = 0; |
| 1864 | 1864 | ||
| 1865 | if(global_comment != NULL) | 1865 | if(global_comment != NULL) |
| 1866 | size_global_comment = (uInt)strlen(global_comment); | 1866 | size_global_comment = (uInt)strlen(global_comment); |
| 1867 | 1867 | ||
| @@ -1897,7 +1897,7 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment) | |||
| 1897 | if (global_comment==NULL) | 1897 | if (global_comment==NULL) |
| 1898 | global_comment = zi->globalcomment; | 1898 | global_comment = zi->globalcomment; |
| 1899 | #endif | 1899 | #endif |
| 1900 | 1900 | ||
| 1901 | centraldir_pos_inzip = ZTELL64(zi->z_filefunc,zi->filestream); | 1901 | centraldir_pos_inzip = ZTELL64(zi->z_filefunc,zi->filestream); |
| 1902 | 1902 | ||
| 1903 | if (err==ZIP_OK) | 1903 | if (err==ZIP_OK) |
| @@ -1922,7 +1922,7 @@ extern int ZEXPORT zipClose (zipFile file, const char* global_comment) | |||
| 1922 | { | 1922 | { |
| 1923 | ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream); | 1923 | ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream); |
| 1924 | Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); | 1924 | Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); |
| 1925 | 1925 | ||
| 1926 | Write_Zip64EndOfCentralDirectoryLocator(zi, Zip64EOCDpos); | 1926 | Write_Zip64EndOfCentralDirectoryLocator(zi, Zip64EOCDpos); |
| 1927 | } | 1927 | } |
| 1928 | 1928 | ||
| @@ -1977,7 +1977,7 @@ extern int ZEXPORT zipRemoveExtraInfoBlock (char* pData, int* dataLen, short sHe | |||
| 1977 | p += dataSize + 4; | 1977 | p += dataSize + 4; |
| 1978 | size += dataSize + 4; | 1978 | size += dataSize + 4; |
| 1979 | } | 1979 | } |
| 1980 | 1980 | ||
| 1981 | } | 1981 | } |
| 1982 | 1982 | ||
| 1983 | if(size < *dataLen) | 1983 | if(size < *dataLen) |
diff --git a/contrib/minizip/zip.h b/contrib/minizip/zip.h index a33a52d..5e3a46c 100644 --- a/contrib/minizip/zip.h +++ b/contrib/minizip/zip.h | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | 31 | ||
| 32 | --------------------------------------------------------------------------- | 32 | --------------------------------------------------------------------------- |
| 33 | 33 | ||
| 34 | Changes | 34 | Changes |
| 35 | 35 | ||
| 36 | See header of zip.h | 36 | See header of zip.h |
| 37 | 37 | ||
| @@ -338,13 +338,13 @@ extern int ZEXPORT zipClose OF((zipFile file, | |||
| 338 | 338 | ||
| 339 | 339 | ||
| 340 | extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader)); | 340 | extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short sHeader)); |
| 341 | /* | 341 | /* |
| 342 | zipRemoveExtraInfoBlock - Added by Mathias Svensson | 342 | zipRemoveExtraInfoBlock - Added by Mathias Svensson |
| 343 | 343 | ||
| 344 | Remove extra information block from a extra information data for the local file header or central directory header | 344 | Remove extra information block from a extra information data for the local file header or central directory header |
| 345 | 345 | ||
| 346 | It is needed to remove ZIP64 extra information blocks when before data is written if using RAW mode. | 346 | It is needed to remove ZIP64 extra information blocks when before data is written if using RAW mode. |
| 347 | 347 | ||
| 348 | 0x0001 is the signature header for the ZIP64 extra information blocks | 348 | 0x0001 is the signature header for the ZIP64 extra information blocks |
| 349 | 349 | ||
| 350 | usage. | 350 | usage. |
