summaryrefslogtreecommitdiff
path: root/contrib/minizip
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:27:26 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:27:26 -0700
commit7751bd4c715ea8478113e34b49b5a794a4642e8e (patch)
tree537ba82b3780f933c2f17028febd6fe3a2332190 /contrib/minizip
parente0ff940e1adb68d3575705ebf1546d9f07ad3b4a (diff)
downloadzlib-1.2.3.9.tar.gz
zlib-1.2.3.9.tar.bz2
zlib-1.2.3.9.zip
zlib 1.2.3.9v1.2.3.9
Diffstat (limited to 'contrib/minizip')
-rw-r--r--contrib/minizip/MiniZip64_Changes.txt2
-rw-r--r--contrib/minizip/MiniZip64_info.txt21
-rw-r--r--contrib/minizip/ioapi.c12
-rw-r--r--contrib/minizip/ioapi.h48
-rw-r--r--contrib/minizip/iowin32.c8
-rw-r--r--contrib/minizip/iowin32.h10
-rw-r--r--contrib/minizip/make_vms.com4
-rw-r--r--contrib/minizip/miniunz.c46
-rw-r--r--contrib/minizip/minizip.c49
-rw-r--r--contrib/minizip/unzip.c106
-rw-r--r--contrib/minizip/unzip.h22
-rw-r--r--contrib/minizip/zip.c67
-rw-r--r--contrib/minizip/zip.h24
13 files changed, 211 insertions, 208 deletions
diff --git a/contrib/minizip/MiniZip64_Changes.txt b/contrib/minizip/MiniZip64_Changes.txt
index 436d8b3..13a1bd9 100644
--- a/contrib/minizip/MiniZip64_Changes.txt
+++ b/contrib/minizip/MiniZip64_Changes.txt
@@ -1,5 +1,5 @@
1 1
2MiniZip64 was derrived from MiniZip at version 1.01f 2MiniZip 1.1 was derrived from MiniZip at version 1.01f
3 3
4Change in 1.0 (Okt 2009) 4Change in 1.0 (Okt 2009)
5 - **TODO - Add history** 5 - **TODO - Add history**
diff --git a/contrib/minizip/MiniZip64_info.txt b/contrib/minizip/MiniZip64_info.txt
index 334b0f0..57d7152 100644
--- a/contrib/minizip/MiniZip64_info.txt
+++ b/contrib/minizip/MiniZip64_info.txt
@@ -1,29 +1,24 @@
1MiniZip64 - Copyright (c) 2009-2010 - Mathias Svensson - Built from MiniZip by Gilles Vollant 1MiniZip - Copyright (c) 1998-2010 - by Gilles Vollant - version 1.1 64 bits from Mathias Svensson
2 2
3Introduction 3Introduction
4--------------------- 4---------------------
5MiniZip64 is built from MiniZip by Gilles Vollant ( http://www.winimage.com/zLibDll/minizip.html ) 5MiniZip 1.1 is built from MiniZip 1.0 by Gilles Vollant ( http://www.winimage.com/zLibDll/minizip.html )
6 6
7When adding ZIP64 support into minizip it would result into breaking compatibility with current minizip. 7When adding ZIP64 support into minizip it would result into risk of breaking compatibility with minizip 1.0.
8And since breaking compatibility in minizip is not wanted. I decided to create a fork of minizip 8All possible work was done for compatibility.
9and create minizip64.
10
11Even though MiniZip64 is build from MiniZip, all functions and struct's have changed name so that it
12would not collide with each other.
13 9
14 10
15Background 11Background
16--------------------- 12---------------------
17When adding ZIP64 support I found that Even Rouault have added ZIP64 support for unzip.c into minizip 13When adding ZIP64 support Mathias Svensson found that Even Rouault have added ZIP64
18for a open source project called gdal ( http://www.gdal.org/ ) 14support for unzip.c into minizip for a open source project called gdal ( http://www.gdal.org/ )
19 15
20That was used as a starting point. And after that ZIP64 support was added to zip.c 16That was used as a starting point. And after that ZIP64 support was added to zip.c
21some refactoring and code cleanup was also done. 17some refactoring and code cleanup was also done.
22 18
23 19
24Changed from MiniZip to MiniZip64 20Changed from MiniZip 1.0 to MiniZip 1.1
25------------------------------------- 21---------------------------------------
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 ) 22* Added ZIP64 support for unzip ( by Even Rouault )
28* Added ZIP64 support for zip ( by Mathias Svensson ) 23* Added ZIP64 support for zip ( by Mathias Svensson )
29* Reverted some changed that Even Rouault did. 24* Reverted some changed that Even Rouault did.
diff --git a/contrib/minizip/ioapi.c b/contrib/minizip/ioapi.c
index a5f1e0b..49958f6 100644
--- a/contrib/minizip/ioapi.c
+++ b/contrib/minizip/ioapi.c
@@ -1,17 +1,17 @@
1/* ioapi.h -- IO base function header for compress/uncompress .zip 1/* ioapi.h -- IO base function header for compress/uncompress .zip
2 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 2 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
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
10 10
11*/ 11*/
12 12
13#if (defined(_WIN32)) 13#if (defined(_WIN32))
14 #define _CRT_SECURE_NO_WARNINGS 14 #define _CRT_SECURE_NO_WARNINGS
15#endif 15#endif
16 16
17#include "ioapi.h" 17#include "ioapi.h"
@@ -189,7 +189,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
189 ret = 0; 189 ret = 0;
190 190
191 if(fseeko64((FILE *)stream, offset, fseek_origin) != 0) 191 if(fseeko64((FILE *)stream, offset, fseek_origin) != 0)
192 ret = -1; 192 ret = -1;
193 193
194 return ret; 194 return ret;
195} 195}
diff --git a/contrib/minizip/ioapi.h b/contrib/minizip/ioapi.h
index 1c7feb0..8309c4c 100644
--- a/contrib/minizip/ioapi.h
+++ b/contrib/minizip/ioapi.h
@@ -1,52 +1,57 @@
1/* ioapi.h -- IO base function header for compress/uncompress .zip 1/* ioapi.h -- IO base function header for compress/uncompress .zip
2 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 2 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
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
10 10
11 Changes 11 Changes
12 12
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*/
20 20
21#ifndef _ZLIBIOAPI64_H 21#ifndef _ZLIBIOAPI64_H
22#define _ZLIBIOAPI64_H 22#define _ZLIBIOAPI64_H
23 23
24#ifndef _WIN32 24#if (!defined(_WIN32)) && (!defined(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.
28 28
29 #ifndef __USE_FILE_OFFSET64 29 #ifndef __USE_FILE_OFFSET64
30 #define __USE_FILE_OFFSET64 30 #define __USE_FILE_OFFSET64
31 #endif 31 #endif
32 #ifndef __USE_LARGEFILE64 32 #ifndef __USE_LARGEFILE64
33 #define __USE_LARGEFILE64 33 #define __USE_LARGEFILE64
34 #endif 34 #endif
35 #ifndef _LARGEFILE64_SOURCE 35 #ifndef _LARGEFILE64_SOURCE
36 #define _LARGEFILE64_SOURCE 36 #define _LARGEFILE64_SOURCE
37 #endif 37 #endif
38 #ifndef _FILE_OFFSET_BIT 38 #ifndef _FILE_OFFSET_BIT
39 #define _FILE_OFFSET_BIT 64 39 #define _FILE_OFFSET_BIT 64
40 #endif 40 #endif
41#endif 41#endif
42 42
43#include <stdio.h> 43#include <stdio.h>
44#include <stdlib.h> 44#include <stdlib.h>
45#include "zlib.h" 45#include "zlib.h"
46 46
47#if defined(USE_FILE32API)
48#define fopen64 fopen
49#define ftello64 ftell
50#define fseeko64 fseek
51#else
47#ifdef _MSC_VER 52#ifdef _MSC_VER
48 #define fopen64 fopen 53 #define fopen64 fopen
49 #if _MSC_VER >= 1400 54 #if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
50 #define ftello64 _ftelli64 55 #define ftello64 _ftelli64
51 #define fseeko64 _fseeki64 56 #define fseeko64 _fseeki64
52 #else // old MSC 57 #else // old MSC
@@ -54,11 +59,12 @@
54 #define fseeko64 fseek 59 #define fseeko64 fseek
55 #endif 60 #endif
56#endif 61#endif
62#endif
57 63
58/* 64/*
59#ifndef ZPOS64_T 65#ifndef ZPOS64_T
60 #ifdef _WIN32 66 #ifdef _WIN32
61 #define ZPOS64_T fpos_t 67 #define ZPOS64_T fpos_t
62 #else 68 #else
63 #include <stdint.h> 69 #include <stdint.h>
64 #define ZPOS64_T uint64_t 70 #define ZPOS64_T uint64_t
diff --git a/contrib/minizip/iowin32.c b/contrib/minizip/iowin32.c
index 43a5715..6a2a883 100644
--- a/contrib/minizip/iowin32.c
+++ b/contrib/minizip/iowin32.c
@@ -1,11 +1,11 @@
1/* iowin32.c -- IO base function header for compress/uncompress .zip 1/* iowin32.c -- IO base function header for compress/uncompress .zip
2 Version 1.1, January 7th, 2010 2 Version 1.1, February 14h, 2010
3 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 3 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
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
11 11
diff --git a/contrib/minizip/iowin32.h b/contrib/minizip/iowin32.h
index 1b6c533..0ca0969 100644
--- a/contrib/minizip/iowin32.h
+++ b/contrib/minizip/iowin32.h
@@ -1,13 +1,13 @@
1/* iowin32.h -- IO base function header for compress/uncompress .zip 1/* iowin32.h -- IO base function header for compress/uncompress .zip
2 Version 1.1, January 7th, 2010 2 Version 1.1, February 14h, 2010
3 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 3 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
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
11 11
12*/ 12*/
13 13
diff --git a/contrib/minizip/make_vms.com b/contrib/minizip/make_vms.com
index 23e1a3a..9ac13a9 100644
--- a/contrib/minizip/make_vms.com
+++ b/contrib/minizip/make_vms.com
@@ -17,9 +17,9 @@ $ 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
19$ link minizip,zip,ioapi,[--]libz.olb/lib 19$ link minizip,zip,ioapi,[--]libz.olb/lib
20$ mcr []minizip test minizip64_info.txt 20$ mcr []minizip test minizip_info.txt
21$ mcr []miniunz -l test.zip 21$ mcr []miniunz -l test.zip
22$ rename minizip64_info.txt; minizip64_info.txt_old 22$ rename minizip_info.txt; minizip_info.txt_old
23$ mcr []miniunz test.zip 23$ mcr []miniunz test.zip
24$ delete test.zip;* 24$ delete test.zip;*
25$exit 25$exit
diff --git a/contrib/minizip/miniunz.c b/contrib/minizip/miniunz.c
index cad8ae2..9ed009f 100644
--- a/contrib/minizip/miniunz.c
+++ b/contrib/minizip/miniunz.c
@@ -1,30 +1,30 @@
1/* 1/*
2 miniunz.c 2 miniunz.c
3 Version 1.1, January 7th, 2010 3 Version 1.1, February 14h, 2010
4 sample part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 4 sample part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
5 5
6 Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 6 Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
7 7
8 Modifications of Unzip for Zip64 8 Modifications of Unzip for Zip64
9 Copyright (C) 2007-2008 Even Rouault 9 Copyright (C) 2007-2008 Even Rouault
10 10
11 Modifications for Zip64 support on both zip and unzip 11 Modifications for Zip64 support on both zip and unzip
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
19 #ifndef __USE_LARGEFILE64 19 #ifndef __USE_LARGEFILE64
20 #define __USE_LARGEFILE64 20 #define __USE_LARGEFILE64
21 #endif 21 #endif
22 #ifndef _LARGEFILE64_SOURCE 22 #ifndef _LARGEFILE64_SOURCE
23 #define _LARGEFILE64_SOURCE 23 #define _LARGEFILE64_SOURCE
24 #endif 24 #endif
25 #ifndef _FILE_OFFSET_BIT 25 #ifndef _FILE_OFFSET_BIT
26 #define _FILE_OFFSET_BIT 64 26 #define _FILE_OFFSET_BIT 64
27 #endif 27 #endif
28#endif 28#endif
29 29
30#include <stdio.h> 30#include <stdio.h>
@@ -133,11 +133,11 @@ int makedir (newdir)
133 return 0; 133 return 0;
134 134
135 buffer = (char*)malloc(len+1); 135 buffer = (char*)malloc(len+1);
136 if (buffer==NULL) 136 if (buffer==NULL)
137 { 137 {
138 printf("Error allocating memory\n"); 138 printf("Error allocating memory\n");
139 return UNZ_INTERNALERROR; 139 return UNZ_INTERNALERROR;
140 } 140 }
141 strcpy(buffer,newdir); 141 strcpy(buffer,newdir);
142 142
143 if (buffer[len-1] == '/') { 143 if (buffer[len-1] == '/') {
diff --git a/contrib/minizip/minizip.c b/contrib/minizip/minizip.c
index ca26091..7a4fa5a 100644
--- a/contrib/minizip/minizip.c
+++ b/contrib/minizip/minizip.c
@@ -1,31 +1,31 @@
1/* 1/*
2 minizip.c 2 minizip.c
3 Version 1.1, January 7th, 2010 3 Version 1.1, February 14h, 2010
4 sample part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 4 sample part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
5 5
6 Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) 6 Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
7 7
8 Modifications of Unzip for Zip64 8 Modifications of Unzip for Zip64
9 Copyright (C) 2007-2008 Even Rouault 9 Copyright (C) 2007-2008 Even Rouault
10 10
11 Modifications for Zip64 support on both zip and unzip 11 Modifications for Zip64 support on both zip and unzip
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 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
20 #ifndef __USE_LARGEFILE64 20 #ifndef __USE_LARGEFILE64
21 #define __USE_LARGEFILE64 21 #define __USE_LARGEFILE64
22 #endif 22 #endif
23 #ifndef _LARGEFILE64_SOURCE 23 #ifndef _LARGEFILE64_SOURCE
24 #define _LARGEFILE64_SOURCE 24 #define _LARGEFILE64_SOURCE
25 #endif 25 #endif
26 #ifndef _FILE_OFFSET_BIT 26 #ifndef _FILE_OFFSET_BIT
27 #define _FILE_OFFSET_BIT 64 27 #define _FILE_OFFSET_BIT 64
28 #endif 28 #endif
29#endif 29#endif
30 30
31#include <stdio.h> 31#include <stdio.h>
@@ -48,8 +48,8 @@
48#include "zip.h" 48#include "zip.h"
49 49
50#ifdef _WIN32 50#ifdef _WIN32
51 #define USEWIN32IOAPI 51 #define USEWIN32IOAPI
52 #include "iowin32.h" 52 #include "iowin32.h"
53#endif 53#endif
54 54
55 55
@@ -152,9 +152,8 @@ int check_exist_file(filename)
152 152
153void do_banner() 153void do_banner()
154{ 154{
155 printf("MiniZip64 1.0, demo of zLib + MiniZip64 package, written by Gilles Vollant\n"); 155 printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n");
156 printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n"); 156 printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n");
157 printf("more info on MiniZip64 at http://result42.com/projects/MiniZip64\n\n");
158} 157}
159 158
160void do_help() 159void do_help()
@@ -220,12 +219,12 @@ int isLargeFile(const char* filename)
220 219
221 pos = ftello64(pFile); 220 pos = ftello64(pFile);
222 221
223 printf("File : %s is %lld bytes\n", filename, pos); 222 printf("File : %s is %lld bytes\n", filename, pos);
224 223
225 if(pos >= 0xffffffff) 224 if(pos >= 0xffffffff)
226 largeFile = 1; 225 largeFile = 1;
227 226
228 fclose(pFile); 227 fclose(pFile);
229 } 228 }
230 229
231 return largeFile; 230 return largeFile;
@@ -409,7 +408,7 @@ int main(argc,argv)
409 408
410 zip64 = isLargeFile(filenameinzip); 409 zip64 = isLargeFile(filenameinzip);
411 410
412 /* The path name saved, should not include a leading slash. */ 411 /* The path name saved, should not include a leading slash. */
413 /*if it did, windows/xp and dynazip couldn't read the zip file. */ 412 /*if it did, windows/xp and dynazip couldn't read the zip file. */
414 savefilenameinzip = filenameinzip; 413 savefilenameinzip = filenameinzip;
415 while( savefilenameinzip[0] == '\\' || savefilenameinzip[0] == '/' ) 414 while( savefilenameinzip[0] == '\\' || savefilenameinzip[0] == '/' )
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c
index 6a4d104..7617f41 100644
--- a/contrib/minizip/unzip.c
+++ b/contrib/minizip/unzip.c
@@ -1,16 +1,16 @@
1/* unzip.c -- IO for uncompress .zip files using zlib 1/* unzip.c -- IO for uncompress .zip files using zlib
2 Version 1.1, January 7th, 2010 2 Version 1.1, February 14h, 2010
3 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 3 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
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 of Unzip for Zip64 7 Modifications of Unzip for Zip64
8 Copyright (C) 2007-2008 Even Rouault 8 Copyright (C) 2007-2008 Even Rouault
9 9
10 Modifications for Zip64 support on both zip and unzip 10 Modifications for Zip64 support on both zip and unzip
11 Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 11 Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
12 12
13 For more info read MiniZip_info.txt 13 For more info read MiniZip_info.txt
14 14
15 15
16 ------------------------------------------------------------------------------------ 16 ------------------------------------------------------------------------------------
@@ -25,39 +25,41 @@
25 If, for some reason, all these files are missing, the Info-ZIP license 25 If, for some reason, all these files are missing, the Info-ZIP license
26 also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 26 also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
27 27
28 crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h] 28 crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h]
29 29
30 The encryption/decryption parts of this source code (as opposed to the 30 The encryption/decryption parts of this source code (as opposed to the
31 non-echoing password parts) were originally written in Europe. The 31 non-echoing password parts) were originally written in Europe. The
32 whole source package can be freely distributed, including from the USA. 32 whole source package can be freely distributed, including from the USA.
33 (Prior to January 2000, re-export from the US was a violation of US law.) 33 (Prior to January 2000, re-export from the US was a violation of US law.)
34 34
35 This encryption code is a direct transcription of the algorithm from 35 This encryption code is a direct transcription of the algorithm from
36 Roger Schlafly, described by Phil Katz in the file appnote.txt. This 36 Roger Schlafly, described by Phil Katz in the file appnote.txt. This
37 file (appnote.txt) is distributed with the PKZIP program (even in the 37 file (appnote.txt) is distributed with the PKZIP program (even in the
38 version without encryption capabilities). 38 version without encryption capabilities).
39 39
40 ------------------------------------------------------------------------------------ 40 ------------------------------------------------------------------------------------
41 41
42 Changes in unzip64.c 42 Changes in unzip.c
43 43
44 2007-2008 - Even Rouault - Addition of cpl_unzGetCurrentFileZStreamPos 44 2007-2008 - Even Rouault - Addition of cpl_unzGetCurrentFileZStreamPos
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 Oct-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 Oct-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 Oct-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 Oct-2009 - Mathias Svensson - Applied support to unzip files with compression mathod BZIP2 (bzip2 lib is required)
58 Patch created by Daniel Borca 58 Patch created by Daniel Borca
59 59
60 Copyright (C) 2009 Mathias Svensson 60 Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
61
62 Copyright (C) 1998 - 2010 Gilles Vollant, Even Rouault, Mathias Svensson
61 63
62*/ 64*/
63 65
@@ -67,7 +69,7 @@
67#include <string.h> 69#include <string.h>
68 70
69#ifndef NOUNCRYPT 71#ifndef NOUNCRYPT
70 #define NOUNCRYPT 72 #define NOUNCRYPT
71#endif 73#endif
72 74
73#include "zlib.h" 75#include "zlib.h"
@@ -482,7 +484,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
482 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */ 484 ZPOS64_T uMaxBack=0xffff; /* maximum size of global comment */
483 ZPOS64_T uPosFound=0; 485 ZPOS64_T uPosFound=0;
484 uLong uL; 486 uLong uL;
485 ZPOS64_T relativeOffset; 487 ZPOS64_T relativeOffset;
486 488
487 if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) 489 if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
488 return 0; 490 return 0;
@@ -957,7 +959,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
957 if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK) 959 if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK)
958 err=UNZ_ERRNO; 960 err=UNZ_ERRNO;
959 961
960 // relative offset of local header 962 // relative offset of local header
961 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) 963 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
962 err=UNZ_ERRNO; 964 err=UNZ_ERRNO;
963 file_info_internal.offset_curfile = uL; 965 file_info_internal.offset_curfile = uL;
@@ -1009,7 +1011,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
1009 1011
1010 if ((err==UNZ_OK) && (file_info.size_file_extra != 0)) 1012 if ((err==UNZ_OK) && (file_info.size_file_extra != 0))
1011 { 1013 {
1012 uLong acc = 0; 1014 uLong acc = 0;
1013 1015
1014 // since lSeek now points to after the extra field we need to move back 1016 // since lSeek now points to after the extra field we need to move back
1015 lSeek -= file_info.size_file_extra; 1017 lSeek -= file_info.size_file_extra;
@@ -1025,7 +1027,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
1025 while(acc < file_info.size_file_extra) 1027 while(acc < file_info.size_file_extra)
1026 { 1028 {
1027 uLong headerId; 1029 uLong headerId;
1028 uLong dataSize; 1030 uLong dataSize;
1029 1031
1030 if (unz64local_getShort(&s->z_filefunc, s->filestream,&headerId) != UNZ_OK) 1032 if (unz64local_getShort(&s->z_filefunc, s->filestream,&headerId) != UNZ_OK)
1031 err=UNZ_ERRNO; 1033 err=UNZ_ERRNO;
@@ -1036,33 +1038,33 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
1036 /* ZIP64 extra fields */ 1038 /* ZIP64 extra fields */
1037 if (headerId == 0x0001) 1039 if (headerId == 0x0001)
1038 { 1040 {
1039 uLong uL; 1041 uLong uL;
1040 1042
1041 if(file_info.uncompressed_size == (ZPOS64_T)(unsigned long)-1) 1043 if(file_info.uncompressed_size == (ZPOS64_T)(unsigned long)-1)
1042 { 1044 {
1043 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK) 1045 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
1044 err=UNZ_ERRNO; 1046 err=UNZ_ERRNO;
1045 } 1047 }
1046 1048
1047 if(file_info.compressed_size == (ZPOS64_T)(unsigned long)-1) 1049 if(file_info.compressed_size == (ZPOS64_T)(unsigned long)-1)
1048 { 1050 {
1049 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK) 1051 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
1050 err=UNZ_ERRNO; 1052 err=UNZ_ERRNO;
1051 } 1053 }
1052 1054
1053 if(file_info_internal.offset_curfile == (ZPOS64_T)(unsigned long)-1) 1055 if(file_info_internal.offset_curfile == (ZPOS64_T)(unsigned long)-1)
1054 { 1056 {
1055 /* Relative Header offset */ 1057 /* Relative Header offset */
1056 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK) 1058 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
1057 err=UNZ_ERRNO; 1059 err=UNZ_ERRNO;
1058 } 1060 }
1059 1061
1060 if(file_info.disk_num_start == (unsigned long)-1) 1062 if(file_info.disk_num_start == (unsigned long)-1)
1061 { 1063 {
1062 /* Disk Start Number */ 1064 /* Disk Start Number */
1063 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) 1065 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
1064 err=UNZ_ERRNO; 1066 err=UNZ_ERRNO;
1065 } 1067 }
1066 1068
1067 } 1069 }
1068 else 1070 else
@@ -1608,7 +1610,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
1608 pfile_in_zip_read_info->stream.avail_in = (uInt)0; 1610 pfile_in_zip_read_info->stream.avail_in = (uInt)0;
1609 1611
1610 s->pfile_in_zip_read = pfile_in_zip_read_info; 1612 s->pfile_in_zip_read = pfile_in_zip_read_info;
1611 s->encrypted = 0; 1613 s->encrypted = 0;
1612 1614
1613# ifndef NOUNCRYPT 1615# ifndef NOUNCRYPT
1614 if (password != NULL) 1616 if (password != NULL)
@@ -2051,7 +2053,7 @@ extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uS
2051 unz64_s* s; 2053 unz64_s* s;
2052 uLong uReadThis ; 2054 uLong uReadThis ;
2053 if (file==NULL) 2055 if (file==NULL)
2054 return (uLong)UNZ_PARAMERROR; 2056 return (int)UNZ_PARAMERROR;
2055 s=(unz64_s*)file; 2057 s=(unz64_s*)file;
2056 2058
2057 uReadThis = uSizeBuf; 2059 uReadThis = uSizeBuf;
diff --git a/contrib/minizip/unzip.h b/contrib/minizip/unzip.h
index da7fb61..3183968 100644
--- a/contrib/minizip/unzip.h
+++ b/contrib/minizip/unzip.h
@@ -1,20 +1,20 @@
1/* unzip.h -- IO for uncompress .zip files using zlib 1/* unzip.h -- IO for uncompress .zip files using zlib
2 Version 1.1, January 7th, 2010 2 Version 1.1, February 14h, 2010
3 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 3 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
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 of Unzip for Zip64 7 Modifications of Unzip for Zip64
8 Copyright (C) 2007-2008 Even Rouault 8 Copyright (C) 2007-2008 Even Rouault
9 9
10 Modifications for Zip64 support on both zip and unzip 10 Modifications for Zip64 support on both zip and unzip
11 Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) 11 Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
12 12
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
20 warranty. In no event will the authors be held liable for any damages 20 warranty. In no event will the authors be held liable for any damages
@@ -34,9 +34,9 @@
34 34
35 --------------------------------------------------------------------------------- 35 ---------------------------------------------------------------------------------
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/zip.c b/contrib/minizip/zip.c
index 698dcec..3c34fc8 100644
--- a/contrib/minizip/zip.c
+++ b/contrib/minizip/zip.c
@@ -1,22 +1,23 @@
1/* zip.c -- IO on .zip files using zlib 1/* zip.c -- IO on .zip files using zlib
2 Version 1.1, January 7th, 2010 2 Version 1.1, February 14h, 2010
3 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 3 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
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
11 11
12 Changes 12 Changes
13 Okt-2009 - Mathias Svensson - Remove old C style function prototypes 13 Oct-2009 - Mathias Svensson - Remove old C style function prototypes
14 Okt-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives 14 Oct-2009 - Mathias Svensson - Added Zip64 Support when creating new file archives
15 Okt-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions. 15 Oct-2009 - Mathias Svensson - Did some code cleanup and refactoring to get better overview of some functions.
16 Okt-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data 16 Oct-2009 - Mathias Svensson - Added zipRemoveExtraInfoBlock to strip extra field data from its ZIP64 data
17 It is used when recreting zip archive with RAW when deleting items from a zip. 17 It is used when recreting zip archive with RAW when deleting items from a zip.
18 ZIP64 data is automaticly added to items that needs it, and existing ZIP64 data need to be removed. 18 ZIP64 data is automaticly added to items that needs it, and existing ZIP64 data need to be removed.
19 Okt-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required) 19 Oct-2009 - Mathias Svensson - Added support for BZIP2 as compression mode (bzip2 lib is required)
20 Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
20 21
21*/ 22*/
22 23
@@ -1526,22 +1527,22 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
1526 zi->ci.stream.avail_in = 0; 1527 zi->ci.stream.avail_in = 0;
1527 1528
1528 if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) 1529 if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
1529 { 1530 {
1530 while (err==ZIP_OK) 1531 while (err==ZIP_OK)
1531 { 1532 {
1532 uLong uTotalOutBefore; 1533 uLong uTotalOutBefore;
1533 if (zi->ci.stream.avail_out == 0) 1534 if (zi->ci.stream.avail_out == 0)
1534 { 1535 {
1535 if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO) 1536 if (zip64FlushWriteBuffer(zi) == ZIP_ERRNO)
1536 err = ZIP_ERRNO; 1537 err = ZIP_ERRNO;
1537 zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; 1538 zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
1538 zi->ci.stream.next_out = zi->ci.buffered_data; 1539 zi->ci.stream.next_out = zi->ci.buffered_data;
1539 } 1540 }
1540 uTotalOutBefore = zi->ci.stream.total_out; 1541 uTotalOutBefore = zi->ci.stream.total_out;
1541 err=deflate(&zi->ci.stream, Z_FINISH); 1542 err=deflate(&zi->ci.stream, Z_FINISH);
1542 zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ; 1543 zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
1543 } 1544 }
1544 } 1545 }
1545 else if ((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw)) 1546 else if ((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw))
1546 { 1547 {
1547#ifdef HAVE_BZIP2 1548#ifdef HAVE_BZIP2
@@ -1573,10 +1574,10 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
1573 err=ZIP_OK; /* this is normal */ 1574 err=ZIP_OK; /* this is normal */
1574 1575
1575 if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK)) 1576 if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK))
1576 { 1577 {
1577 if (zip64FlushWriteBuffer(zi)==ZIP_ERRNO) 1578 if (zip64FlushWriteBuffer(zi)==ZIP_ERRNO)
1578 err = ZIP_ERRNO; 1579 err = ZIP_ERRNO;
1579 } 1580 }
1580 1581
1581 if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) 1582 if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
1582 { 1583 {
@@ -1589,9 +1590,9 @@ extern int ZEXPORT zipCloseFileInZipRaw64 (zipFile file, ZPOS64_T uncompressed_s
1589 else if((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw)) 1590 else if((zi->ci.method == Z_BZIP2ED) && (!zi->ci.raw))
1590 { 1591 {
1591 int tmperr = BZ2_bzCompressEnd(&zi->ci.bstream); 1592 int tmperr = BZ2_bzCompressEnd(&zi->ci.bstream);
1592 if (err==ZIP_OK) 1593 if (err==ZIP_OK)
1593 err = tmperr; 1594 err = tmperr;
1594 zi->ci.stream_initialised = 0; 1595 zi->ci.stream_initialised = 0;
1595 } 1596 }
1596#endif 1597#endif
1597 1598
@@ -1851,7 +1852,7 @@ int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir,
1851 err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)0xffffffff,4); 1852 err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)0xffffffff,4);
1852 } 1853 }
1853 else 1854 else
1854 err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writting_offset),4); 1855 err = zip64local_putValue(&zi->z_filefunc,zi->filestream, (uLong)(centraldir_pos_inzip - zi->add_position_when_writting_offset),4);
1855 } 1856 }
1856 1857
1857 return err; 1858 return err;
diff --git a/contrib/minizip/zip.h b/contrib/minizip/zip.h
index 5e3a46c..8aaebb6 100644
--- a/contrib/minizip/zip.h
+++ b/contrib/minizip/zip.h
@@ -1,15 +1,15 @@
1/* zip.h -- IO on .zip files using zlib 1/* zip.h -- IO on .zip files using zlib
2 Version 1.1, January 7th, 2010 2 Version 1.1, February 14h, 2010
3 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) 3 part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
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
11 11
12 --------------------------------------------------------------------------- 12 ---------------------------------------------------------------------------
13 13
14 Condition of use and distribution are the same than zlib : 14 Condition of use and distribution are the same than zlib :
15 15
@@ -29,11 +29,11 @@
29 misrepresented as being the original software. 29 misrepresented as being the original software.
30 3. This notice may not be removed or altered from any source distribution. 30 3. This notice may not be removed or altered from any source distribution.
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
38*/ 38*/
39 39
@@ -348,10 +348,10 @@ extern int ZEXPORT zipRemoveExtraInfoBlock OF((char* pData, int* dataLen, short
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.
351 Remove ZIP64 Extra information from a central director extra field data 351 Remove ZIP64 Extra information from a central director extra field data
352 zipRemoveExtraInfoBlock(pCenDirExtraFieldData, &nCenDirExtraFieldDataLen, 0x0001); 352 zipRemoveExtraInfoBlock(pCenDirExtraFieldData, &nCenDirExtraFieldDataLen, 0x0001);
353 353
354 Remove ZIP64 Extra information from a Local File Header extra field data 354 Remove ZIP64 Extra information from a Local File Header extra field data
355 zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001); 355 zipRemoveExtraInfoBlock(pLocalHeaderExtraFieldData, &nLocalHeaderExtraFieldDataLen, 0x0001);
356*/ 356*/
357 357