summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Makefile2
-rw-r--r--Makefile.in2
-rw-r--r--README4
-rw-r--r--amiga/Makefile.sas2
-rw-r--r--as400/compile.clp2
-rw-r--r--as400/readme.txt2
-rw-r--r--as400/zlib.inc6
-rw-r--r--contrib/asm586/match.S728
-rw-r--r--contrib/asm686/match.S658
-rw-r--r--contrib/delphi/ZLib.pas2
-rw-r--r--contrib/dotzlib/DotZLib/UnitTests.cs2
-rw-r--r--contrib/infback9/inftree9.c6
-rw-r--r--contrib/infback9/inftree9.h8
-rw-r--r--contrib/masmx64/gvmat64.asm159
-rw-r--r--contrib/masmx64/gvmat64.objbin4155 -> 4119 bytes
-rw-r--r--contrib/masmx86/gvmat32.obj (renamed from contrib/vstudio/vc7/gvmat32.obj)bin10241 -> 10241 bytes
-rw-r--r--contrib/masmx86/inffas32.obj (renamed from contrib/vstudio/vc7/inffas32.obj)bin14893 -> 14893 bytes
-rw-r--r--contrib/minizip/ChangeLogUnzip134
-rw-r--r--contrib/minizip/Makefile50
-rw-r--r--contrib/minizip/crypt.h264
-rw-r--r--contrib/minizip/ioapi.c354
-rw-r--r--contrib/minizip/ioapi.h150
-rw-r--r--contrib/minizip/iowin32.c540
-rw-r--r--contrib/minizip/iowin32.h42
-rw-r--r--contrib/minizip/miniunz.c1170
-rw-r--r--contrib/minizip/minizip.c840
-rw-r--r--contrib/minizip/mztools.c562
-rw-r--r--contrib/minizip/mztools.h62
-rw-r--r--contrib/minizip/unzip.c3196
-rw-r--r--contrib/minizip/unzip.h708
-rw-r--r--contrib/minizip/zip.c2438
-rw-r--r--contrib/minizip/zip.h470
-rw-r--r--contrib/pascal/zlibpas.pas2
-rw-r--r--contrib/testzlib/rdtsc64.asm18
-rw-r--r--contrib/testzlib/rdtsc64.objbin744 -> 0 bytes
-rw-r--r--contrib/testzlib/testzlib.c33
-rw-r--r--contrib/testzlib/testzlib.sln21
-rw-r--r--contrib/testzlib/testzlib8.sln32
-rw-r--r--contrib/vstudio/readme.txt40
-rw-r--r--contrib/vstudio/vc7/miniunz.vcproj6
-rw-r--r--contrib/vstudio/vc7/minizip.vcproj6
-rw-r--r--contrib/vstudio/vc7/testzlib.vcproj (renamed from contrib/testzlib/testzlib.vcproj)10
-rw-r--r--contrib/vstudio/vc7/zlib.rc6
-rw-r--r--contrib/vstudio/vc7/zlibstat.vcproj38
-rw-r--r--contrib/vstudio/vc7/zlibvc.def4
-rw-r--r--contrib/vstudio/vc7/zlibvc.sln12
-rw-r--r--contrib/vstudio/vc7/zlibvc.vcproj75
-rw-r--r--contrib/vstudio/vc8/miniunz.vcproj566
-rw-r--r--contrib/vstudio/vc8/minizip.vcproj563
-rw-r--r--contrib/vstudio/vc8/testzlib.vcproj948
-rw-r--r--contrib/vstudio/vc8/testzlibdll.vcproj (renamed from contrib/testzlib/testzlib8.vcproj)347
-rw-r--r--contrib/vstudio/vc8/zlib.rc32
-rw-r--r--contrib/vstudio/vc8/zlibstat.vcproj870
-rw-r--r--contrib/vstudio/vc8/zlibvc.def92
-rw-r--r--contrib/vstudio/vc8/zlibvc.sln144
-rw-r--r--contrib/vstudio/vc8/zlibvc.vcproj1219
-rw-r--r--deflate.c2
-rw-r--r--inftrees.c4
-rw-r--r--make_vms.com68
-rw-r--r--old/Makefile.riscos18
-rw-r--r--qnx/package.qpg16
-rw-r--r--win32/zlib1.rc8
-rw-r--r--zlib.34
-rw-r--r--zlib.h6
65 files changed, 11095 insertions, 6683 deletions
diff --git a/ChangeLog b/ChangeLog
index 105a7cb..7f6869d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
1 1
2 ChangeLog file for zlib 2 ChangeLog file for zlib
3 3
4Changes in 1.2.3 (18 July 2005)
5- Apply security vulnerability fixes to contrib/infback9 as well
6- Clean up some text files (carriage returns, trailing space)
7- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant]
8
4Changes in 1.2.2.4 (11 July 2005) 9Changes in 1.2.2.4 (11 July 2005)
5- Add inflatePrime() function for starting inflation at bit boundary 10- Add inflatePrime() function for starting inflation at bit boundary
6- Avoid some Visual C warnings in deflate.c 11- Avoid some Visual C warnings in deflate.c
diff --git a/Makefile b/Makefile
index 26f63cd..2fd6e45 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ CPP=$(CC) -E
30 30
31LIBS=libz.a 31LIBS=libz.a
32SHAREDLIB=libz.so 32SHAREDLIB=libz.so
33SHAREDLIBV=libz.so.1.2.2.4 33SHAREDLIBV=libz.so.1.2.3
34SHAREDLIBM=libz.so.1 34SHAREDLIBM=libz.so.1
35 35
36AR=ar rc 36AR=ar rc
diff --git a/Makefile.in b/Makefile.in
index 26f63cd..2fd6e45 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -30,7 +30,7 @@ CPP=$(CC) -E
30 30
31LIBS=libz.a 31LIBS=libz.a
32SHAREDLIB=libz.so 32SHAREDLIB=libz.so
33SHAREDLIBV=libz.so.1.2.2.4 33SHAREDLIBV=libz.so.1.2.3
34SHAREDLIBM=libz.so.1 34SHAREDLIBM=libz.so.1
35 35
36AR=ar rc 36AR=ar rc
diff --git a/README b/README
index 3c8e1d4..758cc50 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
1ZLIB DATA COMPRESSION LIBRARY 1ZLIB DATA COMPRESSION LIBRARY
2 2
3zlib 1.2.2.4 is a general purpose data compression library. All the code is 3zlib 1.2.3 is a general purpose data compression library. All the code is
4thread safe. The data format used by the zlib library is described by RFCs 4thread safe. The data format used by the zlib library is described by RFCs
5(Request for Comments) 1950 to 1952 in the files 5(Request for Comments) 1950 to 1952 in the files
6http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) 6http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
@@ -33,7 +33,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
33issue of Dr. Dobb's Journal; a copy of the article is available in 33issue of Dr. Dobb's Journal; a copy of the article is available in
34http://dogma.net/markn/articles/zlibtool/zlibtool.htm 34http://dogma.net/markn/articles/zlibtool/zlibtool.htm
35 35
36The changes made in version 1.2.2.4 are documented in the file ChangeLog. 36The changes made in version 1.2.3 are documented in the file ChangeLog.
37 37
38Unsupported third party contributions are provided in directory "contrib". 38Unsupported third party contributions are provided in directory "contrib".
39 39
diff --git a/amiga/Makefile.sas b/amiga/Makefile.sas
index d6842b8..296ef48 100644
--- a/amiga/Makefile.sas
+++ b/amiga/Makefile.sas
@@ -23,7 +23,7 @@ all: SCOPTIONS example minigzip
23check: test 23check: test
24test: all 24test: all
25 example 25 example
26 echo hello world | minigzip | minigzip -d 26 echo hello world | minigzip | minigzip -d
27 27
28install: z.lib 28install: z.lib
29 copy clone zlib.h zconf.h INCLUDE: 29 copy clone zlib.h zconf.h INCLUDE:
diff --git a/as400/compile.clp b/as400/compile.clp
index 3c47bb4..8554951 100644
--- a/as400/compile.clp
+++ b/as400/compile.clp
@@ -118,6 +118,6 @@
118 &MODLIB/INFTREES &MODLIB/TREES + 118 &MODLIB/INFTREES &MODLIB/TREES +
119 &MODLIB/UNCOMPR &MODLIB/ZUTIL) + 119 &MODLIB/UNCOMPR &MODLIB/ZUTIL) +
120 SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) + 120 SRCFILE(&SRCLIB/&CTLFILE) SRCMBR(BNDSRC) +
121 TEXT('ZLIB 1.2.2') TGTRLS(V4R4M0) 121 TEXT('ZLIB 1.2.3') TGTRLS(V4R4M0)
122 122
123 ENDPGM 123 ENDPGM
diff --git a/as400/readme.txt b/as400/readme.txt
index 27ca676..beae13f 100644
--- a/as400/readme.txt
+++ b/as400/readme.txt
@@ -1,4 +1,4 @@
1 ZLIB version 1.2.2 for AS400 installation instructions 1 ZLIB version 1.2.3 for AS400 installation instructions
2 2
3I) From an AS400 *SAVF file: 3I) From an AS400 *SAVF file:
4 4
diff --git a/as400/zlib.inc b/as400/zlib.inc
index 263677d..7bbfb7e 100644
--- a/as400/zlib.inc
+++ b/as400/zlib.inc
@@ -1,7 +1,7 @@
1 * ZLIB.INC - Interface to the general purpose compression library 1 * ZLIB.INC - Interface to the general purpose compression library
2 * 2 *
3 * ILE RPG400 version by Patrick Monnerat, DATASPHERE. 3 * ILE RPG400 version by Patrick Monnerat, DATASPHERE.
4 * Version 1.2.2.4 4 * Version 1.2.3
5 * 5 *
6 * 6 *
7 * WARNING: 7 * WARNING:
@@ -22,8 +22,8 @@
22 * 22 *
23 * Versioning information. 23 * Versioning information.
24 * 24 *
25 D ZLIB_VERSION C '1.2.2.4' 25 D ZLIB_VERSION C '1.2.3'
26 D ZLIB_VERNUM C X'1224' 26 D ZLIB_VERNUM C X'1230'
27 * 27 *
28 * Other equates. 28 * Other equates.
29 * 29 *
diff --git a/contrib/asm586/match.S b/contrib/asm586/match.S
index 371c9a0..0368b35 100644
--- a/contrib/asm586/match.S
+++ b/contrib/asm586/match.S
@@ -1,364 +1,364 @@
1/* match.s -- Pentium-optimized version of longest_match() 1/* match.s -- Pentium-optimized version of longest_match()
2 * Written for zlib 1.1.2 2 * Written for zlib 1.1.2
3 * Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com> 3 * Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com>
4 * 4 *
5 * This is free software; you can redistribute it and/or modify it 5 * This is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License. 6 * under the terms of the GNU General Public License.
7 */ 7 */
8 8
9#ifndef NO_UNDERLINE 9#ifndef NO_UNDERLINE
10#define match_init _match_init 10#define match_init _match_init
11#define longest_match _longest_match 11#define longest_match _longest_match
12#endif 12#endif
13 13
14#define MAX_MATCH (258) 14#define MAX_MATCH (258)
15#define MIN_MATCH (3) 15#define MIN_MATCH (3)
16#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1) 16#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1)
17#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7) 17#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7)
18 18
19/* stack frame offsets */ 19/* stack frame offsets */
20 20
21#define wmask 0 /* local copy of s->wmask */ 21#define wmask 0 /* local copy of s->wmask */
22#define window 4 /* local copy of s->window */ 22#define window 4 /* local copy of s->window */
23#define windowbestlen 8 /* s->window + bestlen */ 23#define windowbestlen 8 /* s->window + bestlen */
24#define chainlenscanend 12 /* high word: current chain len */ 24#define chainlenscanend 12 /* high word: current chain len */
25 /* low word: last bytes sought */ 25 /* low word: last bytes sought */
26#define scanstart 16 /* first two bytes of string */ 26#define scanstart 16 /* first two bytes of string */
27#define scanalign 20 /* dword-misalignment of string */ 27#define scanalign 20 /* dword-misalignment of string */
28#define nicematch 24 /* a good enough match size */ 28#define nicematch 24 /* a good enough match size */
29#define bestlen 28 /* size of best match so far */ 29#define bestlen 28 /* size of best match so far */
30#define scan 32 /* ptr to string wanting match */ 30#define scan 32 /* ptr to string wanting match */
31 31
32#define LocalVarsSize (36) 32#define LocalVarsSize (36)
33/* saved ebx 36 */ 33/* saved ebx 36 */
34/* saved edi 40 */ 34/* saved edi 40 */
35/* saved esi 44 */ 35/* saved esi 44 */
36/* saved ebp 48 */ 36/* saved ebp 48 */
37/* return address 52 */ 37/* return address 52 */
38#define deflatestate 56 /* the function arguments */ 38#define deflatestate 56 /* the function arguments */
39#define curmatch 60 39#define curmatch 60
40 40
41/* Offsets for fields in the deflate_state structure. These numbers 41/* Offsets for fields in the deflate_state structure. These numbers
42 * are calculated from the definition of deflate_state, with the 42 * are calculated from the definition of deflate_state, with the
43 * assumption that the compiler will dword-align the fields. (Thus, 43 * assumption that the compiler will dword-align the fields. (Thus,
44 * changing the definition of deflate_state could easily cause this 44 * changing the definition of deflate_state could easily cause this
45 * program to crash horribly, without so much as a warning at 45 * program to crash horribly, without so much as a warning at
46 * compile time. Sigh.) 46 * compile time. Sigh.)
47 */ 47 */
48 48
49/* All the +zlib1222add offsets are due to the addition of fields 49/* All the +zlib1222add offsets are due to the addition of fields
50 * in zlib in the deflate_state structure since the asm code was first written 50 * in zlib in the deflate_state structure since the asm code was first written
51 * (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). 51 * (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
52 * (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). 52 * (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
53 * if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). 53 * if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
54 */ 54 */
55 55
56#define zlib1222add (8) 56#define zlib1222add (8)
57 57
58#define dsWSize (36+zlib1222add) 58#define dsWSize (36+zlib1222add)
59#define dsWMask (44+zlib1222add) 59#define dsWMask (44+zlib1222add)
60#define dsWindow (48+zlib1222add) 60#define dsWindow (48+zlib1222add)
61#define dsPrev (56+zlib1222add) 61#define dsPrev (56+zlib1222add)
62#define dsMatchLen (88+zlib1222add) 62#define dsMatchLen (88+zlib1222add)
63#define dsPrevMatch (92+zlib1222add) 63#define dsPrevMatch (92+zlib1222add)
64#define dsStrStart (100+zlib1222add) 64#define dsStrStart (100+zlib1222add)
65#define dsMatchStart (104+zlib1222add) 65#define dsMatchStart (104+zlib1222add)
66#define dsLookahead (108+zlib1222add) 66#define dsLookahead (108+zlib1222add)
67#define dsPrevLen (112+zlib1222add) 67#define dsPrevLen (112+zlib1222add)
68#define dsMaxChainLen (116+zlib1222add) 68#define dsMaxChainLen (116+zlib1222add)
69#define dsGoodMatch (132+zlib1222add) 69#define dsGoodMatch (132+zlib1222add)
70#define dsNiceMatch (136+zlib1222add) 70#define dsNiceMatch (136+zlib1222add)
71 71
72 72
73.file "match.S" 73.file "match.S"
74 74
75.globl match_init, longest_match 75.globl match_init, longest_match
76 76
77.text 77.text
78 78
79/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */ 79/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
80 80
81longest_match: 81longest_match:
82 82
83/* Save registers that the compiler may be using, and adjust %esp to */ 83/* Save registers that the compiler may be using, and adjust %esp to */
84/* make room for our stack frame. */ 84/* make room for our stack frame. */
85 85
86 pushl %ebp 86 pushl %ebp
87 pushl %edi 87 pushl %edi
88 pushl %esi 88 pushl %esi
89 pushl %ebx 89 pushl %ebx
90 subl $LocalVarsSize, %esp 90 subl $LocalVarsSize, %esp
91 91
92/* Retrieve the function arguments. %ecx will hold cur_match */ 92/* Retrieve the function arguments. %ecx will hold cur_match */
93/* throughout the entire function. %edx will hold the pointer to the */ 93/* throughout the entire function. %edx will hold the pointer to the */
94/* deflate_state structure during the function's setup (before */ 94/* deflate_state structure during the function's setup (before */
95/* entering the main loop). */ 95/* entering the main loop). */
96 96
97 movl deflatestate(%esp), %edx 97 movl deflatestate(%esp), %edx
98 movl curmatch(%esp), %ecx 98 movl curmatch(%esp), %ecx
99 99
100/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */ 100/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */
101 101
102 movl dsNiceMatch(%edx), %eax 102 movl dsNiceMatch(%edx), %eax
103 movl dsLookahead(%edx), %ebx 103 movl dsLookahead(%edx), %ebx
104 cmpl %eax, %ebx 104 cmpl %eax, %ebx
105 jl LookaheadLess 105 jl LookaheadLess
106 movl %eax, %ebx 106 movl %eax, %ebx
107LookaheadLess: movl %ebx, nicematch(%esp) 107LookaheadLess: movl %ebx, nicematch(%esp)
108 108
109/* register Bytef *scan = s->window + s->strstart; */ 109/* register Bytef *scan = s->window + s->strstart; */
110 110
111 movl dsWindow(%edx), %esi 111 movl dsWindow(%edx), %esi
112 movl %esi, window(%esp) 112 movl %esi, window(%esp)
113 movl dsStrStart(%edx), %ebp 113 movl dsStrStart(%edx), %ebp
114 lea (%esi,%ebp), %edi 114 lea (%esi,%ebp), %edi
115 movl %edi, scan(%esp) 115 movl %edi, scan(%esp)
116 116
117/* Determine how many bytes the scan ptr is off from being */ 117/* Determine how many bytes the scan ptr is off from being */
118/* dword-aligned. */ 118/* dword-aligned. */
119 119
120 movl %edi, %eax 120 movl %edi, %eax
121 negl %eax 121 negl %eax
122 andl $3, %eax 122 andl $3, %eax
123 movl %eax, scanalign(%esp) 123 movl %eax, scanalign(%esp)
124 124
125/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */ 125/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
126/* s->strstart - (IPos)MAX_DIST(s) : NIL; */ 126/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
127 127
128 movl dsWSize(%edx), %eax 128 movl dsWSize(%edx), %eax
129 subl $MIN_LOOKAHEAD, %eax 129 subl $MIN_LOOKAHEAD, %eax
130 subl %eax, %ebp 130 subl %eax, %ebp
131 jg LimitPositive 131 jg LimitPositive
132 xorl %ebp, %ebp 132 xorl %ebp, %ebp
133LimitPositive: 133LimitPositive:
134 134
135/* unsigned chain_length = s->max_chain_length; */ 135/* unsigned chain_length = s->max_chain_length; */
136/* if (s->prev_length >= s->good_match) { */ 136/* if (s->prev_length >= s->good_match) { */
137/* chain_length >>= 2; */ 137/* chain_length >>= 2; */
138/* } */ 138/* } */
139 139
140 movl dsPrevLen(%edx), %eax 140 movl dsPrevLen(%edx), %eax
141 movl dsGoodMatch(%edx), %ebx 141 movl dsGoodMatch(%edx), %ebx
142 cmpl %ebx, %eax 142 cmpl %ebx, %eax
143 movl dsMaxChainLen(%edx), %ebx 143 movl dsMaxChainLen(%edx), %ebx
144 jl LastMatchGood 144 jl LastMatchGood
145 shrl $2, %ebx 145 shrl $2, %ebx
146LastMatchGood: 146LastMatchGood:
147 147
148/* chainlen is decremented once beforehand so that the function can */ 148/* chainlen is decremented once beforehand so that the function can */
149/* use the sign flag instead of the zero flag for the exit test. */ 149/* use the sign flag instead of the zero flag for the exit test. */
150/* It is then shifted into the high word, to make room for the scanend */ 150/* It is then shifted into the high word, to make room for the scanend */
151/* scanend value, which it will always accompany. */ 151/* scanend value, which it will always accompany. */
152 152
153 decl %ebx 153 decl %ebx
154 shll $16, %ebx 154 shll $16, %ebx
155 155
156/* int best_len = s->prev_length; */ 156/* int best_len = s->prev_length; */
157 157
158 movl dsPrevLen(%edx), %eax 158 movl dsPrevLen(%edx), %eax
159 movl %eax, bestlen(%esp) 159 movl %eax, bestlen(%esp)
160 160
161/* Store the sum of s->window + best_len in %esi locally, and in %esi. */ 161/* Store the sum of s->window + best_len in %esi locally, and in %esi. */
162 162
163 addl %eax, %esi 163 addl %eax, %esi
164 movl %esi, windowbestlen(%esp) 164 movl %esi, windowbestlen(%esp)
165 165
166/* register ush scan_start = *(ushf*)scan; */ 166/* register ush scan_start = *(ushf*)scan; */
167/* register ush scan_end = *(ushf*)(scan+best_len-1); */ 167/* register ush scan_end = *(ushf*)(scan+best_len-1); */
168 168
169 movw (%edi), %bx 169 movw (%edi), %bx
170 movw %bx, scanstart(%esp) 170 movw %bx, scanstart(%esp)
171 movw -1(%edi,%eax), %bx 171 movw -1(%edi,%eax), %bx
172 movl %ebx, chainlenscanend(%esp) 172 movl %ebx, chainlenscanend(%esp)
173 173
174/* Posf *prev = s->prev; */ 174/* Posf *prev = s->prev; */
175/* uInt wmask = s->w_mask; */ 175/* uInt wmask = s->w_mask; */
176 176
177 movl dsPrev(%edx), %edi 177 movl dsPrev(%edx), %edi
178 movl dsWMask(%edx), %edx 178 movl dsWMask(%edx), %edx
179 mov %edx, wmask(%esp) 179 mov %edx, wmask(%esp)
180 180
181/* Jump into the main loop. */ 181/* Jump into the main loop. */
182 182
183 jmp LoopEntry 183 jmp LoopEntry
184 184
185.balign 16 185.balign 16
186 186
187/* do { 187/* do {
188 * match = s->window + cur_match; 188 * match = s->window + cur_match;
189 * if (*(ushf*)(match+best_len-1) != scan_end || 189 * if (*(ushf*)(match+best_len-1) != scan_end ||
190 * *(ushf*)match != scan_start) continue; 190 * *(ushf*)match != scan_start) continue;
191 * [...] 191 * [...]
192 * } while ((cur_match = prev[cur_match & wmask]) > limit 192 * } while ((cur_match = prev[cur_match & wmask]) > limit
193 * && --chain_length != 0); 193 * && --chain_length != 0);
194 * 194 *
195 * Here is the inner loop of the function. The function will spend the 195 * Here is the inner loop of the function. The function will spend the
196 * majority of its time in this loop, and majority of that time will 196 * majority of its time in this loop, and majority of that time will
197 * be spent in the first ten instructions. 197 * be spent in the first ten instructions.
198 * 198 *
199 * Within this loop: 199 * Within this loop:
200 * %ebx = chainlenscanend - i.e., ((chainlen << 16) | scanend) 200 * %ebx = chainlenscanend - i.e., ((chainlen << 16) | scanend)
201 * %ecx = curmatch 201 * %ecx = curmatch
202 * %edx = curmatch & wmask 202 * %edx = curmatch & wmask
203 * %esi = windowbestlen - i.e., (window + bestlen) 203 * %esi = windowbestlen - i.e., (window + bestlen)
204 * %edi = prev 204 * %edi = prev
205 * %ebp = limit 205 * %ebp = limit
206 * 206 *
207 * Two optimization notes on the choice of instructions: 207 * Two optimization notes on the choice of instructions:
208 * 208 *
209 * The first instruction uses a 16-bit address, which costs an extra, 209 * The first instruction uses a 16-bit address, which costs an extra,
210 * unpairable cycle. This is cheaper than doing a 32-bit access and 210 * unpairable cycle. This is cheaper than doing a 32-bit access and
211 * zeroing the high word, due to the 3-cycle misalignment penalty which 211 * zeroing the high word, due to the 3-cycle misalignment penalty which
212 * would occur half the time. This also turns out to be cheaper than 212 * would occur half the time. This also turns out to be cheaper than
213 * doing two separate 8-bit accesses, as the memory is so rarely in the 213 * doing two separate 8-bit accesses, as the memory is so rarely in the
214 * L1 cache. 214 * L1 cache.
215 * 215 *
216 * The window buffer, however, apparently spends a lot of time in the 216 * The window buffer, however, apparently spends a lot of time in the
217 * cache, and so it is faster to retrieve the word at the end of the 217 * cache, and so it is faster to retrieve the word at the end of the
218 * match string with two 8-bit loads. The instructions that test the 218 * match string with two 8-bit loads. The instructions that test the
219 * word at the beginning of the match string, however, are executed 219 * word at the beginning of the match string, however, are executed
220 * much less frequently, and there it was cheaper to use 16-bit 220 * much less frequently, and there it was cheaper to use 16-bit
221 * instructions, which avoided the necessity of saving off and 221 * instructions, which avoided the necessity of saving off and
222 * subsequently reloading one of the other registers. 222 * subsequently reloading one of the other registers.
223 */ 223 */
224LookupLoop: 224LookupLoop:
225 /* 1 U & V */ 225 /* 1 U & V */
226 movw (%edi,%edx,2), %cx /* 2 U pipe */ 226 movw (%edi,%edx,2), %cx /* 2 U pipe */
227 movl wmask(%esp), %edx /* 2 V pipe */ 227 movl wmask(%esp), %edx /* 2 V pipe */
228 cmpl %ebp, %ecx /* 3 U pipe */ 228 cmpl %ebp, %ecx /* 3 U pipe */
229 jbe LeaveNow /* 3 V pipe */ 229 jbe LeaveNow /* 3 V pipe */
230 subl $0x00010000, %ebx /* 4 U pipe */ 230 subl $0x00010000, %ebx /* 4 U pipe */
231 js LeaveNow /* 4 V pipe */ 231 js LeaveNow /* 4 V pipe */
232LoopEntry: movb -1(%esi,%ecx), %al /* 5 U pipe */ 232LoopEntry: movb -1(%esi,%ecx), %al /* 5 U pipe */
233 andl %ecx, %edx /* 5 V pipe */ 233 andl %ecx, %edx /* 5 V pipe */
234 cmpb %bl, %al /* 6 U pipe */ 234 cmpb %bl, %al /* 6 U pipe */
235 jnz LookupLoop /* 6 V pipe */ 235 jnz LookupLoop /* 6 V pipe */
236 movb (%esi,%ecx), %ah 236 movb (%esi,%ecx), %ah
237 cmpb %bh, %ah 237 cmpb %bh, %ah
238 jnz LookupLoop 238 jnz LookupLoop
239 movl window(%esp), %eax 239 movl window(%esp), %eax
240 movw (%eax,%ecx), %ax 240 movw (%eax,%ecx), %ax
241 cmpw scanstart(%esp), %ax 241 cmpw scanstart(%esp), %ax
242 jnz LookupLoop 242 jnz LookupLoop
243 243
244/* Store the current value of chainlen. */ 244/* Store the current value of chainlen. */
245 245
246 movl %ebx, chainlenscanend(%esp) 246 movl %ebx, chainlenscanend(%esp)
247 247
248/* Point %edi to the string under scrutiny, and %esi to the string we */ 248/* Point %edi to the string under scrutiny, and %esi to the string we */
249/* are hoping to match it up with. In actuality, %esi and %edi are */ 249/* are hoping to match it up with. In actuality, %esi and %edi are */
250/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */ 250/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */
251/* initialized to -(MAX_MATCH_8 - scanalign). */ 251/* initialized to -(MAX_MATCH_8 - scanalign). */
252 252
253 movl window(%esp), %esi 253 movl window(%esp), %esi
254 movl scan(%esp), %edi 254 movl scan(%esp), %edi
255 addl %ecx, %esi 255 addl %ecx, %esi
256 movl scanalign(%esp), %eax 256 movl scanalign(%esp), %eax
257 movl $(-MAX_MATCH_8), %edx 257 movl $(-MAX_MATCH_8), %edx
258 lea MAX_MATCH_8(%edi,%eax), %edi 258 lea MAX_MATCH_8(%edi,%eax), %edi
259 lea MAX_MATCH_8(%esi,%eax), %esi 259 lea MAX_MATCH_8(%esi,%eax), %esi
260 260
261/* Test the strings for equality, 8 bytes at a time. At the end, 261/* Test the strings for equality, 8 bytes at a time. At the end,
262 * adjust %edx so that it is offset to the exact byte that mismatched. 262 * adjust %edx so that it is offset to the exact byte that mismatched.
263 * 263 *
264 * We already know at this point that the first three bytes of the 264 * We already know at this point that the first three bytes of the
265 * strings match each other, and they can be safely passed over before 265 * strings match each other, and they can be safely passed over before
266 * starting the compare loop. So what this code does is skip over 0-3 266 * starting the compare loop. So what this code does is skip over 0-3
267 * bytes, as much as necessary in order to dword-align the %edi 267 * bytes, as much as necessary in order to dword-align the %edi
268 * pointer. (%esi will still be misaligned three times out of four.) 268 * pointer. (%esi will still be misaligned three times out of four.)
269 * 269 *
270 * It should be confessed that this loop usually does not represent 270 * It should be confessed that this loop usually does not represent
271 * much of the total running time. Replacing it with a more 271 * much of the total running time. Replacing it with a more
272 * straightforward "rep cmpsb" would not drastically degrade 272 * straightforward "rep cmpsb" would not drastically degrade
273 * performance. 273 * performance.
274 */ 274 */
275LoopCmps: 275LoopCmps:
276 movl (%esi,%edx), %eax 276 movl (%esi,%edx), %eax
277 movl (%edi,%edx), %ebx 277 movl (%edi,%edx), %ebx
278 xorl %ebx, %eax 278 xorl %ebx, %eax
279 jnz LeaveLoopCmps 279 jnz LeaveLoopCmps
280 movl 4(%esi,%edx), %eax 280 movl 4(%esi,%edx), %eax
281 movl 4(%edi,%edx), %ebx 281 movl 4(%edi,%edx), %ebx
282 xorl %ebx, %eax 282 xorl %ebx, %eax
283 jnz LeaveLoopCmps4 283 jnz LeaveLoopCmps4
284 addl $8, %edx 284 addl $8, %edx
285 jnz LoopCmps 285 jnz LoopCmps
286 jmp LenMaximum 286 jmp LenMaximum
287LeaveLoopCmps4: addl $4, %edx 287LeaveLoopCmps4: addl $4, %edx
288LeaveLoopCmps: testl $0x0000FFFF, %eax 288LeaveLoopCmps: testl $0x0000FFFF, %eax
289 jnz LenLower 289 jnz LenLower
290 addl $2, %edx 290 addl $2, %edx
291 shrl $16, %eax 291 shrl $16, %eax
292LenLower: subb $1, %al 292LenLower: subb $1, %al
293 adcl $0, %edx 293 adcl $0, %edx
294 294
295/* Calculate the length of the match. If it is longer than MAX_MATCH, */ 295/* Calculate the length of the match. If it is longer than MAX_MATCH, */
296/* then automatically accept it as the best possible match and leave. */ 296/* then automatically accept it as the best possible match and leave. */
297 297
298 lea (%edi,%edx), %eax 298 lea (%edi,%edx), %eax
299 movl scan(%esp), %edi 299 movl scan(%esp), %edi
300 subl %edi, %eax 300 subl %edi, %eax
301 cmpl $MAX_MATCH, %eax 301 cmpl $MAX_MATCH, %eax
302 jge LenMaximum 302 jge LenMaximum
303 303
304/* If the length of the match is not longer than the best match we */ 304/* If the length of the match is not longer than the best match we */
305/* have so far, then forget it and return to the lookup loop. */ 305/* have so far, then forget it and return to the lookup loop. */
306 306
307 movl deflatestate(%esp), %edx 307 movl deflatestate(%esp), %edx
308 movl bestlen(%esp), %ebx 308 movl bestlen(%esp), %ebx
309 cmpl %ebx, %eax 309 cmpl %ebx, %eax
310 jg LongerMatch 310 jg LongerMatch
311 movl chainlenscanend(%esp), %ebx 311 movl chainlenscanend(%esp), %ebx
312 movl windowbestlen(%esp), %esi 312 movl windowbestlen(%esp), %esi
313 movl dsPrev(%edx), %edi 313 movl dsPrev(%edx), %edi
314 movl wmask(%esp), %edx 314 movl wmask(%esp), %edx
315 andl %ecx, %edx 315 andl %ecx, %edx
316 jmp LookupLoop 316 jmp LookupLoop
317 317
318/* s->match_start = cur_match; */ 318/* s->match_start = cur_match; */
319/* best_len = len; */ 319/* best_len = len; */
320/* if (len >= nice_match) break; */ 320/* if (len >= nice_match) break; */
321/* scan_end = *(ushf*)(scan+best_len-1); */ 321/* scan_end = *(ushf*)(scan+best_len-1); */
322 322
323LongerMatch: movl nicematch(%esp), %ebx 323LongerMatch: movl nicematch(%esp), %ebx
324 movl %eax, bestlen(%esp) 324 movl %eax, bestlen(%esp)
325 movl %ecx, dsMatchStart(%edx) 325 movl %ecx, dsMatchStart(%edx)
326 cmpl %ebx, %eax 326 cmpl %ebx, %eax
327 jge LeaveNow 327 jge LeaveNow
328 movl window(%esp), %esi 328 movl window(%esp), %esi
329 addl %eax, %esi 329 addl %eax, %esi
330 movl %esi, windowbestlen(%esp) 330 movl %esi, windowbestlen(%esp)
331 movl chainlenscanend(%esp), %ebx 331 movl chainlenscanend(%esp), %ebx
332 movw -1(%edi,%eax), %bx 332 movw -1(%edi,%eax), %bx
333 movl dsPrev(%edx), %edi 333 movl dsPrev(%edx), %edi
334 movl %ebx, chainlenscanend(%esp) 334 movl %ebx, chainlenscanend(%esp)
335 movl wmask(%esp), %edx 335 movl wmask(%esp), %edx
336 andl %ecx, %edx 336 andl %ecx, %edx
337 jmp LookupLoop 337 jmp LookupLoop
338 338
339/* Accept the current string, with the maximum possible length. */ 339/* Accept the current string, with the maximum possible length. */
340 340
341LenMaximum: movl deflatestate(%esp), %edx 341LenMaximum: movl deflatestate(%esp), %edx
342 movl $MAX_MATCH, bestlen(%esp) 342 movl $MAX_MATCH, bestlen(%esp)
343 movl %ecx, dsMatchStart(%edx) 343 movl %ecx, dsMatchStart(%edx)
344 344
345/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */ 345/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
346/* return s->lookahead; */ 346/* return s->lookahead; */
347 347
348LeaveNow: 348LeaveNow:
349 movl deflatestate(%esp), %edx 349 movl deflatestate(%esp), %edx
350 movl bestlen(%esp), %ebx 350 movl bestlen(%esp), %ebx
351 movl dsLookahead(%edx), %eax 351 movl dsLookahead(%edx), %eax
352 cmpl %eax, %ebx 352 cmpl %eax, %ebx
353 jg LookaheadRet 353 jg LookaheadRet
354 movl %ebx, %eax 354 movl %ebx, %eax
355LookaheadRet: 355LookaheadRet:
356 356
357/* Restore the stack and return from whence we came. */ 357/* Restore the stack and return from whence we came. */
358 358
359 addl $LocalVarsSize, %esp 359 addl $LocalVarsSize, %esp
360 popl %ebx 360 popl %ebx
361 popl %esi 361 popl %esi
362 popl %edi 362 popl %edi
363 popl %ebp 363 popl %ebp
364match_init: ret 364match_init: ret
diff --git a/contrib/asm686/match.S b/contrib/asm686/match.S
index c24be4d..5c3e9ee 100644
--- a/contrib/asm686/match.S
+++ b/contrib/asm686/match.S
@@ -1,329 +1,329 @@
1/* match.s -- Pentium-Pro-optimized version of longest_match() 1/* match.s -- Pentium-Pro-optimized version of longest_match()
2 * Written for zlib 1.1.2 2 * Written for zlib 1.1.2
3 * Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com> 3 * Copyright (C) 1998 Brian Raiter <breadbox@muppetlabs.com>
4 * 4 *
5 * This is free software; you can redistribute it and/or modify it 5 * This is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License. 6 * under the terms of the GNU General Public License.
7 */ 7 */
8 8
9#ifndef NO_UNDERLINE 9#ifndef NO_UNDERLINE
10#define match_init _match_init 10#define match_init _match_init
11#define longest_match _longest_match 11#define longest_match _longest_match
12#endif 12#endif
13 13
14#define MAX_MATCH (258) 14#define MAX_MATCH (258)
15#define MIN_MATCH (3) 15#define MIN_MATCH (3)
16#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1) 16#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1)
17#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7) 17#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7)
18 18
19/* stack frame offsets */ 19/* stack frame offsets */
20 20
21#define chainlenwmask 0 /* high word: current chain len */ 21#define chainlenwmask 0 /* high word: current chain len */
22 /* low word: s->wmask */ 22 /* low word: s->wmask */
23#define window 4 /* local copy of s->window */ 23#define window 4 /* local copy of s->window */
24#define windowbestlen 8 /* s->window + bestlen */ 24#define windowbestlen 8 /* s->window + bestlen */
25#define scanstart 16 /* first two bytes of string */ 25#define scanstart 16 /* first two bytes of string */
26#define scanend 12 /* last two bytes of string */ 26#define scanend 12 /* last two bytes of string */
27#define scanalign 20 /* dword-misalignment of string */ 27#define scanalign 20 /* dword-misalignment of string */
28#define nicematch 24 /* a good enough match size */ 28#define nicematch 24 /* a good enough match size */
29#define bestlen 28 /* size of best match so far */ 29#define bestlen 28 /* size of best match so far */
30#define scan 32 /* ptr to string wanting match */ 30#define scan 32 /* ptr to string wanting match */
31 31
32#define LocalVarsSize (36) 32#define LocalVarsSize (36)
33/* saved ebx 36 */ 33/* saved ebx 36 */
34/* saved edi 40 */ 34/* saved edi 40 */
35/* saved esi 44 */ 35/* saved esi 44 */
36/* saved ebp 48 */ 36/* saved ebp 48 */
37/* return address 52 */ 37/* return address 52 */
38#define deflatestate 56 /* the function arguments */ 38#define deflatestate 56 /* the function arguments */
39#define curmatch 60 39#define curmatch 60
40 40
41/* All the +zlib1222add offsets are due to the addition of fields 41/* All the +zlib1222add offsets are due to the addition of fields
42 * in zlib in the deflate_state structure since the asm code was first written 42 * in zlib in the deflate_state structure since the asm code was first written
43 * (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). 43 * (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
44 * (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). 44 * (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
45 * if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). 45 * if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
46 */ 46 */
47 47
48#define zlib1222add (8) 48#define zlib1222add (8)
49 49
50#define dsWSize (36+zlib1222add) 50#define dsWSize (36+zlib1222add)
51#define dsWMask (44+zlib1222add) 51#define dsWMask (44+zlib1222add)
52#define dsWindow (48+zlib1222add) 52#define dsWindow (48+zlib1222add)
53#define dsPrev (56+zlib1222add) 53#define dsPrev (56+zlib1222add)
54#define dsMatchLen (88+zlib1222add) 54#define dsMatchLen (88+zlib1222add)
55#define dsPrevMatch (92+zlib1222add) 55#define dsPrevMatch (92+zlib1222add)
56#define dsStrStart (100+zlib1222add) 56#define dsStrStart (100+zlib1222add)
57#define dsMatchStart (104+zlib1222add) 57#define dsMatchStart (104+zlib1222add)
58#define dsLookahead (108+zlib1222add) 58#define dsLookahead (108+zlib1222add)
59#define dsPrevLen (112+zlib1222add) 59#define dsPrevLen (112+zlib1222add)
60#define dsMaxChainLen (116+zlib1222add) 60#define dsMaxChainLen (116+zlib1222add)
61#define dsGoodMatch (132+zlib1222add) 61#define dsGoodMatch (132+zlib1222add)
62#define dsNiceMatch (136+zlib1222add) 62#define dsNiceMatch (136+zlib1222add)
63 63
64 64
65.file "match.S" 65.file "match.S"
66 66
67.globl match_init, longest_match 67.globl match_init, longest_match
68 68
69.text 69.text
70 70
71/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */ 71/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */
72 72
73longest_match: 73longest_match:
74 74
75/* Save registers that the compiler may be using, and adjust %esp to */ 75/* Save registers that the compiler may be using, and adjust %esp to */
76/* make room for our stack frame. */ 76/* make room for our stack frame. */
77 77
78 pushl %ebp 78 pushl %ebp
79 pushl %edi 79 pushl %edi
80 pushl %esi 80 pushl %esi
81 pushl %ebx 81 pushl %ebx
82 subl $LocalVarsSize, %esp 82 subl $LocalVarsSize, %esp
83 83
84/* Retrieve the function arguments. %ecx will hold cur_match */ 84/* Retrieve the function arguments. %ecx will hold cur_match */
85/* throughout the entire function. %edx will hold the pointer to the */ 85/* throughout the entire function. %edx will hold the pointer to the */
86/* deflate_state structure during the function's setup (before */ 86/* deflate_state structure during the function's setup (before */
87/* entering the main loop). */ 87/* entering the main loop). */
88 88
89 movl deflatestate(%esp), %edx 89 movl deflatestate(%esp), %edx
90 movl curmatch(%esp), %ecx 90 movl curmatch(%esp), %ecx
91 91
92/* uInt wmask = s->w_mask; */ 92/* uInt wmask = s->w_mask; */
93/* unsigned chain_length = s->max_chain_length; */ 93/* unsigned chain_length = s->max_chain_length; */
94/* if (s->prev_length >= s->good_match) { */ 94/* if (s->prev_length >= s->good_match) { */
95/* chain_length >>= 2; */ 95/* chain_length >>= 2; */
96/* } */ 96/* } */
97 97
98 movl dsPrevLen(%edx), %eax 98 movl dsPrevLen(%edx), %eax
99 movl dsGoodMatch(%edx), %ebx 99 movl dsGoodMatch(%edx), %ebx
100 cmpl %ebx, %eax 100 cmpl %ebx, %eax
101 movl dsWMask(%edx), %eax 101 movl dsWMask(%edx), %eax
102 movl dsMaxChainLen(%edx), %ebx 102 movl dsMaxChainLen(%edx), %ebx
103 jl LastMatchGood 103 jl LastMatchGood
104 shrl $2, %ebx 104 shrl $2, %ebx
105LastMatchGood: 105LastMatchGood:
106 106
107/* chainlen is decremented once beforehand so that the function can */ 107/* chainlen is decremented once beforehand so that the function can */
108/* use the sign flag instead of the zero flag for the exit test. */ 108/* use the sign flag instead of the zero flag for the exit test. */
109/* It is then shifted into the high word, to make room for the wmask */ 109/* It is then shifted into the high word, to make room for the wmask */
110/* value, which it will always accompany. */ 110/* value, which it will always accompany. */
111 111
112 decl %ebx 112 decl %ebx
113 shll $16, %ebx 113 shll $16, %ebx
114 orl %eax, %ebx 114 orl %eax, %ebx
115 movl %ebx, chainlenwmask(%esp) 115 movl %ebx, chainlenwmask(%esp)
116 116
117/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */ 117/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */
118 118
119 movl dsNiceMatch(%edx), %eax 119 movl dsNiceMatch(%edx), %eax
120 movl dsLookahead(%edx), %ebx 120 movl dsLookahead(%edx), %ebx
121 cmpl %eax, %ebx 121 cmpl %eax, %ebx
122 jl LookaheadLess 122 jl LookaheadLess
123 movl %eax, %ebx 123 movl %eax, %ebx
124LookaheadLess: movl %ebx, nicematch(%esp) 124LookaheadLess: movl %ebx, nicematch(%esp)
125 125
126/* register Bytef *scan = s->window + s->strstart; */ 126/* register Bytef *scan = s->window + s->strstart; */
127 127
128 movl dsWindow(%edx), %esi 128 movl dsWindow(%edx), %esi
129 movl %esi, window(%esp) 129 movl %esi, window(%esp)
130 movl dsStrStart(%edx), %ebp 130 movl dsStrStart(%edx), %ebp
131 lea (%esi,%ebp), %edi 131 lea (%esi,%ebp), %edi
132 movl %edi, scan(%esp) 132 movl %edi, scan(%esp)
133 133
134/* Determine how many bytes the scan ptr is off from being */ 134/* Determine how many bytes the scan ptr is off from being */
135/* dword-aligned. */ 135/* dword-aligned. */
136 136
137 movl %edi, %eax 137 movl %edi, %eax
138 negl %eax 138 negl %eax
139 andl $3, %eax 139 andl $3, %eax
140 movl %eax, scanalign(%esp) 140 movl %eax, scanalign(%esp)
141 141
142/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */ 142/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */
143/* s->strstart - (IPos)MAX_DIST(s) : NIL; */ 143/* s->strstart - (IPos)MAX_DIST(s) : NIL; */
144 144
145 movl dsWSize(%edx), %eax 145 movl dsWSize(%edx), %eax
146 subl $MIN_LOOKAHEAD, %eax 146 subl $MIN_LOOKAHEAD, %eax
147 subl %eax, %ebp 147 subl %eax, %ebp
148 jg LimitPositive 148 jg LimitPositive
149 xorl %ebp, %ebp 149 xorl %ebp, %ebp
150LimitPositive: 150LimitPositive:
151 151
152/* int best_len = s->prev_length; */ 152/* int best_len = s->prev_length; */
153 153
154 movl dsPrevLen(%edx), %eax 154 movl dsPrevLen(%edx), %eax
155 movl %eax, bestlen(%esp) 155 movl %eax, bestlen(%esp)
156 156
157/* Store the sum of s->window + best_len in %esi locally, and in %esi. */ 157/* Store the sum of s->window + best_len in %esi locally, and in %esi. */
158 158
159 addl %eax, %esi 159 addl %eax, %esi
160 movl %esi, windowbestlen(%esp) 160 movl %esi, windowbestlen(%esp)
161 161
162/* register ush scan_start = *(ushf*)scan; */ 162/* register ush scan_start = *(ushf*)scan; */
163/* register ush scan_end = *(ushf*)(scan+best_len-1); */ 163/* register ush scan_end = *(ushf*)(scan+best_len-1); */
164/* Posf *prev = s->prev; */ 164/* Posf *prev = s->prev; */
165 165
166 movzwl (%edi), %ebx 166 movzwl (%edi), %ebx
167 movl %ebx, scanstart(%esp) 167 movl %ebx, scanstart(%esp)
168 movzwl -1(%edi,%eax), %ebx 168 movzwl -1(%edi,%eax), %ebx
169 movl %ebx, scanend(%esp) 169 movl %ebx, scanend(%esp)
170 movl dsPrev(%edx), %edi 170 movl dsPrev(%edx), %edi
171 171
172/* Jump into the main loop. */ 172/* Jump into the main loop. */
173 173
174 movl chainlenwmask(%esp), %edx 174 movl chainlenwmask(%esp), %edx
175 jmp LoopEntry 175 jmp LoopEntry
176 176
177.balign 16 177.balign 16
178 178
179/* do { 179/* do {
180 * match = s->window + cur_match; 180 * match = s->window + cur_match;
181 * if (*(ushf*)(match+best_len-1) != scan_end || 181 * if (*(ushf*)(match+best_len-1) != scan_end ||
182 * *(ushf*)match != scan_start) continue; 182 * *(ushf*)match != scan_start) continue;
183 * [...] 183 * [...]
184 * } while ((cur_match = prev[cur_match & wmask]) > limit 184 * } while ((cur_match = prev[cur_match & wmask]) > limit
185 * && --chain_length != 0); 185 * && --chain_length != 0);
186 * 186 *
187 * Here is the inner loop of the function. The function will spend the 187 * Here is the inner loop of the function. The function will spend the
188 * majority of its time in this loop, and majority of that time will 188 * majority of its time in this loop, and majority of that time will
189 * be spent in the first ten instructions. 189 * be spent in the first ten instructions.
190 * 190 *
191 * Within this loop: 191 * Within this loop:
192 * %ebx = scanend 192 * %ebx = scanend
193 * %ecx = curmatch 193 * %ecx = curmatch
194 * %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) 194 * %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
195 * %esi = windowbestlen - i.e., (window + bestlen) 195 * %esi = windowbestlen - i.e., (window + bestlen)
196 * %edi = prev 196 * %edi = prev
197 * %ebp = limit 197 * %ebp = limit
198 */ 198 */
199LookupLoop: 199LookupLoop:
200 andl %edx, %ecx 200 andl %edx, %ecx
201 movzwl (%edi,%ecx,2), %ecx 201 movzwl (%edi,%ecx,2), %ecx
202 cmpl %ebp, %ecx 202 cmpl %ebp, %ecx
203 jbe LeaveNow 203 jbe LeaveNow
204 subl $0x00010000, %edx 204 subl $0x00010000, %edx
205 js LeaveNow 205 js LeaveNow
206LoopEntry: movzwl -1(%esi,%ecx), %eax 206LoopEntry: movzwl -1(%esi,%ecx), %eax
207 cmpl %ebx, %eax 207 cmpl %ebx, %eax
208 jnz LookupLoop 208 jnz LookupLoop
209 movl window(%esp), %eax 209 movl window(%esp), %eax
210 movzwl (%eax,%ecx), %eax 210 movzwl (%eax,%ecx), %eax
211 cmpl scanstart(%esp), %eax 211 cmpl scanstart(%esp), %eax
212 jnz LookupLoop 212 jnz LookupLoop
213 213
214/* Store the current value of chainlen. */ 214/* Store the current value of chainlen. */
215 215
216 movl %edx, chainlenwmask(%esp) 216 movl %edx, chainlenwmask(%esp)
217 217
218/* Point %edi to the string under scrutiny, and %esi to the string we */ 218/* Point %edi to the string under scrutiny, and %esi to the string we */
219/* are hoping to match it up with. In actuality, %esi and %edi are */ 219/* are hoping to match it up with. In actuality, %esi and %edi are */
220/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */ 220/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */
221/* initialized to -(MAX_MATCH_8 - scanalign). */ 221/* initialized to -(MAX_MATCH_8 - scanalign). */
222 222
223 movl window(%esp), %esi 223 movl window(%esp), %esi
224 movl scan(%esp), %edi 224 movl scan(%esp), %edi
225 addl %ecx, %esi 225 addl %ecx, %esi
226 movl scanalign(%esp), %eax 226 movl scanalign(%esp), %eax
227 movl $(-MAX_MATCH_8), %edx 227 movl $(-MAX_MATCH_8), %edx
228 lea MAX_MATCH_8(%edi,%eax), %edi 228 lea MAX_MATCH_8(%edi,%eax), %edi
229 lea MAX_MATCH_8(%esi,%eax), %esi 229 lea MAX_MATCH_8(%esi,%eax), %esi
230 230
231/* Test the strings for equality, 8 bytes at a time. At the end, 231/* Test the strings for equality, 8 bytes at a time. At the end,
232 * adjust %edx so that it is offset to the exact byte that mismatched. 232 * adjust %edx so that it is offset to the exact byte that mismatched.
233 * 233 *
234 * We already know at this point that the first three bytes of the 234 * We already know at this point that the first three bytes of the
235 * strings match each other, and they can be safely passed over before 235 * strings match each other, and they can be safely passed over before
236 * starting the compare loop. So what this code does is skip over 0-3 236 * starting the compare loop. So what this code does is skip over 0-3
237 * bytes, as much as necessary in order to dword-align the %edi 237 * bytes, as much as necessary in order to dword-align the %edi
238 * pointer. (%esi will still be misaligned three times out of four.) 238 * pointer. (%esi will still be misaligned three times out of four.)
239 * 239 *
240 * It should be confessed that this loop usually does not represent 240 * It should be confessed that this loop usually does not represent
241 * much of the total running time. Replacing it with a more 241 * much of the total running time. Replacing it with a more
242 * straightforward "rep cmpsb" would not drastically degrade 242 * straightforward "rep cmpsb" would not drastically degrade
243 * performance. 243 * performance.
244 */ 244 */
245LoopCmps: 245LoopCmps:
246 movl (%esi,%edx), %eax 246 movl (%esi,%edx), %eax
247 xorl (%edi,%edx), %eax 247 xorl (%edi,%edx), %eax
248 jnz LeaveLoopCmps 248 jnz LeaveLoopCmps
249 movl 4(%esi,%edx), %eax 249 movl 4(%esi,%edx), %eax
250 xorl 4(%edi,%edx), %eax 250 xorl 4(%edi,%edx), %eax
251 jnz LeaveLoopCmps4 251 jnz LeaveLoopCmps4
252 addl $8, %edx 252 addl $8, %edx
253 jnz LoopCmps 253 jnz LoopCmps
254 jmp LenMaximum 254 jmp LenMaximum
255LeaveLoopCmps4: addl $4, %edx 255LeaveLoopCmps4: addl $4, %edx
256LeaveLoopCmps: testl $0x0000FFFF, %eax 256LeaveLoopCmps: testl $0x0000FFFF, %eax
257 jnz LenLower 257 jnz LenLower
258 addl $2, %edx 258 addl $2, %edx
259 shrl $16, %eax 259 shrl $16, %eax
260LenLower: subb $1, %al 260LenLower: subb $1, %al
261 adcl $0, %edx 261 adcl $0, %edx
262 262
263/* Calculate the length of the match. If it is longer than MAX_MATCH, */ 263/* Calculate the length of the match. If it is longer than MAX_MATCH, */
264/* then automatically accept it as the best possible match and leave. */ 264/* then automatically accept it as the best possible match and leave. */
265 265
266 lea (%edi,%edx), %eax 266 lea (%edi,%edx), %eax
267 movl scan(%esp), %edi 267 movl scan(%esp), %edi
268 subl %edi, %eax 268 subl %edi, %eax
269 cmpl $MAX_MATCH, %eax 269 cmpl $MAX_MATCH, %eax
270 jge LenMaximum 270 jge LenMaximum
271 271
272/* If the length of the match is not longer than the best match we */ 272/* If the length of the match is not longer than the best match we */
273/* have so far, then forget it and return to the lookup loop. */ 273/* have so far, then forget it and return to the lookup loop. */
274 274
275 movl deflatestate(%esp), %edx 275 movl deflatestate(%esp), %edx
276 movl bestlen(%esp), %ebx 276 movl bestlen(%esp), %ebx
277 cmpl %ebx, %eax 277 cmpl %ebx, %eax
278 jg LongerMatch 278 jg LongerMatch
279 movl windowbestlen(%esp), %esi 279 movl windowbestlen(%esp), %esi
280 movl dsPrev(%edx), %edi 280 movl dsPrev(%edx), %edi
281 movl scanend(%esp), %ebx 281 movl scanend(%esp), %ebx
282 movl chainlenwmask(%esp), %edx 282 movl chainlenwmask(%esp), %edx
283 jmp LookupLoop 283 jmp LookupLoop
284 284
285/* s->match_start = cur_match; */ 285/* s->match_start = cur_match; */
286/* best_len = len; */ 286/* best_len = len; */
287/* if (len >= nice_match) break; */ 287/* if (len >= nice_match) break; */
288/* scan_end = *(ushf*)(scan+best_len-1); */ 288/* scan_end = *(ushf*)(scan+best_len-1); */
289 289
290LongerMatch: movl nicematch(%esp), %ebx 290LongerMatch: movl nicematch(%esp), %ebx
291 movl %eax, bestlen(%esp) 291 movl %eax, bestlen(%esp)
292 movl %ecx, dsMatchStart(%edx) 292 movl %ecx, dsMatchStart(%edx)
293 cmpl %ebx, %eax 293 cmpl %ebx, %eax
294 jge LeaveNow 294 jge LeaveNow
295 movl window(%esp), %esi 295 movl window(%esp), %esi
296 addl %eax, %esi 296 addl %eax, %esi
297 movl %esi, windowbestlen(%esp) 297 movl %esi, windowbestlen(%esp)
298 movzwl -1(%edi,%eax), %ebx 298 movzwl -1(%edi,%eax), %ebx
299 movl dsPrev(%edx), %edi 299 movl dsPrev(%edx), %edi
300 movl %ebx, scanend(%esp) 300 movl %ebx, scanend(%esp)
301 movl chainlenwmask(%esp), %edx 301 movl chainlenwmask(%esp), %edx
302 jmp LookupLoop 302 jmp LookupLoop
303 303
304/* Accept the current string, with the maximum possible length. */ 304/* Accept the current string, with the maximum possible length. */
305 305
306LenMaximum: movl deflatestate(%esp), %edx 306LenMaximum: movl deflatestate(%esp), %edx
307 movl $MAX_MATCH, bestlen(%esp) 307 movl $MAX_MATCH, bestlen(%esp)
308 movl %ecx, dsMatchStart(%edx) 308 movl %ecx, dsMatchStart(%edx)
309 309
310/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */ 310/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */
311/* return s->lookahead; */ 311/* return s->lookahead; */
312 312
313LeaveNow: 313LeaveNow:
314 movl deflatestate(%esp), %edx 314 movl deflatestate(%esp), %edx
315 movl bestlen(%esp), %ebx 315 movl bestlen(%esp), %ebx
316 movl dsLookahead(%edx), %eax 316 movl dsLookahead(%edx), %eax
317 cmpl %eax, %ebx 317 cmpl %eax, %ebx
318 jg LookaheadRet 318 jg LookaheadRet
319 movl %ebx, %eax 319 movl %ebx, %eax
320LookaheadRet: 320LookaheadRet:
321 321
322/* Restore the stack and return from whence we came. */ 322/* Restore the stack and return from whence we came. */
323 323
324 addl $LocalVarsSize, %esp 324 addl $LocalVarsSize, %esp
325 popl %ebx 325 popl %ebx
326 popl %esi 326 popl %esi
327 popl %edi 327 popl %edi
328 popl %ebp 328 popl %ebp
329match_init: ret 329match_init: ret
diff --git a/contrib/delphi/ZLib.pas b/contrib/delphi/ZLib.pas
index b9d33e2..3f2b8b4 100644
--- a/contrib/delphi/ZLib.pas
+++ b/contrib/delphi/ZLib.pas
@@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer;
152 const OutBuf: Pointer; BufSize: Integer); 152 const OutBuf: Pointer; BufSize: Integer);
153 153
154const 154const
155 zlib_version = '1.2.2'; 155 zlib_version = '1.2.3';
156 156
157type 157type
158 EZlibError = class(Exception); 158 EZlibError = class(Exception);
diff --git a/contrib/dotzlib/DotZLib/UnitTests.cs b/contrib/dotzlib/DotZLib/UnitTests.cs
index 2f374b6..8dc00db 100644
--- a/contrib/dotzlib/DotZLib/UnitTests.cs
+++ b/contrib/dotzlib/DotZLib/UnitTests.cs
@@ -156,7 +156,7 @@ namespace DotZLibTests
156 public void Info_Version() 156 public void Info_Version()
157 { 157 {
158 Info info = new Info(); 158 Info info = new Info();
159 Assert.AreEqual("1.2.2", Info.Version); 159 Assert.AreEqual("1.2.3", Info.Version);
160 Assert.AreEqual(32, info.SizeOfUInt); 160 Assert.AreEqual(32, info.SizeOfUInt);
161 Assert.AreEqual(32, info.SizeOfULong); 161 Assert.AreEqual(32, info.SizeOfULong);
162 Assert.AreEqual(32, info.SizeOfPointer); 162 Assert.AreEqual(32, info.SizeOfPointer);
diff --git a/contrib/infback9/inftree9.c b/contrib/infback9/inftree9.c
index 9e37840..0993f75 100644
--- a/contrib/infback9/inftree9.c
+++ b/contrib/infback9/inftree9.c
@@ -9,7 +9,7 @@
9#define MAXBITS 15 9#define MAXBITS 15
10 10
11const char inflate9_copyright[] = 11const char inflate9_copyright[] =
12 " inflate9 1.2.2.4 Copyright 1995-2005 Mark Adler "; 12 " inflate9 1.2.3 Copyright 1995-2005 Mark Adler ";
13/* 13/*
14 If you use the zlib library in a product, an acknowledgment is welcome 14 If you use the zlib library in a product, an acknowledgment is welcome
15 in the documentation of your product. If for some reason you cannot 15 in the documentation of your product. If for some reason you cannot
@@ -64,7 +64,7 @@ unsigned short FAR *work;
64 static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 64 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
65 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 65 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
66 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, 66 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
67 133, 133, 133, 133, 144, 206, 69}; 67 133, 133, 133, 133, 144, 201, 196};
68 static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ 68 static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
69 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 69 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
70 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 70 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
@@ -128,7 +128,7 @@ unsigned short FAR *work;
128 left -= count[len]; 128 left -= count[len];
129 if (left < 0) return -1; /* over-subscribed */ 129 if (left < 0) return -1; /* over-subscribed */
130 } 130 }
131 if (left > 0 && (type == CODES || (codes - count[0] != 1))) 131 if (left > 0 && (type == CODES || max != 1))
132 return -1; /* incomplete set */ 132 return -1; /* incomplete set */
133 133
134 /* generate offsets into symbol table for each length for sorting */ 134 /* generate offsets into symbol table for each length for sorting */
diff --git a/contrib/infback9/inftree9.h b/contrib/infback9/inftree9.h
index 6a699a7..a268084 100644
--- a/contrib/infback9/inftree9.h
+++ b/contrib/infback9/inftree9.h
@@ -36,12 +36,12 @@ typedef struct {
36 */ 36 */
37 37
38/* Maximum size of dynamic tree. The maximum found in a long but non- 38/* Maximum size of dynamic tree. The maximum found in a long but non-
39 exhaustive search was 1004 code structures (850 for length/literals 39 exhaustive search was 1444 code structures (852 for length/literals
40 and 154 for distances, the latter actually the result of an 40 and 592 for distances, the latter actually the result of an
41 exhaustive search). The true maximum is not known, but the value 41 exhaustive search). The true maximum is not known, but the value
42 below is more than safe. */ 42 below is more than safe. */
43#define ENOUGH 1440 43#define ENOUGH 2048
44#define MAXD 154 44#define MAXD 592
45 45
46/* Type of code to build for inftable() */ 46/* Type of code to build for inftable() */
47typedef enum { 47typedef enum {
diff --git a/contrib/masmx64/gvmat64.asm b/contrib/masmx64/gvmat64.asm
index cee2145..790d655 100644
--- a/contrib/masmx64/gvmat64.asm
+++ b/contrib/masmx64/gvmat64.asm
@@ -4,24 +4,33 @@
4 4
5; gvmat64.asm -- Asm portion of the optimized longest_match for 32 bits x86 5; gvmat64.asm -- Asm portion of the optimized longest_match for 32 bits x86
6; Copyright (C) 1995-2005 Jean-loup Gailly, Brian Raiter and Gilles Vollant. 6; Copyright (C) 1995-2005 Jean-loup Gailly, Brian Raiter and Gilles Vollant.
7; File written by Gilles Vollant, by modifiying the longest_match 7;
8; from Jean-loup Gailly in deflate.c 8; File written by Gilles Vollant, by converting to assembly the longest_match
9; and modifying asm686 with masm, optimised assembly code from Brian Raiter, 9; from Jean-loup Gailly in deflate.c of zLib and infoZip zip.
10; written 1998 10;
11; and by taking inspiration on asm686 with masm, optimised assembly code
12; from Brian Raiter, written 1998
13;
11; http://www.zlib.net 14; http://www.zlib.net
12; http://www.winimage.com/zLibDll 15; http://www.winimage.com/zLibDll
13; http://www.muppetlabs.com/~breadbox/software/assembly.html 16; http://www.muppetlabs.com/~breadbox/software/assembly.html
14; 17;
15; to compile this file, I use option 18; to compile this file for infozip Zip, I use option:
19; ml64.exe /Flgvmat64 /c /Zi /DINFOZIP gvmat64.asm
20;
21; to compile this file for zLib, I use option:
16; ml64.exe /Flgvmat64 /c /Zi gvmat64.asm 22; ml64.exe /Flgvmat64 /c /Zi gvmat64.asm
17; with Microsoft Macro Assembler (x64) for AMD64 23; Be carrefull to adapt zlib1222add below to your version of zLib
24; (if you use a version of zLib before 1.0.4 or after 1.2.2.2, change
25; value of zlib1222add later)
18; 26;
19; ml64.exe is given with Visual Studio 2005, Windows 2003 server DDK 27; This file compile with Microsoft Macro Assembler (x64) for AMD64
28;
29; ml64.exe is given with Visual Studio 2005 and Windows 2003 server DDK
20; 30;
21; (you can get Windows 2003 server DDK with ml64 and cl for AMD64 from 31; (you can get Windows 2003 server DDK with ml64 and cl for AMD64 from
22; http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price) 32; http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price)
23; 33;
24; Be carrefull to adapt zlib1222add below to your version of zLib
25 34
26 35
27;uInt longest_match(s, cur_match) 36;uInt longest_match(s, cur_match)
@@ -47,7 +56,10 @@ longest_match PROC
47;scanalign equ rsp + xx - LocalVarsSize ; dword-misalignment of string r13 56;scanalign equ rsp + xx - LocalVarsSize ; dword-misalignment of string r13
48;bestlen equ rsp + xx - LocalVarsSize ; size of best match so far -> r11d 57;bestlen equ rsp + xx - LocalVarsSize ; size of best match so far -> r11d
49;scan equ rsp + xx - LocalVarsSize ; ptr to string wanting match -> r9 58;scan equ rsp + xx - LocalVarsSize ; ptr to string wanting match -> r9
50 nicematch equ rsp + 16 - LocalVarsSize ; a good enough match size -> r14 59IFDEF INFOZIP
60ELSE
61 nicematch equ (rsp + 16 - LocalVarsSize) ; a good enough match size
62ENDIF
51 63
52save_rdi equ rsp + 24 - LocalVarsSize 64save_rdi equ rsp + 24 - LocalVarsSize
53save_rsi equ rsp + 32 - LocalVarsSize 65save_rsi equ rsp + 32 - LocalVarsSize
@@ -84,8 +96,34 @@ save_r13 equ rsp + 64 - LocalVarsSize
84; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). 96; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
85; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). 97; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
86 98
87zlib1222add equ 8
88 99
100IFDEF INFOZIP
101
102_DATA SEGMENT
103COMM window_size:DWORD
104; WMask ; 7fff
105COMM window:BYTE:010040H
106COMM prev:WORD:08000H
107; MatchLen : unused
108; PrevMatch : unused
109COMM strstart:DWORD
110COMM match_start:DWORD
111; Lookahead : ignore
112COMM prev_length:DWORD ; PrevLen
113COMM max_chain_length:DWORD
114COMM good_match:DWORD
115COMM nice_match:DWORD
116prev_ad equ OFFSET prev
117window_ad equ OFFSET window
118nicematch equ nice_match
119_DATA ENDS
120WMask equ 07fffh
121
122ELSE
123
124 IFNDEF zlib1222add
125 zlib1222add equ 8
126 ENDIF
89dsWSize equ 56+zlib1222add+(zlib1222add/2) 127dsWSize equ 56+zlib1222add+(zlib1222add/2)
90dsWMask equ 64+zlib1222add+(zlib1222add/2) 128dsWMask equ 64+zlib1222add+(zlib1222add/2)
91dsWindow equ 72+zlib1222add 129dsWindow equ 72+zlib1222add
@@ -100,6 +138,18 @@ dsMaxChainLen equ 156+zlib1222add
100dsGoodMatch equ 172+zlib1222add 138dsGoodMatch equ 172+zlib1222add
101dsNiceMatch equ 176+zlib1222add 139dsNiceMatch equ 176+zlib1222add
102 140
141window_size equ [ rcx + dsWSize]
142WMask equ [ rcx + dsWMask]
143window_ad equ [ rcx + dsWindow]
144prev_ad equ [ rcx + dsPrev]
145strstart equ [ rcx + dsStrStart]
146match_start equ [ rcx + dsMatchStart]
147Lookahead equ [ rcx + dsLookahead] ; 0ffffffffh on infozip
148prev_length equ [ rcx + dsPrevLen]
149max_chain_length equ [ rcx + dsMaxChainLen]
150good_match equ [ rcx + dsGoodMatch]
151nice_match equ [ rcx + dsNiceMatch]
152ENDIF
103 153
104; parameter 1 in r8(deflate state s), param 2 in rdx (cur match) 154; parameter 1 in r8(deflate state s), param 2 in rdx (cur match)
105 155
@@ -107,7 +157,7 @@ dsNiceMatch equ 176+zlib1222add
107; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp 157; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp
108; 158;
109; All registers must be preserved across the call, except for 159; All registers must be preserved across the call, except for
110; rax, rcx, rdx, r8, r-9, r10, and r11, which are scratch. 160; rax, rcx, rdx, r8, r9, r10, and r11, which are scratch.
111 161
112 162
113 163
@@ -124,12 +174,15 @@ dsNiceMatch equ 176+zlib1222add
124 174
125; this clear high 32 bits of r8, which can be garbage in both r8 and rdx 175; this clear high 32 bits of r8, which can be garbage in both r8 and rdx
126 176
127
128 mov [save_rdi],rdi 177 mov [save_rdi],rdi
129 mov [save_rsi],rsi 178 mov [save_rsi],rsi
130 mov [save_rbx],rbx 179 mov [save_rbx],rbx
131 mov [save_rbp],rbp 180 mov [save_rbp],rbp
181IFDEF INFOZIP
182 mov r8d,ecx
183ELSE
132 mov r8d,edx 184 mov r8d,edx
185ENDIF
133 mov [save_r12],r12 186 mov [save_r12],r12
134 mov [save_r13],r13 187 mov [save_r13],r13
135; mov [save_r14],r14 188; mov [save_r14],r14
@@ -142,10 +195,10 @@ dsNiceMatch equ 176+zlib1222add
142;;; chain_length >>= 2; 195;;; chain_length >>= 2;
143;;; } 196;;; }
144 197
145 mov edi, [rcx + dsPrevLen] 198 mov edi, prev_length
146 mov esi, [rcx + dsGoodMatch] 199 mov esi, good_match
147 mov eax, [rcx + dsWMask] 200 mov eax, WMask
148 mov ebx, [rcx + dsMaxChainLen] 201 mov ebx, max_chain_length
149 cmp edi, esi 202 cmp edi, esi
150 jl LastMatchGood 203 jl LastMatchGood
151 shr ebx, 2 204 shr ebx, 2
@@ -159,21 +212,25 @@ LastMatchGood:
159 dec ebx 212 dec ebx
160 shl ebx, 16 213 shl ebx, 16
161 or ebx, eax 214 or ebx, eax
162 mov [chainlenwmask], ebx
163 215
216;;; on zlib only
164;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; 217;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
165 218
166 mov eax, [rcx + dsNiceMatch] 219IFDEF INFOZIP
167 mov r10d, [rcx + dsLookahead] 220 mov [chainlenwmask], ebx
221; on infozip nice_match = [nice_match]
222ELSE
223 mov eax, nice_match
224 mov [chainlenwmask], ebx
225 mov r10d, Lookahead
168 cmp r10d, eax 226 cmp r10d, eax
169 cmovnl r10d, eax 227 cmovnl r10d, eax
170 mov [nicematch],r10d 228 mov [nicematch],r10d
171LookaheadLess: 229ENDIF
172 230
173;;; register Bytef *scan = s->window + s->strstart; 231;;; register Bytef *scan = s->window + s->strstart;
174 232 mov r10, window_ad
175 mov r10, [rcx + dsWindow] 233 mov ebp, strstart
176 mov ebp, [rcx + dsStrStart]
177 lea r13, [r10 + rbp] 234 lea r13, [r10 + rbp]
178 235
179;;; Determine how many bytes the scan ptr is off from being 236;;; Determine how many bytes the scan ptr is off from being
@@ -185,13 +242,16 @@ LookaheadLess:
185 242
186;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ? 243;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
187;;; s->strstart - (IPos)MAX_DIST(s) : NIL; 244;;; s->strstart - (IPos)MAX_DIST(s) : NIL;
188 245IFDEF INFOZIP
189 mov eax, [rcx + dsWSize] 246 mov eax,07efah ; MAX_DIST = (WSIZE-MIN_LOOKAHEAD) (0x8000-(3+8+1))
247ELSE
248 mov eax, window_size
190 sub eax, MIN_LOOKAHEAD 249 sub eax, MIN_LOOKAHEAD
250ENDIF
191 xor edi,edi 251 xor edi,edi
192 sub ebp, eax 252 sub ebp, eax
193 253
194 mov r11d, [rcx + dsPrevLen] 254 mov r11d, prev_length
195 255
196 cmovng ebp,edi 256 cmovng ebp,edi
197 257
@@ -207,8 +267,9 @@ LookaheadLess:
207;;; Posf *prev = s->prev; 267;;; Posf *prev = s->prev;
208 268
209 movzx r12d,word ptr [r9] 269 movzx r12d,word ptr [r9]
210 movzx ebx, word ptr [r9 + r11 - 1] 270 movzx ebx, word ptr [r9 + r11 - 1]
211 mov rdi, [rcx + dsPrev] 271
272 mov rdi, prev_ad
212 273
213;;; Jump into the main loop. 274;;; Jump into the main loop.
214 275
@@ -312,38 +373,22 @@ LookupLoopIsZero:
312 373
313 prefetcht1 [rsi+rdx] 374 prefetcht1 [rsi+rdx]
314 prefetcht1 [rdi+rdx] 375 prefetcht1 [rdi+rdx]
376
377
315;;; Test the strings for equality, 8 bytes at a time. At the end, 378;;; Test the strings for equality, 8 bytes at a time. At the end,
316;;; adjust edx so that it is offset to the exact byte that mismatched. 379;;; adjust rdx so that it is offset to the exact byte that mismatched.
317;;; 380;;;
318;;; We already know at this point that the first three bytes of the 381;;; We already know at this point that the first three bytes of the
319;;; strings match each other, and they can be safely passed over before 382;;; strings match each other, and they can be safely passed over before
320;;; starting the compare loop. So what this code does is skip over 0-3 383;;; starting the compare loop. So what this code does is skip over 0-3
321;;; bytes, as much as necessary in order to dword-align the edi 384;;; bytes, as much as necessary in order to dword-align the edi
322;;; pointer. (esi will still be misaligned three times out of four.) 385;;; pointer. (rsi will still be misaligned three times out of four.)
323;;; 386;;;
324;;; It should be confessed that this loop usually does not represent 387;;; It should be confessed that this loop usually does not represent
325;;; much of the total running time. Replacing it with a more 388;;; much of the total running time. Replacing it with a more
326;;; straightforward "rep cmpsb" would not drastically degrade 389;;; straightforward "rep cmpsb" would not drastically degrade
327;;; performance. 390;;; performance.
328 391
329;LoopCmps:
330; mov eax, [rsi + rdx]
331; xor eax, [rdi + rdx]
332; jnz LeaveLoopCmps
333; mov eax, [rsi + rdx + 4]
334; xor eax, [rdi + rdx + 4]
335; jnz LeaveLoopCmps4
336; add rdx, 8
337; jnz LoopCmps
338; jmp LenMaximum
339;LeaveLoopCmps4: add rdx, 4
340;LeaveLoopCmps: test eax, 0000FFFFh
341; jnz LenLower
342; add rdx, 2
343; shr eax, 16
344;LenLower: sub al, 1
345; adc rdx, 0
346
347 392
348LoopCmps: 393LoopCmps:
349 mov rax, [rsi + rdx] 394 mov rax, [rsi + rdx]
@@ -400,7 +445,7 @@ LenLower: sub al, 1
400 445
401 lea rsi,[r10+r11] 446 lea rsi,[r10+r11]
402 447
403 mov rdi, [rcx + dsPrev] 448 mov rdi, prev_ad
404 mov edx, [chainlenwmask] 449 mov edx, [chainlenwmask]
405 jmp LookupLoop 450 jmp LookupLoop
406 451
@@ -411,14 +456,14 @@ LenLower: sub al, 1
411 456
412LongerMatch: 457LongerMatch:
413 mov r11d, eax 458 mov r11d, eax
414 mov [rcx + dsMatchStart], r8d 459 mov match_start, r8d
415 cmp eax, [nicematch] 460 cmp eax, [nicematch]
416 jge LeaveNow 461 jge LeaveNow
417 462
418 lea rsi,[r10+rax] 463 lea rsi,[r10+rax]
419 464
420 movzx ebx, word ptr [r9 + rax - 1] 465 movzx ebx, word ptr [r9 + rax - 1]
421 mov rdi, [rcx + dsPrev] 466 mov rdi, prev_ad
422 mov edx, [chainlenwmask] 467 mov edx, [chainlenwmask]
423 jmp LookupLoop 468 jmp LookupLoop
424 469
@@ -426,16 +471,19 @@ LongerMatch:
426 471
427LenMaximum: 472LenMaximum:
428 mov r11d,MAX_MATCH 473 mov r11d,MAX_MATCH
429 mov [rcx + dsMatchStart], r8d 474 mov match_start, r8d
430 475
431;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len; 476;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
432;;; return s->lookahead; 477;;; return s->lookahead;
433 478
434LeaveNow: 479LeaveNow:
435 mov eax, [rcx + dsLookahead] 480IFDEF INFOZIP
481 mov eax,r11d
482ELSE
483 mov eax, Lookahead
436 cmp r11d, eax 484 cmp r11d, eax
437 cmovng eax, r11d 485 cmovng eax, r11d
438 486ENDIF
439 487
440;;; Restore the stack and return from whence we came. 488;;; Restore the stack and return from whence we came.
441 489
@@ -452,7 +500,8 @@ LeaveNow:
452 500
453 ret 0 501 ret 0
454; please don't remove this string ! 502; please don't remove this string !
455; Your can freely use gvmat32 in any free or commercial app if you don't remove the string in the binary! 503; Your can freely use gvmat64 in any free or commercial app
504; but it is far better don't remove the string in the binary!
456 db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998, converted to amd 64 by Gilles Vollant 2005",0dh,0ah,0 505 db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998, converted to amd 64 by Gilles Vollant 2005",0dh,0ah,0
457longest_match ENDP 506longest_match ENDP
458 507
diff --git a/contrib/masmx64/gvmat64.obj b/contrib/masmx64/gvmat64.obj
index 10a73fe..a49ca02 100644
--- a/contrib/masmx64/gvmat64.obj
+++ b/contrib/masmx64/gvmat64.obj
Binary files differ
diff --git a/contrib/vstudio/vc7/gvmat32.obj b/contrib/masmx86/gvmat32.obj
index ebb3262..ebb3262 100644
--- a/contrib/vstudio/vc7/gvmat32.obj
+++ b/contrib/masmx86/gvmat32.obj
Binary files differ
diff --git a/contrib/vstudio/vc7/inffas32.obj b/contrib/masmx86/inffas32.obj
index bd6664d..bd6664d 100644
--- a/contrib/vstudio/vc7/inffas32.obj
+++ b/contrib/masmx86/inffas32.obj
Binary files differ
diff --git a/contrib/minizip/ChangeLogUnzip b/contrib/minizip/ChangeLogUnzip
index e62af14..50ca6a9 100644
--- a/contrib/minizip/ChangeLogUnzip
+++ b/contrib/minizip/ChangeLogUnzip
@@ -1,67 +1,67 @@
1Change in 1.01e (12 feb 05) 1Change in 1.01e (12 feb 05)
2- Fix in zipOpen2 for globalcomment (Rolf Kalbermatter) 2- Fix in zipOpen2 for globalcomment (Rolf Kalbermatter)
3- Fix possible memory leak in unzip.c (Zoran Stevanovic) 3- Fix possible memory leak in unzip.c (Zoran Stevanovic)
4 4
5Change in 1.01b (20 may 04) 5Change in 1.01b (20 may 04)
6- Integrate patch from Debian package (submited by Mark Brown) 6- Integrate patch from Debian package (submited by Mark Brown)
7- Add tools mztools from Xavier Roche 7- Add tools mztools from Xavier Roche
8 8
9Change in 1.01 (8 may 04) 9Change in 1.01 (8 may 04)
10- fix buffer overrun risk in unzip.c (Xavier Roche) 10- fix buffer overrun risk in unzip.c (Xavier Roche)
11- fix a minor buffer insecurity in minizip.c (Mike Whittaker) 11- fix a minor buffer insecurity in minizip.c (Mike Whittaker)
12 12
13Change in 1.00: (10 sept 03) 13Change in 1.00: (10 sept 03)
14- rename to 1.00 14- rename to 1.00
15- cosmetic code change 15- cosmetic code change
16 16
17Change in 0.22: (19 May 03) 17Change in 0.22: (19 May 03)
18- crypting support (unless you define NOCRYPT) 18- crypting support (unless you define NOCRYPT)
19- append file in existing zipfile 19- append file in existing zipfile
20 20
21Change in 0.21: (10 Mar 03) 21Change in 0.21: (10 Mar 03)
22- bug fixes 22- bug fixes
23 23
24Change in 0.17: (27 Jan 02) 24Change in 0.17: (27 Jan 02)
25- bug fixes 25- bug fixes
26 26
27Change in 0.16: (19 Jan 02) 27Change in 0.16: (19 Jan 02)
28- Support of ioapi for virtualize zip file access 28- Support of ioapi for virtualize zip file access
29 29
30Change in 0.15: (19 Mar 98) 30Change in 0.15: (19 Mar 98)
31- fix memory leak in minizip.c 31- fix memory leak in minizip.c
32 32
33Change in 0.14: (10 Mar 98) 33Change in 0.14: (10 Mar 98)
34- fix bugs in minizip.c sample for zipping big file 34- fix bugs in minizip.c sample for zipping big file
35- fix problem in month in date handling 35- fix problem in month in date handling
36- fix bug in unzlocal_GetCurrentFileInfoInternal in unzip.c for 36- fix bug in unzlocal_GetCurrentFileInfoInternal in unzip.c for
37 comment handling 37 comment handling
38 38
39Change in 0.13: (6 Mar 98) 39Change in 0.13: (6 Mar 98)
40- fix bugs in zip.c 40- fix bugs in zip.c
41- add real minizip sample 41- add real minizip sample
42 42
43Change in 0.12: (4 Mar 98) 43Change in 0.12: (4 Mar 98)
44- add zip.c and zip.h for creates .zip file 44- add zip.c and zip.h for creates .zip file
45- fix change_file_date in miniunz.c for Unix (Jean-loup Gailly) 45- fix change_file_date in miniunz.c for Unix (Jean-loup Gailly)
46- fix miniunz.c for file without specific record for directory 46- fix miniunz.c for file without specific record for directory
47 47
48Change in 0.11: (3 Mar 98) 48Change in 0.11: (3 Mar 98)
49- fix bug in unzGetCurrentFileInfo for get extra field and comment 49- fix bug in unzGetCurrentFileInfo for get extra field and comment
50- enhance miniunz sample, remove the bad unztst.c sample 50- enhance miniunz sample, remove the bad unztst.c sample
51 51
52Change in 0.10: (2 Mar 98) 52Change in 0.10: (2 Mar 98)
53- fix bug in unzReadCurrentFile 53- fix bug in unzReadCurrentFile
54- rename unzip* to unz* function and structure 54- rename unzip* to unz* function and structure
55- remove Windows-like hungary notation variable name 55- remove Windows-like hungary notation variable name
56- modify some structure in unzip.h 56- modify some structure in unzip.h
57- add somes comment in source 57- add somes comment in source
58- remove unzipGetcCurrentFile function 58- remove unzipGetcCurrentFile function
59- replace ZUNZEXPORT by ZEXPORT 59- replace ZUNZEXPORT by ZEXPORT
60- add unzGetLocalExtrafield for get the local extrafield info 60- add unzGetLocalExtrafield for get the local extrafield info
61- add a new sample, miniunz.c 61- add a new sample, miniunz.c
62 62
63Change in 0.4: (25 Feb 98) 63Change in 0.4: (25 Feb 98)
64- suppress the type unzipFileInZip. 64- suppress the type unzipFileInZip.
65 Only on file in the zipfile can be open at the same time 65 Only on file in the zipfile can be open at the same time
66- fix somes typo in code 66- fix somes typo in code
67- added tm_unz structure in unzip_file_info (date/time in readable format) 67- added tm_unz structure in unzip_file_info (date/time in readable format)
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 @@
1CC=cc 1CC=cc
2CFLAGS=-O -I../.. 2CFLAGS=-O -I../..
3 3
4UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a 4UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
5ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a 5ZIP_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
10all: miniunz minizip 10all: miniunz minizip
11 11
12miniunz: $(UNZ_OBJS) 12miniunz: $(UNZ_OBJS)
13 $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) 13 $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
14 14
15minizip: $(ZIP_OBJS) 15minizip: $(ZIP_OBJS)
16 $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) 16 $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
17 17
18test: miniunz minizip 18test: 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
24clean: 24clean:
25 /bin/rm -f *.o *~ minizip miniunz 25 /bin/rm -f *.o *~ minizip miniunz
diff --git a/contrib/minizip/crypt.h b/contrib/minizip/crypt.h
index f14a628..622f4bc 100644
--- a/contrib/minizip/crypt.h
+++ b/contrib/minizip/crypt.h
@@ -1,132 +1,132 @@
1/* crypt.h -- base code for crypt/uncrypt ZIPfile 1/* crypt.h -- base code for crypt/uncrypt ZIPfile
2 2
3 3
4 Version 1.01e, February 12th, 2005 4 Version 1.01e, February 12th, 2005
5 5
6 Copyright (C) 1998-2005 Gilles Vollant 6 Copyright (C) 1998-2005 Gilles Vollant
7 7
8 This code is a modified version of crypting code in Infozip distribution 8 This code is a modified version of crypting code in Infozip distribution
9 9
10 The encryption/decryption parts of this source code (as opposed to the 10 The encryption/decryption parts of this source code (as opposed to the
11 non-echoing password parts) were originally written in Europe. The 11 non-echoing password parts) were originally written in Europe. The
12 whole source package can be freely distributed, including from the USA. 12 whole source package can be freely distributed, including from the USA.
13 (Prior to January 2000, re-export from the US was a violation of US law.) 13 (Prior to January 2000, re-export from the US was a violation of US law.)
14 14
15 This encryption code is a direct transcription of the algorithm from 15 This encryption code is a direct transcription of the algorithm from
16 Roger Schlafly, described by Phil Katz in the file appnote.txt. This 16 Roger Schlafly, described by Phil Katz in the file appnote.txt. This
17 file (appnote.txt) is distributed with the PKZIP program (even in the 17 file (appnote.txt) is distributed with the PKZIP program (even in the
18 version without encryption capabilities). 18 version without encryption capabilities).
19 19
20 If you don't need crypting in your application, just define symbols 20 If you don't need crypting in your application, just define symbols
21 NOCRYPT and NOUNCRYPT. 21 NOCRYPT and NOUNCRYPT.
22 22
23 This code support the "Traditional PKWARE Encryption". 23 This code support the "Traditional PKWARE Encryption".
24 24
25 The new AES encryption added on Zip format by Winzip (see the page 25 The new AES encryption added on Zip format by Winzip (see the page
26 http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong 26 http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
27 Encryption is not supported. 27 Encryption is not supported.
28*/ 28*/
29 29
30#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) 30#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
31 31
32/*********************************************************************** 32/***********************************************************************
33 * Return the next byte in the pseudo-random sequence 33 * Return the next byte in the pseudo-random sequence
34 */ 34 */
35static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab) 35static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
36{ 36{
37 unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an 37 unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
38 * unpredictable manner on 16-bit systems; not a problem 38 * unpredictable manner on 16-bit systems; not a problem
39 * with any known compiler so far, though */ 39 * with any known compiler so far, though */
40 40
41 temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2; 41 temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
42 return (int)(((temp * (temp ^ 1)) >> 8) & 0xff); 42 return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
43} 43}
44 44
45/*********************************************************************** 45/***********************************************************************
46 * Update the encryption keys with the next byte of plain text 46 * Update the encryption keys with the next byte of plain text
47 */ 47 */
48static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c) 48static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
49{ 49{
50 (*(pkeys+0)) = CRC32((*(pkeys+0)), c); 50 (*(pkeys+0)) = CRC32((*(pkeys+0)), c);
51 (*(pkeys+1)) += (*(pkeys+0)) & 0xff; 51 (*(pkeys+1)) += (*(pkeys+0)) & 0xff;
52 (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1; 52 (*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
53 { 53 {
54 register int keyshift = (int)((*(pkeys+1)) >> 24); 54 register int keyshift = (int)((*(pkeys+1)) >> 24);
55 (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift); 55 (*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
56 } 56 }
57 return c; 57 return c;
58} 58}
59 59
60 60
61/*********************************************************************** 61/***********************************************************************
62 * Initialize the encryption keys and the random header according to 62 * Initialize the encryption keys and the random header according to
63 * the given password. 63 * the given password.
64 */ 64 */
65static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab) 65static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
66{ 66{
67 *(pkeys+0) = 305419896L; 67 *(pkeys+0) = 305419896L;
68 *(pkeys+1) = 591751049L; 68 *(pkeys+1) = 591751049L;
69 *(pkeys+2) = 878082192L; 69 *(pkeys+2) = 878082192L;
70 while (*passwd != '\0') { 70 while (*passwd != '\0') {
71 update_keys(pkeys,pcrc_32_tab,(int)*passwd); 71 update_keys(pkeys,pcrc_32_tab,(int)*passwd);
72 passwd++; 72 passwd++;
73 } 73 }
74} 74}
75 75
76#define zdecode(pkeys,pcrc_32_tab,c) \ 76#define zdecode(pkeys,pcrc_32_tab,c) \
77 (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab))) 77 (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
78 78
79#define zencode(pkeys,pcrc_32_tab,c,t) \ 79#define zencode(pkeys,pcrc_32_tab,c,t) \
80 (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c)) 80 (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
81 81
82#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED 82#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
83 83
84#define RAND_HEAD_LEN 12 84#define RAND_HEAD_LEN 12
85 /* "last resort" source for second part of crypt seed pattern */ 85 /* "last resort" source for second part of crypt seed pattern */
86# ifndef ZCR_SEED2 86# ifndef ZCR_SEED2
87# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ 87# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
88# endif 88# endif
89 89
90static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting) 90static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
91 const char *passwd; /* password string */ 91 const char *passwd; /* password string */
92 unsigned char *buf; /* where to write header */ 92 unsigned char *buf; /* where to write header */
93 int bufSize; 93 int bufSize;
94 unsigned long* pkeys; 94 unsigned long* pkeys;
95 const unsigned long* pcrc_32_tab; 95 const unsigned long* pcrc_32_tab;
96 unsigned long crcForCrypting; 96 unsigned long crcForCrypting;
97{ 97{
98 int n; /* index in random header */ 98 int n; /* index in random header */
99 int t; /* temporary */ 99 int t; /* temporary */
100 int c; /* random byte */ 100 int c; /* random byte */
101 unsigned char header[RAND_HEAD_LEN-2]; /* random header */ 101 unsigned char header[RAND_HEAD_LEN-2]; /* random header */
102 static unsigned calls = 0; /* ensure different random header each time */ 102 static unsigned calls = 0; /* ensure different random header each time */
103 103
104 if (bufSize<RAND_HEAD_LEN) 104 if (bufSize<RAND_HEAD_LEN)
105 return 0; 105 return 0;
106 106
107 /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the 107 /* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
108 * output of rand() to get less predictability, since rand() is 108 * output of rand() to get less predictability, since rand() is
109 * often poorly implemented. 109 * often poorly implemented.
110 */ 110 */
111 if (++calls == 1) 111 if (++calls == 1)
112 { 112 {
113 srand((unsigned)(time(NULL) ^ ZCR_SEED2)); 113 srand((unsigned)(time(NULL) ^ ZCR_SEED2));
114 } 114 }
115 init_keys(passwd, pkeys, pcrc_32_tab); 115 init_keys(passwd, pkeys, pcrc_32_tab);
116 for (n = 0; n < RAND_HEAD_LEN-2; n++) 116 for (n = 0; n < RAND_HEAD_LEN-2; n++)
117 { 117 {
118 c = (rand() >> 7) & 0xff; 118 c = (rand() >> 7) & 0xff;
119 header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t); 119 header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
120 } 120 }
121 /* Encrypt random header (last two bytes is high word of crc) */ 121 /* Encrypt random header (last two bytes is high word of crc) */
122 init_keys(passwd, pkeys, pcrc_32_tab); 122 init_keys(passwd, pkeys, pcrc_32_tab);
123 for (n = 0; n < RAND_HEAD_LEN-2; n++) 123 for (n = 0; n < RAND_HEAD_LEN-2; n++)
124 { 124 {
125 buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t); 125 buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
126 } 126 }
127 buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t); 127 buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
128 buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t); 128 buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
129 return n; 129 return n;
130} 130}
131 131
132#endif 132#endif
diff --git a/contrib/minizip/ioapi.c b/contrib/minizip/ioapi.c
index 7f20c18..f1bee23 100644
--- a/contrib/minizip/ioapi.c
+++ b/contrib/minizip/ioapi.c
@@ -1,177 +1,177 @@
1/* ioapi.c -- IO base function header for compress/uncompress .zip 1/* ioapi.c -- IO base function header for compress/uncompress .zip
2 files using zlib + zip or unzip API 2 files using zlib + zip or unzip API
3 3
4 Version 1.01e, February 12th, 2005 4 Version 1.01e, February 12th, 2005
5 5
6 Copyright (C) 1998-2005 Gilles Vollant 6 Copyright (C) 1998-2005 Gilles Vollant
7*/ 7*/
8 8
9#include <stdio.h> 9#include <stdio.h>
10#include <stdlib.h> 10#include <stdlib.h>
11#include <string.h> 11#include <string.h>
12 12
13#include "zlib.h" 13#include "zlib.h"
14#include "ioapi.h" 14#include "ioapi.h"
15 15
16 16
17 17
18/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ 18/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
19 19
20#ifndef SEEK_CUR 20#ifndef SEEK_CUR
21#define SEEK_CUR 1 21#define SEEK_CUR 1
22#endif 22#endif
23 23
24#ifndef SEEK_END 24#ifndef SEEK_END
25#define SEEK_END 2 25#define SEEK_END 2
26#endif 26#endif
27 27
28#ifndef SEEK_SET 28#ifndef SEEK_SET
29#define SEEK_SET 0 29#define SEEK_SET 0
30#endif 30#endif
31 31
32voidpf ZCALLBACK fopen_file_func OF(( 32voidpf ZCALLBACK fopen_file_func OF((
33 voidpf opaque, 33 voidpf opaque,
34 const char* filename, 34 const char* filename,
35 int mode)); 35 int mode));
36 36
37uLong ZCALLBACK fread_file_func OF(( 37uLong ZCALLBACK fread_file_func OF((
38 voidpf opaque, 38 voidpf opaque,
39 voidpf stream, 39 voidpf stream,
40 void* buf, 40 void* buf,
41 uLong size)); 41 uLong size));
42 42
43uLong ZCALLBACK fwrite_file_func OF(( 43uLong ZCALLBACK fwrite_file_func OF((
44 voidpf opaque, 44 voidpf opaque,
45 voidpf stream, 45 voidpf stream,
46 const void* buf, 46 const void* buf,
47 uLong size)); 47 uLong size));
48 48
49long ZCALLBACK ftell_file_func OF(( 49long ZCALLBACK ftell_file_func OF((
50 voidpf opaque, 50 voidpf opaque,
51 voidpf stream)); 51 voidpf stream));
52 52
53long ZCALLBACK fseek_file_func OF(( 53long ZCALLBACK fseek_file_func OF((
54 voidpf opaque, 54 voidpf opaque,
55 voidpf stream, 55 voidpf stream,
56 uLong offset, 56 uLong offset,
57 int origin)); 57 int origin));
58 58
59int ZCALLBACK fclose_file_func OF(( 59int ZCALLBACK fclose_file_func OF((
60 voidpf opaque, 60 voidpf opaque,
61 voidpf stream)); 61 voidpf stream));
62 62
63int ZCALLBACK ferror_file_func OF(( 63int ZCALLBACK ferror_file_func OF((
64 voidpf opaque, 64 voidpf opaque,
65 voidpf stream)); 65 voidpf stream));
66 66
67 67
68voidpf ZCALLBACK fopen_file_func (opaque, filename, mode) 68voidpf ZCALLBACK fopen_file_func (opaque, filename, mode)
69 voidpf opaque; 69 voidpf opaque;
70 const char* filename; 70 const char* filename;
71 int mode; 71 int mode;
72{ 72{
73 FILE* file = NULL; 73 FILE* file = NULL;
74 const char* mode_fopen = NULL; 74 const char* mode_fopen = NULL;
75 if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) 75 if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
76 mode_fopen = "rb"; 76 mode_fopen = "rb";
77 else 77 else
78 if (mode & ZLIB_FILEFUNC_MODE_EXISTING) 78 if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
79 mode_fopen = "r+b"; 79 mode_fopen = "r+b";
80 else 80 else
81 if (mode & ZLIB_FILEFUNC_MODE_CREATE) 81 if (mode & ZLIB_FILEFUNC_MODE_CREATE)
82 mode_fopen = "wb"; 82 mode_fopen = "wb";
83 83
84 if ((filename!=NULL) && (mode_fopen != NULL)) 84 if ((filename!=NULL) && (mode_fopen != NULL))
85 file = fopen(filename, mode_fopen); 85 file = fopen(filename, mode_fopen);
86 return file; 86 return file;
87} 87}
88 88
89 89
90uLong ZCALLBACK fread_file_func (opaque, stream, buf, size) 90uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
91 voidpf opaque; 91 voidpf opaque;
92 voidpf stream; 92 voidpf stream;
93 void* buf; 93 void* buf;
94 uLong size; 94 uLong size;
95{ 95{
96 uLong ret; 96 uLong ret;
97 ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream); 97 ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
98 return ret; 98 return ret;
99} 99}
100 100
101 101
102uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size) 102uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
103 voidpf opaque; 103 voidpf opaque;
104 voidpf stream; 104 voidpf stream;
105 const void* buf; 105 const void* buf;
106 uLong size; 106 uLong size;
107{ 107{
108 uLong ret; 108 uLong ret;
109 ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream); 109 ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
110 return ret; 110 return ret;
111} 111}
112 112
113long ZCALLBACK ftell_file_func (opaque, stream) 113long ZCALLBACK ftell_file_func (opaque, stream)
114 voidpf opaque; 114 voidpf opaque;
115 voidpf stream; 115 voidpf stream;
116{ 116{
117 long ret; 117 long ret;
118 ret = ftell((FILE *)stream); 118 ret = ftell((FILE *)stream);
119 return ret; 119 return ret;
120} 120}
121 121
122long ZCALLBACK fseek_file_func (opaque, stream, offset, origin) 122long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
123 voidpf opaque; 123 voidpf opaque;
124 voidpf stream; 124 voidpf stream;
125 uLong offset; 125 uLong offset;
126 int origin; 126 int origin;
127{ 127{
128 int fseek_origin=0; 128 int fseek_origin=0;
129 long ret; 129 long ret;
130 switch (origin) 130 switch (origin)
131 { 131 {
132 case ZLIB_FILEFUNC_SEEK_CUR : 132 case ZLIB_FILEFUNC_SEEK_CUR :
133 fseek_origin = SEEK_CUR; 133 fseek_origin = SEEK_CUR;
134 break; 134 break;
135 case ZLIB_FILEFUNC_SEEK_END : 135 case ZLIB_FILEFUNC_SEEK_END :
136 fseek_origin = SEEK_END; 136 fseek_origin = SEEK_END;
137 break; 137 break;
138 case ZLIB_FILEFUNC_SEEK_SET : 138 case ZLIB_FILEFUNC_SEEK_SET :
139 fseek_origin = SEEK_SET; 139 fseek_origin = SEEK_SET;
140 break; 140 break;
141 default: return -1; 141 default: return -1;
142 } 142 }
143 ret = 0; 143 ret = 0;
144 fseek((FILE *)stream, offset, fseek_origin); 144 fseek((FILE *)stream, offset, fseek_origin);
145 return ret; 145 return ret;
146} 146}
147 147
148int ZCALLBACK fclose_file_func (opaque, stream) 148int ZCALLBACK fclose_file_func (opaque, stream)
149 voidpf opaque; 149 voidpf opaque;
150 voidpf stream; 150 voidpf stream;
151{ 151{
152 int ret; 152 int ret;
153 ret = fclose((FILE *)stream); 153 ret = fclose((FILE *)stream);
154 return ret; 154 return ret;
155} 155}
156 156
157int ZCALLBACK ferror_file_func (opaque, stream) 157int ZCALLBACK ferror_file_func (opaque, stream)
158 voidpf opaque; 158 voidpf opaque;
159 voidpf stream; 159 voidpf stream;
160{ 160{
161 int ret; 161 int ret;
162 ret = ferror((FILE *)stream); 162 ret = ferror((FILE *)stream);
163 return ret; 163 return ret;
164} 164}
165 165
166void fill_fopen_filefunc (pzlib_filefunc_def) 166void fill_fopen_filefunc (pzlib_filefunc_def)
167 zlib_filefunc_def* pzlib_filefunc_def; 167 zlib_filefunc_def* pzlib_filefunc_def;
168{ 168{
169 pzlib_filefunc_def->zopen_file = fopen_file_func; 169 pzlib_filefunc_def->zopen_file = fopen_file_func;
170 pzlib_filefunc_def->zread_file = fread_file_func; 170 pzlib_filefunc_def->zread_file = fread_file_func;
171 pzlib_filefunc_def->zwrite_file = fwrite_file_func; 171 pzlib_filefunc_def->zwrite_file = fwrite_file_func;
172 pzlib_filefunc_def->ztell_file = ftell_file_func; 172 pzlib_filefunc_def->ztell_file = ftell_file_func;
173 pzlib_filefunc_def->zseek_file = fseek_file_func; 173 pzlib_filefunc_def->zseek_file = fseek_file_func;
174 pzlib_filefunc_def->zclose_file = fclose_file_func; 174 pzlib_filefunc_def->zclose_file = fclose_file_func;
175 pzlib_filefunc_def->zerror_file = ferror_file_func; 175 pzlib_filefunc_def->zerror_file = ferror_file_func;
176 pzlib_filefunc_def->opaque = NULL; 176 pzlib_filefunc_def->opaque = NULL;
177} 177}
diff --git a/contrib/minizip/ioapi.h b/contrib/minizip/ioapi.h
index e73a3b2..7d457ba 100644
--- a/contrib/minizip/ioapi.h
+++ b/contrib/minizip/ioapi.h
@@ -1,75 +1,75 @@
1/* ioapi.h -- IO base function header for compress/uncompress .zip 1/* ioapi.h -- IO base function header for compress/uncompress .zip
2 files using zlib + zip or unzip API 2 files using zlib + zip or unzip API
3 3
4 Version 1.01e, February 12th, 2005 4 Version 1.01e, February 12th, 2005
5 5
6 Copyright (C) 1998-2005 Gilles Vollant 6 Copyright (C) 1998-2005 Gilles Vollant
7*/ 7*/
8 8
9#ifndef _ZLIBIOAPI_H 9#ifndef _ZLIBIOAPI_H
10#define _ZLIBIOAPI_H 10#define _ZLIBIOAPI_H
11 11
12 12
13#define ZLIB_FILEFUNC_SEEK_CUR (1) 13#define ZLIB_FILEFUNC_SEEK_CUR (1)
14#define ZLIB_FILEFUNC_SEEK_END (2) 14#define ZLIB_FILEFUNC_SEEK_END (2)
15#define ZLIB_FILEFUNC_SEEK_SET (0) 15#define ZLIB_FILEFUNC_SEEK_SET (0)
16 16
17#define ZLIB_FILEFUNC_MODE_READ (1) 17#define ZLIB_FILEFUNC_MODE_READ (1)
18#define ZLIB_FILEFUNC_MODE_WRITE (2) 18#define ZLIB_FILEFUNC_MODE_WRITE (2)
19#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) 19#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
20 20
21#define ZLIB_FILEFUNC_MODE_EXISTING (4) 21#define ZLIB_FILEFUNC_MODE_EXISTING (4)
22#define ZLIB_FILEFUNC_MODE_CREATE (8) 22#define ZLIB_FILEFUNC_MODE_CREATE (8)
23 23
24 24
25#ifndef ZCALLBACK 25#ifndef ZCALLBACK
26 26
27#if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) 27#if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
28#define ZCALLBACK CALLBACK 28#define ZCALLBACK CALLBACK
29#else 29#else
30#define ZCALLBACK 30#define ZCALLBACK
31#endif 31#endif
32#endif 32#endif
33 33
34#ifdef __cplusplus 34#ifdef __cplusplus
35extern "C" { 35extern "C" {
36#endif 36#endif
37 37
38typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); 38typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
39typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); 39typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
40typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); 40typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
41typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); 41typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
42typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); 42typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
43typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); 43typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
44typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); 44typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
45 45
46typedef struct zlib_filefunc_def_s 46typedef struct zlib_filefunc_def_s
47{ 47{
48 open_file_func zopen_file; 48 open_file_func zopen_file;
49 read_file_func zread_file; 49 read_file_func zread_file;
50 write_file_func zwrite_file; 50 write_file_func zwrite_file;
51 tell_file_func ztell_file; 51 tell_file_func ztell_file;
52 seek_file_func zseek_file; 52 seek_file_func zseek_file;
53 close_file_func zclose_file; 53 close_file_func zclose_file;
54 testerror_file_func zerror_file; 54 testerror_file_func zerror_file;
55 voidpf opaque; 55 voidpf opaque;
56} zlib_filefunc_def; 56} zlib_filefunc_def;
57 57
58 58
59 59
60void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 60void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
61 61
62#define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size)) 62#define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
63#define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size)) 63#define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
64#define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream)) 64#define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
65#define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode)) 65#define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
66#define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream)) 66#define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
67#define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream)) 67#define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
68 68
69 69
70#ifdef __cplusplus 70#ifdef __cplusplus
71} 71}
72#endif 72#endif
73 73
74#endif 74#endif
75 75
diff --git a/contrib/minizip/iowin32.c b/contrib/minizip/iowin32.c
index 694bc03..a9b5f78 100644
--- a/contrib/minizip/iowin32.c
+++ b/contrib/minizip/iowin32.c
@@ -1,270 +1,270 @@
1/* iowin32.c -- IO base function header for compress/uncompress .zip 1/* iowin32.c -- IO base function header for compress/uncompress .zip
2 files using zlib + zip or unzip API 2 files using zlib + zip or unzip API
3 This IO API version uses the Win32 API (for Microsoft Windows) 3 This IO API version uses the Win32 API (for Microsoft Windows)
4 4
5 Version 1.01e, February 12th, 2005 5 Version 1.01e, February 12th, 2005
6 6
7 Copyright (C) 1998-2005 Gilles Vollant 7 Copyright (C) 1998-2005 Gilles Vollant
8*/ 8*/
9 9
10#include <stdlib.h> 10#include <stdlib.h>
11 11
12#include "zlib.h" 12#include "zlib.h"
13#include "ioapi.h" 13#include "ioapi.h"
14#include "iowin32.h" 14#include "iowin32.h"
15 15
16#ifndef INVALID_HANDLE_VALUE 16#ifndef INVALID_HANDLE_VALUE
17#define INVALID_HANDLE_VALUE (0xFFFFFFFF) 17#define INVALID_HANDLE_VALUE (0xFFFFFFFF)
18#endif 18#endif
19 19
20#ifndef INVALID_SET_FILE_POINTER 20#ifndef INVALID_SET_FILE_POINTER
21#define INVALID_SET_FILE_POINTER ((DWORD)-1) 21#define INVALID_SET_FILE_POINTER ((DWORD)-1)
22#endif 22#endif
23 23
24voidpf ZCALLBACK win32_open_file_func OF(( 24voidpf ZCALLBACK win32_open_file_func OF((
25 voidpf opaque, 25 voidpf opaque,
26 const char* filename, 26 const char* filename,
27 int mode)); 27 int mode));
28 28
29uLong ZCALLBACK win32_read_file_func OF(( 29uLong ZCALLBACK win32_read_file_func OF((
30 voidpf opaque, 30 voidpf opaque,
31 voidpf stream, 31 voidpf stream,
32 void* buf, 32 void* buf,
33 uLong size)); 33 uLong size));
34 34
35uLong ZCALLBACK win32_write_file_func OF(( 35uLong ZCALLBACK win32_write_file_func OF((
36 voidpf opaque, 36 voidpf opaque,
37 voidpf stream, 37 voidpf stream,
38 const void* buf, 38 const void* buf,
39 uLong size)); 39 uLong size));
40 40
41long ZCALLBACK win32_tell_file_func OF(( 41long ZCALLBACK win32_tell_file_func OF((
42 voidpf opaque, 42 voidpf opaque,
43 voidpf stream)); 43 voidpf stream));
44 44
45long ZCALLBACK win32_seek_file_func OF(( 45long ZCALLBACK win32_seek_file_func OF((
46 voidpf opaque, 46 voidpf opaque,
47 voidpf stream, 47 voidpf stream,
48 uLong offset, 48 uLong offset,
49 int origin)); 49 int origin));
50 50
51int ZCALLBACK win32_close_file_func OF(( 51int ZCALLBACK win32_close_file_func OF((
52 voidpf opaque, 52 voidpf opaque,
53 voidpf stream)); 53 voidpf stream));
54 54
55int ZCALLBACK win32_error_file_func OF(( 55int ZCALLBACK win32_error_file_func OF((
56 voidpf opaque, 56 voidpf opaque,
57 voidpf stream)); 57 voidpf stream));
58 58
59typedef struct 59typedef struct
60{ 60{
61 HANDLE hf; 61 HANDLE hf;
62 int error; 62 int error;
63} WIN32FILE_IOWIN; 63} WIN32FILE_IOWIN;
64 64
65voidpf ZCALLBACK win32_open_file_func (opaque, filename, mode) 65voidpf ZCALLBACK win32_open_file_func (opaque, filename, mode)
66 voidpf opaque; 66 voidpf opaque;
67 const char* filename; 67 const char* filename;
68 int mode; 68 int mode;
69{ 69{
70 const char* mode_fopen = NULL; 70 const char* mode_fopen = NULL;
71 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ; 71 DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
72 HANDLE hFile = 0; 72 HANDLE hFile = 0;
73 voidpf ret=NULL; 73 voidpf ret=NULL;
74 74
75 dwDesiredAccess = dwShareMode = dwFlagsAndAttributes = 0; 75 dwDesiredAccess = dwShareMode = dwFlagsAndAttributes = 0;
76 76
77 if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ) 77 if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
78 { 78 {
79 dwDesiredAccess = GENERIC_READ; 79 dwDesiredAccess = GENERIC_READ;
80 dwCreationDisposition = OPEN_EXISTING; 80 dwCreationDisposition = OPEN_EXISTING;
81 dwShareMode = FILE_SHARE_READ; 81 dwShareMode = FILE_SHARE_READ;
82 } 82 }
83 else 83 else
84 if (mode & ZLIB_FILEFUNC_MODE_EXISTING) 84 if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
85 { 85 {
86 dwDesiredAccess = GENERIC_WRITE | GENERIC_READ; 86 dwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
87 dwCreationDisposition = OPEN_EXISTING; 87 dwCreationDisposition = OPEN_EXISTING;
88 } 88 }
89 else 89 else
90 if (mode & ZLIB_FILEFUNC_MODE_CREATE) 90 if (mode & ZLIB_FILEFUNC_MODE_CREATE)
91 { 91 {
92 dwDesiredAccess = GENERIC_WRITE | GENERIC_READ; 92 dwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
93 dwCreationDisposition = CREATE_ALWAYS; 93 dwCreationDisposition = CREATE_ALWAYS;
94 } 94 }
95 95
96 if ((filename!=NULL) && (dwDesiredAccess != 0)) 96 if ((filename!=NULL) && (dwDesiredAccess != 0))
97 hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, 97 hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL,
98 dwCreationDisposition, dwFlagsAndAttributes, NULL); 98 dwCreationDisposition, dwFlagsAndAttributes, NULL);
99 99
100 if (hFile == INVALID_HANDLE_VALUE) 100 if (hFile == INVALID_HANDLE_VALUE)
101 hFile = NULL; 101 hFile = NULL;
102 102
103 if (hFile != NULL) 103 if (hFile != NULL)
104 { 104 {
105 WIN32FILE_IOWIN w32fiow; 105 WIN32FILE_IOWIN w32fiow;
106 w32fiow.hf = hFile; 106 w32fiow.hf = hFile;
107 w32fiow.error = 0; 107 w32fiow.error = 0;
108 ret = malloc(sizeof(WIN32FILE_IOWIN)); 108 ret = malloc(sizeof(WIN32FILE_IOWIN));
109 if (ret==NULL) 109 if (ret==NULL)
110 CloseHandle(hFile); 110 CloseHandle(hFile);
111 else *((WIN32FILE_IOWIN*)ret) = w32fiow; 111 else *((WIN32FILE_IOWIN*)ret) = w32fiow;
112 } 112 }
113 return ret; 113 return ret;
114} 114}
115 115
116 116
117uLong ZCALLBACK win32_read_file_func (opaque, stream, buf, size) 117uLong ZCALLBACK win32_read_file_func (opaque, stream, buf, size)
118 voidpf opaque; 118 voidpf opaque;
119 voidpf stream; 119 voidpf stream;
120 void* buf; 120 void* buf;
121 uLong size; 121 uLong size;
122{ 122{
123 uLong ret=0; 123 uLong ret=0;
124 HANDLE hFile = NULL; 124 HANDLE hFile = NULL;
125 if (stream!=NULL) 125 if (stream!=NULL)
126 hFile = ((WIN32FILE_IOWIN*)stream) -> hf; 126 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
127 if (hFile != NULL) 127 if (hFile != NULL)
128 if (!ReadFile(hFile, buf, size, &ret, NULL)) 128 if (!ReadFile(hFile, buf, size, &ret, NULL))
129 { 129 {
130 DWORD dwErr = GetLastError(); 130 DWORD dwErr = GetLastError();
131 if (dwErr == ERROR_HANDLE_EOF) 131 if (dwErr == ERROR_HANDLE_EOF)
132 dwErr = 0; 132 dwErr = 0;
133 ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; 133 ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
134 } 134 }
135 135
136 return ret; 136 return ret;
137} 137}
138 138
139 139
140uLong ZCALLBACK win32_write_file_func (opaque, stream, buf, size) 140uLong ZCALLBACK win32_write_file_func (opaque, stream, buf, size)
141 voidpf opaque; 141 voidpf opaque;
142 voidpf stream; 142 voidpf stream;
143 const void* buf; 143 const void* buf;
144 uLong size; 144 uLong size;
145{ 145{
146 uLong ret=0; 146 uLong ret=0;
147 HANDLE hFile = NULL; 147 HANDLE hFile = NULL;
148 if (stream!=NULL) 148 if (stream!=NULL)
149 hFile = ((WIN32FILE_IOWIN*)stream) -> hf; 149 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
150 150
151 if (hFile !=NULL) 151 if (hFile !=NULL)
152 if (!WriteFile(hFile, buf, size, &ret, NULL)) 152 if (!WriteFile(hFile, buf, size, &ret, NULL))
153 { 153 {
154 DWORD dwErr = GetLastError(); 154 DWORD dwErr = GetLastError();
155 if (dwErr == ERROR_HANDLE_EOF) 155 if (dwErr == ERROR_HANDLE_EOF)
156 dwErr = 0; 156 dwErr = 0;
157 ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; 157 ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
158 } 158 }
159 159
160 return ret; 160 return ret;
161} 161}
162 162
163long ZCALLBACK win32_tell_file_func (opaque, stream) 163long ZCALLBACK win32_tell_file_func (opaque, stream)
164 voidpf opaque; 164 voidpf opaque;
165 voidpf stream; 165 voidpf stream;
166{ 166{
167 long ret=-1; 167 long ret=-1;
168 HANDLE hFile = NULL; 168 HANDLE hFile = NULL;
169 if (stream!=NULL) 169 if (stream!=NULL)
170 hFile = ((WIN32FILE_IOWIN*)stream) -> hf; 170 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
171 if (hFile != NULL) 171 if (hFile != NULL)
172 { 172 {
173 DWORD dwSet = SetFilePointer(hFile, 0, NULL, FILE_CURRENT); 173 DWORD dwSet = SetFilePointer(hFile, 0, NULL, FILE_CURRENT);
174 if (dwSet == INVALID_SET_FILE_POINTER) 174 if (dwSet == INVALID_SET_FILE_POINTER)
175 { 175 {
176 DWORD dwErr = GetLastError(); 176 DWORD dwErr = GetLastError();
177 ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; 177 ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
178 ret = -1; 178 ret = -1;
179 } 179 }
180 else 180 else
181 ret=(long)dwSet; 181 ret=(long)dwSet;
182 } 182 }
183 return ret; 183 return ret;
184} 184}
185 185
186long ZCALLBACK win32_seek_file_func (opaque, stream, offset, origin) 186long ZCALLBACK win32_seek_file_func (opaque, stream, offset, origin)
187 voidpf opaque; 187 voidpf opaque;
188 voidpf stream; 188 voidpf stream;
189 uLong offset; 189 uLong offset;
190 int origin; 190 int origin;
191{ 191{
192 DWORD dwMoveMethod=0xFFFFFFFF; 192 DWORD dwMoveMethod=0xFFFFFFFF;
193 HANDLE hFile = NULL; 193 HANDLE hFile = NULL;
194 194
195 long ret=-1; 195 long ret=-1;
196 if (stream!=NULL) 196 if (stream!=NULL)
197 hFile = ((WIN32FILE_IOWIN*)stream) -> hf; 197 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
198 switch (origin) 198 switch (origin)
199 { 199 {
200 case ZLIB_FILEFUNC_SEEK_CUR : 200 case ZLIB_FILEFUNC_SEEK_CUR :
201 dwMoveMethod = FILE_CURRENT; 201 dwMoveMethod = FILE_CURRENT;
202 break; 202 break;
203 case ZLIB_FILEFUNC_SEEK_END : 203 case ZLIB_FILEFUNC_SEEK_END :
204 dwMoveMethod = FILE_END; 204 dwMoveMethod = FILE_END;
205 break; 205 break;
206 case ZLIB_FILEFUNC_SEEK_SET : 206 case ZLIB_FILEFUNC_SEEK_SET :
207 dwMoveMethod = FILE_BEGIN; 207 dwMoveMethod = FILE_BEGIN;
208 break; 208 break;
209 default: return -1; 209 default: return -1;
210 } 210 }
211 211
212 if (hFile != NULL) 212 if (hFile != NULL)
213 { 213 {
214 DWORD dwSet = SetFilePointer(hFile, offset, NULL, dwMoveMethod); 214 DWORD dwSet = SetFilePointer(hFile, offset, NULL, dwMoveMethod);
215 if (dwSet == INVALID_SET_FILE_POINTER) 215 if (dwSet == INVALID_SET_FILE_POINTER)
216 { 216 {
217 DWORD dwErr = GetLastError(); 217 DWORD dwErr = GetLastError();
218 ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; 218 ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
219 ret = -1; 219 ret = -1;
220 } 220 }
221 else 221 else
222 ret=0; 222 ret=0;
223 } 223 }
224 return ret; 224 return ret;
225} 225}
226 226
227int ZCALLBACK win32_close_file_func (opaque, stream) 227int ZCALLBACK win32_close_file_func (opaque, stream)
228 voidpf opaque; 228 voidpf opaque;
229 voidpf stream; 229 voidpf stream;
230{ 230{
231 int ret=-1; 231 int ret=-1;
232 232
233 if (stream!=NULL) 233 if (stream!=NULL)
234 { 234 {
235 HANDLE hFile; 235 HANDLE hFile;
236 hFile = ((WIN32FILE_IOWIN*)stream) -> hf; 236 hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
237 if (hFile != NULL) 237 if (hFile != NULL)
238 { 238 {
239 CloseHandle(hFile); 239 CloseHandle(hFile);
240 ret=0; 240 ret=0;
241 } 241 }
242 free(stream); 242 free(stream);
243 } 243 }
244 return ret; 244 return ret;
245} 245}
246 246
247int ZCALLBACK win32_error_file_func (opaque, stream) 247int ZCALLBACK win32_error_file_func (opaque, stream)
248 voidpf opaque; 248 voidpf opaque;
249 voidpf stream; 249 voidpf stream;
250{ 250{
251 int ret=-1; 251 int ret=-1;
252 if (stream!=NULL) 252 if (stream!=NULL)
253 { 253 {
254 ret = ((WIN32FILE_IOWIN*)stream) -> error; 254 ret = ((WIN32FILE_IOWIN*)stream) -> error;
255 } 255 }
256 return ret; 256 return ret;
257} 257}
258 258
259void fill_win32_filefunc (pzlib_filefunc_def) 259void fill_win32_filefunc (pzlib_filefunc_def)
260 zlib_filefunc_def* pzlib_filefunc_def; 260 zlib_filefunc_def* pzlib_filefunc_def;
261{ 261{
262 pzlib_filefunc_def->zopen_file = win32_open_file_func; 262 pzlib_filefunc_def->zopen_file = win32_open_file_func;
263 pzlib_filefunc_def->zread_file = win32_read_file_func; 263 pzlib_filefunc_def->zread_file = win32_read_file_func;
264 pzlib_filefunc_def->zwrite_file = win32_write_file_func; 264 pzlib_filefunc_def->zwrite_file = win32_write_file_func;
265 pzlib_filefunc_def->ztell_file = win32_tell_file_func; 265 pzlib_filefunc_def->ztell_file = win32_tell_file_func;
266 pzlib_filefunc_def->zseek_file = win32_seek_file_func; 266 pzlib_filefunc_def->zseek_file = win32_seek_file_func;
267 pzlib_filefunc_def->zclose_file = win32_close_file_func; 267 pzlib_filefunc_def->zclose_file = win32_close_file_func;
268 pzlib_filefunc_def->zerror_file = win32_error_file_func; 268 pzlib_filefunc_def->zerror_file = win32_error_file_func;
269 pzlib_filefunc_def->opaque=NULL; 269 pzlib_filefunc_def->opaque=NULL;
270} 270}
diff --git a/contrib/minizip/iowin32.h b/contrib/minizip/iowin32.h
index e9c5f8b..a3a437a 100644
--- a/contrib/minizip/iowin32.h
+++ b/contrib/minizip/iowin32.h
@@ -1,21 +1,21 @@
1/* iowin32.h -- IO base function header for compress/uncompress .zip 1/* iowin32.h -- IO base function header for compress/uncompress .zip
2 files using zlib + zip or unzip API 2 files using zlib + zip or unzip API
3 This IO API version uses the Win32 API (for Microsoft Windows) 3 This IO API version uses the Win32 API (for Microsoft Windows)
4 4
5 Version 1.01e, February 12th, 2005 5 Version 1.01e, February 12th, 2005
6 6
7 Copyright (C) 1998-2005 Gilles Vollant 7 Copyright (C) 1998-2005 Gilles Vollant
8*/ 8*/
9 9
10#include <windows.h> 10#include <windows.h>
11 11
12 12
13#ifdef __cplusplus 13#ifdef __cplusplus
14extern "C" { 14extern "C" {
15#endif 15#endif
16 16
17void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); 17void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
18 18
19#ifdef __cplusplus 19#ifdef __cplusplus
20} 20}
21#endif 21#endif
diff --git a/contrib/minizip/miniunz.c b/contrib/minizip/miniunz.c
index 82d8702..f599938 100644
--- a/contrib/minizip/miniunz.c
+++ b/contrib/minizip/miniunz.c
@@ -1,585 +1,585 @@
1/* 1/*
2 miniunz.c 2 miniunz.c
3 Version 1.01e, February 12th, 2005 3 Version 1.01e, February 12th, 2005
4 4
5 Copyright (C) 1998-2005 Gilles Vollant 5 Copyright (C) 1998-2005 Gilles Vollant
6*/ 6*/
7 7
8 8
9#include <stdio.h> 9#include <stdio.h>
10#include <stdlib.h> 10#include <stdlib.h>
11#include <string.h> 11#include <string.h>
12#include <time.h> 12#include <time.h>
13#include <errno.h> 13#include <errno.h>
14#include <fcntl.h> 14#include <fcntl.h>
15 15
16#ifdef unix 16#ifdef unix
17# include <unistd.h> 17# include <unistd.h>
18# include <utime.h> 18# include <utime.h>
19#else 19#else
20# include <direct.h> 20# include <direct.h>
21# include <io.h> 21# include <io.h>
22#endif 22#endif
23 23
24#include "unzip.h" 24#include "unzip.h"
25 25
26#define CASESENSITIVITY (0) 26#define CASESENSITIVITY (0)
27#define WRITEBUFFERSIZE (8192) 27#define WRITEBUFFERSIZE (8192)
28#define MAXFILENAME (256) 28#define MAXFILENAME (256)
29 29
30#ifdef WIN32 30#ifdef WIN32
31#define USEWIN32IOAPI 31#define USEWIN32IOAPI
32#include "iowin32.h" 32#include "iowin32.h"
33#endif 33#endif
34/* 34/*
35 mini unzip, demo of unzip package 35 mini unzip, demo of unzip package
36 36
37 usage : 37 usage :
38 Usage : miniunz [-exvlo] file.zip [file_to_extract] [-d extractdir] 38 Usage : miniunz [-exvlo] file.zip [file_to_extract] [-d extractdir]
39 39
40 list the file in the zipfile, and print the content of FILE_ID.ZIP or README.TXT 40 list the file in the zipfile, and print the content of FILE_ID.ZIP or README.TXT
41 if it exists 41 if it exists
42*/ 42*/
43 43
44 44
45/* change_file_date : change the date/time of a file 45/* change_file_date : change the date/time of a file
46 filename : the filename of the file where date/time must be modified 46 filename : the filename of the file where date/time must be modified
47 dosdate : the new date at the MSDos format (4 bytes) 47 dosdate : the new date at the MSDos format (4 bytes)
48 tmu_date : the SAME new date at the tm_unz format */ 48 tmu_date : the SAME new date at the tm_unz format */
49void change_file_date(filename,dosdate,tmu_date) 49void change_file_date(filename,dosdate,tmu_date)
50 const char *filename; 50 const char *filename;
51 uLong dosdate; 51 uLong dosdate;
52 tm_unz tmu_date; 52 tm_unz tmu_date;
53{ 53{
54#ifdef WIN32 54#ifdef WIN32
55 HANDLE hFile; 55 HANDLE hFile;
56 FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite; 56 FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
57 57
58 hFile = CreateFile(filename,GENERIC_READ | GENERIC_WRITE, 58 hFile = CreateFile(filename,GENERIC_READ | GENERIC_WRITE,
59 0,NULL,OPEN_EXISTING,0,NULL); 59 0,NULL,OPEN_EXISTING,0,NULL);
60 GetFileTime(hFile,&ftCreate,&ftLastAcc,&ftLastWrite); 60 GetFileTime(hFile,&ftCreate,&ftLastAcc,&ftLastWrite);
61 DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate,&ftLocal); 61 DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate,&ftLocal);
62 LocalFileTimeToFileTime(&ftLocal,&ftm); 62 LocalFileTimeToFileTime(&ftLocal,&ftm);
63 SetFileTime(hFile,&ftm,&ftLastAcc,&ftm); 63 SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
64 CloseHandle(hFile); 64 CloseHandle(hFile);
65#else 65#else
66#ifdef unix 66#ifdef unix
67 struct utimbuf ut; 67 struct utimbuf ut;
68 struct tm newdate; 68 struct tm newdate;
69 newdate.tm_sec = tmu_date.tm_sec; 69 newdate.tm_sec = tmu_date.tm_sec;
70 newdate.tm_min=tmu_date.tm_min; 70 newdate.tm_min=tmu_date.tm_min;
71 newdate.tm_hour=tmu_date.tm_hour; 71 newdate.tm_hour=tmu_date.tm_hour;
72 newdate.tm_mday=tmu_date.tm_mday; 72 newdate.tm_mday=tmu_date.tm_mday;
73 newdate.tm_mon=tmu_date.tm_mon; 73 newdate.tm_mon=tmu_date.tm_mon;
74 if (tmu_date.tm_year > 1900) 74 if (tmu_date.tm_year > 1900)
75 newdate.tm_year=tmu_date.tm_year - 1900; 75 newdate.tm_year=tmu_date.tm_year - 1900;
76 else 76 else
77 newdate.tm_year=tmu_date.tm_year ; 77 newdate.tm_year=tmu_date.tm_year ;
78 newdate.tm_isdst=-1; 78 newdate.tm_isdst=-1;
79 79
80 ut.actime=ut.modtime=mktime(&newdate); 80 ut.actime=ut.modtime=mktime(&newdate);
81 utime(filename,&ut); 81 utime(filename,&ut);
82#endif 82#endif
83#endif 83#endif
84} 84}
85 85
86 86
87/* mymkdir and change_file_date are not 100 % portable 87/* mymkdir and change_file_date are not 100 % portable
88 As I don't know well Unix, I wait feedback for the unix portion */ 88 As I don't know well Unix, I wait feedback for the unix portion */
89 89
90int mymkdir(dirname) 90int mymkdir(dirname)
91 const char* dirname; 91 const char* dirname;
92{ 92{
93 int ret=0; 93 int ret=0;
94#ifdef WIN32 94#ifdef WIN32
95 ret = mkdir(dirname); 95 ret = mkdir(dirname);
96#else 96#else
97#ifdef unix 97#ifdef unix
98 ret = mkdir (dirname,0775); 98 ret = mkdir (dirname,0775);
99#endif 99#endif
100#endif 100#endif
101 return ret; 101 return ret;
102} 102}
103 103
104int makedir (newdir) 104int makedir (newdir)
105 char *newdir; 105 char *newdir;
106{ 106{
107 char *buffer ; 107 char *buffer ;
108 char *p; 108 char *p;
109 int len = (int)strlen(newdir); 109 int len = (int)strlen(newdir);
110 110
111 if (len <= 0) 111 if (len <= 0)
112 return 0; 112 return 0;
113 113
114 buffer = (char*)malloc(len+1); 114 buffer = (char*)malloc(len+1);
115 strcpy(buffer,newdir); 115 strcpy(buffer,newdir);
116 116
117 if (buffer[len-1] == '/') { 117 if (buffer[len-1] == '/') {
118 buffer[len-1] = '\0'; 118 buffer[len-1] = '\0';
119 } 119 }
120 if (mymkdir(buffer) == 0) 120 if (mymkdir(buffer) == 0)
121 { 121 {
122 free(buffer); 122 free(buffer);
123 return 1; 123 return 1;
124 } 124 }
125 125
126 p = buffer+1; 126 p = buffer+1;
127 while (1) 127 while (1)
128 { 128 {
129 char hold; 129 char hold;
130 130
131 while(*p && *p != '\\' && *p != '/') 131 while(*p && *p != '\\' && *p != '/')
132 p++; 132 p++;
133 hold = *p; 133 hold = *p;
134 *p = 0; 134 *p = 0;
135 if ((mymkdir(buffer) == -1) && (errno == ENOENT)) 135 if ((mymkdir(buffer) == -1) && (errno == ENOENT))
136 { 136 {
137 printf("couldn't create directory %s\n",buffer); 137 printf("couldn't create directory %s\n",buffer);
138 free(buffer); 138 free(buffer);
139 return 0; 139 return 0;
140 } 140 }
141 if (hold == 0) 141 if (hold == 0)
142 break; 142 break;
143 *p++ = hold; 143 *p++ = hold;
144 } 144 }
145 free(buffer); 145 free(buffer);
146 return 1; 146 return 1;
147} 147}
148 148
149void do_banner() 149void do_banner()
150{ 150{
151 printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); 151 printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
152 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); 152 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
153} 153}
154 154
155void do_help() 155void do_help()
156{ 156{
157 printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \ 157 printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
158 " -e Extract without pathname (junk paths)\n" \ 158 " -e Extract without pathname (junk paths)\n" \
159 " -x Extract with pathname\n" \ 159 " -x Extract with pathname\n" \
160 " -v list files\n" \ 160 " -v list files\n" \
161 " -l list files\n" \ 161 " -l list files\n" \
162 " -d directory to extract into\n" \ 162 " -d directory to extract into\n" \
163 " -o overwrite files without prompting\n" \ 163 " -o overwrite files without prompting\n" \
164 " -p extract crypted file using password\n\n"); 164 " -p extract crypted file using password\n\n");
165} 165}
166 166
167 167
168int do_list(uf) 168int do_list(uf)
169 unzFile uf; 169 unzFile uf;
170{ 170{
171 uLong i; 171 uLong i;
172 unz_global_info gi; 172 unz_global_info gi;
173 int err; 173 int err;
174 174
175 err = unzGetGlobalInfo (uf,&gi); 175 err = unzGetGlobalInfo (uf,&gi);
176 if (err!=UNZ_OK) 176 if (err!=UNZ_OK)
177 printf("error %d with zipfile in unzGetGlobalInfo \n",err); 177 printf("error %d with zipfile in unzGetGlobalInfo \n",err);
178 printf(" Length Method Size Ratio Date Time CRC-32 Name\n"); 178 printf(" Length Method Size Ratio Date Time CRC-32 Name\n");
179 printf(" ------ ------ ---- ----- ---- ---- ------ ----\n"); 179 printf(" ------ ------ ---- ----- ---- ---- ------ ----\n");
180 for (i=0;i<gi.number_entry;i++) 180 for (i=0;i<gi.number_entry;i++)
181 { 181 {
182 char filename_inzip[256]; 182 char filename_inzip[256];
183 unz_file_info file_info; 183 unz_file_info file_info;
184 uLong ratio=0; 184 uLong ratio=0;
185 const char *string_method; 185 const char *string_method;
186 char charCrypt=' '; 186 char charCrypt=' ';
187 err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0); 187 err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
188 if (err!=UNZ_OK) 188 if (err!=UNZ_OK)
189 { 189 {
190 printf("error %d with zipfile in unzGetCurrentFileInfo\n",err); 190 printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
191 break; 191 break;
192 } 192 }
193 if (file_info.uncompressed_size>0) 193 if (file_info.uncompressed_size>0)
194 ratio = (file_info.compressed_size*100)/file_info.uncompressed_size; 194 ratio = (file_info.compressed_size*100)/file_info.uncompressed_size;
195 195
196 /* display a '*' if the file is crypted */ 196 /* display a '*' if the file is crypted */
197 if ((file_info.flag & 1) != 0) 197 if ((file_info.flag & 1) != 0)
198 charCrypt='*'; 198 charCrypt='*';
199 199
200 if (file_info.compression_method==0) 200 if (file_info.compression_method==0)
201 string_method="Stored"; 201 string_method="Stored";
202 else 202 else
203 if (file_info.compression_method==Z_DEFLATED) 203 if (file_info.compression_method==Z_DEFLATED)
204 { 204 {
205 uInt iLevel=(uInt)((file_info.flag & 0x6)/2); 205 uInt iLevel=(uInt)((file_info.flag & 0x6)/2);
206 if (iLevel==0) 206 if (iLevel==0)
207 string_method="Defl:N"; 207 string_method="Defl:N";
208 else if (iLevel==1) 208 else if (iLevel==1)
209 string_method="Defl:X"; 209 string_method="Defl:X";
210 else if ((iLevel==2) || (iLevel==3)) 210 else if ((iLevel==2) || (iLevel==3))
211 string_method="Defl:F"; /* 2:fast , 3 : extra fast*/ 211 string_method="Defl:F"; /* 2:fast , 3 : extra fast*/
212 } 212 }
213 else 213 else
214 string_method="Unkn. "; 214 string_method="Unkn. ";
215 215
216 printf("%7lu %6s%c%7lu %3lu%% %2.2lu-%2.2lu-%2.2lu %2.2lu:%2.2lu %8.8lx %s\n", 216 printf("%7lu %6s%c%7lu %3lu%% %2.2lu-%2.2lu-%2.2lu %2.2lu:%2.2lu %8.8lx %s\n",
217 file_info.uncompressed_size,string_method, 217 file_info.uncompressed_size,string_method,
218 charCrypt, 218 charCrypt,
219 file_info.compressed_size, 219 file_info.compressed_size,
220 ratio, 220 ratio,
221 (uLong)file_info.tmu_date.tm_mon + 1, 221 (uLong)file_info.tmu_date.tm_mon + 1,
222 (uLong)file_info.tmu_date.tm_mday, 222 (uLong)file_info.tmu_date.tm_mday,
223 (uLong)file_info.tmu_date.tm_year % 100, 223 (uLong)file_info.tmu_date.tm_year % 100,
224 (uLong)file_info.tmu_date.tm_hour,(uLong)file_info.tmu_date.tm_min, 224 (uLong)file_info.tmu_date.tm_hour,(uLong)file_info.tmu_date.tm_min,
225 (uLong)file_info.crc,filename_inzip); 225 (uLong)file_info.crc,filename_inzip);
226 if ((i+1)<gi.number_entry) 226 if ((i+1)<gi.number_entry)
227 { 227 {
228 err = unzGoToNextFile(uf); 228 err = unzGoToNextFile(uf);
229 if (err!=UNZ_OK) 229 if (err!=UNZ_OK)
230 { 230 {
231 printf("error %d with zipfile in unzGoToNextFile\n",err); 231 printf("error %d with zipfile in unzGoToNextFile\n",err);
232 break; 232 break;
233 } 233 }
234 } 234 }
235 } 235 }
236 236
237 return 0; 237 return 0;
238} 238}
239 239
240 240
241int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password) 241int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
242 unzFile uf; 242 unzFile uf;
243 const int* popt_extract_without_path; 243 const int* popt_extract_without_path;
244 int* popt_overwrite; 244 int* popt_overwrite;
245 const char* password; 245 const char* password;
246{ 246{
247 char filename_inzip[256]; 247 char filename_inzip[256];
248 char* filename_withoutpath; 248 char* filename_withoutpath;
249 char* p; 249 char* p;
250 int err=UNZ_OK; 250 int err=UNZ_OK;
251 FILE *fout=NULL; 251 FILE *fout=NULL;
252 void* buf; 252 void* buf;
253 uInt size_buf; 253 uInt size_buf;
254 254
255 unz_file_info file_info; 255 unz_file_info file_info;
256 uLong ratio=0; 256 uLong ratio=0;
257 err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0); 257 err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
258 258
259 if (err!=UNZ_OK) 259 if (err!=UNZ_OK)
260 { 260 {
261 printf("error %d with zipfile in unzGetCurrentFileInfo\n",err); 261 printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
262 return err; 262 return err;
263 } 263 }
264 264
265 size_buf = WRITEBUFFERSIZE; 265 size_buf = WRITEBUFFERSIZE;
266 buf = (void*)malloc(size_buf); 266 buf = (void*)malloc(size_buf);
267 if (buf==NULL) 267 if (buf==NULL)
268 { 268 {
269 printf("Error allocating memory\n"); 269 printf("Error allocating memory\n");
270 return UNZ_INTERNALERROR; 270 return UNZ_INTERNALERROR;
271 } 271 }
272 272
273 p = filename_withoutpath = filename_inzip; 273 p = filename_withoutpath = filename_inzip;
274 while ((*p) != '\0') 274 while ((*p) != '\0')
275 { 275 {
276 if (((*p)=='/') || ((*p)=='\\')) 276 if (((*p)=='/') || ((*p)=='\\'))
277 filename_withoutpath = p+1; 277 filename_withoutpath = p+1;
278 p++; 278 p++;
279 } 279 }
280 280
281 if ((*filename_withoutpath)=='\0') 281 if ((*filename_withoutpath)=='\0')
282 { 282 {
283 if ((*popt_extract_without_path)==0) 283 if ((*popt_extract_without_path)==0)
284 { 284 {
285 printf("creating directory: %s\n",filename_inzip); 285 printf("creating directory: %s\n",filename_inzip);
286 mymkdir(filename_inzip); 286 mymkdir(filename_inzip);
287 } 287 }
288 } 288 }
289 else 289 else
290 { 290 {
291 const char* write_filename; 291 const char* write_filename;
292 int skip=0; 292 int skip=0;
293 293
294 if ((*popt_extract_without_path)==0) 294 if ((*popt_extract_without_path)==0)
295 write_filename = filename_inzip; 295 write_filename = filename_inzip;
296 else 296 else
297 write_filename = filename_withoutpath; 297 write_filename = filename_withoutpath;
298 298
299 err = unzOpenCurrentFilePassword(uf,password); 299 err = unzOpenCurrentFilePassword(uf,password);
300 if (err!=UNZ_OK) 300 if (err!=UNZ_OK)
301 { 301 {
302 printf("error %d with zipfile in unzOpenCurrentFilePassword\n",err); 302 printf("error %d with zipfile in unzOpenCurrentFilePassword\n",err);
303 } 303 }
304 304
305 if (((*popt_overwrite)==0) && (err==UNZ_OK)) 305 if (((*popt_overwrite)==0) && (err==UNZ_OK))
306 { 306 {
307 char rep=0; 307 char rep=0;
308 FILE* ftestexist; 308 FILE* ftestexist;
309 ftestexist = fopen(write_filename,"rb"); 309 ftestexist = fopen(write_filename,"rb");
310 if (ftestexist!=NULL) 310 if (ftestexist!=NULL)
311 { 311 {
312 fclose(ftestexist); 312 fclose(ftestexist);
313 do 313 do
314 { 314 {
315 char answer[128]; 315 char answer[128];
316 int ret; 316 int ret;
317 317
318 printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename); 318 printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename);
319 ret = scanf("%1s",answer); 319 ret = scanf("%1s",answer);
320 if (ret != 1) 320 if (ret != 1)
321 { 321 {
322 exit(EXIT_FAILURE); 322 exit(EXIT_FAILURE);
323 } 323 }
324 rep = answer[0] ; 324 rep = answer[0] ;
325 if ((rep>='a') && (rep<='z')) 325 if ((rep>='a') && (rep<='z'))
326 rep -= 0x20; 326 rep -= 0x20;
327 } 327 }
328 while ((rep!='Y') && (rep!='N') && (rep!='A')); 328 while ((rep!='Y') && (rep!='N') && (rep!='A'));
329 } 329 }
330 330
331 if (rep == 'N') 331 if (rep == 'N')
332 skip = 1; 332 skip = 1;
333 333
334 if (rep == 'A') 334 if (rep == 'A')
335 *popt_overwrite=1; 335 *popt_overwrite=1;
336 } 336 }
337 337
338 if ((skip==0) && (err==UNZ_OK)) 338 if ((skip==0) && (err==UNZ_OK))
339 { 339 {
340 fout=fopen(write_filename,"wb"); 340 fout=fopen(write_filename,"wb");
341 341
342 /* some zipfile don't contain directory alone before file */ 342 /* some zipfile don't contain directory alone before file */
343 if ((fout==NULL) && ((*popt_extract_without_path)==0) && 343 if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
344 (filename_withoutpath!=(char*)filename_inzip)) 344 (filename_withoutpath!=(char*)filename_inzip))
345 { 345 {
346 char c=*(filename_withoutpath-1); 346 char c=*(filename_withoutpath-1);
347 *(filename_withoutpath-1)='\0'; 347 *(filename_withoutpath-1)='\0';
348 makedir(write_filename); 348 makedir(write_filename);
349 *(filename_withoutpath-1)=c; 349 *(filename_withoutpath-1)=c;
350 fout=fopen(write_filename,"wb"); 350 fout=fopen(write_filename,"wb");
351 } 351 }
352 352
353 if (fout==NULL) 353 if (fout==NULL)
354 { 354 {
355 printf("error opening %s\n",write_filename); 355 printf("error opening %s\n",write_filename);
356 } 356 }
357 } 357 }
358 358
359 if (fout!=NULL) 359 if (fout!=NULL)
360 { 360 {
361 printf(" extracting: %s\n",write_filename); 361 printf(" extracting: %s\n",write_filename);
362 362
363 do 363 do
364 { 364 {
365 err = unzReadCurrentFile(uf,buf,size_buf); 365 err = unzReadCurrentFile(uf,buf,size_buf);
366 if (err<0) 366 if (err<0)
367 { 367 {
368 printf("error %d with zipfile in unzReadCurrentFile\n",err); 368 printf("error %d with zipfile in unzReadCurrentFile\n",err);
369 break; 369 break;
370 } 370 }
371 if (err>0) 371 if (err>0)
372 if (fwrite(buf,err,1,fout)!=1) 372 if (fwrite(buf,err,1,fout)!=1)
373 { 373 {
374 printf("error in writing extracted file\n"); 374 printf("error in writing extracted file\n");
375 err=UNZ_ERRNO; 375 err=UNZ_ERRNO;
376 break; 376 break;
377 } 377 }
378 } 378 }
379 while (err>0); 379 while (err>0);
380 if (fout) 380 if (fout)
381 fclose(fout); 381 fclose(fout);
382 382
383 if (err==0) 383 if (err==0)
384 change_file_date(write_filename,file_info.dosDate, 384 change_file_date(write_filename,file_info.dosDate,
385 file_info.tmu_date); 385 file_info.tmu_date);
386 } 386 }
387 387
388 if (err==UNZ_OK) 388 if (err==UNZ_OK)
389 { 389 {
390 err = unzCloseCurrentFile (uf); 390 err = unzCloseCurrentFile (uf);
391 if (err!=UNZ_OK) 391 if (err!=UNZ_OK)
392 { 392 {
393 printf("error %d with zipfile in unzCloseCurrentFile\n",err); 393 printf("error %d with zipfile in unzCloseCurrentFile\n",err);
394 } 394 }
395 } 395 }
396 else 396 else
397 unzCloseCurrentFile(uf); /* don't lose the error */ 397 unzCloseCurrentFile(uf); /* don't lose the error */
398 } 398 }
399 399
400 free(buf); 400 free(buf);
401 return err; 401 return err;
402} 402}
403 403
404 404
405int do_extract(uf,opt_extract_without_path,opt_overwrite,password) 405int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
406 unzFile uf; 406 unzFile uf;
407 int opt_extract_without_path; 407 int opt_extract_without_path;
408 int opt_overwrite; 408 int opt_overwrite;
409 const char* password; 409 const char* password;
410{ 410{
411 uLong i; 411 uLong i;
412 unz_global_info gi; 412 unz_global_info gi;
413 int err; 413 int err;
414 FILE* fout=NULL; 414 FILE* fout=NULL;
415 415
416 err = unzGetGlobalInfo (uf,&gi); 416 err = unzGetGlobalInfo (uf,&gi);
417 if (err!=UNZ_OK) 417 if (err!=UNZ_OK)
418 printf("error %d with zipfile in unzGetGlobalInfo \n",err); 418 printf("error %d with zipfile in unzGetGlobalInfo \n",err);
419 419
420 for (i=0;i<gi.number_entry;i++) 420 for (i=0;i<gi.number_entry;i++)
421 { 421 {
422 if (do_extract_currentfile(uf,&opt_extract_without_path, 422 if (do_extract_currentfile(uf,&opt_extract_without_path,
423 &opt_overwrite, 423 &opt_overwrite,
424 password) != UNZ_OK) 424 password) != UNZ_OK)
425 break; 425 break;
426 426
427 if ((i+1)<gi.number_entry) 427 if ((i+1)<gi.number_entry)
428 { 428 {
429 err = unzGoToNextFile(uf); 429 err = unzGoToNextFile(uf);
430 if (err!=UNZ_OK) 430 if (err!=UNZ_OK)
431 { 431 {
432 printf("error %d with zipfile in unzGoToNextFile\n",err); 432 printf("error %d with zipfile in unzGoToNextFile\n",err);
433 break; 433 break;
434 } 434 }
435 } 435 }
436 } 436 }
437 437
438 return 0; 438 return 0;
439} 439}
440 440
441int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password) 441int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
442 unzFile uf; 442 unzFile uf;
443 const char* filename; 443 const char* filename;
444 int opt_extract_without_path; 444 int opt_extract_without_path;
445 int opt_overwrite; 445 int opt_overwrite;
446 const char* password; 446 const char* password;
447{ 447{
448 int err = UNZ_OK; 448 int err = UNZ_OK;
449 if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK) 449 if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
450 { 450 {
451 printf("file %s not found in the zipfile\n",filename); 451 printf("file %s not found in the zipfile\n",filename);
452 return 2; 452 return 2;
453 } 453 }
454 454
455 if (do_extract_currentfile(uf,&opt_extract_without_path, 455 if (do_extract_currentfile(uf,&opt_extract_without_path,
456 &opt_overwrite, 456 &opt_overwrite,
457 password) == UNZ_OK) 457 password) == UNZ_OK)
458 return 0; 458 return 0;
459 else 459 else
460 return 1; 460 return 1;
461} 461}
462 462
463 463
464int main(argc,argv) 464int main(argc,argv)
465 int argc; 465 int argc;
466 char *argv[]; 466 char *argv[];
467{ 467{
468 const char *zipfilename=NULL; 468 const char *zipfilename=NULL;
469 const char *filename_to_extract=NULL; 469 const char *filename_to_extract=NULL;
470 const char *password=NULL; 470 const char *password=NULL;
471 char filename_try[MAXFILENAME+16] = ""; 471 char filename_try[MAXFILENAME+16] = "";
472 int i; 472 int i;
473 int opt_do_list=0; 473 int opt_do_list=0;
474 int opt_do_extract=1; 474 int opt_do_extract=1;
475 int opt_do_extract_withoutpath=0; 475 int opt_do_extract_withoutpath=0;
476 int opt_overwrite=0; 476 int opt_overwrite=0;
477 int opt_extractdir=0; 477 int opt_extractdir=0;
478 const char *dirname=NULL; 478 const char *dirname=NULL;
479 unzFile uf=NULL; 479 unzFile uf=NULL;
480 480
481 do_banner(); 481 do_banner();
482 if (argc==1) 482 if (argc==1)
483 { 483 {
484 do_help(); 484 do_help();
485 return 0; 485 return 0;
486 } 486 }
487 else 487 else
488 { 488 {
489 for (i=1;i<argc;i++) 489 for (i=1;i<argc;i++)
490 { 490 {
491 if ((*argv[i])=='-') 491 if ((*argv[i])=='-')
492 { 492 {
493 const char *p=argv[i]+1; 493 const char *p=argv[i]+1;
494 494
495 while ((*p)!='\0') 495 while ((*p)!='\0')
496 { 496 {
497 char c=*(p++);; 497 char c=*(p++);;
498 if ((c=='l') || (c=='L')) 498 if ((c=='l') || (c=='L'))
499 opt_do_list = 1; 499 opt_do_list = 1;
500 if ((c=='v') || (c=='V')) 500 if ((c=='v') || (c=='V'))
501 opt_do_list = 1; 501 opt_do_list = 1;
502 if ((c=='x') || (c=='X')) 502 if ((c=='x') || (c=='X'))
503 opt_do_extract = 1; 503 opt_do_extract = 1;
504 if ((c=='e') || (c=='E')) 504 if ((c=='e') || (c=='E'))
505 opt_do_extract = opt_do_extract_withoutpath = 1; 505 opt_do_extract = opt_do_extract_withoutpath = 1;
506 if ((c=='o') || (c=='O')) 506 if ((c=='o') || (c=='O'))
507 opt_overwrite=1; 507 opt_overwrite=1;
508 if ((c=='d') || (c=='D')) 508 if ((c=='d') || (c=='D'))
509 { 509 {
510 opt_extractdir=1; 510 opt_extractdir=1;
511 dirname=argv[i+1]; 511 dirname=argv[i+1];
512 } 512 }
513 513
514 if (((c=='p') || (c=='P')) && (i+1<argc)) 514 if (((c=='p') || (c=='P')) && (i+1<argc))
515 { 515 {
516 password=argv[i+1]; 516 password=argv[i+1];
517 i++; 517 i++;
518 } 518 }
519 } 519 }
520 } 520 }
521 else 521 else
522 { 522 {
523 if (zipfilename == NULL) 523 if (zipfilename == NULL)
524 zipfilename = argv[i]; 524 zipfilename = argv[i];
525 else if ((filename_to_extract==NULL) && (!opt_extractdir)) 525 else if ((filename_to_extract==NULL) && (!opt_extractdir))
526 filename_to_extract = argv[i] ; 526 filename_to_extract = argv[i] ;
527 } 527 }
528 } 528 }
529 } 529 }
530 530
531 if (zipfilename!=NULL) 531 if (zipfilename!=NULL)
532 { 532 {
533 533
534# ifdef USEWIN32IOAPI 534# ifdef USEWIN32IOAPI
535 zlib_filefunc_def ffunc; 535 zlib_filefunc_def ffunc;
536# endif 536# endif
537 537
538 strncpy(filename_try, zipfilename,MAXFILENAME-1); 538 strncpy(filename_try, zipfilename,MAXFILENAME-1);
539 /* strncpy doesnt append the trailing NULL, of the string is too long. */ 539 /* strncpy doesnt append the trailing NULL, of the string is too long. */
540 filename_try[ MAXFILENAME ] = '\0'; 540 filename_try[ MAXFILENAME ] = '\0';
541 541
542# ifdef USEWIN32IOAPI 542# ifdef USEWIN32IOAPI
543 fill_win32_filefunc(&ffunc); 543 fill_win32_filefunc(&ffunc);
544 uf = unzOpen2(zipfilename,&ffunc); 544 uf = unzOpen2(zipfilename,&ffunc);
545# else 545# else
546 uf = unzOpen(zipfilename); 546 uf = unzOpen(zipfilename);
547# endif 547# endif
548 if (uf==NULL) 548 if (uf==NULL)
549 { 549 {
550 strcat(filename_try,".zip"); 550 strcat(filename_try,".zip");
551# ifdef USEWIN32IOAPI 551# ifdef USEWIN32IOAPI
552 uf = unzOpen2(filename_try,&ffunc); 552 uf = unzOpen2(filename_try,&ffunc);
553# else 553# else
554 uf = unzOpen(filename_try); 554 uf = unzOpen(filename_try);
555# endif 555# endif
556 } 556 }
557 } 557 }
558 558
559 if (uf==NULL) 559 if (uf==NULL)
560 { 560 {
561 printf("Cannot open %s or %s.zip\n",zipfilename,zipfilename); 561 printf("Cannot open %s or %s.zip\n",zipfilename,zipfilename);
562 return 1; 562 return 1;
563 } 563 }
564 printf("%s opened\n",filename_try); 564 printf("%s opened\n",filename_try);
565 565
566 if (opt_do_list==1) 566 if (opt_do_list==1)
567 return do_list(uf); 567 return do_list(uf);
568 else if (opt_do_extract==1) 568 else if (opt_do_extract==1)
569 { 569 {
570 if (opt_extractdir && chdir(dirname)) 570 if (opt_extractdir && chdir(dirname))
571 { 571 {
572 printf("Error changing into %s, aborting\n", dirname); 572 printf("Error changing into %s, aborting\n", dirname);
573 exit(-1); 573 exit(-1);
574 } 574 }
575 575
576 if (filename_to_extract == NULL) 576 if (filename_to_extract == NULL)
577 return do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,password); 577 return do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,password);
578 else 578 else
579 return do_extract_onefile(uf,filename_to_extract, 579 return do_extract_onefile(uf,filename_to_extract,
580 opt_do_extract_withoutpath,opt_overwrite,password); 580 opt_do_extract_withoutpath,opt_overwrite,password);
581 } 581 }
582 unzCloseCurrentFile(uf); 582 unzCloseCurrentFile(uf);
583 583
584 return 0; 584 return 0;
585} 585}
diff --git a/contrib/minizip/minizip.c b/contrib/minizip/minizip.c
index 70fee02..f2dfecd 100644
--- a/contrib/minizip/minizip.c
+++ b/contrib/minizip/minizip.c
@@ -1,420 +1,420 @@
1/* 1/*
2 minizip.c 2 minizip.c
3 Version 1.01e, February 12th, 2005 3 Version 1.01e, February 12th, 2005
4 4
5 Copyright (C) 1998-2005 Gilles Vollant 5 Copyright (C) 1998-2005 Gilles Vollant
6*/ 6*/
7 7
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 <time.h> 11#include <time.h>
12#include <errno.h> 12#include <errno.h>
13#include <fcntl.h> 13#include <fcntl.h>
14 14
15#ifdef unix 15#ifdef unix
16# include <unistd.h> 16# include <unistd.h>
17# include <utime.h> 17# include <utime.h>
18# include <sys/types.h> 18# include <sys/types.h>
19# include <sys/stat.h> 19# include <sys/stat.h>
20#else 20#else
21# include <direct.h> 21# include <direct.h>
22# include <io.h> 22# include <io.h>
23#endif 23#endif
24 24
25#include "zip.h" 25#include "zip.h"
26 26
27#ifdef WIN32 27#ifdef WIN32
28#define USEWIN32IOAPI 28#define USEWIN32IOAPI
29#include "iowin32.h" 29#include "iowin32.h"
30#endif 30#endif
31 31
32 32
33 33
34#define WRITEBUFFERSIZE (16384) 34#define WRITEBUFFERSIZE (16384)
35#define MAXFILENAME (256) 35#define MAXFILENAME (256)
36 36
37#ifdef WIN32 37#ifdef WIN32
38uLong filetime(f, tmzip, dt) 38uLong filetime(f, tmzip, dt)
39 char *f; /* name of file to get info on */ 39 char *f; /* name of file to get info on */
40 tm_zip *tmzip; /* return value: access, modific. and creation times */ 40 tm_zip *tmzip; /* return value: access, modific. and creation times */
41 uLong *dt; /* dostime */ 41 uLong *dt; /* dostime */
42{ 42{
43 int ret = 0; 43 int ret = 0;
44 { 44 {
45 FILETIME ftLocal; 45 FILETIME ftLocal;
46 HANDLE hFind; 46 HANDLE hFind;
47 WIN32_FIND_DATA ff32; 47 WIN32_FIND_DATA ff32;
48 48
49 hFind = FindFirstFile(f,&ff32); 49 hFind = FindFirstFile(f,&ff32);
50 if (hFind != INVALID_HANDLE_VALUE) 50 if (hFind != INVALID_HANDLE_VALUE)
51 { 51 {
52 FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal); 52 FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal);
53 FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0); 53 FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0);
54 FindClose(hFind); 54 FindClose(hFind);
55 ret = 1; 55 ret = 1;
56 } 56 }
57 } 57 }
58 return ret; 58 return ret;
59} 59}
60#else 60#else
61#ifdef unix 61#ifdef unix
62uLong filetime(f, tmzip, dt) 62uLong filetime(f, tmzip, dt)
63 char *f; /* name of file to get info on */ 63 char *f; /* name of file to get info on */
64 tm_zip *tmzip; /* return value: access, modific. and creation times */ 64 tm_zip *tmzip; /* return value: access, modific. and creation times */
65 uLong *dt; /* dostime */ 65 uLong *dt; /* dostime */
66{ 66{
67 int ret=0; 67 int ret=0;
68 struct stat s; /* results of stat() */ 68 struct stat s; /* results of stat() */
69 struct tm* filedate; 69 struct tm* filedate;
70 time_t tm_t=0; 70 time_t tm_t=0;
71 71
72 if (strcmp(f,"-")!=0) 72 if (strcmp(f,"-")!=0)
73 { 73 {
74 char name[MAXFILENAME+1]; 74 char name[MAXFILENAME+1];
75 int len = strlen(f); 75 int len = strlen(f);
76 if (len > MAXFILENAME) 76 if (len > MAXFILENAME)
77 len = MAXFILENAME; 77 len = MAXFILENAME;
78 78
79 strncpy(name, f,MAXFILENAME-1); 79 strncpy(name, f,MAXFILENAME-1);
80 /* strncpy doesnt append the trailing NULL, of the string is too long. */ 80 /* strncpy doesnt append the trailing NULL, of the string is too long. */
81 name[ MAXFILENAME ] = '\0'; 81 name[ MAXFILENAME ] = '\0';
82 82
83 if (name[len - 1] == '/') 83 if (name[len - 1] == '/')
84 name[len - 1] = '\0'; 84 name[len - 1] = '\0';
85 /* not all systems allow stat'ing a file with / appended */ 85 /* not all systems allow stat'ing a file with / appended */
86 if (stat(name,&s)==0) 86 if (stat(name,&s)==0)
87 { 87 {
88 tm_t = s.st_mtime; 88 tm_t = s.st_mtime;
89 ret = 1; 89 ret = 1;
90 } 90 }
91 } 91 }
92 filedate = localtime(&tm_t); 92 filedate = localtime(&tm_t);
93 93
94 tmzip->tm_sec = filedate->tm_sec; 94 tmzip->tm_sec = filedate->tm_sec;
95 tmzip->tm_min = filedate->tm_min; 95 tmzip->tm_min = filedate->tm_min;
96 tmzip->tm_hour = filedate->tm_hour; 96 tmzip->tm_hour = filedate->tm_hour;
97 tmzip->tm_mday = filedate->tm_mday; 97 tmzip->tm_mday = filedate->tm_mday;
98 tmzip->tm_mon = filedate->tm_mon ; 98 tmzip->tm_mon = filedate->tm_mon ;
99 tmzip->tm_year = filedate->tm_year; 99 tmzip->tm_year = filedate->tm_year;
100 100
101 return ret; 101 return ret;
102} 102}
103#else 103#else
104uLong filetime(f, tmzip, dt) 104uLong filetime(f, tmzip, dt)
105 char *f; /* name of file to get info on */ 105 char *f; /* name of file to get info on */
106 tm_zip *tmzip; /* return value: access, modific. and creation times */ 106 tm_zip *tmzip; /* return value: access, modific. and creation times */
107 uLong *dt; /* dostime */ 107 uLong *dt; /* dostime */
108{ 108{
109 return 0; 109 return 0;
110} 110}
111#endif 111#endif
112#endif 112#endif
113 113
114 114
115 115
116 116
117int check_exist_file(filename) 117int check_exist_file(filename)
118 const char* filename; 118 const char* filename;
119{ 119{
120 FILE* ftestexist; 120 FILE* ftestexist;
121 int ret = 1; 121 int ret = 1;
122 ftestexist = fopen(filename,"rb"); 122 ftestexist = fopen(filename,"rb");
123 if (ftestexist==NULL) 123 if (ftestexist==NULL)
124 ret = 0; 124 ret = 0;
125 else 125 else
126 fclose(ftestexist); 126 fclose(ftestexist);
127 return ret; 127 return ret;
128} 128}
129 129
130void do_banner() 130void do_banner()
131{ 131{
132 printf("MiniZip 1.01b, demo of zLib + Zip package written by Gilles Vollant\n"); 132 printf("MiniZip 1.01b, demo of zLib + Zip package written by Gilles Vollant\n");
133 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); 133 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
134} 134}
135 135
136void do_help() 136void do_help()
137{ 137{
138 printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] file.zip [files_to_add]\n\n" \ 138 printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] file.zip [files_to_add]\n\n" \
139 " -o Overwrite existing file.zip\n" \ 139 " -o Overwrite existing file.zip\n" \
140 " -a Append to existing file.zip\n" \ 140 " -a Append to existing file.zip\n" \
141 " -0 Store only\n" \ 141 " -0 Store only\n" \
142 " -1 Compress faster\n" \ 142 " -1 Compress faster\n" \
143 " -9 Compress better\n\n"); 143 " -9 Compress better\n\n");
144} 144}
145 145
146/* calculate the CRC32 of a file, 146/* calculate the CRC32 of a file,
147 because to encrypt a file, we need known the CRC32 of the file before */ 147 because to encrypt a file, we need known the CRC32 of the file before */
148int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc) 148int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc)
149{ 149{
150 unsigned long calculate_crc=0; 150 unsigned long calculate_crc=0;
151 int err=ZIP_OK; 151 int err=ZIP_OK;
152 FILE * fin = fopen(filenameinzip,"rb"); 152 FILE * fin = fopen(filenameinzip,"rb");
153 unsigned long size_read = 0; 153 unsigned long size_read = 0;
154 unsigned long total_read = 0; 154 unsigned long total_read = 0;
155 if (fin==NULL) 155 if (fin==NULL)
156 { 156 {
157 err = ZIP_ERRNO; 157 err = ZIP_ERRNO;
158 } 158 }
159 159
160 if (err == ZIP_OK) 160 if (err == ZIP_OK)
161 do 161 do
162 { 162 {
163 err = ZIP_OK; 163 err = ZIP_OK;
164 size_read = (int)fread(buf,1,size_buf,fin); 164 size_read = (int)fread(buf,1,size_buf,fin);
165 if (size_read < size_buf) 165 if (size_read < size_buf)
166 if (feof(fin)==0) 166 if (feof(fin)==0)
167 { 167 {
168 printf("error in reading %s\n",filenameinzip); 168 printf("error in reading %s\n",filenameinzip);
169 err = ZIP_ERRNO; 169 err = ZIP_ERRNO;
170 } 170 }
171 171
172 if (size_read>0) 172 if (size_read>0)
173 calculate_crc = crc32(calculate_crc,buf,size_read); 173 calculate_crc = crc32(calculate_crc,buf,size_read);
174 total_read += size_read; 174 total_read += size_read;
175 175
176 } while ((err == ZIP_OK) && (size_read>0)); 176 } while ((err == ZIP_OK) && (size_read>0));
177 177
178 if (fin) 178 if (fin)
179 fclose(fin); 179 fclose(fin);
180 180
181 *result_crc=calculate_crc; 181 *result_crc=calculate_crc;
182 printf("file %s crc %x\n",filenameinzip,calculate_crc); 182 printf("file %s crc %x\n",filenameinzip,calculate_crc);
183 return err; 183 return err;
184} 184}
185 185
186int main(argc,argv) 186int main(argc,argv)
187 int argc; 187 int argc;
188 char *argv[]; 188 char *argv[];
189{ 189{
190 int i; 190 int i;
191 int opt_overwrite=0; 191 int opt_overwrite=0;
192 int opt_compress_level=Z_DEFAULT_COMPRESSION; 192 int opt_compress_level=Z_DEFAULT_COMPRESSION;
193 int zipfilenamearg = 0; 193 int zipfilenamearg = 0;
194 char filename_try[MAXFILENAME+16]; 194 char filename_try[MAXFILENAME+16];
195 int zipok; 195 int zipok;
196 int err=0; 196 int err=0;
197 int size_buf=0; 197 int size_buf=0;
198 void* buf=NULL; 198 void* buf=NULL;
199 const char* password=NULL; 199 const char* password=NULL;
200 200
201 201
202 do_banner(); 202 do_banner();
203 if (argc==1) 203 if (argc==1)
204 { 204 {
205 do_help(); 205 do_help();
206 return 0; 206 return 0;
207 } 207 }
208 else 208 else
209 { 209 {
210 for (i=1;i<argc;i++) 210 for (i=1;i<argc;i++)
211 { 211 {
212 if ((*argv[i])=='-') 212 if ((*argv[i])=='-')
213 { 213 {
214 const char *p=argv[i]+1; 214 const char *p=argv[i]+1;
215 215
216 while ((*p)!='\0') 216 while ((*p)!='\0')
217 { 217 {
218 char c=*(p++);; 218 char c=*(p++);;
219 if ((c=='o') || (c=='O')) 219 if ((c=='o') || (c=='O'))
220 opt_overwrite = 1; 220 opt_overwrite = 1;
221 if ((c=='a') || (c=='A')) 221 if ((c=='a') || (c=='A'))
222 opt_overwrite = 2; 222 opt_overwrite = 2;
223 if ((c>='0') && (c<='9')) 223 if ((c>='0') && (c<='9'))
224 opt_compress_level = c-'0'; 224 opt_compress_level = c-'0';
225 225
226 if (((c=='p') || (c=='P')) && (i+1<argc)) 226 if (((c=='p') || (c=='P')) && (i+1<argc))
227 { 227 {
228 password=argv[i+1]; 228 password=argv[i+1];
229 i++; 229 i++;
230 } 230 }
231 } 231 }
232 } 232 }
233 else 233 else
234 if (zipfilenamearg == 0) 234 if (zipfilenamearg == 0)
235 zipfilenamearg = i ; 235 zipfilenamearg = i ;
236 } 236 }
237 } 237 }
238 238
239 size_buf = WRITEBUFFERSIZE; 239 size_buf = WRITEBUFFERSIZE;
240 buf = (void*)malloc(size_buf); 240 buf = (void*)malloc(size_buf);
241 if (buf==NULL) 241 if (buf==NULL)
242 { 242 {
243 printf("Error allocating memory\n"); 243 printf("Error allocating memory\n");
244 return ZIP_INTERNALERROR; 244 return ZIP_INTERNALERROR;
245 } 245 }
246 246
247 if (zipfilenamearg==0) 247 if (zipfilenamearg==0)
248 zipok=0; 248 zipok=0;
249 else 249 else
250 { 250 {
251 int i,len; 251 int i,len;
252 int dot_found=0; 252 int dot_found=0;
253 253
254 zipok = 1 ; 254 zipok = 1 ;
255 strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1); 255 strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1);
256 /* strncpy doesnt append the trailing NULL, of the string is too long. */ 256 /* strncpy doesnt append the trailing NULL, of the string is too long. */
257 filename_try[ MAXFILENAME ] = '\0'; 257 filename_try[ MAXFILENAME ] = '\0';
258 258
259 len=(int)strlen(filename_try); 259 len=(int)strlen(filename_try);
260 for (i=0;i<len;i++) 260 for (i=0;i<len;i++)
261 if (filename_try[i]=='.') 261 if (filename_try[i]=='.')
262 dot_found=1; 262 dot_found=1;
263 263
264 if (dot_found==0) 264 if (dot_found==0)
265 strcat(filename_try,".zip"); 265 strcat(filename_try,".zip");
266 266
267 if (opt_overwrite==2) 267 if (opt_overwrite==2)
268 { 268 {
269 /* if the file don't exist, we not append file */ 269 /* if the file don't exist, we not append file */
270 if (check_exist_file(filename_try)==0) 270 if (check_exist_file(filename_try)==0)
271 opt_overwrite=1; 271 opt_overwrite=1;
272 } 272 }
273 else 273 else
274 if (opt_overwrite==0) 274 if (opt_overwrite==0)
275 if (check_exist_file(filename_try)!=0) 275 if (check_exist_file(filename_try)!=0)
276 { 276 {
277 char rep=0; 277 char rep=0;
278 do 278 do
279 { 279 {
280 char answer[128]; 280 char answer[128];
281 int ret; 281 int ret;
282 printf("The file %s exists. Overwrite ? [y]es, [n]o, [a]ppend : ",filename_try); 282 printf("The file %s exists. Overwrite ? [y]es, [n]o, [a]ppend : ",filename_try);
283 ret = scanf("%1s",answer); 283 ret = scanf("%1s",answer);
284 if (ret != 1) 284 if (ret != 1)
285 { 285 {
286 exit(EXIT_FAILURE); 286 exit(EXIT_FAILURE);
287 } 287 }
288 rep = answer[0] ; 288 rep = answer[0] ;
289 if ((rep>='a') && (rep<='z')) 289 if ((rep>='a') && (rep<='z'))
290 rep -= 0x20; 290 rep -= 0x20;
291 } 291 }
292 while ((rep!='Y') && (rep!='N') && (rep!='A')); 292 while ((rep!='Y') && (rep!='N') && (rep!='A'));
293 if (rep=='N') 293 if (rep=='N')
294 zipok = 0; 294 zipok = 0;
295 if (rep=='A') 295 if (rep=='A')
296 opt_overwrite = 2; 296 opt_overwrite = 2;
297 } 297 }
298 } 298 }
299 299
300 if (zipok==1) 300 if (zipok==1)
301 { 301 {
302 zipFile zf; 302 zipFile zf;
303 int errclose; 303 int errclose;
304# ifdef USEWIN32IOAPI 304# ifdef USEWIN32IOAPI
305 zlib_filefunc_def ffunc; 305 zlib_filefunc_def ffunc;
306 fill_win32_filefunc(&ffunc); 306 fill_win32_filefunc(&ffunc);
307 zf = zipOpen2(filename_try,(opt_overwrite==2) ? 2 : 0,NULL,&ffunc); 307 zf = zipOpen2(filename_try,(opt_overwrite==2) ? 2 : 0,NULL,&ffunc);
308# else 308# else
309 zf = zipOpen(filename_try,(opt_overwrite==2) ? 2 : 0); 309 zf = zipOpen(filename_try,(opt_overwrite==2) ? 2 : 0);
310# endif 310# endif
311 311
312 if (zf == NULL) 312 if (zf == NULL)
313 { 313 {
314 printf("error opening %s\n",filename_try); 314 printf("error opening %s\n",filename_try);
315 err= ZIP_ERRNO; 315 err= ZIP_ERRNO;
316 } 316 }
317 else 317 else
318 printf("creating %s\n",filename_try); 318 printf("creating %s\n",filename_try);
319 319
320 for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++) 320 for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++)
321 { 321 {
322 if (!((((*(argv[i]))=='-') || ((*(argv[i]))=='/')) && 322 if (!((((*(argv[i]))=='-') || ((*(argv[i]))=='/')) &&
323 ((argv[i][1]=='o') || (argv[i][1]=='O') || 323 ((argv[i][1]=='o') || (argv[i][1]=='O') ||
324 (argv[i][1]=='a') || (argv[i][1]=='A') || 324 (argv[i][1]=='a') || (argv[i][1]=='A') ||
325 (argv[i][1]=='p') || (argv[i][1]=='P') || 325 (argv[i][1]=='p') || (argv[i][1]=='P') ||
326 ((argv[i][1]>='0') || (argv[i][1]<='9'))) && 326 ((argv[i][1]>='0') || (argv[i][1]<='9'))) &&
327 (strlen(argv[i]) == 2))) 327 (strlen(argv[i]) == 2)))
328 { 328 {
329 FILE * fin; 329 FILE * fin;
330 int size_read; 330 int size_read;
331 const char* filenameinzip = argv[i]; 331 const char* filenameinzip = argv[i];
332 zip_fileinfo zi; 332 zip_fileinfo zi;
333 unsigned long crcFile=0; 333 unsigned long crcFile=0;
334 334
335 zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour = 335 zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
336 zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0; 336 zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
337 zi.dosDate = 0; 337 zi.dosDate = 0;
338 zi.internal_fa = 0; 338 zi.internal_fa = 0;
339 zi.external_fa = 0; 339 zi.external_fa = 0;
340 filetime(filenameinzip,&zi.tmz_date,&zi.dosDate); 340 filetime(filenameinzip,&zi.tmz_date,&zi.dosDate);
341 341
342/* 342/*
343 err = zipOpenNewFileInZip(zf,filenameinzip,&zi, 343 err = zipOpenNewFileInZip(zf,filenameinzip,&zi,
344 NULL,0,NULL,0,NULL / * comment * /, 344 NULL,0,NULL,0,NULL / * comment * /,
345 (opt_compress_level != 0) ? Z_DEFLATED : 0, 345 (opt_compress_level != 0) ? Z_DEFLATED : 0,
346 opt_compress_level); 346 opt_compress_level);
347*/ 347*/
348 if ((password != NULL) && (err==ZIP_OK)) 348 if ((password != NULL) && (err==ZIP_OK))
349 err = getFileCrc(filenameinzip,buf,size_buf,&crcFile); 349 err = getFileCrc(filenameinzip,buf,size_buf,&crcFile);
350 350
351 err = zipOpenNewFileInZip3(zf,filenameinzip,&zi, 351 err = zipOpenNewFileInZip3(zf,filenameinzip,&zi,
352 NULL,0,NULL,0,NULL /* comment*/, 352 NULL,0,NULL,0,NULL /* comment*/,
353 (opt_compress_level != 0) ? Z_DEFLATED : 0, 353 (opt_compress_level != 0) ? Z_DEFLATED : 0,
354 opt_compress_level,0, 354 opt_compress_level,0,
355 /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */ 355 /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */
356 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, 356 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
357 password,crcFile); 357 password,crcFile);
358 358
359 if (err != ZIP_OK) 359 if (err != ZIP_OK)
360 printf("error in opening %s in zipfile\n",filenameinzip); 360 printf("error in opening %s in zipfile\n",filenameinzip);
361 else 361 else
362 { 362 {
363 fin = fopen(filenameinzip,"rb"); 363 fin = fopen(filenameinzip,"rb");
364 if (fin==NULL) 364 if (fin==NULL)
365 { 365 {
366 err=ZIP_ERRNO; 366 err=ZIP_ERRNO;
367 printf("error in opening %s for reading\n",filenameinzip); 367 printf("error in opening %s for reading\n",filenameinzip);
368 } 368 }
369 } 369 }
370 370
371 if (err == ZIP_OK) 371 if (err == ZIP_OK)
372 do 372 do
373 { 373 {
374 err = ZIP_OK; 374 err = ZIP_OK;
375 size_read = (int)fread(buf,1,size_buf,fin); 375 size_read = (int)fread(buf,1,size_buf,fin);
376 if (size_read < size_buf) 376 if (size_read < size_buf)
377 if (feof(fin)==0) 377 if (feof(fin)==0)
378 { 378 {
379 printf("error in reading %s\n",filenameinzip); 379 printf("error in reading %s\n",filenameinzip);
380 err = ZIP_ERRNO; 380 err = ZIP_ERRNO;
381 } 381 }
382 382
383 if (size_read>0) 383 if (size_read>0)
384 { 384 {
385 err = zipWriteInFileInZip (zf,buf,size_read); 385 err = zipWriteInFileInZip (zf,buf,size_read);
386 if (err<0) 386 if (err<0)
387 { 387 {
388 printf("error in writing %s in the zipfile\n", 388 printf("error in writing %s in the zipfile\n",
389 filenameinzip); 389 filenameinzip);
390 } 390 }
391 391
392 } 392 }
393 } while ((err == ZIP_OK) && (size_read>0)); 393 } while ((err == ZIP_OK) && (size_read>0));
394 394
395 if (fin) 395 if (fin)
396 fclose(fin); 396 fclose(fin);
397 397
398 if (err<0) 398 if (err<0)
399 err=ZIP_ERRNO; 399 err=ZIP_ERRNO;
400 else 400 else
401 { 401 {
402 err = zipCloseFileInZip(zf); 402 err = zipCloseFileInZip(zf);
403 if (err!=ZIP_OK) 403 if (err!=ZIP_OK)
404 printf("error in closing %s in the zipfile\n", 404 printf("error in closing %s in the zipfile\n",
405 filenameinzip); 405 filenameinzip);
406 } 406 }
407 } 407 }
408 } 408 }
409 errclose = zipClose(zf,NULL); 409 errclose = zipClose(zf,NULL);
410 if (errclose != ZIP_OK) 410 if (errclose != ZIP_OK)
411 printf("error in closing %s\n",filename_try); 411 printf("error in closing %s\n",filename_try);
412 } 412 }
413 else 413 else
414 { 414 {
415 do_help(); 415 do_help();
416 } 416 }
417 417
418 free(buf); 418 free(buf);
419 return 0; 419 return 0;
420} 420}
diff --git a/contrib/minizip/mztools.c b/contrib/minizip/mztools.c
index bc5c798..8a50ee4 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
30extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered) 30extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)
31const char* file; 31const char* file;
32const char* fileOut; 32const char* fileOut;
33const char* fileOutTmp; 33const char* fileOutTmp;
34uLong* nRecovered; 34uLong* nRecovered;
35uLong* bytesRecovered; 35uLong* 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..eee78dc 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
11extern "C" { 11extern "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*/
25extern int ZEXPORT unzRepair(const char* file, 25extern 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 3a70629..9ad4766 100644
--- a/contrib/minizip/unzip.c
+++ b/contrib/minizip/unzip.c
@@ -1,1598 +1,1598 @@
1/* unzip.c -- IO for uncompress .zip files using zlib 1/* unzip.c -- IO for uncompress .zip files using zlib
2 Version 1.01e, February 12th, 2005 2 Version 1.01e, February 12th, 2005
3 3
4 Copyright (C) 1998-2005 Gilles Vollant 4 Copyright (C) 1998-2005 Gilles Vollant
5 5
6 Read unzip.h for more info 6 Read unzip.h for more info
7*/ 7*/
8 8
9/* Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of 9/* Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of
10compatibility with older software. The following is from the original crypt.c. Code 10compatibility with older software. The following is from the original crypt.c. Code
11woven in by Terry Thorsen 1/2003. 11woven in by Terry Thorsen 1/2003.
12*/ 12*/
13/* 13/*
14 Copyright (c) 1990-2000 Info-ZIP. All rights reserved. 14 Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
15 15
16 See the accompanying file LICENSE, version 2000-Apr-09 or later 16 See the accompanying file LICENSE, version 2000-Apr-09 or later
17 (the contents of which are also included in zip.h) for terms of use. 17 (the contents of which are also included in zip.h) for terms of use.
18 If, for some reason, all these files are missing, the Info-ZIP license 18 If, for some reason, all these files are missing, the Info-ZIP license
19 also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html 19 also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
20*/ 20*/
21/* 21/*
22 crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h] 22 crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h]
23 23
24 The encryption/decryption parts of this source code (as opposed to the 24 The encryption/decryption parts of this source code (as opposed to the
25 non-echoing password parts) were originally written in Europe. The 25 non-echoing password parts) were originally written in Europe. The
26 whole source package can be freely distributed, including from the USA. 26 whole source package can be freely distributed, including from the USA.
27 (Prior to January 2000, re-export from the US was a violation of US law.) 27 (Prior to January 2000, re-export from the US was a violation of US law.)
28 */ 28 */
29 29
30/* 30/*
31 This encryption code is a direct transcription of the algorithm from 31 This encryption code is a direct transcription of the algorithm from
32 Roger Schlafly, described by Phil Katz in the file appnote.txt. This 32 Roger Schlafly, described by Phil Katz in the file appnote.txt. This
33 file (appnote.txt) is distributed with the PKZIP program (even in the 33 file (appnote.txt) is distributed with the PKZIP program (even in the
34 version without encryption capabilities). 34 version without encryption capabilities).
35 */ 35 */
36 36
37 37
38#include <stdio.h> 38#include <stdio.h>
39#include <stdlib.h> 39#include <stdlib.h>
40#include <string.h> 40#include <string.h>
41#include "zlib.h" 41#include "zlib.h"
42#include "unzip.h" 42#include "unzip.h"
43 43
44#ifdef STDC 44#ifdef STDC
45# include <stddef.h> 45# include <stddef.h>
46# include <string.h> 46# include <string.h>
47# include <stdlib.h> 47# include <stdlib.h>
48#endif 48#endif
49#ifdef NO_ERRNO_H 49#ifdef NO_ERRNO_H
50 extern int errno; 50 extern int errno;
51#else 51#else
52# include <errno.h> 52# include <errno.h>
53#endif 53#endif
54 54
55 55
56#ifndef local 56#ifndef local
57# define local static 57# define local static
58#endif 58#endif
59/* compile with -Dlocal if your debugger can't find static symbols */ 59/* compile with -Dlocal if your debugger can't find static symbols */
60 60
61 61
62#ifndef CASESENSITIVITYDEFAULT_NO 62#ifndef CASESENSITIVITYDEFAULT_NO
63# if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) 63# if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES)
64# define CASESENSITIVITYDEFAULT_NO 64# define CASESENSITIVITYDEFAULT_NO
65# endif 65# endif
66#endif 66#endif
67 67
68 68
69#ifndef UNZ_BUFSIZE 69#ifndef UNZ_BUFSIZE
70#define UNZ_BUFSIZE (16384) 70#define UNZ_BUFSIZE (16384)
71#endif 71#endif
72 72
73#ifndef UNZ_MAXFILENAMEINZIP 73#ifndef UNZ_MAXFILENAMEINZIP
74#define UNZ_MAXFILENAMEINZIP (256) 74#define UNZ_MAXFILENAMEINZIP (256)
75#endif 75#endif
76 76
77#ifndef ALLOC 77#ifndef ALLOC
78# define ALLOC(size) (malloc(size)) 78# define ALLOC(size) (malloc(size))
79#endif 79#endif
80#ifndef TRYFREE 80#ifndef TRYFREE
81# define TRYFREE(p) {if (p) free(p);} 81# define TRYFREE(p) {if (p) free(p);}
82#endif 82#endif
83 83
84#define SIZECENTRALDIRITEM (0x2e) 84#define SIZECENTRALDIRITEM (0x2e)
85#define SIZEZIPLOCALHEADER (0x1e) 85#define SIZEZIPLOCALHEADER (0x1e)
86 86
87 87
88 88
89 89
90const char unz_copyright[] = 90const char unz_copyright[] =
91 " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; 91 " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
92 92
93/* unz_file_info_interntal contain internal info about a file in zipfile*/ 93/* unz_file_info_interntal contain internal info about a file in zipfile*/
94typedef struct unz_file_info_internal_s 94typedef struct unz_file_info_internal_s
95{ 95{
96 uLong offset_curfile;/* relative offset of local header 4 bytes */ 96 uLong offset_curfile;/* relative offset of local header 4 bytes */
97} unz_file_info_internal; 97} unz_file_info_internal;
98 98
99 99
100/* file_in_zip_read_info_s contain internal information about a file in zipfile, 100/* file_in_zip_read_info_s contain internal information about a file in zipfile,
101 when reading and decompress it */ 101 when reading and decompress it */
102typedef struct 102typedef struct
103{ 103{
104 char *read_buffer; /* internal buffer for compressed data */ 104 char *read_buffer; /* internal buffer for compressed data */
105 z_stream stream; /* zLib stream structure for inflate */ 105 z_stream stream; /* zLib stream structure for inflate */
106 106
107 uLong pos_in_zipfile; /* position in byte on the zipfile, for fseek*/ 107 uLong pos_in_zipfile; /* position in byte on the zipfile, for fseek*/
108 uLong stream_initialised; /* flag set if stream structure is initialised*/ 108 uLong stream_initialised; /* flag set if stream structure is initialised*/
109 109
110 uLong offset_local_extrafield;/* offset of the local extra field */ 110 uLong offset_local_extrafield;/* offset of the local extra field */
111 uInt size_local_extrafield;/* size of the local extra field */ 111 uInt size_local_extrafield;/* size of the local extra field */
112 uLong pos_local_extrafield; /* position in the local extra field in read*/ 112 uLong pos_local_extrafield; /* position in the local extra field in read*/
113 113
114 uLong crc32; /* crc32 of all data uncompressed */ 114 uLong crc32; /* crc32 of all data uncompressed */
115 uLong crc32_wait; /* crc32 we must obtain after decompress all */ 115 uLong crc32_wait; /* crc32 we must obtain after decompress all */
116 uLong rest_read_compressed; /* number of byte to be decompressed */ 116 uLong rest_read_compressed; /* number of byte to be decompressed */
117 uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/ 117 uLong rest_read_uncompressed;/*number of byte to be obtained after decomp*/
118 zlib_filefunc_def z_filefunc; 118 zlib_filefunc_def z_filefunc;
119 voidpf filestream; /* io structore of the zipfile */ 119 voidpf filestream; /* io structore of the zipfile */
120 uLong compression_method; /* compression method (0==store) */ 120 uLong compression_method; /* compression method (0==store) */
121 uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ 121 uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
122 int raw; 122 int raw;
123} file_in_zip_read_info_s; 123} file_in_zip_read_info_s;
124 124
125 125
126/* unz_s contain internal information about the zipfile 126/* unz_s contain internal information about the zipfile
127*/ 127*/
128typedef struct 128typedef struct
129{ 129{
130 zlib_filefunc_def z_filefunc; 130 zlib_filefunc_def z_filefunc;
131 voidpf filestream; /* io structore of the zipfile */ 131 voidpf filestream; /* io structore of the zipfile */
132 unz_global_info gi; /* public global information */ 132 unz_global_info gi; /* public global information */
133 uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ 133 uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
134 uLong num_file; /* number of the current file in the zipfile*/ 134 uLong num_file; /* number of the current file in the zipfile*/
135 uLong pos_in_central_dir; /* pos of the current file in the central dir*/ 135 uLong pos_in_central_dir; /* pos of the current file in the central dir*/
136 uLong current_file_ok; /* flag about the usability of the current file*/ 136 uLong current_file_ok; /* flag about the usability of the current file*/
137 uLong central_pos; /* position of the beginning of the central dir*/ 137 uLong central_pos; /* position of the beginning of the central dir*/
138 138
139 uLong size_central_dir; /* size of the central directory */ 139 uLong size_central_dir; /* size of the central directory */
140 uLong offset_central_dir; /* offset of start of central directory with 140 uLong offset_central_dir; /* offset of start of central directory with
141 respect to the starting disk number */ 141 respect to the starting disk number */
142 142
143 unz_file_info cur_file_info; /* public info about the current file in zip*/ 143 unz_file_info cur_file_info; /* public info about the current file in zip*/
144 unz_file_info_internal cur_file_info_internal; /* private info about it*/ 144 unz_file_info_internal cur_file_info_internal; /* private info about it*/
145 file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current 145 file_in_zip_read_info_s* pfile_in_zip_read; /* structure about the current
146 file if we are decompressing it */ 146 file if we are decompressing it */
147 int encrypted; 147 int encrypted;
148# ifndef NOUNCRYPT 148# ifndef NOUNCRYPT
149 unsigned long keys[3]; /* keys defining the pseudo-random sequence */ 149 unsigned long keys[3]; /* keys defining the pseudo-random sequence */
150 const unsigned long* pcrc_32_tab; 150 const unsigned long* pcrc_32_tab;
151# endif 151# endif
152} unz_s; 152} unz_s;
153 153
154 154
155#ifndef NOUNCRYPT 155#ifndef NOUNCRYPT
156#include "crypt.h" 156#include "crypt.h"
157#endif 157#endif
158 158
159/* =========================================================================== 159/* ===========================================================================
160 Read a byte from a gz_stream; update next_in and avail_in. Return EOF 160 Read a byte from a gz_stream; update next_in and avail_in. Return EOF
161 for end of file. 161 for end of file.
162 IN assertion: the stream s has been sucessfully opened for reading. 162 IN assertion: the stream s has been sucessfully opened for reading.
163*/ 163*/
164 164
165 165
166local int unzlocal_getByte OF(( 166local int unzlocal_getByte OF((
167 const zlib_filefunc_def* pzlib_filefunc_def, 167 const zlib_filefunc_def* pzlib_filefunc_def,
168 voidpf filestream, 168 voidpf filestream,
169 int *pi)); 169 int *pi));
170 170
171local int unzlocal_getByte(pzlib_filefunc_def,filestream,pi) 171local int unzlocal_getByte(pzlib_filefunc_def,filestream,pi)
172 const zlib_filefunc_def* pzlib_filefunc_def; 172 const zlib_filefunc_def* pzlib_filefunc_def;
173 voidpf filestream; 173 voidpf filestream;
174 int *pi; 174 int *pi;
175{ 175{
176 unsigned char c; 176 unsigned char c;
177 int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1); 177 int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
178 if (err==1) 178 if (err==1)
179 { 179 {
180 *pi = (int)c; 180 *pi = (int)c;
181 return UNZ_OK; 181 return UNZ_OK;
182 } 182 }
183 else 183 else
184 { 184 {
185 if (ZERROR(*pzlib_filefunc_def,filestream)) 185 if (ZERROR(*pzlib_filefunc_def,filestream))
186 return UNZ_ERRNO; 186 return UNZ_ERRNO;
187 else 187 else
188 return UNZ_EOF; 188 return UNZ_EOF;
189 } 189 }
190} 190}
191 191
192 192
193/* =========================================================================== 193/* ===========================================================================
194 Reads a long in LSB order from the given gz_stream. Sets 194 Reads a long in LSB order from the given gz_stream. Sets
195*/ 195*/
196local int unzlocal_getShort OF(( 196local int unzlocal_getShort OF((
197 const zlib_filefunc_def* pzlib_filefunc_def, 197 const zlib_filefunc_def* pzlib_filefunc_def,
198 voidpf filestream, 198 voidpf filestream,
199 uLong *pX)); 199 uLong *pX));
200 200
201local int unzlocal_getShort (pzlib_filefunc_def,filestream,pX) 201local int unzlocal_getShort (pzlib_filefunc_def,filestream,pX)
202 const zlib_filefunc_def* pzlib_filefunc_def; 202 const zlib_filefunc_def* pzlib_filefunc_def;
203 voidpf filestream; 203 voidpf filestream;
204 uLong *pX; 204 uLong *pX;
205{ 205{
206 uLong x ; 206 uLong x ;
207 int i; 207 int i;
208 int err; 208 int err;
209 209
210 err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); 210 err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
211 x = (uLong)i; 211 x = (uLong)i;
212 212
213 if (err==UNZ_OK) 213 if (err==UNZ_OK)
214 err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); 214 err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
215 x += ((uLong)i)<<8; 215 x += ((uLong)i)<<8;
216 216
217 if (err==UNZ_OK) 217 if (err==UNZ_OK)
218 *pX = x; 218 *pX = x;
219 else 219 else
220 *pX = 0; 220 *pX = 0;
221 return err; 221 return err;
222} 222}
223 223
224local int unzlocal_getLong OF(( 224local int unzlocal_getLong OF((
225 const zlib_filefunc_def* pzlib_filefunc_def, 225 const zlib_filefunc_def* pzlib_filefunc_def,
226 voidpf filestream, 226 voidpf filestream,
227 uLong *pX)); 227 uLong *pX));
228 228
229local int unzlocal_getLong (pzlib_filefunc_def,filestream,pX) 229local int unzlocal_getLong (pzlib_filefunc_def,filestream,pX)
230 const zlib_filefunc_def* pzlib_filefunc_def; 230 const zlib_filefunc_def* pzlib_filefunc_def;
231 voidpf filestream; 231 voidpf filestream;
232 uLong *pX; 232 uLong *pX;
233{ 233{
234 uLong x ; 234 uLong x ;
235 int i; 235 int i;
236 int err; 236 int err;
237 237
238 err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); 238 err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
239 x = (uLong)i; 239 x = (uLong)i;
240 240
241 if (err==UNZ_OK) 241 if (err==UNZ_OK)
242 err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); 242 err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
243 x += ((uLong)i)<<8; 243 x += ((uLong)i)<<8;
244 244
245 if (err==UNZ_OK) 245 if (err==UNZ_OK)
246 err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); 246 err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
247 x += ((uLong)i)<<16; 247 x += ((uLong)i)<<16;
248 248
249 if (err==UNZ_OK) 249 if (err==UNZ_OK)
250 err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); 250 err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
251 x += ((uLong)i)<<24; 251 x += ((uLong)i)<<24;
252 252
253 if (err==UNZ_OK) 253 if (err==UNZ_OK)
254 *pX = x; 254 *pX = x;
255 else 255 else
256 *pX = 0; 256 *pX = 0;
257 return err; 257 return err;
258} 258}
259 259
260 260
261/* My own strcmpi / strcasecmp */ 261/* My own strcmpi / strcasecmp */
262local int strcmpcasenosensitive_internal (fileName1,fileName2) 262local int strcmpcasenosensitive_internal (fileName1,fileName2)
263 const char* fileName1; 263 const char* fileName1;
264 const char* fileName2; 264 const char* fileName2;
265{ 265{
266 for (;;) 266 for (;;)
267 { 267 {
268 char c1=*(fileName1++); 268 char c1=*(fileName1++);
269 char c2=*(fileName2++); 269 char c2=*(fileName2++);
270 if ((c1>='a') && (c1<='z')) 270 if ((c1>='a') && (c1<='z'))
271 c1 -= 0x20; 271 c1 -= 0x20;
272 if ((c2>='a') && (c2<='z')) 272 if ((c2>='a') && (c2<='z'))
273 c2 -= 0x20; 273 c2 -= 0x20;
274 if (c1=='\0') 274 if (c1=='\0')
275 return ((c2=='\0') ? 0 : -1); 275 return ((c2=='\0') ? 0 : -1);
276 if (c2=='\0') 276 if (c2=='\0')
277 return 1; 277 return 1;
278 if (c1<c2) 278 if (c1<c2)
279 return -1; 279 return -1;
280 if (c1>c2) 280 if (c1>c2)
281 return 1; 281 return 1;
282 } 282 }
283} 283}
284 284
285 285
286#ifdef CASESENSITIVITYDEFAULT_NO 286#ifdef CASESENSITIVITYDEFAULT_NO
287#define CASESENSITIVITYDEFAULTVALUE 2 287#define CASESENSITIVITYDEFAULTVALUE 2
288#else 288#else
289#define CASESENSITIVITYDEFAULTVALUE 1 289#define CASESENSITIVITYDEFAULTVALUE 1
290#endif 290#endif
291 291
292#ifndef STRCMPCASENOSENTIVEFUNCTION 292#ifndef STRCMPCASENOSENTIVEFUNCTION
293#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal 293#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
294#endif 294#endif
295 295
296/* 296/*
297 Compare two filename (fileName1,fileName2). 297 Compare two filename (fileName1,fileName2).
298 If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) 298 If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
299 If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi 299 If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
300 or strcasecmp) 300 or strcasecmp)
301 If iCaseSenisivity = 0, case sensitivity is defaut of your operating system 301 If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
302 (like 1 on Unix, 2 on Windows) 302 (like 1 on Unix, 2 on Windows)
303 303
304*/ 304*/
305extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity) 305extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity)
306 const char* fileName1; 306 const char* fileName1;
307 const char* fileName2; 307 const char* fileName2;
308 int iCaseSensitivity; 308 int iCaseSensitivity;
309{ 309{
310 if (iCaseSensitivity==0) 310 if (iCaseSensitivity==0)
311 iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; 311 iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
312 312
313 if (iCaseSensitivity==1) 313 if (iCaseSensitivity==1)
314 return strcmp(fileName1,fileName2); 314 return strcmp(fileName1,fileName2);
315 315
316 return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); 316 return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
317} 317}
318 318
319#ifndef BUFREADCOMMENT 319#ifndef BUFREADCOMMENT
320#define BUFREADCOMMENT (0x400) 320#define BUFREADCOMMENT (0x400)
321#endif 321#endif
322 322
323/* 323/*
324 Locate the Central directory of a zipfile (at the end, just before 324 Locate the Central directory of a zipfile (at the end, just before
325 the global comment) 325 the global comment)
326*/ 326*/
327local uLong unzlocal_SearchCentralDir OF(( 327local uLong unzlocal_SearchCentralDir OF((
328 const zlib_filefunc_def* pzlib_filefunc_def, 328 const zlib_filefunc_def* pzlib_filefunc_def,
329 voidpf filestream)); 329 voidpf filestream));
330 330
331local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream) 331local uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
332 const zlib_filefunc_def* pzlib_filefunc_def; 332 const zlib_filefunc_def* pzlib_filefunc_def;
333 voidpf filestream; 333 voidpf filestream;
334{ 334{
335 unsigned char* buf; 335 unsigned char* buf;
336 uLong uSizeFile; 336 uLong uSizeFile;
337 uLong uBackRead; 337 uLong uBackRead;
338 uLong uMaxBack=0xffff; /* maximum size of global comment */ 338 uLong uMaxBack=0xffff; /* maximum size of global comment */
339 uLong uPosFound=0; 339 uLong uPosFound=0;
340 340
341 if (ZSEEK(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) 341 if (ZSEEK(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
342 return 0; 342 return 0;
343 343
344 344
345 uSizeFile = ZTELL(*pzlib_filefunc_def,filestream); 345 uSizeFile = ZTELL(*pzlib_filefunc_def,filestream);
346 346
347 if (uMaxBack>uSizeFile) 347 if (uMaxBack>uSizeFile)
348 uMaxBack = uSizeFile; 348 uMaxBack = uSizeFile;
349 349
350 buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); 350 buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
351 if (buf==NULL) 351 if (buf==NULL)
352 return 0; 352 return 0;
353 353
354 uBackRead = 4; 354 uBackRead = 4;
355 while (uBackRead<uMaxBack) 355 while (uBackRead<uMaxBack)
356 { 356 {
357 uLong uReadSize,uReadPos ; 357 uLong uReadSize,uReadPos ;
358 int i; 358 int i;
359 if (uBackRead+BUFREADCOMMENT>uMaxBack) 359 if (uBackRead+BUFREADCOMMENT>uMaxBack)
360 uBackRead = uMaxBack; 360 uBackRead = uMaxBack;
361 else 361 else
362 uBackRead+=BUFREADCOMMENT; 362 uBackRead+=BUFREADCOMMENT;
363 uReadPos = uSizeFile-uBackRead ; 363 uReadPos = uSizeFile-uBackRead ;
364 364
365 uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? 365 uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
366 (BUFREADCOMMENT+4) : (uSizeFile-uReadPos); 366 (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
367 if (ZSEEK(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0) 367 if (ZSEEK(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
368 break; 368 break;
369 369
370 if (ZREAD(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize) 370 if (ZREAD(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
371 break; 371 break;
372 372
373 for (i=(int)uReadSize-3; (i--)>0;) 373 for (i=(int)uReadSize-3; (i--)>0;)
374 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && 374 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
375 ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) 375 ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
376 { 376 {
377 uPosFound = uReadPos+i; 377 uPosFound = uReadPos+i;
378 break; 378 break;
379 } 379 }
380 380
381 if (uPosFound!=0) 381 if (uPosFound!=0)
382 break; 382 break;
383 } 383 }
384 TRYFREE(buf); 384 TRYFREE(buf);
385 return uPosFound; 385 return uPosFound;
386} 386}
387 387
388/* 388/*
389 Open a Zip file. path contain the full pathname (by example, 389 Open a Zip file. path contain the full pathname (by example,
390 on a Windows NT computer "c:\\test\\zlib114.zip" or on an Unix computer 390 on a Windows NT computer "c:\\test\\zlib114.zip" or on an Unix computer
391 "zlib/zlib114.zip". 391 "zlib/zlib114.zip".
392 If the zipfile cannot be opened (file doesn't exist or in not valid), the 392 If the zipfile cannot be opened (file doesn't exist or in not valid), the
393 return value is NULL. 393 return value is NULL.
394 Else, the return value is a unzFile Handle, usable with other function 394 Else, the return value is a unzFile Handle, usable with other function
395 of this unzip package. 395 of this unzip package.
396*/ 396*/
397extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def) 397extern unzFile ZEXPORT unzOpen2 (path, pzlib_filefunc_def)
398 const char *path; 398 const char *path;
399 zlib_filefunc_def* pzlib_filefunc_def; 399 zlib_filefunc_def* pzlib_filefunc_def;
400{ 400{
401 unz_s us; 401 unz_s us;
402 unz_s *s; 402 unz_s *s;
403 uLong central_pos,uL; 403 uLong central_pos,uL;
404 404
405 uLong number_disk; /* number of the current dist, used for 405 uLong number_disk; /* number of the current dist, used for
406 spaning ZIP, unsupported, always 0*/ 406 spaning ZIP, unsupported, always 0*/
407 uLong number_disk_with_CD; /* number the the disk with central dir, used 407 uLong number_disk_with_CD; /* number the the disk with central dir, used
408 for spaning ZIP, unsupported, always 0*/ 408 for spaning ZIP, unsupported, always 0*/
409 uLong number_entry_CD; /* total number of entries in 409 uLong number_entry_CD; /* total number of entries in
410 the central dir 410 the central dir
411 (same than number_entry on nospan) */ 411 (same than number_entry on nospan) */
412 412
413 int err=UNZ_OK; 413 int err=UNZ_OK;
414 414
415 if (unz_copyright[0]!=' ') 415 if (unz_copyright[0]!=' ')
416 return NULL; 416 return NULL;
417 417
418 if (pzlib_filefunc_def==NULL) 418 if (pzlib_filefunc_def==NULL)
419 fill_fopen_filefunc(&us.z_filefunc); 419 fill_fopen_filefunc(&us.z_filefunc);
420 else 420 else
421 us.z_filefunc = *pzlib_filefunc_def; 421 us.z_filefunc = *pzlib_filefunc_def;
422 422
423 us.filestream= (*(us.z_filefunc.zopen_file))(us.z_filefunc.opaque, 423 us.filestream= (*(us.z_filefunc.zopen_file))(us.z_filefunc.opaque,
424 path, 424 path,
425 ZLIB_FILEFUNC_MODE_READ | 425 ZLIB_FILEFUNC_MODE_READ |
426 ZLIB_FILEFUNC_MODE_EXISTING); 426 ZLIB_FILEFUNC_MODE_EXISTING);
427 if (us.filestream==NULL) 427 if (us.filestream==NULL)
428 return NULL; 428 return NULL;
429 429
430 central_pos = unzlocal_SearchCentralDir(&us.z_filefunc,us.filestream); 430 central_pos = unzlocal_SearchCentralDir(&us.z_filefunc,us.filestream);
431 if (central_pos==0) 431 if (central_pos==0)
432 err=UNZ_ERRNO; 432 err=UNZ_ERRNO;
433 433
434 if (ZSEEK(us.z_filefunc, us.filestream, 434 if (ZSEEK(us.z_filefunc, us.filestream,
435 central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0) 435 central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
436 err=UNZ_ERRNO; 436 err=UNZ_ERRNO;
437 437
438 /* the signature, already checked */ 438 /* the signature, already checked */
439 if (unzlocal_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK) 439 if (unzlocal_getLong(&us.z_filefunc, us.filestream,&uL)!=UNZ_OK)
440 err=UNZ_ERRNO; 440 err=UNZ_ERRNO;
441 441
442 /* number of this disk */ 442 /* number of this disk */
443 if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK) 443 if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_disk)!=UNZ_OK)
444 err=UNZ_ERRNO; 444 err=UNZ_ERRNO;
445 445
446 /* number of the disk with the start of the central directory */ 446 /* number of the disk with the start of the central directory */
447 if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK) 447 if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_disk_with_CD)!=UNZ_OK)
448 err=UNZ_ERRNO; 448 err=UNZ_ERRNO;
449 449
450 /* total number of entries in the central dir on this disk */ 450 /* total number of entries in the central dir on this disk */
451 if (unzlocal_getShort(&us.z_filefunc, us.filestream,&us.gi.number_entry)!=UNZ_OK) 451 if (unzlocal_getShort(&us.z_filefunc, us.filestream,&us.gi.number_entry)!=UNZ_OK)
452 err=UNZ_ERRNO; 452 err=UNZ_ERRNO;
453 453
454 /* total number of entries in the central dir */ 454 /* total number of entries in the central dir */
455 if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_entry_CD)!=UNZ_OK) 455 if (unzlocal_getShort(&us.z_filefunc, us.filestream,&number_entry_CD)!=UNZ_OK)
456 err=UNZ_ERRNO; 456 err=UNZ_ERRNO;
457 457
458 if ((number_entry_CD!=us.gi.number_entry) || 458 if ((number_entry_CD!=us.gi.number_entry) ||
459 (number_disk_with_CD!=0) || 459 (number_disk_with_CD!=0) ||
460 (number_disk!=0)) 460 (number_disk!=0))
461 err=UNZ_BADZIPFILE; 461 err=UNZ_BADZIPFILE;
462 462
463 /* size of the central directory */ 463 /* size of the central directory */
464 if (unzlocal_getLong(&us.z_filefunc, us.filestream,&us.size_central_dir)!=UNZ_OK) 464 if (unzlocal_getLong(&us.z_filefunc, us.filestream,&us.size_central_dir)!=UNZ_OK)
465 err=UNZ_ERRNO; 465 err=UNZ_ERRNO;
466 466
467 /* offset of start of central directory with respect to the 467 /* offset of start of central directory with respect to the
468 starting disk number */ 468 starting disk number */
469 if (unzlocal_getLong(&us.z_filefunc, us.filestream,&us.offset_central_dir)!=UNZ_OK) 469 if (unzlocal_getLong(&us.z_filefunc, us.filestream,&us.offset_central_dir)!=UNZ_OK)
470 err=UNZ_ERRNO; 470 err=UNZ_ERRNO;
471 471
472 /* zipfile comment length */ 472 /* zipfile comment length */
473 if (unzlocal_getShort(&us.z_filefunc, us.filestream,&us.gi.size_comment)!=UNZ_OK) 473 if (unzlocal_getShort(&us.z_filefunc, us.filestream,&us.gi.size_comment)!=UNZ_OK)
474 err=UNZ_ERRNO; 474 err=UNZ_ERRNO;
475 475
476 if ((central_pos<us.offset_central_dir+us.size_central_dir) && 476 if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
477 (err==UNZ_OK)) 477 (err==UNZ_OK))
478 err=UNZ_BADZIPFILE; 478 err=UNZ_BADZIPFILE;
479 479
480 if (err!=UNZ_OK) 480 if (err!=UNZ_OK)
481 { 481 {
482 ZCLOSE(us.z_filefunc, us.filestream); 482 ZCLOSE(us.z_filefunc, us.filestream);
483 return NULL; 483 return NULL;
484 } 484 }
485 485
486 us.byte_before_the_zipfile = central_pos - 486 us.byte_before_the_zipfile = central_pos -
487 (us.offset_central_dir+us.size_central_dir); 487 (us.offset_central_dir+us.size_central_dir);
488 us.central_pos = central_pos; 488 us.central_pos = central_pos;
489 us.pfile_in_zip_read = NULL; 489 us.pfile_in_zip_read = NULL;
490 us.encrypted = 0; 490 us.encrypted = 0;
491 491
492 492
493 s=(unz_s*)ALLOC(sizeof(unz_s)); 493 s=(unz_s*)ALLOC(sizeof(unz_s));
494 *s=us; 494 *s=us;
495 unzGoToFirstFile((unzFile)s); 495 unzGoToFirstFile((unzFile)s);
496 return (unzFile)s; 496 return (unzFile)s;
497} 497}
498 498
499 499
500extern unzFile ZEXPORT unzOpen (path) 500extern unzFile ZEXPORT unzOpen (path)
501 const char *path; 501 const char *path;
502{ 502{
503 return unzOpen2(path, NULL); 503 return unzOpen2(path, NULL);
504} 504}
505 505
506/* 506/*
507 Close a ZipFile opened with unzipOpen. 507 Close a ZipFile opened with unzipOpen.
508 If there is files inside the .Zip opened with unzipOpenCurrentFile (see later), 508 If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
509 these files MUST be closed with unzipCloseCurrentFile before call unzipClose. 509 these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
510 return UNZ_OK if there is no problem. */ 510 return UNZ_OK if there is no problem. */
511extern int ZEXPORT unzClose (file) 511extern int ZEXPORT unzClose (file)
512 unzFile file; 512 unzFile file;
513{ 513{
514 unz_s* s; 514 unz_s* s;
515 if (file==NULL) 515 if (file==NULL)
516 return UNZ_PARAMERROR; 516 return UNZ_PARAMERROR;
517 s=(unz_s*)file; 517 s=(unz_s*)file;
518 518
519 if (s->pfile_in_zip_read!=NULL) 519 if (s->pfile_in_zip_read!=NULL)
520 unzCloseCurrentFile(file); 520 unzCloseCurrentFile(file);
521 521
522 ZCLOSE(s->z_filefunc, s->filestream); 522 ZCLOSE(s->z_filefunc, s->filestream);
523 TRYFREE(s); 523 TRYFREE(s);
524 return UNZ_OK; 524 return UNZ_OK;
525} 525}
526 526
527 527
528/* 528/*
529 Write info about the ZipFile in the *pglobal_info structure. 529 Write info about the ZipFile in the *pglobal_info structure.
530 No preparation of the structure is needed 530 No preparation of the structure is needed
531 return UNZ_OK if there is no problem. */ 531 return UNZ_OK if there is no problem. */
532extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info) 532extern int ZEXPORT unzGetGlobalInfo (file,pglobal_info)
533 unzFile file; 533 unzFile file;
534 unz_global_info *pglobal_info; 534 unz_global_info *pglobal_info;
535{ 535{
536 unz_s* s; 536 unz_s* s;
537 if (file==NULL) 537 if (file==NULL)
538 return UNZ_PARAMERROR; 538 return UNZ_PARAMERROR;
539 s=(unz_s*)file; 539 s=(unz_s*)file;
540 *pglobal_info=s->gi; 540 *pglobal_info=s->gi;
541 return UNZ_OK; 541 return UNZ_OK;
542} 542}
543 543
544 544
545/* 545/*
546 Translate date/time from Dos format to tm_unz (readable more easilty) 546 Translate date/time from Dos format to tm_unz (readable more easilty)
547*/ 547*/
548local void unzlocal_DosDateToTmuDate (ulDosDate, ptm) 548local void unzlocal_DosDateToTmuDate (ulDosDate, ptm)
549 uLong ulDosDate; 549 uLong ulDosDate;
550 tm_unz* ptm; 550 tm_unz* ptm;
551{ 551{
552 uLong uDate; 552 uLong uDate;
553 uDate = (uLong)(ulDosDate>>16); 553 uDate = (uLong)(ulDosDate>>16);
554 ptm->tm_mday = (uInt)(uDate&0x1f) ; 554 ptm->tm_mday = (uInt)(uDate&0x1f) ;
555 ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; 555 ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ;
556 ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; 556 ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ;
557 557
558 ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800); 558 ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800);
559 ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ; 559 ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ;
560 ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ; 560 ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ;
561} 561}
562 562
563/* 563/*
564 Get Info about the current file in the zipfile, with internal only info 564 Get Info about the current file in the zipfile, with internal only info
565*/ 565*/
566local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file, 566local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
567 unz_file_info *pfile_info, 567 unz_file_info *pfile_info,
568 unz_file_info_internal 568 unz_file_info_internal
569 *pfile_info_internal, 569 *pfile_info_internal,
570 char *szFileName, 570 char *szFileName,
571 uLong fileNameBufferSize, 571 uLong fileNameBufferSize,
572 void *extraField, 572 void *extraField,
573 uLong extraFieldBufferSize, 573 uLong extraFieldBufferSize,
574 char *szComment, 574 char *szComment,
575 uLong commentBufferSize)); 575 uLong commentBufferSize));
576 576
577local int unzlocal_GetCurrentFileInfoInternal (file, 577local int unzlocal_GetCurrentFileInfoInternal (file,
578 pfile_info, 578 pfile_info,
579 pfile_info_internal, 579 pfile_info_internal,
580 szFileName, fileNameBufferSize, 580 szFileName, fileNameBufferSize,
581 extraField, extraFieldBufferSize, 581 extraField, extraFieldBufferSize,
582 szComment, commentBufferSize) 582 szComment, commentBufferSize)
583 unzFile file; 583 unzFile file;
584 unz_file_info *pfile_info; 584 unz_file_info *pfile_info;
585 unz_file_info_internal *pfile_info_internal; 585 unz_file_info_internal *pfile_info_internal;
586 char *szFileName; 586 char *szFileName;
587 uLong fileNameBufferSize; 587 uLong fileNameBufferSize;
588 void *extraField; 588 void *extraField;
589 uLong extraFieldBufferSize; 589 uLong extraFieldBufferSize;
590 char *szComment; 590 char *szComment;
591 uLong commentBufferSize; 591 uLong commentBufferSize;
592{ 592{
593 unz_s* s; 593 unz_s* s;
594 unz_file_info file_info; 594 unz_file_info file_info;
595 unz_file_info_internal file_info_internal; 595 unz_file_info_internal file_info_internal;
596 int err=UNZ_OK; 596 int err=UNZ_OK;
597 uLong uMagic; 597 uLong uMagic;
598 long lSeek=0; 598 long lSeek=0;
599 599
600 if (file==NULL) 600 if (file==NULL)
601 return UNZ_PARAMERROR; 601 return UNZ_PARAMERROR;
602 s=(unz_s*)file; 602 s=(unz_s*)file;
603 if (ZSEEK(s->z_filefunc, s->filestream, 603 if (ZSEEK(s->z_filefunc, s->filestream,
604 s->pos_in_central_dir+s->byte_before_the_zipfile, 604 s->pos_in_central_dir+s->byte_before_the_zipfile,
605 ZLIB_FILEFUNC_SEEK_SET)!=0) 605 ZLIB_FILEFUNC_SEEK_SET)!=0)
606 err=UNZ_ERRNO; 606 err=UNZ_ERRNO;
607 607
608 608
609 /* we check the magic */ 609 /* we check the magic */
610 if (err==UNZ_OK) 610 if (err==UNZ_OK)
611 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) 611 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
612 err=UNZ_ERRNO; 612 err=UNZ_ERRNO;
613 else if (uMagic!=0x02014b50) 613 else if (uMagic!=0x02014b50)
614 err=UNZ_BADZIPFILE; 614 err=UNZ_BADZIPFILE;
615 615
616 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK) 616 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
617 err=UNZ_ERRNO; 617 err=UNZ_ERRNO;
618 618
619 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version_needed) != UNZ_OK) 619 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version_needed) != UNZ_OK)
620 err=UNZ_ERRNO; 620 err=UNZ_ERRNO;
621 621
622 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.flag) != UNZ_OK) 622 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.flag) != UNZ_OK)
623 err=UNZ_ERRNO; 623 err=UNZ_ERRNO;
624 624
625 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.compression_method) != UNZ_OK) 625 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.compression_method) != UNZ_OK)
626 err=UNZ_ERRNO; 626 err=UNZ_ERRNO;
627 627
628 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.dosDate) != UNZ_OK) 628 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.dosDate) != UNZ_OK)
629 err=UNZ_ERRNO; 629 err=UNZ_ERRNO;
630 630
631 unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date); 631 unzlocal_DosDateToTmuDate(file_info.dosDate,&file_info.tmu_date);
632 632
633 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.crc) != UNZ_OK) 633 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.crc) != UNZ_OK)
634 err=UNZ_ERRNO; 634 err=UNZ_ERRNO;
635 635
636 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK) 636 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
637 err=UNZ_ERRNO; 637 err=UNZ_ERRNO;
638 638
639 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK) 639 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
640 err=UNZ_ERRNO; 640 err=UNZ_ERRNO;
641 641
642 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_filename) != UNZ_OK) 642 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_filename) != UNZ_OK)
643 err=UNZ_ERRNO; 643 err=UNZ_ERRNO;
644 644
645 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_extra) != UNZ_OK) 645 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_extra) != UNZ_OK)
646 err=UNZ_ERRNO; 646 err=UNZ_ERRNO;
647 647
648 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_comment) != UNZ_OK) 648 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.size_file_comment) != UNZ_OK)
649 err=UNZ_ERRNO; 649 err=UNZ_ERRNO;
650 650
651 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK) 651 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.disk_num_start) != UNZ_OK)
652 err=UNZ_ERRNO; 652 err=UNZ_ERRNO;
653 653
654 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.internal_fa) != UNZ_OK) 654 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.internal_fa) != UNZ_OK)
655 err=UNZ_ERRNO; 655 err=UNZ_ERRNO;
656 656
657 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK) 657 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK)
658 err=UNZ_ERRNO; 658 err=UNZ_ERRNO;
659 659
660 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK) 660 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
661 err=UNZ_ERRNO; 661 err=UNZ_ERRNO;
662 662
663 lSeek+=file_info.size_filename; 663 lSeek+=file_info.size_filename;
664 if ((err==UNZ_OK) && (szFileName!=NULL)) 664 if ((err==UNZ_OK) && (szFileName!=NULL))
665 { 665 {
666 uLong uSizeRead ; 666 uLong uSizeRead ;
667 if (file_info.size_filename<fileNameBufferSize) 667 if (file_info.size_filename<fileNameBufferSize)
668 { 668 {
669 *(szFileName+file_info.size_filename)='\0'; 669 *(szFileName+file_info.size_filename)='\0';
670 uSizeRead = file_info.size_filename; 670 uSizeRead = file_info.size_filename;
671 } 671 }
672 else 672 else
673 uSizeRead = fileNameBufferSize; 673 uSizeRead = fileNameBufferSize;
674 674
675 if ((file_info.size_filename>0) && (fileNameBufferSize>0)) 675 if ((file_info.size_filename>0) && (fileNameBufferSize>0))
676 if (ZREAD(s->z_filefunc, s->filestream,szFileName,uSizeRead)!=uSizeRead) 676 if (ZREAD(s->z_filefunc, s->filestream,szFileName,uSizeRead)!=uSizeRead)
677 err=UNZ_ERRNO; 677 err=UNZ_ERRNO;
678 lSeek -= uSizeRead; 678 lSeek -= uSizeRead;
679 } 679 }
680 680
681 681
682 if ((err==UNZ_OK) && (extraField!=NULL)) 682 if ((err==UNZ_OK) && (extraField!=NULL))
683 { 683 {
684 uLong uSizeRead ; 684 uLong uSizeRead ;
685 if (file_info.size_file_extra<extraFieldBufferSize) 685 if (file_info.size_file_extra<extraFieldBufferSize)
686 uSizeRead = file_info.size_file_extra; 686 uSizeRead = file_info.size_file_extra;
687 else 687 else
688 uSizeRead = extraFieldBufferSize; 688 uSizeRead = extraFieldBufferSize;
689 689
690 if (lSeek!=0) 690 if (lSeek!=0)
691 if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) 691 if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
692 lSeek=0; 692 lSeek=0;
693 else 693 else
694 err=UNZ_ERRNO; 694 err=UNZ_ERRNO;
695 if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0)) 695 if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
696 if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead) 696 if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
697 err=UNZ_ERRNO; 697 err=UNZ_ERRNO;
698 lSeek += file_info.size_file_extra - uSizeRead; 698 lSeek += file_info.size_file_extra - uSizeRead;
699 } 699 }
700 else 700 else
701 lSeek+=file_info.size_file_extra; 701 lSeek+=file_info.size_file_extra;
702 702
703 703
704 if ((err==UNZ_OK) && (szComment!=NULL)) 704 if ((err==UNZ_OK) && (szComment!=NULL))
705 { 705 {
706 uLong uSizeRead ; 706 uLong uSizeRead ;
707 if (file_info.size_file_comment<commentBufferSize) 707 if (file_info.size_file_comment<commentBufferSize)
708 { 708 {
709 *(szComment+file_info.size_file_comment)='\0'; 709 *(szComment+file_info.size_file_comment)='\0';
710 uSizeRead = file_info.size_file_comment; 710 uSizeRead = file_info.size_file_comment;
711 } 711 }
712 else 712 else
713 uSizeRead = commentBufferSize; 713 uSizeRead = commentBufferSize;
714 714
715 if (lSeek!=0) 715 if (lSeek!=0)
716 if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0) 716 if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
717 lSeek=0; 717 lSeek=0;
718 else 718 else
719 err=UNZ_ERRNO; 719 err=UNZ_ERRNO;
720 if ((file_info.size_file_comment>0) && (commentBufferSize>0)) 720 if ((file_info.size_file_comment>0) && (commentBufferSize>0))
721 if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead) 721 if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
722 err=UNZ_ERRNO; 722 err=UNZ_ERRNO;
723 lSeek+=file_info.size_file_comment - uSizeRead; 723 lSeek+=file_info.size_file_comment - uSizeRead;
724 } 724 }
725 else 725 else
726 lSeek+=file_info.size_file_comment; 726 lSeek+=file_info.size_file_comment;
727 727
728 if ((err==UNZ_OK) && (pfile_info!=NULL)) 728 if ((err==UNZ_OK) && (pfile_info!=NULL))
729 *pfile_info=file_info; 729 *pfile_info=file_info;
730 730
731 if ((err==UNZ_OK) && (pfile_info_internal!=NULL)) 731 if ((err==UNZ_OK) && (pfile_info_internal!=NULL))
732 *pfile_info_internal=file_info_internal; 732 *pfile_info_internal=file_info_internal;
733 733
734 return err; 734 return err;
735} 735}
736 736
737 737
738 738
739/* 739/*
740 Write info about the ZipFile in the *pglobal_info structure. 740 Write info about the ZipFile in the *pglobal_info structure.
741 No preparation of the structure is needed 741 No preparation of the structure is needed
742 return UNZ_OK if there is no problem. 742 return UNZ_OK if there is no problem.
743*/ 743*/
744extern int ZEXPORT unzGetCurrentFileInfo (file, 744extern int ZEXPORT unzGetCurrentFileInfo (file,
745 pfile_info, 745 pfile_info,
746 szFileName, fileNameBufferSize, 746 szFileName, fileNameBufferSize,
747 extraField, extraFieldBufferSize, 747 extraField, extraFieldBufferSize,
748 szComment, commentBufferSize) 748 szComment, commentBufferSize)
749 unzFile file; 749 unzFile file;
750 unz_file_info *pfile_info; 750 unz_file_info *pfile_info;
751 char *szFileName; 751 char *szFileName;
752 uLong fileNameBufferSize; 752 uLong fileNameBufferSize;
753 void *extraField; 753 void *extraField;
754 uLong extraFieldBufferSize; 754 uLong extraFieldBufferSize;
755 char *szComment; 755 char *szComment;
756 uLong commentBufferSize; 756 uLong commentBufferSize;
757{ 757{
758 return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL, 758 return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL,
759 szFileName,fileNameBufferSize, 759 szFileName,fileNameBufferSize,
760 extraField,extraFieldBufferSize, 760 extraField,extraFieldBufferSize,
761 szComment,commentBufferSize); 761 szComment,commentBufferSize);
762} 762}
763 763
764/* 764/*
765 Set the current file of the zipfile to the first file. 765 Set the current file of the zipfile to the first file.
766 return UNZ_OK if there is no problem 766 return UNZ_OK if there is no problem
767*/ 767*/
768extern int ZEXPORT unzGoToFirstFile (file) 768extern int ZEXPORT unzGoToFirstFile (file)
769 unzFile file; 769 unzFile file;
770{ 770{
771 int err=UNZ_OK; 771 int err=UNZ_OK;
772 unz_s* s; 772 unz_s* s;
773 if (file==NULL) 773 if (file==NULL)
774 return UNZ_PARAMERROR; 774 return UNZ_PARAMERROR;
775 s=(unz_s*)file; 775 s=(unz_s*)file;
776 s->pos_in_central_dir=s->offset_central_dir; 776 s->pos_in_central_dir=s->offset_central_dir;
777 s->num_file=0; 777 s->num_file=0;
778 err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, 778 err=unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
779 &s->cur_file_info_internal, 779 &s->cur_file_info_internal,
780 NULL,0,NULL,0,NULL,0); 780 NULL,0,NULL,0,NULL,0);
781 s->current_file_ok = (err == UNZ_OK); 781 s->current_file_ok = (err == UNZ_OK);
782 return err; 782 return err;
783} 783}
784 784
785/* 785/*
786 Set the current file of the zipfile to the next file. 786 Set the current file of the zipfile to the next file.
787 return UNZ_OK if there is no problem 787 return UNZ_OK if there is no problem
788 return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. 788 return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
789*/ 789*/
790extern int ZEXPORT unzGoToNextFile (file) 790extern int ZEXPORT unzGoToNextFile (file)
791 unzFile file; 791 unzFile file;
792{ 792{
793 unz_s* s; 793 unz_s* s;
794 int err; 794 int err;
795 795
796 if (file==NULL) 796 if (file==NULL)
797 return UNZ_PARAMERROR; 797 return UNZ_PARAMERROR;
798 s=(unz_s*)file; 798 s=(unz_s*)file;
799 if (!s->current_file_ok) 799 if (!s->current_file_ok)
800 return UNZ_END_OF_LIST_OF_FILE; 800 return UNZ_END_OF_LIST_OF_FILE;
801 if (s->gi.number_entry != 0xffff) /* 2^16 files overflow hack */ 801 if (s->gi.number_entry != 0xffff) /* 2^16 files overflow hack */
802 if (s->num_file+1==s->gi.number_entry) 802 if (s->num_file+1==s->gi.number_entry)
803 return UNZ_END_OF_LIST_OF_FILE; 803 return UNZ_END_OF_LIST_OF_FILE;
804 804
805 s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename + 805 s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +
806 s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ; 806 s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ;
807 s->num_file++; 807 s->num_file++;
808 err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, 808 err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
809 &s->cur_file_info_internal, 809 &s->cur_file_info_internal,
810 NULL,0,NULL,0,NULL,0); 810 NULL,0,NULL,0,NULL,0);
811 s->current_file_ok = (err == UNZ_OK); 811 s->current_file_ok = (err == UNZ_OK);
812 return err; 812 return err;
813} 813}
814 814
815 815
816/* 816/*
817 Try locate the file szFileName in the zipfile. 817 Try locate the file szFileName in the zipfile.
818 For the iCaseSensitivity signification, see unzipStringFileNameCompare 818 For the iCaseSensitivity signification, see unzipStringFileNameCompare
819 819
820 return value : 820 return value :
821 UNZ_OK if the file is found. It becomes the current file. 821 UNZ_OK if the file is found. It becomes the current file.
822 UNZ_END_OF_LIST_OF_FILE if the file is not found 822 UNZ_END_OF_LIST_OF_FILE if the file is not found
823*/ 823*/
824extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity) 824extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
825 unzFile file; 825 unzFile file;
826 const char *szFileName; 826 const char *szFileName;
827 int iCaseSensitivity; 827 int iCaseSensitivity;
828{ 828{
829 unz_s* s; 829 unz_s* s;
830 int err; 830 int err;
831 831
832 /* We remember the 'current' position in the file so that we can jump 832 /* We remember the 'current' position in the file so that we can jump
833 * back there if we fail. 833 * back there if we fail.
834 */ 834 */
835 unz_file_info cur_file_infoSaved; 835 unz_file_info cur_file_infoSaved;
836 unz_file_info_internal cur_file_info_internalSaved; 836 unz_file_info_internal cur_file_info_internalSaved;
837 uLong num_fileSaved; 837 uLong num_fileSaved;
838 uLong pos_in_central_dirSaved; 838 uLong pos_in_central_dirSaved;
839 839
840 840
841 if (file==NULL) 841 if (file==NULL)
842 return UNZ_PARAMERROR; 842 return UNZ_PARAMERROR;
843 843
844 if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) 844 if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP)
845 return UNZ_PARAMERROR; 845 return UNZ_PARAMERROR;
846 846
847 s=(unz_s*)file; 847 s=(unz_s*)file;
848 if (!s->current_file_ok) 848 if (!s->current_file_ok)
849 return UNZ_END_OF_LIST_OF_FILE; 849 return UNZ_END_OF_LIST_OF_FILE;
850 850
851 /* Save the current state */ 851 /* Save the current state */
852 num_fileSaved = s->num_file; 852 num_fileSaved = s->num_file;
853 pos_in_central_dirSaved = s->pos_in_central_dir; 853 pos_in_central_dirSaved = s->pos_in_central_dir;
854 cur_file_infoSaved = s->cur_file_info; 854 cur_file_infoSaved = s->cur_file_info;
855 cur_file_info_internalSaved = s->cur_file_info_internal; 855 cur_file_info_internalSaved = s->cur_file_info_internal;
856 856
857 err = unzGoToFirstFile(file); 857 err = unzGoToFirstFile(file);
858 858
859 while (err == UNZ_OK) 859 while (err == UNZ_OK)
860 { 860 {
861 char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1]; 861 char szCurrentFileName[UNZ_MAXFILENAMEINZIP+1];
862 err = unzGetCurrentFileInfo(file,NULL, 862 err = unzGetCurrentFileInfo(file,NULL,
863 szCurrentFileName,sizeof(szCurrentFileName)-1, 863 szCurrentFileName,sizeof(szCurrentFileName)-1,
864 NULL,0,NULL,0); 864 NULL,0,NULL,0);
865 if (err == UNZ_OK) 865 if (err == UNZ_OK)
866 { 866 {
867 if (unzStringFileNameCompare(szCurrentFileName, 867 if (unzStringFileNameCompare(szCurrentFileName,
868 szFileName,iCaseSensitivity)==0) 868 szFileName,iCaseSensitivity)==0)
869 return UNZ_OK; 869 return UNZ_OK;
870 err = unzGoToNextFile(file); 870 err = unzGoToNextFile(file);
871 } 871 }
872 } 872 }
873 873
874 /* We failed, so restore the state of the 'current file' to where we 874 /* We failed, so restore the state of the 'current file' to where we
875 * were. 875 * were.
876 */ 876 */
877 s->num_file = num_fileSaved ; 877 s->num_file = num_fileSaved ;
878 s->pos_in_central_dir = pos_in_central_dirSaved ; 878 s->pos_in_central_dir = pos_in_central_dirSaved ;
879 s->cur_file_info = cur_file_infoSaved; 879 s->cur_file_info = cur_file_infoSaved;
880 s->cur_file_info_internal = cur_file_info_internalSaved; 880 s->cur_file_info_internal = cur_file_info_internalSaved;
881 return err; 881 return err;
882} 882}
883 883
884 884
885/* 885/*
886/////////////////////////////////////////// 886///////////////////////////////////////////
887// Contributed by Ryan Haksi (mailto://cryogen@infoserve.net) 887// Contributed by Ryan Haksi (mailto://cryogen@infoserve.net)
888// I need random access 888// I need random access
889// 889//
890// Further optimization could be realized by adding an ability 890// Further optimization could be realized by adding an ability
891// to cache the directory in memory. The goal being a single 891// to cache the directory in memory. The goal being a single
892// comprehensive file read to put the file I need in a memory. 892// comprehensive file read to put the file I need in a memory.
893*/ 893*/
894 894
895/* 895/*
896typedef struct unz_file_pos_s 896typedef struct unz_file_pos_s
897{ 897{
898 uLong pos_in_zip_directory; // offset in file 898 uLong pos_in_zip_directory; // offset in file
899 uLong num_of_file; // # of file 899 uLong num_of_file; // # of file
900} unz_file_pos; 900} unz_file_pos;
901*/ 901*/
902 902
903extern int ZEXPORT unzGetFilePos(file, file_pos) 903extern int ZEXPORT unzGetFilePos(file, file_pos)
904 unzFile file; 904 unzFile file;
905 unz_file_pos* file_pos; 905 unz_file_pos* file_pos;
906{ 906{
907 unz_s* s; 907 unz_s* s;
908 908
909 if (file==NULL || file_pos==NULL) 909 if (file==NULL || file_pos==NULL)
910 return UNZ_PARAMERROR; 910 return UNZ_PARAMERROR;
911 s=(unz_s*)file; 911 s=(unz_s*)file;
912 if (!s->current_file_ok) 912 if (!s->current_file_ok)
913 return UNZ_END_OF_LIST_OF_FILE; 913 return UNZ_END_OF_LIST_OF_FILE;
914 914
915 file_pos->pos_in_zip_directory = s->pos_in_central_dir; 915 file_pos->pos_in_zip_directory = s->pos_in_central_dir;
916 file_pos->num_of_file = s->num_file; 916 file_pos->num_of_file = s->num_file;
917 917
918 return UNZ_OK; 918 return UNZ_OK;
919} 919}
920 920
921extern int ZEXPORT unzGoToFilePos(file, file_pos) 921extern int ZEXPORT unzGoToFilePos(file, file_pos)
922 unzFile file; 922 unzFile file;
923 unz_file_pos* file_pos; 923 unz_file_pos* file_pos;
924{ 924{
925 unz_s* s; 925 unz_s* s;
926 int err; 926 int err;
927 927
928 if (file==NULL || file_pos==NULL) 928 if (file==NULL || file_pos==NULL)
929 return UNZ_PARAMERROR; 929 return UNZ_PARAMERROR;
930 s=(unz_s*)file; 930 s=(unz_s*)file;
931 931
932 /* jump to the right spot */ 932 /* jump to the right spot */
933 s->pos_in_central_dir = file_pos->pos_in_zip_directory; 933 s->pos_in_central_dir = file_pos->pos_in_zip_directory;
934 s->num_file = file_pos->num_of_file; 934 s->num_file = file_pos->num_of_file;
935 935
936 /* set the current file */ 936 /* set the current file */
937 err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, 937 err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
938 &s->cur_file_info_internal, 938 &s->cur_file_info_internal,
939 NULL,0,NULL,0,NULL,0); 939 NULL,0,NULL,0,NULL,0);
940 /* return results */ 940 /* return results */
941 s->current_file_ok = (err == UNZ_OK); 941 s->current_file_ok = (err == UNZ_OK);
942 return err; 942 return err;
943} 943}
944 944
945/* 945/*
946// Unzip Helper Functions - should be here? 946// Unzip Helper Functions - should be here?
947/////////////////////////////////////////// 947///////////////////////////////////////////
948*/ 948*/
949 949
950/* 950/*
951 Read the local header of the current zipfile 951 Read the local header of the current zipfile
952 Check the coherency of the local header and info in the end of central 952 Check the coherency of the local header and info in the end of central
953 directory about this file 953 directory about this file
954 store in *piSizeVar the size of extra info in local header 954 store in *piSizeVar the size of extra info in local header
955 (filename and size of extra field data) 955 (filename and size of extra field data)
956*/ 956*/
957local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, 957local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
958 poffset_local_extrafield, 958 poffset_local_extrafield,
959 psize_local_extrafield) 959 psize_local_extrafield)
960 unz_s* s; 960 unz_s* s;
961 uInt* piSizeVar; 961 uInt* piSizeVar;
962 uLong *poffset_local_extrafield; 962 uLong *poffset_local_extrafield;
963 uInt *psize_local_extrafield; 963 uInt *psize_local_extrafield;
964{ 964{
965 uLong uMagic,uData,uFlags; 965 uLong uMagic,uData,uFlags;
966 uLong size_filename; 966 uLong size_filename;
967 uLong size_extra_field; 967 uLong size_extra_field;
968 int err=UNZ_OK; 968 int err=UNZ_OK;
969 969
970 *piSizeVar = 0; 970 *piSizeVar = 0;
971 *poffset_local_extrafield = 0; 971 *poffset_local_extrafield = 0;
972 *psize_local_extrafield = 0; 972 *psize_local_extrafield = 0;
973 973
974 if (ZSEEK(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile + 974 if (ZSEEK(s->z_filefunc, s->filestream,s->cur_file_info_internal.offset_curfile +
975 s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0) 975 s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)
976 return UNZ_ERRNO; 976 return UNZ_ERRNO;
977 977
978 978
979 if (err==UNZ_OK) 979 if (err==UNZ_OK)
980 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) 980 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
981 err=UNZ_ERRNO; 981 err=UNZ_ERRNO;
982 else if (uMagic!=0x04034b50) 982 else if (uMagic!=0x04034b50)
983 err=UNZ_BADZIPFILE; 983 err=UNZ_BADZIPFILE;
984 984
985 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) 985 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
986 err=UNZ_ERRNO; 986 err=UNZ_ERRNO;
987/* 987/*
988 else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion)) 988 else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
989 err=UNZ_BADZIPFILE; 989 err=UNZ_BADZIPFILE;
990*/ 990*/
991 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK) 991 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK)
992 err=UNZ_ERRNO; 992 err=UNZ_ERRNO;
993 993
994 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) 994 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
995 err=UNZ_ERRNO; 995 err=UNZ_ERRNO;
996 else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) 996 else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method))
997 err=UNZ_BADZIPFILE; 997 err=UNZ_BADZIPFILE;
998 998
999 if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && 999 if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
1000 (s->cur_file_info.compression_method!=Z_DEFLATED)) 1000 (s->cur_file_info.compression_method!=Z_DEFLATED))
1001 err=UNZ_BADZIPFILE; 1001 err=UNZ_BADZIPFILE;
1002 1002
1003 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */ 1003 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* date/time */
1004 err=UNZ_ERRNO; 1004 err=UNZ_ERRNO;
1005 1005
1006 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */ 1006 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* crc */
1007 err=UNZ_ERRNO; 1007 err=UNZ_ERRNO;
1008 else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) && 1008 else if ((err==UNZ_OK) && (uData!=s->cur_file_info.crc) &&
1009 ((uFlags & 8)==0)) 1009 ((uFlags & 8)==0))
1010 err=UNZ_BADZIPFILE; 1010 err=UNZ_BADZIPFILE;
1011 1011
1012 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */ 1012 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size compr */
1013 err=UNZ_ERRNO; 1013 err=UNZ_ERRNO;
1014 else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) && 1014 else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compressed_size) &&
1015 ((uFlags & 8)==0)) 1015 ((uFlags & 8)==0))
1016 err=UNZ_BADZIPFILE; 1016 err=UNZ_BADZIPFILE;
1017 1017
1018 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */ 1018 if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uData) != UNZ_OK) /* size uncompr */
1019 err=UNZ_ERRNO; 1019 err=UNZ_ERRNO;
1020 else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && 1020 else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
1021 ((uFlags & 8)==0)) 1021 ((uFlags & 8)==0))
1022 err=UNZ_BADZIPFILE; 1022 err=UNZ_BADZIPFILE;
1023 1023
1024 1024
1025 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_filename) != UNZ_OK) 1025 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_filename) != UNZ_OK)
1026 err=UNZ_ERRNO; 1026 err=UNZ_ERRNO;
1027 else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename)) 1027 else if ((err==UNZ_OK) && (size_filename!=s->cur_file_info.size_filename))
1028 err=UNZ_BADZIPFILE; 1028 err=UNZ_BADZIPFILE;
1029 1029
1030 *piSizeVar += (uInt)size_filename; 1030 *piSizeVar += (uInt)size_filename;
1031 1031
1032 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK) 1032 if (unzlocal_getShort(&s->z_filefunc, s->filestream,&size_extra_field) != UNZ_OK)
1033 err=UNZ_ERRNO; 1033 err=UNZ_ERRNO;
1034 *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile + 1034 *poffset_local_extrafield= s->cur_file_info_internal.offset_curfile +
1035 SIZEZIPLOCALHEADER + size_filename; 1035 SIZEZIPLOCALHEADER + size_filename;
1036 *psize_local_extrafield = (uInt)size_extra_field; 1036 *psize_local_extrafield = (uInt)size_extra_field;
1037 1037
1038 *piSizeVar += (uInt)size_extra_field; 1038 *piSizeVar += (uInt)size_extra_field;
1039 1039
1040 return err; 1040 return err;
1041} 1041}
1042 1042
1043/* 1043/*
1044 Open for reading data the current file in the zipfile. 1044 Open for reading data the current file in the zipfile.
1045 If there is no error and the file is opened, the return value is UNZ_OK. 1045 If there is no error and the file is opened, the return value is UNZ_OK.
1046*/ 1046*/
1047extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password) 1047extern int ZEXPORT unzOpenCurrentFile3 (file, method, level, raw, password)
1048 unzFile file; 1048 unzFile file;
1049 int* method; 1049 int* method;
1050 int* level; 1050 int* level;
1051 int raw; 1051 int raw;
1052 const char* password; 1052 const char* password;
1053{ 1053{
1054 int err=UNZ_OK; 1054 int err=UNZ_OK;
1055 uInt iSizeVar; 1055 uInt iSizeVar;
1056 unz_s* s; 1056 unz_s* s;
1057 file_in_zip_read_info_s* pfile_in_zip_read_info; 1057 file_in_zip_read_info_s* pfile_in_zip_read_info;
1058 uLong offset_local_extrafield; /* offset of the local extra field */ 1058 uLong offset_local_extrafield; /* offset of the local extra field */
1059 uInt size_local_extrafield; /* size of the local extra field */ 1059 uInt size_local_extrafield; /* size of the local extra field */
1060# ifndef NOUNCRYPT 1060# ifndef NOUNCRYPT
1061 char source[12]; 1061 char source[12];
1062# else 1062# else
1063 if (password != NULL) 1063 if (password != NULL)
1064 return UNZ_PARAMERROR; 1064 return UNZ_PARAMERROR;
1065# endif 1065# endif
1066 1066
1067 if (file==NULL) 1067 if (file==NULL)
1068 return UNZ_PARAMERROR; 1068 return UNZ_PARAMERROR;
1069 s=(unz_s*)file; 1069 s=(unz_s*)file;
1070 if (!s->current_file_ok) 1070 if (!s->current_file_ok)
1071 return UNZ_PARAMERROR; 1071 return UNZ_PARAMERROR;
1072 1072
1073 if (s->pfile_in_zip_read != NULL) 1073 if (s->pfile_in_zip_read != NULL)
1074 unzCloseCurrentFile(file); 1074 unzCloseCurrentFile(file);
1075 1075
1076 if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar, 1076 if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar,
1077 &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) 1077 &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
1078 return UNZ_BADZIPFILE; 1078 return UNZ_BADZIPFILE;
1079 1079
1080 pfile_in_zip_read_info = (file_in_zip_read_info_s*) 1080 pfile_in_zip_read_info = (file_in_zip_read_info_s*)
1081 ALLOC(sizeof(file_in_zip_read_info_s)); 1081 ALLOC(sizeof(file_in_zip_read_info_s));
1082 if (pfile_in_zip_read_info==NULL) 1082 if (pfile_in_zip_read_info==NULL)
1083 return UNZ_INTERNALERROR; 1083 return UNZ_INTERNALERROR;
1084 1084
1085 pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE); 1085 pfile_in_zip_read_info->read_buffer=(char*)ALLOC(UNZ_BUFSIZE);
1086 pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield; 1086 pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
1087 pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield; 1087 pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
1088 pfile_in_zip_read_info->pos_local_extrafield=0; 1088 pfile_in_zip_read_info->pos_local_extrafield=0;
1089 pfile_in_zip_read_info->raw=raw; 1089 pfile_in_zip_read_info->raw=raw;
1090 1090
1091 if (pfile_in_zip_read_info->read_buffer==NULL) 1091 if (pfile_in_zip_read_info->read_buffer==NULL)
1092 { 1092 {
1093 TRYFREE(pfile_in_zip_read_info); 1093 TRYFREE(pfile_in_zip_read_info);
1094 return UNZ_INTERNALERROR; 1094 return UNZ_INTERNALERROR;
1095 } 1095 }
1096 1096
1097 pfile_in_zip_read_info->stream_initialised=0; 1097 pfile_in_zip_read_info->stream_initialised=0;
1098 1098
1099 if (method!=NULL) 1099 if (method!=NULL)
1100 *method = (int)s->cur_file_info.compression_method; 1100 *method = (int)s->cur_file_info.compression_method;
1101 1101
1102 if (level!=NULL) 1102 if (level!=NULL)
1103 { 1103 {
1104 *level = 6; 1104 *level = 6;
1105 switch (s->cur_file_info.flag & 0x06) 1105 switch (s->cur_file_info.flag & 0x06)
1106 { 1106 {
1107 case 6 : *level = 1; break; 1107 case 6 : *level = 1; break;
1108 case 4 : *level = 2; break; 1108 case 4 : *level = 2; break;
1109 case 2 : *level = 9; break; 1109 case 2 : *level = 9; break;
1110 } 1110 }
1111 } 1111 }
1112 1112
1113 if ((s->cur_file_info.compression_method!=0) && 1113 if ((s->cur_file_info.compression_method!=0) &&
1114 (s->cur_file_info.compression_method!=Z_DEFLATED)) 1114 (s->cur_file_info.compression_method!=Z_DEFLATED))
1115 err=UNZ_BADZIPFILE; 1115 err=UNZ_BADZIPFILE;
1116 1116
1117 pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc; 1117 pfile_in_zip_read_info->crc32_wait=s->cur_file_info.crc;
1118 pfile_in_zip_read_info->crc32=0; 1118 pfile_in_zip_read_info->crc32=0;
1119 pfile_in_zip_read_info->compression_method = 1119 pfile_in_zip_read_info->compression_method =
1120 s->cur_file_info.compression_method; 1120 s->cur_file_info.compression_method;
1121 pfile_in_zip_read_info->filestream=s->filestream; 1121 pfile_in_zip_read_info->filestream=s->filestream;
1122 pfile_in_zip_read_info->z_filefunc=s->z_filefunc; 1122 pfile_in_zip_read_info->z_filefunc=s->z_filefunc;
1123 pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile; 1123 pfile_in_zip_read_info->byte_before_the_zipfile=s->byte_before_the_zipfile;
1124 1124
1125 pfile_in_zip_read_info->stream.total_out = 0; 1125 pfile_in_zip_read_info->stream.total_out = 0;
1126 1126
1127 if ((s->cur_file_info.compression_method==Z_DEFLATED) && 1127 if ((s->cur_file_info.compression_method==Z_DEFLATED) &&
1128 (!raw)) 1128 (!raw))
1129 { 1129 {
1130 pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; 1130 pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
1131 pfile_in_zip_read_info->stream.zfree = (free_func)0; 1131 pfile_in_zip_read_info->stream.zfree = (free_func)0;
1132 pfile_in_zip_read_info->stream.opaque = (voidpf)0; 1132 pfile_in_zip_read_info->stream.opaque = (voidpf)0;
1133 pfile_in_zip_read_info->stream.next_in = (voidpf)0; 1133 pfile_in_zip_read_info->stream.next_in = (voidpf)0;
1134 pfile_in_zip_read_info->stream.avail_in = 0; 1134 pfile_in_zip_read_info->stream.avail_in = 0;
1135 1135
1136 err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); 1136 err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
1137 if (err == Z_OK) 1137 if (err == Z_OK)
1138 pfile_in_zip_read_info->stream_initialised=1; 1138 pfile_in_zip_read_info->stream_initialised=1;
1139 else 1139 else
1140 { 1140 {
1141 TRYFREE(pfile_in_zip_read_info); 1141 TRYFREE(pfile_in_zip_read_info);
1142 return err; 1142 return err;
1143 } 1143 }
1144 /* windowBits is passed < 0 to tell that there is no zlib header. 1144 /* windowBits is passed < 0 to tell that there is no zlib header.
1145 * Note that in this case inflate *requires* an extra "dummy" byte 1145 * Note that in this case inflate *requires* an extra "dummy" byte
1146 * after the compressed stream in order to complete decompression and 1146 * after the compressed stream in order to complete decompression and
1147 * return Z_STREAM_END. 1147 * return Z_STREAM_END.
1148 * In unzip, i don't wait absolutely Z_STREAM_END because I known the 1148 * In unzip, i don't wait absolutely Z_STREAM_END because I known the
1149 * size of both compressed and uncompressed data 1149 * size of both compressed and uncompressed data
1150 */ 1150 */
1151 } 1151 }
1152 pfile_in_zip_read_info->rest_read_compressed = 1152 pfile_in_zip_read_info->rest_read_compressed =
1153 s->cur_file_info.compressed_size ; 1153 s->cur_file_info.compressed_size ;
1154 pfile_in_zip_read_info->rest_read_uncompressed = 1154 pfile_in_zip_read_info->rest_read_uncompressed =
1155 s->cur_file_info.uncompressed_size ; 1155 s->cur_file_info.uncompressed_size ;
1156 1156
1157 1157
1158 pfile_in_zip_read_info->pos_in_zipfile = 1158 pfile_in_zip_read_info->pos_in_zipfile =
1159 s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + 1159 s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
1160 iSizeVar; 1160 iSizeVar;
1161 1161
1162 pfile_in_zip_read_info->stream.avail_in = (uInt)0; 1162 pfile_in_zip_read_info->stream.avail_in = (uInt)0;
1163 1163
1164 s->pfile_in_zip_read = pfile_in_zip_read_info; 1164 s->pfile_in_zip_read = pfile_in_zip_read_info;
1165 1165
1166# ifndef NOUNCRYPT 1166# ifndef NOUNCRYPT
1167 if (password != NULL) 1167 if (password != NULL)
1168 { 1168 {
1169 int i; 1169 int i;
1170 s->pcrc_32_tab = get_crc_table(); 1170 s->pcrc_32_tab = get_crc_table();
1171 init_keys(password,s->keys,s->pcrc_32_tab); 1171 init_keys(password,s->keys,s->pcrc_32_tab);
1172 if (ZSEEK(s->z_filefunc, s->filestream, 1172 if (ZSEEK(s->z_filefunc, s->filestream,
1173 s->pfile_in_zip_read->pos_in_zipfile + 1173 s->pfile_in_zip_read->pos_in_zipfile +
1174 s->pfile_in_zip_read->byte_before_the_zipfile, 1174 s->pfile_in_zip_read->byte_before_the_zipfile,
1175 SEEK_SET)!=0) 1175 SEEK_SET)!=0)
1176 return UNZ_INTERNALERROR; 1176 return UNZ_INTERNALERROR;
1177 if(ZREAD(s->z_filefunc, s->filestream,source, 12)<12) 1177 if(ZREAD(s->z_filefunc, s->filestream,source, 12)<12)
1178 return UNZ_INTERNALERROR; 1178 return UNZ_INTERNALERROR;
1179 1179
1180 for (i = 0; i<12; i++) 1180 for (i = 0; i<12; i++)
1181 zdecode(s->keys,s->pcrc_32_tab,source[i]); 1181 zdecode(s->keys,s->pcrc_32_tab,source[i]);
1182 1182
1183 s->pfile_in_zip_read->pos_in_zipfile+=12; 1183 s->pfile_in_zip_read->pos_in_zipfile+=12;
1184 s->encrypted=1; 1184 s->encrypted=1;
1185 } 1185 }
1186# endif 1186# endif
1187 1187
1188 1188
1189 return UNZ_OK; 1189 return UNZ_OK;
1190} 1190}
1191 1191
1192extern int ZEXPORT unzOpenCurrentFile (file) 1192extern int ZEXPORT unzOpenCurrentFile (file)
1193 unzFile file; 1193 unzFile file;
1194{ 1194{
1195 return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL); 1195 return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
1196} 1196}
1197 1197
1198extern int ZEXPORT unzOpenCurrentFilePassword (file, password) 1198extern int ZEXPORT unzOpenCurrentFilePassword (file, password)
1199 unzFile file; 1199 unzFile file;
1200 const char* password; 1200 const char* password;
1201{ 1201{
1202 return unzOpenCurrentFile3(file, NULL, NULL, 0, password); 1202 return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
1203} 1203}
1204 1204
1205extern int ZEXPORT unzOpenCurrentFile2 (file,method,level,raw) 1205extern int ZEXPORT unzOpenCurrentFile2 (file,method,level,raw)
1206 unzFile file; 1206 unzFile file;
1207 int* method; 1207 int* method;
1208 int* level; 1208 int* level;
1209 int raw; 1209 int raw;
1210{ 1210{
1211 return unzOpenCurrentFile3(file, method, level, raw, NULL); 1211 return unzOpenCurrentFile3(file, method, level, raw, NULL);
1212} 1212}
1213 1213
1214/* 1214/*
1215 Read bytes from the current file. 1215 Read bytes from the current file.
1216 buf contain buffer where data must be copied 1216 buf contain buffer where data must be copied
1217 len the size of buf. 1217 len the size of buf.
1218 1218
1219 return the number of byte copied if somes bytes are copied 1219 return the number of byte copied if somes bytes are copied
1220 return 0 if the end of file was reached 1220 return 0 if the end of file was reached
1221 return <0 with error code if there is an error 1221 return <0 with error code if there is an error
1222 (UNZ_ERRNO for IO error, or zLib error for uncompress error) 1222 (UNZ_ERRNO for IO error, or zLib error for uncompress error)
1223*/ 1223*/
1224extern int ZEXPORT unzReadCurrentFile (file, buf, len) 1224extern int ZEXPORT unzReadCurrentFile (file, buf, len)
1225 unzFile file; 1225 unzFile file;
1226 voidp buf; 1226 voidp buf;
1227 unsigned len; 1227 unsigned len;
1228{ 1228{
1229 int err=UNZ_OK; 1229 int err=UNZ_OK;
1230 uInt iRead = 0; 1230 uInt iRead = 0;
1231 unz_s* s; 1231 unz_s* s;
1232 file_in_zip_read_info_s* pfile_in_zip_read_info; 1232 file_in_zip_read_info_s* pfile_in_zip_read_info;
1233 if (file==NULL) 1233 if (file==NULL)
1234 return UNZ_PARAMERROR; 1234 return UNZ_PARAMERROR;
1235 s=(unz_s*)file; 1235 s=(unz_s*)file;
1236 pfile_in_zip_read_info=s->pfile_in_zip_read; 1236 pfile_in_zip_read_info=s->pfile_in_zip_read;
1237 1237
1238 if (pfile_in_zip_read_info==NULL) 1238 if (pfile_in_zip_read_info==NULL)
1239 return UNZ_PARAMERROR; 1239 return UNZ_PARAMERROR;
1240 1240
1241 1241
1242 if ((pfile_in_zip_read_info->read_buffer == NULL)) 1242 if ((pfile_in_zip_read_info->read_buffer == NULL))
1243 return UNZ_END_OF_LIST_OF_FILE; 1243 return UNZ_END_OF_LIST_OF_FILE;
1244 if (len==0) 1244 if (len==0)
1245 return 0; 1245 return 0;
1246 1246
1247 pfile_in_zip_read_info->stream.next_out = (Bytef*)buf; 1247 pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
1248 1248
1249 pfile_in_zip_read_info->stream.avail_out = (uInt)len; 1249 pfile_in_zip_read_info->stream.avail_out = (uInt)len;
1250 1250
1251 if ((len>pfile_in_zip_read_info->rest_read_uncompressed) && 1251 if ((len>pfile_in_zip_read_info->rest_read_uncompressed) &&
1252 (!(pfile_in_zip_read_info->raw))) 1252 (!(pfile_in_zip_read_info->raw)))
1253 pfile_in_zip_read_info->stream.avail_out = 1253 pfile_in_zip_read_info->stream.avail_out =
1254 (uInt)pfile_in_zip_read_info->rest_read_uncompressed; 1254 (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
1255 1255
1256 if ((len>pfile_in_zip_read_info->rest_read_compressed+ 1256 if ((len>pfile_in_zip_read_info->rest_read_compressed+
1257 pfile_in_zip_read_info->stream.avail_in) && 1257 pfile_in_zip_read_info->stream.avail_in) &&
1258 (pfile_in_zip_read_info->raw)) 1258 (pfile_in_zip_read_info->raw))
1259 pfile_in_zip_read_info->stream.avail_out = 1259 pfile_in_zip_read_info->stream.avail_out =
1260 (uInt)pfile_in_zip_read_info->rest_read_compressed+ 1260 (uInt)pfile_in_zip_read_info->rest_read_compressed+
1261 pfile_in_zip_read_info->stream.avail_in; 1261 pfile_in_zip_read_info->stream.avail_in;
1262 1262
1263 while (pfile_in_zip_read_info->stream.avail_out>0) 1263 while (pfile_in_zip_read_info->stream.avail_out>0)
1264 { 1264 {
1265 if ((pfile_in_zip_read_info->stream.avail_in==0) && 1265 if ((pfile_in_zip_read_info->stream.avail_in==0) &&
1266 (pfile_in_zip_read_info->rest_read_compressed>0)) 1266 (pfile_in_zip_read_info->rest_read_compressed>0))
1267 { 1267 {
1268 uInt uReadThis = UNZ_BUFSIZE; 1268 uInt uReadThis = UNZ_BUFSIZE;
1269 if (pfile_in_zip_read_info->rest_read_compressed<uReadThis) 1269 if (pfile_in_zip_read_info->rest_read_compressed<uReadThis)
1270 uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed; 1270 uReadThis = (uInt)pfile_in_zip_read_info->rest_read_compressed;
1271 if (uReadThis == 0) 1271 if (uReadThis == 0)
1272 return UNZ_EOF; 1272 return UNZ_EOF;
1273 if (ZSEEK(pfile_in_zip_read_info->z_filefunc, 1273 if (ZSEEK(pfile_in_zip_read_info->z_filefunc,
1274 pfile_in_zip_read_info->filestream, 1274 pfile_in_zip_read_info->filestream,
1275 pfile_in_zip_read_info->pos_in_zipfile + 1275 pfile_in_zip_read_info->pos_in_zipfile +
1276 pfile_in_zip_read_info->byte_before_the_zipfile, 1276 pfile_in_zip_read_info->byte_before_the_zipfile,
1277 ZLIB_FILEFUNC_SEEK_SET)!=0) 1277 ZLIB_FILEFUNC_SEEK_SET)!=0)
1278 return UNZ_ERRNO; 1278 return UNZ_ERRNO;
1279 if (ZREAD(pfile_in_zip_read_info->z_filefunc, 1279 if (ZREAD(pfile_in_zip_read_info->z_filefunc,
1280 pfile_in_zip_read_info->filestream, 1280 pfile_in_zip_read_info->filestream,
1281 pfile_in_zip_read_info->read_buffer, 1281 pfile_in_zip_read_info->read_buffer,
1282 uReadThis)!=uReadThis) 1282 uReadThis)!=uReadThis)
1283 return UNZ_ERRNO; 1283 return UNZ_ERRNO;
1284 1284
1285 1285
1286# ifndef NOUNCRYPT 1286# ifndef NOUNCRYPT
1287 if(s->encrypted) 1287 if(s->encrypted)
1288 { 1288 {
1289 uInt i; 1289 uInt i;
1290 for(i=0;i<uReadThis;i++) 1290 for(i=0;i<uReadThis;i++)
1291 pfile_in_zip_read_info->read_buffer[i] = 1291 pfile_in_zip_read_info->read_buffer[i] =
1292 zdecode(s->keys,s->pcrc_32_tab, 1292 zdecode(s->keys,s->pcrc_32_tab,
1293 pfile_in_zip_read_info->read_buffer[i]); 1293 pfile_in_zip_read_info->read_buffer[i]);
1294 } 1294 }
1295# endif 1295# endif
1296 1296
1297 1297
1298 pfile_in_zip_read_info->pos_in_zipfile += uReadThis; 1298 pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
1299 1299
1300 pfile_in_zip_read_info->rest_read_compressed-=uReadThis; 1300 pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
1301 1301
1302 pfile_in_zip_read_info->stream.next_in = 1302 pfile_in_zip_read_info->stream.next_in =
1303 (Bytef*)pfile_in_zip_read_info->read_buffer; 1303 (Bytef*)pfile_in_zip_read_info->read_buffer;
1304 pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; 1304 pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
1305 } 1305 }
1306 1306
1307 if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw)) 1307 if ((pfile_in_zip_read_info->compression_method==0) || (pfile_in_zip_read_info->raw))
1308 { 1308 {
1309 uInt uDoCopy,i ; 1309 uInt uDoCopy,i ;
1310 1310
1311 if ((pfile_in_zip_read_info->stream.avail_in == 0) && 1311 if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
1312 (pfile_in_zip_read_info->rest_read_compressed == 0)) 1312 (pfile_in_zip_read_info->rest_read_compressed == 0))
1313 return (iRead==0) ? UNZ_EOF : iRead; 1313 return (iRead==0) ? UNZ_EOF : iRead;
1314 1314
1315 if (pfile_in_zip_read_info->stream.avail_out < 1315 if (pfile_in_zip_read_info->stream.avail_out <
1316 pfile_in_zip_read_info->stream.avail_in) 1316 pfile_in_zip_read_info->stream.avail_in)
1317 uDoCopy = pfile_in_zip_read_info->stream.avail_out ; 1317 uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
1318 else 1318 else
1319 uDoCopy = pfile_in_zip_read_info->stream.avail_in ; 1319 uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
1320 1320
1321 for (i=0;i<uDoCopy;i++) 1321 for (i=0;i<uDoCopy;i++)
1322 *(pfile_in_zip_read_info->stream.next_out+i) = 1322 *(pfile_in_zip_read_info->stream.next_out+i) =
1323 *(pfile_in_zip_read_info->stream.next_in+i); 1323 *(pfile_in_zip_read_info->stream.next_in+i);
1324 1324
1325 pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, 1325 pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
1326 pfile_in_zip_read_info->stream.next_out, 1326 pfile_in_zip_read_info->stream.next_out,
1327 uDoCopy); 1327 uDoCopy);
1328 pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy; 1328 pfile_in_zip_read_info->rest_read_uncompressed-=uDoCopy;
1329 pfile_in_zip_read_info->stream.avail_in -= uDoCopy; 1329 pfile_in_zip_read_info->stream.avail_in -= uDoCopy;
1330 pfile_in_zip_read_info->stream.avail_out -= uDoCopy; 1330 pfile_in_zip_read_info->stream.avail_out -= uDoCopy;
1331 pfile_in_zip_read_info->stream.next_out += uDoCopy; 1331 pfile_in_zip_read_info->stream.next_out += uDoCopy;
1332 pfile_in_zip_read_info->stream.next_in += uDoCopy; 1332 pfile_in_zip_read_info->stream.next_in += uDoCopy;
1333 pfile_in_zip_read_info->stream.total_out += uDoCopy; 1333 pfile_in_zip_read_info->stream.total_out += uDoCopy;
1334 iRead += uDoCopy; 1334 iRead += uDoCopy;
1335 } 1335 }
1336 else 1336 else
1337 { 1337 {
1338 uLong uTotalOutBefore,uTotalOutAfter; 1338 uLong uTotalOutBefore,uTotalOutAfter;
1339 const Bytef *bufBefore; 1339 const Bytef *bufBefore;
1340 uLong uOutThis; 1340 uLong uOutThis;
1341 int flush=Z_SYNC_FLUSH; 1341 int flush=Z_SYNC_FLUSH;
1342 1342
1343 uTotalOutBefore = pfile_in_zip_read_info->stream.total_out; 1343 uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;
1344 bufBefore = pfile_in_zip_read_info->stream.next_out; 1344 bufBefore = pfile_in_zip_read_info->stream.next_out;
1345 1345
1346 /* 1346 /*
1347 if ((pfile_in_zip_read_info->rest_read_uncompressed == 1347 if ((pfile_in_zip_read_info->rest_read_uncompressed ==
1348 pfile_in_zip_read_info->stream.avail_out) && 1348 pfile_in_zip_read_info->stream.avail_out) &&
1349 (pfile_in_zip_read_info->rest_read_compressed == 0)) 1349 (pfile_in_zip_read_info->rest_read_compressed == 0))
1350 flush = Z_FINISH; 1350 flush = Z_FINISH;
1351 */ 1351 */
1352 err=inflate(&pfile_in_zip_read_info->stream,flush); 1352 err=inflate(&pfile_in_zip_read_info->stream,flush);
1353 1353
1354 if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL)) 1354 if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL))
1355 err = Z_DATA_ERROR; 1355 err = Z_DATA_ERROR;
1356 1356
1357 uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; 1357 uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
1358 uOutThis = uTotalOutAfter-uTotalOutBefore; 1358 uOutThis = uTotalOutAfter-uTotalOutBefore;
1359 1359
1360 pfile_in_zip_read_info->crc32 = 1360 pfile_in_zip_read_info->crc32 =
1361 crc32(pfile_in_zip_read_info->crc32,bufBefore, 1361 crc32(pfile_in_zip_read_info->crc32,bufBefore,
1362 (uInt)(uOutThis)); 1362 (uInt)(uOutThis));
1363 1363
1364 pfile_in_zip_read_info->rest_read_uncompressed -= 1364 pfile_in_zip_read_info->rest_read_uncompressed -=
1365 uOutThis; 1365 uOutThis;
1366 1366
1367 iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); 1367 iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
1368 1368
1369 if (err==Z_STREAM_END) 1369 if (err==Z_STREAM_END)
1370 return (iRead==0) ? UNZ_EOF : iRead; 1370 return (iRead==0) ? UNZ_EOF : iRead;
1371 if (err!=Z_OK) 1371 if (err!=Z_OK)
1372 break; 1372 break;
1373 } 1373 }
1374 } 1374 }
1375 1375
1376 if (err==Z_OK) 1376 if (err==Z_OK)
1377 return iRead; 1377 return iRead;
1378 return err; 1378 return err;
1379} 1379}
1380 1380
1381 1381
1382/* 1382/*
1383 Give the current position in uncompressed data 1383 Give the current position in uncompressed data
1384*/ 1384*/
1385extern z_off_t ZEXPORT unztell (file) 1385extern z_off_t ZEXPORT unztell (file)
1386 unzFile file; 1386 unzFile file;
1387{ 1387{
1388 unz_s* s; 1388 unz_s* s;
1389 file_in_zip_read_info_s* pfile_in_zip_read_info; 1389 file_in_zip_read_info_s* pfile_in_zip_read_info;
1390 if (file==NULL) 1390 if (file==NULL)
1391 return UNZ_PARAMERROR; 1391 return UNZ_PARAMERROR;
1392 s=(unz_s*)file; 1392 s=(unz_s*)file;
1393 pfile_in_zip_read_info=s->pfile_in_zip_read; 1393 pfile_in_zip_read_info=s->pfile_in_zip_read;
1394 1394
1395 if (pfile_in_zip_read_info==NULL) 1395 if (pfile_in_zip_read_info==NULL)
1396 return UNZ_PARAMERROR; 1396 return UNZ_PARAMERROR;
1397 1397
1398 return (z_off_t)pfile_in_zip_read_info->stream.total_out; 1398 return (z_off_t)pfile_in_zip_read_info->stream.total_out;
1399} 1399}
1400 1400
1401 1401
1402/* 1402/*
1403 return 1 if the end of file was reached, 0 elsewhere 1403 return 1 if the end of file was reached, 0 elsewhere
1404*/ 1404*/
1405extern int ZEXPORT unzeof (file) 1405extern int ZEXPORT unzeof (file)
1406 unzFile file; 1406 unzFile file;
1407{ 1407{
1408 unz_s* s; 1408 unz_s* s;
1409 file_in_zip_read_info_s* pfile_in_zip_read_info; 1409 file_in_zip_read_info_s* pfile_in_zip_read_info;
1410 if (file==NULL) 1410 if (file==NULL)
1411 return UNZ_PARAMERROR; 1411 return UNZ_PARAMERROR;
1412 s=(unz_s*)file; 1412 s=(unz_s*)file;
1413 pfile_in_zip_read_info=s->pfile_in_zip_read; 1413 pfile_in_zip_read_info=s->pfile_in_zip_read;
1414 1414
1415 if (pfile_in_zip_read_info==NULL) 1415 if (pfile_in_zip_read_info==NULL)
1416 return UNZ_PARAMERROR; 1416 return UNZ_PARAMERROR;
1417 1417
1418 if (pfile_in_zip_read_info->rest_read_uncompressed == 0) 1418 if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
1419 return 1; 1419 return 1;
1420 else 1420 else
1421 return 0; 1421 return 0;
1422} 1422}
1423 1423
1424 1424
1425 1425
1426/* 1426/*
1427 Read extra field from the current file (opened by unzOpenCurrentFile) 1427 Read extra field from the current file (opened by unzOpenCurrentFile)
1428 This is the local-header version of the extra field (sometimes, there is 1428 This is the local-header version of the extra field (sometimes, there is
1429 more info in the local-header version than in the central-header) 1429 more info in the local-header version than in the central-header)
1430 1430
1431 if buf==NULL, it return the size of the local extra field that can be read 1431 if buf==NULL, it return the size of the local extra field that can be read
1432 1432
1433 if buf!=NULL, len is the size of the buffer, the extra header is copied in 1433 if buf!=NULL, len is the size of the buffer, the extra header is copied in
1434 buf. 1434 buf.
1435 the return value is the number of bytes copied in buf, or (if <0) 1435 the return value is the number of bytes copied in buf, or (if <0)
1436 the error code 1436 the error code
1437*/ 1437*/
1438extern int ZEXPORT unzGetLocalExtrafield (file,buf,len) 1438extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
1439 unzFile file; 1439 unzFile file;
1440 voidp buf; 1440 voidp buf;
1441 unsigned len; 1441 unsigned len;
1442{ 1442{
1443 unz_s* s; 1443 unz_s* s;
1444 file_in_zip_read_info_s* pfile_in_zip_read_info; 1444 file_in_zip_read_info_s* pfile_in_zip_read_info;
1445 uInt read_now; 1445 uInt read_now;
1446 uLong size_to_read; 1446 uLong size_to_read;
1447 1447
1448 if (file==NULL) 1448 if (file==NULL)
1449 return UNZ_PARAMERROR; 1449 return UNZ_PARAMERROR;
1450 s=(unz_s*)file; 1450 s=(unz_s*)file;
1451 pfile_in_zip_read_info=s->pfile_in_zip_read; 1451 pfile_in_zip_read_info=s->pfile_in_zip_read;
1452 1452
1453 if (pfile_in_zip_read_info==NULL) 1453 if (pfile_in_zip_read_info==NULL)
1454 return UNZ_PARAMERROR; 1454 return UNZ_PARAMERROR;
1455 1455
1456 size_to_read = (pfile_in_zip_read_info->size_local_extrafield - 1456 size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
1457 pfile_in_zip_read_info->pos_local_extrafield); 1457 pfile_in_zip_read_info->pos_local_extrafield);
1458 1458
1459 if (buf==NULL) 1459 if (buf==NULL)
1460 return (int)size_to_read; 1460 return (int)size_to_read;
1461 1461
1462 if (len>size_to_read) 1462 if (len>size_to_read)
1463 read_now = (uInt)size_to_read; 1463 read_now = (uInt)size_to_read;
1464 else 1464 else
1465 read_now = (uInt)len ; 1465 read_now = (uInt)len ;
1466 1466
1467 if (read_now==0) 1467 if (read_now==0)
1468 return 0; 1468 return 0;
1469 1469
1470 if (ZSEEK(pfile_in_zip_read_info->z_filefunc, 1470 if (ZSEEK(pfile_in_zip_read_info->z_filefunc,
1471 pfile_in_zip_read_info->filestream, 1471 pfile_in_zip_read_info->filestream,
1472 pfile_in_zip_read_info->offset_local_extrafield + 1472 pfile_in_zip_read_info->offset_local_extrafield +
1473 pfile_in_zip_read_info->pos_local_extrafield, 1473 pfile_in_zip_read_info->pos_local_extrafield,
1474 ZLIB_FILEFUNC_SEEK_SET)!=0) 1474 ZLIB_FILEFUNC_SEEK_SET)!=0)
1475 return UNZ_ERRNO; 1475 return UNZ_ERRNO;
1476 1476
1477 if (ZREAD(pfile_in_zip_read_info->z_filefunc, 1477 if (ZREAD(pfile_in_zip_read_info->z_filefunc,
1478 pfile_in_zip_read_info->filestream, 1478 pfile_in_zip_read_info->filestream,
1479 buf,read_now)!=read_now) 1479 buf,read_now)!=read_now)
1480 return UNZ_ERRNO; 1480 return UNZ_ERRNO;
1481 1481
1482 return (int)read_now; 1482 return (int)read_now;
1483} 1483}
1484 1484
1485/* 1485/*
1486 Close the file in zip opened with unzipOpenCurrentFile 1486 Close the file in zip opened with unzipOpenCurrentFile
1487 Return UNZ_CRCERROR if all the file was read but the CRC is not good 1487 Return UNZ_CRCERROR if all the file was read but the CRC is not good
1488*/ 1488*/
1489extern int ZEXPORT unzCloseCurrentFile (file) 1489extern int ZEXPORT unzCloseCurrentFile (file)
1490 unzFile file; 1490 unzFile file;
1491{ 1491{
1492 int err=UNZ_OK; 1492 int err=UNZ_OK;
1493 1493
1494 unz_s* s; 1494 unz_s* s;
1495 file_in_zip_read_info_s* pfile_in_zip_read_info; 1495 file_in_zip_read_info_s* pfile_in_zip_read_info;
1496 if (file==NULL) 1496 if (file==NULL)
1497 return UNZ_PARAMERROR; 1497 return UNZ_PARAMERROR;
1498 s=(unz_s*)file; 1498 s=(unz_s*)file;
1499 pfile_in_zip_read_info=s->pfile_in_zip_read; 1499 pfile_in_zip_read_info=s->pfile_in_zip_read;
1500 1500
1501 if (pfile_in_zip_read_info==NULL) 1501 if (pfile_in_zip_read_info==NULL)
1502 return UNZ_PARAMERROR; 1502 return UNZ_PARAMERROR;
1503 1503
1504 1504
1505 if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) && 1505 if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) &&
1506 (!pfile_in_zip_read_info->raw)) 1506 (!pfile_in_zip_read_info->raw))
1507 { 1507 {
1508 if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait) 1508 if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
1509 err=UNZ_CRCERROR; 1509 err=UNZ_CRCERROR;
1510 } 1510 }
1511 1511
1512 1512
1513 TRYFREE(pfile_in_zip_read_info->read_buffer); 1513 TRYFREE(pfile_in_zip_read_info->read_buffer);
1514 pfile_in_zip_read_info->read_buffer = NULL; 1514 pfile_in_zip_read_info->read_buffer = NULL;
1515 if (pfile_in_zip_read_info->stream_initialised) 1515 if (pfile_in_zip_read_info->stream_initialised)
1516 inflateEnd(&pfile_in_zip_read_info->stream); 1516 inflateEnd(&pfile_in_zip_read_info->stream);
1517 1517
1518 pfile_in_zip_read_info->stream_initialised = 0; 1518 pfile_in_zip_read_info->stream_initialised = 0;
1519 TRYFREE(pfile_in_zip_read_info); 1519 TRYFREE(pfile_in_zip_read_info);
1520 1520
1521 s->pfile_in_zip_read=NULL; 1521 s->pfile_in_zip_read=NULL;
1522 1522
1523 return err; 1523 return err;
1524} 1524}
1525 1525
1526 1526
1527/* 1527/*
1528 Get the global comment string of the ZipFile, in the szComment buffer. 1528 Get the global comment string of the ZipFile, in the szComment buffer.
1529 uSizeBuf is the size of the szComment buffer. 1529 uSizeBuf is the size of the szComment buffer.
1530 return the number of byte copied or an error code <0 1530 return the number of byte copied or an error code <0
1531*/ 1531*/
1532extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf) 1532extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf)
1533 unzFile file; 1533 unzFile file;
1534 char *szComment; 1534 char *szComment;
1535 uLong uSizeBuf; 1535 uLong uSizeBuf;
1536{ 1536{
1537 int err=UNZ_OK; 1537 int err=UNZ_OK;
1538 unz_s* s; 1538 unz_s* s;
1539 uLong uReadThis ; 1539 uLong uReadThis ;
1540 if (file==NULL) 1540 if (file==NULL)
1541 return UNZ_PARAMERROR; 1541 return UNZ_PARAMERROR;
1542 s=(unz_s*)file; 1542 s=(unz_s*)file;
1543 1543
1544 uReadThis = uSizeBuf; 1544 uReadThis = uSizeBuf;
1545 if (uReadThis>s->gi.size_comment) 1545 if (uReadThis>s->gi.size_comment)
1546 uReadThis = s->gi.size_comment; 1546 uReadThis = s->gi.size_comment;
1547 1547
1548 if (ZSEEK(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0) 1548 if (ZSEEK(s->z_filefunc,s->filestream,s->central_pos+22,ZLIB_FILEFUNC_SEEK_SET)!=0)
1549 return UNZ_ERRNO; 1549 return UNZ_ERRNO;
1550 1550
1551 if (uReadThis>0) 1551 if (uReadThis>0)
1552 { 1552 {
1553 *szComment='\0'; 1553 *szComment='\0';
1554 if (ZREAD(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis) 1554 if (ZREAD(s->z_filefunc,s->filestream,szComment,uReadThis)!=uReadThis)
1555 return UNZ_ERRNO; 1555 return UNZ_ERRNO;
1556 } 1556 }
1557 1557
1558 if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment)) 1558 if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment))
1559 *(szComment+s->gi.size_comment)='\0'; 1559 *(szComment+s->gi.size_comment)='\0';
1560 return (int)uReadThis; 1560 return (int)uReadThis;
1561} 1561}
1562 1562
1563/* Additions by RX '2004 */ 1563/* Additions by RX '2004 */
1564extern uLong ZEXPORT unzGetOffset (file) 1564extern uLong ZEXPORT unzGetOffset (file)
1565 unzFile file; 1565 unzFile file;
1566{ 1566{
1567 unz_s* s; 1567 unz_s* s;
1568 1568
1569 if (file==NULL) 1569 if (file==NULL)
1570 return UNZ_PARAMERROR; 1570 return UNZ_PARAMERROR;
1571 s=(unz_s*)file; 1571 s=(unz_s*)file;
1572 if (!s->current_file_ok) 1572 if (!s->current_file_ok)
1573 return 0; 1573 return 0;
1574 if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff) 1574 if (s->gi.number_entry != 0 && s->gi.number_entry != 0xffff)
1575 if (s->num_file==s->gi.number_entry) 1575 if (s->num_file==s->gi.number_entry)
1576 return 0; 1576 return 0;
1577 return s->pos_in_central_dir; 1577 return s->pos_in_central_dir;
1578} 1578}
1579 1579
1580extern int ZEXPORT unzSetOffset (file, pos) 1580extern int ZEXPORT unzSetOffset (file, pos)
1581 unzFile file; 1581 unzFile file;
1582 uLong pos; 1582 uLong pos;
1583{ 1583{
1584 unz_s* s; 1584 unz_s* s;
1585 int err; 1585 int err;
1586 1586
1587 if (file==NULL) 1587 if (file==NULL)
1588 return UNZ_PARAMERROR; 1588 return UNZ_PARAMERROR;
1589 s=(unz_s*)file; 1589 s=(unz_s*)file;
1590 1590
1591 s->pos_in_central_dir = pos; 1591 s->pos_in_central_dir = pos;
1592 s->num_file = s->gi.number_entry; /* hack */ 1592 s->num_file = s->gi.number_entry; /* hack */
1593 err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, 1593 err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info,
1594 &s->cur_file_info_internal, 1594 &s->cur_file_info_internal,
1595 NULL,0,NULL,0,NULL,0); 1595 NULL,0,NULL,0,NULL,0);
1596 s->current_file_ok = (err == UNZ_OK); 1596 s->current_file_ok = (err == UNZ_OK);
1597 return err; 1597 return err;
1598} 1598}
diff --git a/contrib/minizip/unzip.h b/contrib/minizip/unzip.h
index c3206a0..b247937 100644
--- a/contrib/minizip/unzip.h
+++ b/contrib/minizip/unzip.h
@@ -1,354 +1,354 @@
1/* unzip.h -- IO for uncompress .zip files using zlib 1/* unzip.h -- IO for uncompress .zip files using zlib
2 Version 1.01e, February 12th, 2005 2 Version 1.01e, February 12th, 2005
3 3
4 Copyright (C) 1998-2005 Gilles Vollant 4 Copyright (C) 1998-2005 Gilles Vollant
5 5
6 This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g 6 This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
7 WinZip, InfoZip tools and compatible. 7 WinZip, InfoZip tools and compatible.
8 8
9 Multi volume ZipFile (span) are not supported. 9 Multi volume ZipFile (span) are not supported.
10 Encryption compatible with pkzip 2.04g only supported 10 Encryption compatible with pkzip 2.04g only supported
11 Old compressions used by old PKZip 1.x are not supported 11 Old compressions used by old PKZip 1.x are not supported
12 12
13 13
14 I WAIT FEEDBACK at mail info@winimage.com 14 I WAIT FEEDBACK at mail info@winimage.com
15 Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution 15 Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
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
21 arising from the use of this software. 21 arising from the use of this software.
22 22
23 Permission is granted to anyone to use this software for any purpose, 23 Permission is granted to anyone to use this software for any purpose,
24 including commercial applications, and to alter it and redistribute it 24 including commercial applications, and to alter it and redistribute it
25 freely, subject to the following restrictions: 25 freely, subject to the following restrictions:
26 26
27 1. The origin of this software must not be misrepresented; you must not 27 1. The origin of this software must not be misrepresented; you must not
28 claim that you wrote the original software. If you use this software 28 claim that you wrote the original software. If you use this software
29 in a product, an acknowledgment in the product documentation would be 29 in a product, an acknowledgment in the product documentation would be
30 appreciated but is not required. 30 appreciated but is not required.
31 2. Altered source versions must be plainly marked as such, and must not be 31 2. Altered source versions must be plainly marked as such, and must not be
32 misrepresented as being the original software. 32 misrepresented as being the original software.
33 3. This notice may not be removed or altered from any source distribution. 33 3. This notice may not be removed or altered from any source distribution.
34 34
35 35
36*/ 36*/
37 37
38/* for more info about .ZIP format, see 38/* for more info about .ZIP format, see
39 http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip 39 http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
40 http://www.info-zip.org/pub/infozip/doc/ 40 http://www.info-zip.org/pub/infozip/doc/
41 PkWare has also a specification at : 41 PkWare has also a specification at :
42 ftp://ftp.pkware.com/probdesc.zip 42 ftp://ftp.pkware.com/probdesc.zip
43*/ 43*/
44 44
45#ifndef _unz_H 45#ifndef _unz_H
46#define _unz_H 46#define _unz_H
47 47
48#ifdef __cplusplus 48#ifdef __cplusplus
49extern "C" { 49extern "C" {
50#endif 50#endif
51 51
52#ifndef _ZLIB_H 52#ifndef _ZLIB_H
53#include "zlib.h" 53#include "zlib.h"
54#endif 54#endif
55 55
56#ifndef _ZLIBIOAPI_H 56#ifndef _ZLIBIOAPI_H
57#include "ioapi.h" 57#include "ioapi.h"
58#endif 58#endif
59 59
60#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) 60#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
61/* like the STRICT of WIN32, we define a pointer that cannot be converted 61/* like the STRICT of WIN32, we define a pointer that cannot be converted
62 from (void*) without cast */ 62 from (void*) without cast */
63typedef struct TagunzFile__ { int unused; } unzFile__; 63typedef struct TagunzFile__ { int unused; } unzFile__;
64typedef unzFile__ *unzFile; 64typedef unzFile__ *unzFile;
65#else 65#else
66typedef voidp unzFile; 66typedef voidp unzFile;
67#endif 67#endif
68 68
69 69
70#define UNZ_OK (0) 70#define UNZ_OK (0)
71#define UNZ_END_OF_LIST_OF_FILE (-100) 71#define UNZ_END_OF_LIST_OF_FILE (-100)
72#define UNZ_ERRNO (Z_ERRNO) 72#define UNZ_ERRNO (Z_ERRNO)
73#define UNZ_EOF (0) 73#define UNZ_EOF (0)
74#define UNZ_PARAMERROR (-102) 74#define UNZ_PARAMERROR (-102)
75#define UNZ_BADZIPFILE (-103) 75#define UNZ_BADZIPFILE (-103)
76#define UNZ_INTERNALERROR (-104) 76#define UNZ_INTERNALERROR (-104)
77#define UNZ_CRCERROR (-105) 77#define UNZ_CRCERROR (-105)
78 78
79/* tm_unz contain date/time info */ 79/* tm_unz contain date/time info */
80typedef struct tm_unz_s 80typedef struct tm_unz_s
81{ 81{
82 uInt tm_sec; /* seconds after the minute - [0,59] */ 82 uInt tm_sec; /* seconds after the minute - [0,59] */
83 uInt tm_min; /* minutes after the hour - [0,59] */ 83 uInt tm_min; /* minutes after the hour - [0,59] */
84 uInt tm_hour; /* hours since midnight - [0,23] */ 84 uInt tm_hour; /* hours since midnight - [0,23] */
85 uInt tm_mday; /* day of the month - [1,31] */ 85 uInt tm_mday; /* day of the month - [1,31] */
86 uInt tm_mon; /* months since January - [0,11] */ 86 uInt tm_mon; /* months since January - [0,11] */
87 uInt tm_year; /* years - [1980..2044] */ 87 uInt tm_year; /* years - [1980..2044] */
88} tm_unz; 88} tm_unz;
89 89
90/* unz_global_info structure contain global data about the ZIPfile 90/* unz_global_info structure contain global data about the ZIPfile
91 These data comes from the end of central dir */ 91 These data comes from the end of central dir */
92typedef struct unz_global_info_s 92typedef struct unz_global_info_s
93{ 93{
94 uLong number_entry; /* total number of entries in 94 uLong number_entry; /* total number of entries in
95 the central dir on this disk */ 95 the central dir on this disk */
96 uLong size_comment; /* size of the global comment of the zipfile */ 96 uLong size_comment; /* size of the global comment of the zipfile */
97} unz_global_info; 97} unz_global_info;
98 98
99 99
100/* unz_file_info contain information about a file in the zipfile */ 100/* unz_file_info contain information about a file in the zipfile */
101typedef struct unz_file_info_s 101typedef struct unz_file_info_s
102{ 102{
103 uLong version; /* version made by 2 bytes */ 103 uLong version; /* version made by 2 bytes */
104 uLong version_needed; /* version needed to extract 2 bytes */ 104 uLong version_needed; /* version needed to extract 2 bytes */
105 uLong flag; /* general purpose bit flag 2 bytes */ 105 uLong flag; /* general purpose bit flag 2 bytes */
106 uLong compression_method; /* compression method 2 bytes */ 106 uLong compression_method; /* compression method 2 bytes */
107 uLong dosDate; /* last mod file date in Dos fmt 4 bytes */ 107 uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
108 uLong crc; /* crc-32 4 bytes */ 108 uLong crc; /* crc-32 4 bytes */
109 uLong compressed_size; /* compressed size 4 bytes */ 109 uLong compressed_size; /* compressed size 4 bytes */
110 uLong uncompressed_size; /* uncompressed size 4 bytes */ 110 uLong uncompressed_size; /* uncompressed size 4 bytes */
111 uLong size_filename; /* filename length 2 bytes */ 111 uLong size_filename; /* filename length 2 bytes */
112 uLong size_file_extra; /* extra field length 2 bytes */ 112 uLong size_file_extra; /* extra field length 2 bytes */
113 uLong size_file_comment; /* file comment length 2 bytes */ 113 uLong size_file_comment; /* file comment length 2 bytes */
114 114
115 uLong disk_num_start; /* disk number start 2 bytes */ 115 uLong disk_num_start; /* disk number start 2 bytes */
116 uLong internal_fa; /* internal file attributes 2 bytes */ 116 uLong internal_fa; /* internal file attributes 2 bytes */
117 uLong external_fa; /* external file attributes 4 bytes */ 117 uLong external_fa; /* external file attributes 4 bytes */
118 118
119 tm_unz tmu_date; 119 tm_unz tmu_date;
120} unz_file_info; 120} unz_file_info;
121 121
122extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, 122extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
123 const char* fileName2, 123 const char* fileName2,
124 int iCaseSensitivity)); 124 int iCaseSensitivity));
125/* 125/*
126 Compare two filename (fileName1,fileName2). 126 Compare two filename (fileName1,fileName2).
127 If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) 127 If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
128 If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi 128 If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
129 or strcasecmp) 129 or strcasecmp)
130 If iCaseSenisivity = 0, case sensitivity is defaut of your operating system 130 If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
131 (like 1 on Unix, 2 on Windows) 131 (like 1 on Unix, 2 on Windows)
132*/ 132*/
133 133
134 134
135extern unzFile ZEXPORT unzOpen OF((const char *path)); 135extern unzFile ZEXPORT unzOpen OF((const char *path));
136/* 136/*
137 Open a Zip file. path contain the full pathname (by example, 137 Open a Zip file. path contain the full pathname (by example,
138 on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer 138 on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
139 "zlib/zlib113.zip". 139 "zlib/zlib113.zip".
140 If the zipfile cannot be opened (file don't exist or in not valid), the 140 If the zipfile cannot be opened (file don't exist or in not valid), the
141 return value is NULL. 141 return value is NULL.
142 Else, the return value is a unzFile Handle, usable with other function 142 Else, the return value is a unzFile Handle, usable with other function
143 of this unzip package. 143 of this unzip package.
144*/ 144*/
145 145
146extern unzFile ZEXPORT unzOpen2 OF((const char *path, 146extern unzFile ZEXPORT unzOpen2 OF((const char *path,
147 zlib_filefunc_def* pzlib_filefunc_def)); 147 zlib_filefunc_def* pzlib_filefunc_def));
148/* 148/*
149 Open a Zip file, like unzOpen, but provide a set of file low level API 149 Open a Zip file, like unzOpen, but provide a set of file low level API
150 for read/write the zip file (see ioapi.h) 150 for read/write the zip file (see ioapi.h)
151*/ 151*/
152 152
153extern int ZEXPORT unzClose OF((unzFile file)); 153extern int ZEXPORT unzClose OF((unzFile file));
154/* 154/*
155 Close a ZipFile opened with unzipOpen. 155 Close a ZipFile opened with unzipOpen.
156 If there is files inside the .Zip opened with unzOpenCurrentFile (see later), 156 If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
157 these files MUST be closed with unzipCloseCurrentFile before call unzipClose. 157 these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
158 return UNZ_OK if there is no problem. */ 158 return UNZ_OK if there is no problem. */
159 159
160extern int ZEXPORT unzGetGlobalInfo OF((unzFile file, 160extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
161 unz_global_info *pglobal_info)); 161 unz_global_info *pglobal_info));
162/* 162/*
163 Write info about the ZipFile in the *pglobal_info structure. 163 Write info about the ZipFile in the *pglobal_info structure.
164 No preparation of the structure is needed 164 No preparation of the structure is needed
165 return UNZ_OK if there is no problem. */ 165 return UNZ_OK if there is no problem. */
166 166
167 167
168extern int ZEXPORT unzGetGlobalComment OF((unzFile file, 168extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
169 char *szComment, 169 char *szComment,
170 uLong uSizeBuf)); 170 uLong uSizeBuf));
171/* 171/*
172 Get the global comment string of the ZipFile, in the szComment buffer. 172 Get the global comment string of the ZipFile, in the szComment buffer.
173 uSizeBuf is the size of the szComment buffer. 173 uSizeBuf is the size of the szComment buffer.
174 return the number of byte copied or an error code <0 174 return the number of byte copied or an error code <0
175*/ 175*/
176 176
177 177
178/***************************************************************************/ 178/***************************************************************************/
179/* Unzip package allow you browse the directory of the zipfile */ 179/* Unzip package allow you browse the directory of the zipfile */
180 180
181extern int ZEXPORT unzGoToFirstFile OF((unzFile file)); 181extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
182/* 182/*
183 Set the current file of the zipfile to the first file. 183 Set the current file of the zipfile to the first file.
184 return UNZ_OK if there is no problem 184 return UNZ_OK if there is no problem
185*/ 185*/
186 186
187extern int ZEXPORT unzGoToNextFile OF((unzFile file)); 187extern int ZEXPORT unzGoToNextFile OF((unzFile file));
188/* 188/*
189 Set the current file of the zipfile to the next file. 189 Set the current file of the zipfile to the next file.
190 return UNZ_OK if there is no problem 190 return UNZ_OK if there is no problem
191 return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. 191 return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
192*/ 192*/
193 193
194extern int ZEXPORT unzLocateFile OF((unzFile file, 194extern int ZEXPORT unzLocateFile OF((unzFile file,
195 const char *szFileName, 195 const char *szFileName,
196 int iCaseSensitivity)); 196 int iCaseSensitivity));
197/* 197/*
198 Try locate the file szFileName in the zipfile. 198 Try locate the file szFileName in the zipfile.
199 For the iCaseSensitivity signification, see unzStringFileNameCompare 199 For the iCaseSensitivity signification, see unzStringFileNameCompare
200 200
201 return value : 201 return value :
202 UNZ_OK if the file is found. It becomes the current file. 202 UNZ_OK if the file is found. It becomes the current file.
203 UNZ_END_OF_LIST_OF_FILE if the file is not found 203 UNZ_END_OF_LIST_OF_FILE if the file is not found
204*/ 204*/
205 205
206 206
207/* ****************************************** */ 207/* ****************************************** */
208/* Ryan supplied functions */ 208/* Ryan supplied functions */
209/* unz_file_info contain information about a file in the zipfile */ 209/* unz_file_info contain information about a file in the zipfile */
210typedef struct unz_file_pos_s 210typedef struct unz_file_pos_s
211{ 211{
212 uLong pos_in_zip_directory; /* offset in zip file directory */ 212 uLong pos_in_zip_directory; /* offset in zip file directory */
213 uLong num_of_file; /* # of file */ 213 uLong num_of_file; /* # of file */
214} unz_file_pos; 214} unz_file_pos;
215 215
216extern int ZEXPORT unzGetFilePos( 216extern int ZEXPORT unzGetFilePos(
217 unzFile file, 217 unzFile file,
218 unz_file_pos* file_pos); 218 unz_file_pos* file_pos);
219 219
220extern int ZEXPORT unzGoToFilePos( 220extern int ZEXPORT unzGoToFilePos(
221 unzFile file, 221 unzFile file,
222 unz_file_pos* file_pos); 222 unz_file_pos* file_pos);
223 223
224/* ****************************************** */ 224/* ****************************************** */
225 225
226extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, 226extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
227 unz_file_info *pfile_info, 227 unz_file_info *pfile_info,
228 char *szFileName, 228 char *szFileName,
229 uLong fileNameBufferSize, 229 uLong fileNameBufferSize,
230 void *extraField, 230 void *extraField,
231 uLong extraFieldBufferSize, 231 uLong extraFieldBufferSize,
232 char *szComment, 232 char *szComment,
233 uLong commentBufferSize)); 233 uLong commentBufferSize));
234/* 234/*
235 Get Info about the current file 235 Get Info about the current file
236 if pfile_info!=NULL, the *pfile_info structure will contain somes info about 236 if pfile_info!=NULL, the *pfile_info structure will contain somes info about
237 the current file 237 the current file
238 if szFileName!=NULL, the filemane string will be copied in szFileName 238 if szFileName!=NULL, the filemane string will be copied in szFileName
239 (fileNameBufferSize is the size of the buffer) 239 (fileNameBufferSize is the size of the buffer)
240 if extraField!=NULL, the extra field information will be copied in extraField 240 if extraField!=NULL, the extra field information will be copied in extraField
241 (extraFieldBufferSize is the size of the buffer). 241 (extraFieldBufferSize is the size of the buffer).
242 This is the Central-header version of the extra field 242 This is the Central-header version of the extra field
243 if szComment!=NULL, the comment string of the file will be copied in szComment 243 if szComment!=NULL, the comment string of the file will be copied in szComment
244 (commentBufferSize is the size of the buffer) 244 (commentBufferSize is the size of the buffer)
245*/ 245*/
246 246
247/***************************************************************************/ 247/***************************************************************************/
248/* for reading the content of the current zipfile, you can open it, read data 248/* for reading the content of the current zipfile, you can open it, read data
249 from it, and close it (you can close it before reading all the file) 249 from it, and close it (you can close it before reading all the file)
250 */ 250 */
251 251
252extern int ZEXPORT unzOpenCurrentFile OF((unzFile file)); 252extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
253/* 253/*
254 Open for reading data the current file in the zipfile. 254 Open for reading data the current file in the zipfile.
255 If there is no error, the return value is UNZ_OK. 255 If there is no error, the return value is UNZ_OK.
256*/ 256*/
257 257
258extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file, 258extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
259 const char* password)); 259 const char* password));
260/* 260/*
261 Open for reading data the current file in the zipfile. 261 Open for reading data the current file in the zipfile.
262 password is a crypting password 262 password is a crypting password
263 If there is no error, the return value is UNZ_OK. 263 If there is no error, the return value is UNZ_OK.
264*/ 264*/
265 265
266extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file, 266extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
267 int* method, 267 int* method,
268 int* level, 268 int* level,
269 int raw)); 269 int raw));
270/* 270/*
271 Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) 271 Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
272 if raw==1 272 if raw==1
273 *method will receive method of compression, *level will receive level of 273 *method will receive method of compression, *level will receive level of
274 compression 274 compression
275 note : you can set level parameter as NULL (if you did not want known level, 275 note : you can set level parameter as NULL (if you did not want known level,
276 but you CANNOT set method parameter as NULL 276 but you CANNOT set method parameter as NULL
277*/ 277*/
278 278
279extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file, 279extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
280 int* method, 280 int* method,
281 int* level, 281 int* level,
282 int raw, 282 int raw,
283 const char* password)); 283 const char* password));
284/* 284/*
285 Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) 285 Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
286 if raw==1 286 if raw==1
287 *method will receive method of compression, *level will receive level of 287 *method will receive method of compression, *level will receive level of
288 compression 288 compression
289 note : you can set level parameter as NULL (if you did not want known level, 289 note : you can set level parameter as NULL (if you did not want known level,
290 but you CANNOT set method parameter as NULL 290 but you CANNOT set method parameter as NULL
291*/ 291*/
292 292
293 293
294extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); 294extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
295/* 295/*
296 Close the file in zip opened with unzOpenCurrentFile 296 Close the file in zip opened with unzOpenCurrentFile
297 Return UNZ_CRCERROR if all the file was read but the CRC is not good 297 Return UNZ_CRCERROR if all the file was read but the CRC is not good
298*/ 298*/
299 299
300extern int ZEXPORT unzReadCurrentFile OF((unzFile file, 300extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
301 voidp buf, 301 voidp buf,
302 unsigned len)); 302 unsigned len));
303/* 303/*
304 Read bytes from the current file (opened by unzOpenCurrentFile) 304 Read bytes from the current file (opened by unzOpenCurrentFile)
305 buf contain buffer where data must be copied 305 buf contain buffer where data must be copied
306 len the size of buf. 306 len the size of buf.
307 307
308 return the number of byte copied if somes bytes are copied 308 return the number of byte copied if somes bytes are copied
309 return 0 if the end of file was reached 309 return 0 if the end of file was reached
310 return <0 with error code if there is an error 310 return <0 with error code if there is an error
311 (UNZ_ERRNO for IO error, or zLib error for uncompress error) 311 (UNZ_ERRNO for IO error, or zLib error for uncompress error)
312*/ 312*/
313 313
314extern z_off_t ZEXPORT unztell OF((unzFile file)); 314extern z_off_t ZEXPORT unztell OF((unzFile file));
315/* 315/*
316 Give the current position in uncompressed data 316 Give the current position in uncompressed data
317*/ 317*/
318 318
319extern int ZEXPORT unzeof OF((unzFile file)); 319extern int ZEXPORT unzeof OF((unzFile file));
320/* 320/*
321 return 1 if the end of file was reached, 0 elsewhere 321 return 1 if the end of file was reached, 0 elsewhere
322*/ 322*/
323 323
324extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file, 324extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
325 voidp buf, 325 voidp buf,
326 unsigned len)); 326 unsigned len));
327/* 327/*
328 Read extra field from the current file (opened by unzOpenCurrentFile) 328 Read extra field from the current file (opened by unzOpenCurrentFile)
329 This is the local-header version of the extra field (sometimes, there is 329 This is the local-header version of the extra field (sometimes, there is
330 more info in the local-header version than in the central-header) 330 more info in the local-header version than in the central-header)
331 331
332 if buf==NULL, it return the size of the local extra field 332 if buf==NULL, it return the size of the local extra field
333 333
334 if buf!=NULL, len is the size of the buffer, the extra header is copied in 334 if buf!=NULL, len is the size of the buffer, the extra header is copied in
335 buf. 335 buf.
336 the return value is the number of bytes copied in buf, or (if <0) 336 the return value is the number of bytes copied in buf, or (if <0)
337 the error code 337 the error code
338*/ 338*/
339 339
340/***************************************************************************/ 340/***************************************************************************/
341 341
342/* Get the current file offset */ 342/* Get the current file offset */
343extern uLong ZEXPORT unzGetOffset (unzFile file); 343extern uLong ZEXPORT unzGetOffset (unzFile file);
344 344
345/* Set the current file offset */ 345/* Set the current file offset */
346extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); 346extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
347 347
348 348
349 349
350#ifdef __cplusplus 350#ifdef __cplusplus
351} 351}
352#endif 352#endif
353 353
354#endif /* _unz_H */ 354#endif /* _unz_H */
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c
index 400e2ba..7fbe002 100644
--- a/contrib/minizip/zip.c
+++ b/contrib/minizip/zip.c
@@ -1,1219 +1,1219 @@
1/* zip.c -- IO on .zip files using zlib 1/* zip.c -- IO on .zip files using zlib
2 Version 1.01e, February 12th, 2005 2 Version 1.01e, February 12th, 2005
3 3
4 27 Dec 2004 Rolf Kalbermatter 4 27 Dec 2004 Rolf Kalbermatter
5 Modification to zipOpen2 to support globalComment retrieval. 5 Modification to zipOpen2 to support globalComment retrieval.
6 6
7 Copyright (C) 1998-2005 Gilles Vollant 7 Copyright (C) 1998-2005 Gilles Vollant
8 8
9 Read zip.h for more info 9 Read zip.h for more info
10*/ 10*/
11 11
12 12
13#include <stdio.h> 13#include <stdio.h>
14#include <stdlib.h> 14#include <stdlib.h>
15#include <string.h> 15#include <string.h>
16#include <time.h> 16#include <time.h>
17#include "zlib.h" 17#include "zlib.h"
18#include "zip.h" 18#include "zip.h"
19 19
20#ifdef STDC 20#ifdef STDC
21# include <stddef.h> 21# include <stddef.h>
22# include <string.h> 22# include <string.h>
23# include <stdlib.h> 23# include <stdlib.h>
24#endif 24#endif
25#ifdef NO_ERRNO_H 25#ifdef NO_ERRNO_H
26 extern int errno; 26 extern int errno;
27#else 27#else
28# include <errno.h> 28# include <errno.h>
29#endif 29#endif
30 30
31 31
32#ifndef local 32#ifndef local
33# define local static 33# define local static
34#endif 34#endif
35/* compile with -Dlocal if your debugger can't find static symbols */ 35/* compile with -Dlocal if your debugger can't find static symbols */
36 36
37#ifndef VERSIONMADEBY 37#ifndef VERSIONMADEBY
38# define VERSIONMADEBY (0x0) /* platform depedent */ 38# define VERSIONMADEBY (0x0) /* platform depedent */
39#endif 39#endif
40 40
41#ifndef Z_BUFSIZE 41#ifndef Z_BUFSIZE
42#define Z_BUFSIZE (16384) 42#define Z_BUFSIZE (16384)
43#endif 43#endif
44 44
45#ifndef Z_MAXFILENAMEINZIP 45#ifndef Z_MAXFILENAMEINZIP
46#define Z_MAXFILENAMEINZIP (256) 46#define Z_MAXFILENAMEINZIP (256)
47#endif 47#endif
48 48
49#ifndef ALLOC 49#ifndef ALLOC
50# define ALLOC(size) (malloc(size)) 50# define ALLOC(size) (malloc(size))
51#endif 51#endif
52#ifndef TRYFREE 52#ifndef TRYFREE
53# define TRYFREE(p) {if (p) free(p);} 53# define TRYFREE(p) {if (p) free(p);}
54#endif 54#endif
55 55
56/* 56/*
57#define SIZECENTRALDIRITEM (0x2e) 57#define SIZECENTRALDIRITEM (0x2e)
58#define SIZEZIPLOCALHEADER (0x1e) 58#define SIZEZIPLOCALHEADER (0x1e)
59*/ 59*/
60 60
61/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ 61/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
62 62
63#ifndef SEEK_CUR 63#ifndef SEEK_CUR
64#define SEEK_CUR 1 64#define SEEK_CUR 1
65#endif 65#endif
66 66
67#ifndef SEEK_END 67#ifndef SEEK_END
68#define SEEK_END 2 68#define SEEK_END 2
69#endif 69#endif
70 70
71#ifndef SEEK_SET 71#ifndef SEEK_SET
72#define SEEK_SET 0 72#define SEEK_SET 0
73#endif 73#endif
74 74
75#ifndef DEF_MEM_LEVEL 75#ifndef DEF_MEM_LEVEL
76#if MAX_MEM_LEVEL >= 8 76#if MAX_MEM_LEVEL >= 8
77# define DEF_MEM_LEVEL 8 77# define DEF_MEM_LEVEL 8
78#else 78#else
79# define DEF_MEM_LEVEL MAX_MEM_LEVEL 79# define DEF_MEM_LEVEL MAX_MEM_LEVEL
80#endif 80#endif
81#endif 81#endif
82const char zip_copyright[] = 82const char zip_copyright[] =
83 " zip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; 83 " zip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
84 84
85 85
86#define SIZEDATA_INDATABLOCK (4096-(4*4)) 86#define SIZEDATA_INDATABLOCK (4096-(4*4))
87 87
88#define LOCALHEADERMAGIC (0x04034b50) 88#define LOCALHEADERMAGIC (0x04034b50)
89#define CENTRALHEADERMAGIC (0x02014b50) 89#define CENTRALHEADERMAGIC (0x02014b50)
90#define ENDHEADERMAGIC (0x06054b50) 90#define ENDHEADERMAGIC (0x06054b50)
91 91
92#define FLAG_LOCALHEADER_OFFSET (0x06) 92#define FLAG_LOCALHEADER_OFFSET (0x06)
93#define CRC_LOCALHEADER_OFFSET (0x0e) 93#define CRC_LOCALHEADER_OFFSET (0x0e)
94 94
95#define SIZECENTRALHEADER (0x2e) /* 46 */ 95#define SIZECENTRALHEADER (0x2e) /* 46 */
96 96
97typedef struct linkedlist_datablock_internal_s 97typedef struct linkedlist_datablock_internal_s
98{ 98{
99 struct linkedlist_datablock_internal_s* next_datablock; 99 struct linkedlist_datablock_internal_s* next_datablock;
100 uLong avail_in_this_block; 100 uLong avail_in_this_block;
101 uLong filled_in_this_block; 101 uLong filled_in_this_block;
102 uLong unused; /* for future use and alignement */ 102 uLong unused; /* for future use and alignement */
103 unsigned char data[SIZEDATA_INDATABLOCK]; 103 unsigned char data[SIZEDATA_INDATABLOCK];
104} linkedlist_datablock_internal; 104} linkedlist_datablock_internal;
105 105
106typedef struct linkedlist_data_s 106typedef struct linkedlist_data_s
107{ 107{
108 linkedlist_datablock_internal* first_block; 108 linkedlist_datablock_internal* first_block;
109 linkedlist_datablock_internal* last_block; 109 linkedlist_datablock_internal* last_block;
110} linkedlist_data; 110} linkedlist_data;
111 111
112 112
113typedef struct 113typedef struct
114{ 114{
115 z_stream stream; /* zLib stream structure for inflate */ 115 z_stream stream; /* zLib stream structure for inflate */
116 int stream_initialised; /* 1 is stream is initialised */ 116 int stream_initialised; /* 1 is stream is initialised */
117 uInt pos_in_buffered_data; /* last written byte in buffered_data */ 117 uInt pos_in_buffered_data; /* last written byte in buffered_data */
118 118
119 uLong pos_local_header; /* offset of the local header of the file 119 uLong pos_local_header; /* offset of the local header of the file
120 currenty writing */ 120 currenty writing */
121 char* central_header; /* central header data for the current file */ 121 char* central_header; /* central header data for the current file */
122 uLong size_centralheader; /* size of the central header for cur file */ 122 uLong size_centralheader; /* size of the central header for cur file */
123 uLong flag; /* flag of the file currently writing */ 123 uLong flag; /* flag of the file currently writing */
124 124
125 int method; /* compression method of file currenty wr.*/ 125 int method; /* compression method of file currenty wr.*/
126 int raw; /* 1 for directly writing raw data */ 126 int raw; /* 1 for directly writing raw data */
127 Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/ 127 Byte buffered_data[Z_BUFSIZE];/* buffer contain compressed data to be writ*/
128 uLong dosDate; 128 uLong dosDate;
129 uLong crc32; 129 uLong crc32;
130 int encrypt; 130 int encrypt;
131#ifndef NOCRYPT 131#ifndef NOCRYPT
132 unsigned long keys[3]; /* keys defining the pseudo-random sequence */ 132 unsigned long keys[3]; /* keys defining the pseudo-random sequence */
133 const unsigned long* pcrc_32_tab; 133 const unsigned long* pcrc_32_tab;
134 int crypt_header_size; 134 int crypt_header_size;
135#endif 135#endif
136} curfile_info; 136} curfile_info;
137 137
138typedef struct 138typedef struct
139{ 139{
140 zlib_filefunc_def z_filefunc; 140 zlib_filefunc_def z_filefunc;
141 voidpf filestream; /* io structore of the zipfile */ 141 voidpf filestream; /* io structore of the zipfile */
142 linkedlist_data central_dir;/* datablock with central dir in construction*/ 142 linkedlist_data central_dir;/* datablock with central dir in construction*/
143 int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/ 143 int in_opened_file_inzip; /* 1 if a file in the zip is currently writ.*/
144 curfile_info ci; /* info on the file curretly writing */ 144 curfile_info ci; /* info on the file curretly writing */
145 145
146 uLong begin_pos; /* position of the beginning of the zipfile */ 146 uLong begin_pos; /* position of the beginning of the zipfile */
147 uLong add_position_when_writting_offset; 147 uLong add_position_when_writting_offset;
148 uLong number_entry; 148 uLong number_entry;
149#ifndef NO_ADDFILEINEXISTINGZIP 149#ifndef NO_ADDFILEINEXISTINGZIP
150 char *globalcomment; 150 char *globalcomment;
151#endif 151#endif
152} zip_internal; 152} zip_internal;
153 153
154 154
155 155
156#ifndef NOCRYPT 156#ifndef NOCRYPT
157#define INCLUDECRYPTINGCODE_IFCRYPTALLOWED 157#define INCLUDECRYPTINGCODE_IFCRYPTALLOWED
158#include "crypt.h" 158#include "crypt.h"
159#endif 159#endif
160 160
161local linkedlist_datablock_internal* allocate_new_datablock() 161local linkedlist_datablock_internal* allocate_new_datablock()
162{ 162{
163 linkedlist_datablock_internal* ldi; 163 linkedlist_datablock_internal* ldi;
164 ldi = (linkedlist_datablock_internal*) 164 ldi = (linkedlist_datablock_internal*)
165 ALLOC(sizeof(linkedlist_datablock_internal)); 165 ALLOC(sizeof(linkedlist_datablock_internal));
166 if (ldi!=NULL) 166 if (ldi!=NULL)
167 { 167 {
168 ldi->next_datablock = NULL ; 168 ldi->next_datablock = NULL ;
169 ldi->filled_in_this_block = 0 ; 169 ldi->filled_in_this_block = 0 ;
170 ldi->avail_in_this_block = SIZEDATA_INDATABLOCK ; 170 ldi->avail_in_this_block = SIZEDATA_INDATABLOCK ;
171 } 171 }
172 return ldi; 172 return ldi;
173} 173}
174 174
175local void free_datablock(ldi) 175local void free_datablock(ldi)
176 linkedlist_datablock_internal* ldi; 176 linkedlist_datablock_internal* ldi;
177{ 177{
178 while (ldi!=NULL) 178 while (ldi!=NULL)
179 { 179 {
180 linkedlist_datablock_internal* ldinext = ldi->next_datablock; 180 linkedlist_datablock_internal* ldinext = ldi->next_datablock;
181 TRYFREE(ldi); 181 TRYFREE(ldi);
182 ldi = ldinext; 182 ldi = ldinext;
183 } 183 }
184} 184}
185 185
186local void init_linkedlist(ll) 186local void init_linkedlist(ll)
187 linkedlist_data* ll; 187 linkedlist_data* ll;
188{ 188{
189 ll->first_block = ll->last_block = NULL; 189 ll->first_block = ll->last_block = NULL;
190} 190}
191 191
192local void free_linkedlist(ll) 192local void free_linkedlist(ll)
193 linkedlist_data* ll; 193 linkedlist_data* ll;
194{ 194{
195 free_datablock(ll->first_block); 195 free_datablock(ll->first_block);
196 ll->first_block = ll->last_block = NULL; 196 ll->first_block = ll->last_block = NULL;
197} 197}
198 198
199 199
200local int add_data_in_datablock(ll,buf,len) 200local int add_data_in_datablock(ll,buf,len)
201 linkedlist_data* ll; 201 linkedlist_data* ll;
202 const void* buf; 202 const void* buf;
203 uLong len; 203 uLong len;
204{ 204{
205 linkedlist_datablock_internal* ldi; 205 linkedlist_datablock_internal* ldi;
206 const unsigned char* from_copy; 206 const unsigned char* from_copy;
207 207
208 if (ll==NULL) 208 if (ll==NULL)
209 return ZIP_INTERNALERROR; 209 return ZIP_INTERNALERROR;
210 210
211 if (ll->last_block == NULL) 211 if (ll->last_block == NULL)
212 { 212 {
213 ll->first_block = ll->last_block = allocate_new_datablock(); 213 ll->first_block = ll->last_block = allocate_new_datablock();
214 if (ll->first_block == NULL) 214 if (ll->first_block == NULL)
215 return ZIP_INTERNALERROR; 215 return ZIP_INTERNALERROR;
216 } 216 }
217 217
218 ldi = ll->last_block; 218 ldi = ll->last_block;
219 from_copy = (unsigned char*)buf; 219 from_copy = (unsigned char*)buf;
220 220
221 while (len>0) 221 while (len>0)
222 { 222 {
223 uInt copy_this; 223 uInt copy_this;
224 uInt i; 224 uInt i;
225 unsigned char* to_copy; 225 unsigned char* to_copy;
226 226
227 if (ldi->avail_in_this_block==0) 227 if (ldi->avail_in_this_block==0)
228 { 228 {
229 ldi->next_datablock = allocate_new_datablock(); 229 ldi->next_datablock = allocate_new_datablock();
230 if (ldi->next_datablock == NULL) 230 if (ldi->next_datablock == NULL)
231 return ZIP_INTERNALERROR; 231 return ZIP_INTERNALERROR;
232 ldi = ldi->next_datablock ; 232 ldi = ldi->next_datablock ;
233 ll->last_block = ldi; 233 ll->last_block = ldi;
234 } 234 }
235 235
236 if (ldi->avail_in_this_block < len) 236 if (ldi->avail_in_this_block < len)
237 copy_this = (uInt)ldi->avail_in_this_block; 237 copy_this = (uInt)ldi->avail_in_this_block;
238 else 238 else
239 copy_this = (uInt)len; 239 copy_this = (uInt)len;
240 240
241 to_copy = &(ldi->data[ldi->filled_in_this_block]); 241 to_copy = &(ldi->data[ldi->filled_in_this_block]);
242 242
243 for (i=0;i<copy_this;i++) 243 for (i=0;i<copy_this;i++)
244 *(to_copy+i)=*(from_copy+i); 244 *(to_copy+i)=*(from_copy+i);
245 245
246 ldi->filled_in_this_block += copy_this; 246 ldi->filled_in_this_block += copy_this;
247 ldi->avail_in_this_block -= copy_this; 247 ldi->avail_in_this_block -= copy_this;
248 from_copy += copy_this ; 248 from_copy += copy_this ;
249 len -= copy_this; 249 len -= copy_this;
250 } 250 }
251 return ZIP_OK; 251 return ZIP_OK;
252} 252}
253 253
254 254
255 255
256/****************************************************************************/ 256/****************************************************************************/
257 257
258#ifndef NO_ADDFILEINEXISTINGZIP 258#ifndef NO_ADDFILEINEXISTINGZIP
259/* =========================================================================== 259/* ===========================================================================
260 Inputs a long in LSB order to the given file 260 Inputs a long in LSB order to the given file
261 nbByte == 1, 2 or 4 (byte, short or long) 261 nbByte == 1, 2 or 4 (byte, short or long)
262*/ 262*/
263 263
264local int ziplocal_putValue OF((const zlib_filefunc_def* pzlib_filefunc_def, 264local int ziplocal_putValue OF((const zlib_filefunc_def* pzlib_filefunc_def,
265 voidpf filestream, uLong x, int nbByte)); 265 voidpf filestream, uLong x, int nbByte));
266local int ziplocal_putValue (pzlib_filefunc_def, filestream, x, nbByte) 266local int ziplocal_putValue (pzlib_filefunc_def, filestream, x, nbByte)
267 const zlib_filefunc_def* pzlib_filefunc_def; 267 const zlib_filefunc_def* pzlib_filefunc_def;
268 voidpf filestream; 268 voidpf filestream;
269 uLong x; 269 uLong x;
270 int nbByte; 270 int nbByte;
271{ 271{
272 unsigned char buf[4]; 272 unsigned char buf[4];
273 int n; 273 int n;
274 for (n = 0; n < nbByte; n++) 274 for (n = 0; n < nbByte; n++)
275 { 275 {
276 buf[n] = (unsigned char)(x & 0xff); 276 buf[n] = (unsigned char)(x & 0xff);
277 x >>= 8; 277 x >>= 8;
278 } 278 }
279 if (x != 0) 279 if (x != 0)
280 { /* data overflow - hack for ZIP64 (X Roche) */ 280 { /* data overflow - hack for ZIP64 (X Roche) */
281 for (n = 0; n < nbByte; n++) 281 for (n = 0; n < nbByte; n++)
282 { 282 {
283 buf[n] = 0xff; 283 buf[n] = 0xff;
284 } 284 }
285 } 285 }
286 286
287 if (ZWRITE(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte) 287 if (ZWRITE(*pzlib_filefunc_def,filestream,buf,nbByte)!=(uLong)nbByte)
288 return ZIP_ERRNO; 288 return ZIP_ERRNO;
289 else 289 else
290 return ZIP_OK; 290 return ZIP_OK;
291} 291}
292 292
293local void ziplocal_putValue_inmemory OF((void* dest, uLong x, int nbByte)); 293local void ziplocal_putValue_inmemory OF((void* dest, uLong x, int nbByte));
294local void ziplocal_putValue_inmemory (dest, x, nbByte) 294local void ziplocal_putValue_inmemory (dest, x, nbByte)
295 void* dest; 295 void* dest;
296 uLong x; 296 uLong x;
297 int nbByte; 297 int nbByte;
298{ 298{
299 unsigned char* buf=(unsigned char*)dest; 299 unsigned char* buf=(unsigned char*)dest;
300 int n; 300 int n;
301 for (n = 0; n < nbByte; n++) { 301 for (n = 0; n < nbByte; n++) {
302 buf[n] = (unsigned char)(x & 0xff); 302 buf[n] = (unsigned char)(x & 0xff);
303 x >>= 8; 303 x >>= 8;
304 } 304 }
305 305
306 if (x != 0) 306 if (x != 0)
307 { /* data overflow - hack for ZIP64 */ 307 { /* data overflow - hack for ZIP64 */
308 for (n = 0; n < nbByte; n++) 308 for (n = 0; n < nbByte; n++)
309 { 309 {
310 buf[n] = 0xff; 310 buf[n] = 0xff;
311 } 311 }
312 } 312 }
313} 313}
314 314
315/****************************************************************************/ 315/****************************************************************************/
316 316
317 317
318local uLong ziplocal_TmzDateToDosDate(ptm,dosDate) 318local uLong ziplocal_TmzDateToDosDate(ptm,dosDate)
319 const tm_zip* ptm; 319 const tm_zip* ptm;
320 uLong dosDate; 320 uLong dosDate;
321{ 321{
322 uLong year = (uLong)ptm->tm_year; 322 uLong year = (uLong)ptm->tm_year;
323 if (year>1980) 323 if (year>1980)
324 year-=1980; 324 year-=1980;
325 else if (year>80) 325 else if (year>80)
326 year-=80; 326 year-=80;
327 return 327 return
328 (uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) | 328 (uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) |
329 ((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour)); 329 ((ptm->tm_sec/2) + (32* ptm->tm_min) + (2048 * (uLong)ptm->tm_hour));
330} 330}
331 331
332 332
333/****************************************************************************/ 333/****************************************************************************/
334 334
335local int ziplocal_getByte OF(( 335local int ziplocal_getByte OF((
336 const zlib_filefunc_def* pzlib_filefunc_def, 336 const zlib_filefunc_def* pzlib_filefunc_def,
337 voidpf filestream, 337 voidpf filestream,
338 int *pi)); 338 int *pi));
339 339
340local int ziplocal_getByte(pzlib_filefunc_def,filestream,pi) 340local int ziplocal_getByte(pzlib_filefunc_def,filestream,pi)
341 const zlib_filefunc_def* pzlib_filefunc_def; 341 const zlib_filefunc_def* pzlib_filefunc_def;
342 voidpf filestream; 342 voidpf filestream;
343 int *pi; 343 int *pi;
344{ 344{
345 unsigned char c; 345 unsigned char c;
346 int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1); 346 int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
347 if (err==1) 347 if (err==1)
348 { 348 {
349 *pi = (int)c; 349 *pi = (int)c;
350 return ZIP_OK; 350 return ZIP_OK;
351 } 351 }
352 else 352 else
353 { 353 {
354 if (ZERROR(*pzlib_filefunc_def,filestream)) 354 if (ZERROR(*pzlib_filefunc_def,filestream))
355 return ZIP_ERRNO; 355 return ZIP_ERRNO;
356 else 356 else
357 return ZIP_EOF; 357 return ZIP_EOF;
358 } 358 }
359} 359}
360 360
361 361
362/* =========================================================================== 362/* ===========================================================================
363 Reads a long in LSB order from the given gz_stream. Sets 363 Reads a long in LSB order from the given gz_stream. Sets
364*/ 364*/
365local int ziplocal_getShort OF(( 365local int ziplocal_getShort OF((
366 const zlib_filefunc_def* pzlib_filefunc_def, 366 const zlib_filefunc_def* pzlib_filefunc_def,
367 voidpf filestream, 367 voidpf filestream,
368 uLong *pX)); 368 uLong *pX));
369 369
370local int ziplocal_getShort (pzlib_filefunc_def,filestream,pX) 370local int ziplocal_getShort (pzlib_filefunc_def,filestream,pX)
371 const zlib_filefunc_def* pzlib_filefunc_def; 371 const zlib_filefunc_def* pzlib_filefunc_def;
372 voidpf filestream; 372 voidpf filestream;
373 uLong *pX; 373 uLong *pX;
374{ 374{
375 uLong x ; 375 uLong x ;
376 int i; 376 int i;
377 int err; 377 int err;
378 378
379 err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i); 379 err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
380 x = (uLong)i; 380 x = (uLong)i;
381 381
382 if (err==ZIP_OK) 382 if (err==ZIP_OK)
383 err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i); 383 err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
384 x += ((uLong)i)<<8; 384 x += ((uLong)i)<<8;
385 385
386 if (err==ZIP_OK) 386 if (err==ZIP_OK)
387 *pX = x; 387 *pX = x;
388 else 388 else
389 *pX = 0; 389 *pX = 0;
390 return err; 390 return err;
391} 391}
392 392
393local int ziplocal_getLong OF(( 393local int ziplocal_getLong OF((
394 const zlib_filefunc_def* pzlib_filefunc_def, 394 const zlib_filefunc_def* pzlib_filefunc_def,
395 voidpf filestream, 395 voidpf filestream,
396 uLong *pX)); 396 uLong *pX));
397 397
398local int ziplocal_getLong (pzlib_filefunc_def,filestream,pX) 398local int ziplocal_getLong (pzlib_filefunc_def,filestream,pX)
399 const zlib_filefunc_def* pzlib_filefunc_def; 399 const zlib_filefunc_def* pzlib_filefunc_def;
400 voidpf filestream; 400 voidpf filestream;
401 uLong *pX; 401 uLong *pX;
402{ 402{
403 uLong x ; 403 uLong x ;
404 int i; 404 int i;
405 int err; 405 int err;
406 406
407 err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i); 407 err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
408 x = (uLong)i; 408 x = (uLong)i;
409 409
410 if (err==ZIP_OK) 410 if (err==ZIP_OK)
411 err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i); 411 err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
412 x += ((uLong)i)<<8; 412 x += ((uLong)i)<<8;
413 413
414 if (err==ZIP_OK) 414 if (err==ZIP_OK)
415 err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i); 415 err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
416 x += ((uLong)i)<<16; 416 x += ((uLong)i)<<16;
417 417
418 if (err==ZIP_OK) 418 if (err==ZIP_OK)
419 err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i); 419 err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
420 x += ((uLong)i)<<24; 420 x += ((uLong)i)<<24;
421 421
422 if (err==ZIP_OK) 422 if (err==ZIP_OK)
423 *pX = x; 423 *pX = x;
424 else 424 else
425 *pX = 0; 425 *pX = 0;
426 return err; 426 return err;
427} 427}
428 428
429#ifndef BUFREADCOMMENT 429#ifndef BUFREADCOMMENT
430#define BUFREADCOMMENT (0x400) 430#define BUFREADCOMMENT (0x400)
431#endif 431#endif
432/* 432/*
433 Locate the Central directory of a zipfile (at the end, just before 433 Locate the Central directory of a zipfile (at the end, just before
434 the global comment) 434 the global comment)
435*/ 435*/
436local uLong ziplocal_SearchCentralDir OF(( 436local uLong ziplocal_SearchCentralDir OF((
437 const zlib_filefunc_def* pzlib_filefunc_def, 437 const zlib_filefunc_def* pzlib_filefunc_def,
438 voidpf filestream)); 438 voidpf filestream));
439 439
440local uLong ziplocal_SearchCentralDir(pzlib_filefunc_def,filestream) 440local uLong ziplocal_SearchCentralDir(pzlib_filefunc_def,filestream)
441 const zlib_filefunc_def* pzlib_filefunc_def; 441 const zlib_filefunc_def* pzlib_filefunc_def;
442 voidpf filestream; 442 voidpf filestream;
443{ 443{
444 unsigned char* buf; 444 unsigned char* buf;
445 uLong uSizeFile; 445 uLong uSizeFile;
446 uLong uBackRead; 446 uLong uBackRead;
447 uLong uMaxBack=0xffff; /* maximum size of global comment */ 447 uLong uMaxBack=0xffff; /* maximum size of global comment */
448 uLong uPosFound=0; 448 uLong uPosFound=0;
449 449
450 if (ZSEEK(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) 450 if (ZSEEK(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0)
451 return 0; 451 return 0;
452 452
453 453
454 uSizeFile = ZTELL(*pzlib_filefunc_def,filestream); 454 uSizeFile = ZTELL(*pzlib_filefunc_def,filestream);
455 455
456 if (uMaxBack>uSizeFile) 456 if (uMaxBack>uSizeFile)
457 uMaxBack = uSizeFile; 457 uMaxBack = uSizeFile;
458 458
459 buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4); 459 buf = (unsigned char*)ALLOC(BUFREADCOMMENT+4);
460 if (buf==NULL) 460 if (buf==NULL)
461 return 0; 461 return 0;
462 462
463 uBackRead = 4; 463 uBackRead = 4;
464 while (uBackRead<uMaxBack) 464 while (uBackRead<uMaxBack)
465 { 465 {
466 uLong uReadSize,uReadPos ; 466 uLong uReadSize,uReadPos ;
467 int i; 467 int i;
468 if (uBackRead+BUFREADCOMMENT>uMaxBack) 468 if (uBackRead+BUFREADCOMMENT>uMaxBack)
469 uBackRead = uMaxBack; 469 uBackRead = uMaxBack;
470 else 470 else
471 uBackRead+=BUFREADCOMMENT; 471 uBackRead+=BUFREADCOMMENT;
472 uReadPos = uSizeFile-uBackRead ; 472 uReadPos = uSizeFile-uBackRead ;
473 473
474 uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? 474 uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
475 (BUFREADCOMMENT+4) : (uSizeFile-uReadPos); 475 (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
476 if (ZSEEK(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0) 476 if (ZSEEK(*pzlib_filefunc_def,filestream,uReadPos,ZLIB_FILEFUNC_SEEK_SET)!=0)
477 break; 477 break;
478 478
479 if (ZREAD(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize) 479 if (ZREAD(*pzlib_filefunc_def,filestream,buf,uReadSize)!=uReadSize)
480 break; 480 break;
481 481
482 for (i=(int)uReadSize-3; (i--)>0;) 482 for (i=(int)uReadSize-3; (i--)>0;)
483 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && 483 if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
484 ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) 484 ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
485 { 485 {
486 uPosFound = uReadPos+i; 486 uPosFound = uReadPos+i;
487 break; 487 break;
488 } 488 }
489 489
490 if (uPosFound!=0) 490 if (uPosFound!=0)
491 break; 491 break;
492 } 492 }
493 TRYFREE(buf); 493 TRYFREE(buf);
494 return uPosFound; 494 return uPosFound;
495} 495}
496#endif /* !NO_ADDFILEINEXISTINGZIP*/ 496#endif /* !NO_ADDFILEINEXISTINGZIP*/
497 497
498/************************************************************/ 498/************************************************************/
499extern zipFile ZEXPORT zipOpen2 (pathname, append, globalcomment, pzlib_filefunc_def) 499extern zipFile ZEXPORT zipOpen2 (pathname, append, globalcomment, pzlib_filefunc_def)
500 const char *pathname; 500 const char *pathname;
501 int append; 501 int append;
502 zipcharpc* globalcomment; 502 zipcharpc* globalcomment;
503 zlib_filefunc_def* pzlib_filefunc_def; 503 zlib_filefunc_def* pzlib_filefunc_def;
504{ 504{
505 zip_internal ziinit; 505 zip_internal ziinit;
506 zip_internal* zi; 506 zip_internal* zi;
507 int err=ZIP_OK; 507 int err=ZIP_OK;
508 508
509 509
510 if (pzlib_filefunc_def==NULL) 510 if (pzlib_filefunc_def==NULL)
511 fill_fopen_filefunc(&ziinit.z_filefunc); 511 fill_fopen_filefunc(&ziinit.z_filefunc);
512 else 512 else
513 ziinit.z_filefunc = *pzlib_filefunc_def; 513 ziinit.z_filefunc = *pzlib_filefunc_def;
514 514
515 ziinit.filestream = (*(ziinit.z_filefunc.zopen_file)) 515 ziinit.filestream = (*(ziinit.z_filefunc.zopen_file))
516 (ziinit.z_filefunc.opaque, 516 (ziinit.z_filefunc.opaque,
517 pathname, 517 pathname,
518 (append == APPEND_STATUS_CREATE) ? 518 (append == APPEND_STATUS_CREATE) ?
519 (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_CREATE) : 519 (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_CREATE) :
520 (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_EXISTING)); 520 (ZLIB_FILEFUNC_MODE_READ | ZLIB_FILEFUNC_MODE_WRITE | ZLIB_FILEFUNC_MODE_EXISTING));
521 521
522 if (ziinit.filestream == NULL) 522 if (ziinit.filestream == NULL)
523 return NULL; 523 return NULL;
524 ziinit.begin_pos = ZTELL(ziinit.z_filefunc,ziinit.filestream); 524 ziinit.begin_pos = ZTELL(ziinit.z_filefunc,ziinit.filestream);
525 ziinit.in_opened_file_inzip = 0; 525 ziinit.in_opened_file_inzip = 0;
526 ziinit.ci.stream_initialised = 0; 526 ziinit.ci.stream_initialised = 0;
527 ziinit.number_entry = 0; 527 ziinit.number_entry = 0;
528 ziinit.add_position_when_writting_offset = 0; 528 ziinit.add_position_when_writting_offset = 0;
529 init_linkedlist(&(ziinit.central_dir)); 529 init_linkedlist(&(ziinit.central_dir));
530 530
531 531
532 zi = (zip_internal*)ALLOC(sizeof(zip_internal)); 532 zi = (zip_internal*)ALLOC(sizeof(zip_internal));
533 if (zi==NULL) 533 if (zi==NULL)
534 { 534 {
535 ZCLOSE(ziinit.z_filefunc,ziinit.filestream); 535 ZCLOSE(ziinit.z_filefunc,ziinit.filestream);
536 return NULL; 536 return NULL;
537 } 537 }
538 538
539 /* now we add file in a zipfile */ 539 /* now we add file in a zipfile */
540# ifndef NO_ADDFILEINEXISTINGZIP 540# ifndef NO_ADDFILEINEXISTINGZIP
541 ziinit.globalcomment = NULL; 541 ziinit.globalcomment = NULL;
542 if (append == APPEND_STATUS_ADDINZIP) 542 if (append == APPEND_STATUS_ADDINZIP)
543 { 543 {
544 uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/ 544 uLong byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
545 545
546 uLong size_central_dir; /* size of the central directory */ 546 uLong size_central_dir; /* size of the central directory */
547 uLong offset_central_dir; /* offset of start of central directory */ 547 uLong offset_central_dir; /* offset of start of central directory */
548 uLong central_pos,uL; 548 uLong central_pos,uL;
549 549
550 uLong number_disk; /* number of the current dist, used for 550 uLong number_disk; /* number of the current dist, used for
551 spaning ZIP, unsupported, always 0*/ 551 spaning ZIP, unsupported, always 0*/
552 uLong number_disk_with_CD; /* number the the disk with central dir, used 552 uLong number_disk_with_CD; /* number the the disk with central dir, used
553 for spaning ZIP, unsupported, always 0*/ 553 for spaning ZIP, unsupported, always 0*/
554 uLong number_entry; 554 uLong number_entry;
555 uLong number_entry_CD; /* total number of entries in 555 uLong number_entry_CD; /* total number of entries in
556 the central dir 556 the central dir
557 (same than number_entry on nospan) */ 557 (same than number_entry on nospan) */
558 uLong size_comment; 558 uLong size_comment;
559 559
560 central_pos = ziplocal_SearchCentralDir(&ziinit.z_filefunc,ziinit.filestream); 560 central_pos = ziplocal_SearchCentralDir(&ziinit.z_filefunc,ziinit.filestream);
561 if (central_pos==0) 561 if (central_pos==0)
562 err=ZIP_ERRNO; 562 err=ZIP_ERRNO;
563 563
564 if (ZSEEK(ziinit.z_filefunc, ziinit.filestream, 564 if (ZSEEK(ziinit.z_filefunc, ziinit.filestream,
565 central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0) 565 central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
566 err=ZIP_ERRNO; 566 err=ZIP_ERRNO;
567 567
568 /* the signature, already checked */ 568 /* the signature, already checked */
569 if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&uL)!=ZIP_OK) 569 if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&uL)!=ZIP_OK)
570 err=ZIP_ERRNO; 570 err=ZIP_ERRNO;
571 571
572 /* number of this disk */ 572 /* number of this disk */
573 if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_disk)!=ZIP_OK) 573 if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_disk)!=ZIP_OK)
574 err=ZIP_ERRNO; 574 err=ZIP_ERRNO;
575 575
576 /* number of the disk with the start of the central directory */ 576 /* number of the disk with the start of the central directory */
577 if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_disk_with_CD)!=ZIP_OK) 577 if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_disk_with_CD)!=ZIP_OK)
578 err=ZIP_ERRNO; 578 err=ZIP_ERRNO;
579 579
580 /* total number of entries in the central dir on this disk */ 580 /* total number of entries in the central dir on this disk */
581 if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_entry)!=ZIP_OK) 581 if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_entry)!=ZIP_OK)
582 err=ZIP_ERRNO; 582 err=ZIP_ERRNO;
583 583
584 /* total number of entries in the central dir */ 584 /* total number of entries in the central dir */
585 if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_entry_CD)!=ZIP_OK) 585 if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_entry_CD)!=ZIP_OK)
586 err=ZIP_ERRNO; 586 err=ZIP_ERRNO;
587 587
588 if ((number_entry_CD!=number_entry) || 588 if ((number_entry_CD!=number_entry) ||
589 (number_disk_with_CD!=0) || 589 (number_disk_with_CD!=0) ||
590 (number_disk!=0)) 590 (number_disk!=0))
591 err=ZIP_BADZIPFILE; 591 err=ZIP_BADZIPFILE;
592 592
593 /* size of the central directory */ 593 /* size of the central directory */
594 if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&size_central_dir)!=ZIP_OK) 594 if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&size_central_dir)!=ZIP_OK)
595 err=ZIP_ERRNO; 595 err=ZIP_ERRNO;
596 596
597 /* offset of start of central directory with respect to the 597 /* offset of start of central directory with respect to the
598 starting disk number */ 598 starting disk number */
599 if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&offset_central_dir)!=ZIP_OK) 599 if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&offset_central_dir)!=ZIP_OK)
600 err=ZIP_ERRNO; 600 err=ZIP_ERRNO;
601 601
602 /* zipfile global comment length */ 602 /* zipfile global comment length */
603 if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&size_comment)!=ZIP_OK) 603 if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&size_comment)!=ZIP_OK)
604 err=ZIP_ERRNO; 604 err=ZIP_ERRNO;
605 605
606 if ((central_pos<offset_central_dir+size_central_dir) && 606 if ((central_pos<offset_central_dir+size_central_dir) &&
607 (err==ZIP_OK)) 607 (err==ZIP_OK))
608 err=ZIP_BADZIPFILE; 608 err=ZIP_BADZIPFILE;
609 609
610 if (err!=ZIP_OK) 610 if (err!=ZIP_OK)
611 { 611 {
612 ZCLOSE(ziinit.z_filefunc, ziinit.filestream); 612 ZCLOSE(ziinit.z_filefunc, ziinit.filestream);
613 return NULL; 613 return NULL;
614 } 614 }
615 615
616 if (size_comment>0) 616 if (size_comment>0)
617 { 617 {
618 ziinit.globalcomment = ALLOC(size_comment+1); 618 ziinit.globalcomment = ALLOC(size_comment+1);
619 if (ziinit.globalcomment) 619 if (ziinit.globalcomment)
620 { 620 {
621 size_comment = ZREAD(ziinit.z_filefunc, ziinit.filestream,ziinit.globalcomment,size_comment); 621 size_comment = ZREAD(ziinit.z_filefunc, ziinit.filestream,ziinit.globalcomment,size_comment);
622 ziinit.globalcomment[size_comment]=0; 622 ziinit.globalcomment[size_comment]=0;
623 } 623 }
624 } 624 }
625 625
626 byte_before_the_zipfile = central_pos - 626 byte_before_the_zipfile = central_pos -
627 (offset_central_dir+size_central_dir); 627 (offset_central_dir+size_central_dir);
628 ziinit.add_position_when_writting_offset = byte_before_the_zipfile; 628 ziinit.add_position_when_writting_offset = byte_before_the_zipfile;
629 629
630 { 630 {
631 uLong size_central_dir_to_read = size_central_dir; 631 uLong size_central_dir_to_read = size_central_dir;
632 size_t buf_size = SIZEDATA_INDATABLOCK; 632 size_t buf_size = SIZEDATA_INDATABLOCK;
633 void* buf_read = (void*)ALLOC(buf_size); 633 void* buf_read = (void*)ALLOC(buf_size);
634 if (ZSEEK(ziinit.z_filefunc, ziinit.filestream, 634 if (ZSEEK(ziinit.z_filefunc, ziinit.filestream,
635 offset_central_dir + byte_before_the_zipfile, 635 offset_central_dir + byte_before_the_zipfile,
636 ZLIB_FILEFUNC_SEEK_SET) != 0) 636 ZLIB_FILEFUNC_SEEK_SET) != 0)
637 err=ZIP_ERRNO; 637 err=ZIP_ERRNO;
638 638
639 while ((size_central_dir_to_read>0) && (err==ZIP_OK)) 639 while ((size_central_dir_to_read>0) && (err==ZIP_OK))
640 { 640 {
641 uLong read_this = SIZEDATA_INDATABLOCK; 641 uLong read_this = SIZEDATA_INDATABLOCK;
642 if (read_this > size_central_dir_to_read) 642 if (read_this > size_central_dir_to_read)
643 read_this = size_central_dir_to_read; 643 read_this = size_central_dir_to_read;
644 if (ZREAD(ziinit.z_filefunc, ziinit.filestream,buf_read,read_this) != read_this) 644 if (ZREAD(ziinit.z_filefunc, ziinit.filestream,buf_read,read_this) != read_this)
645 err=ZIP_ERRNO; 645 err=ZIP_ERRNO;
646 646
647 if (err==ZIP_OK) 647 if (err==ZIP_OK)
648 err = add_data_in_datablock(&ziinit.central_dir,buf_read, 648 err = add_data_in_datablock(&ziinit.central_dir,buf_read,
649 (uLong)read_this); 649 (uLong)read_this);
650 size_central_dir_to_read-=read_this; 650 size_central_dir_to_read-=read_this;
651 } 651 }
652 TRYFREE(buf_read); 652 TRYFREE(buf_read);
653 } 653 }
654 ziinit.begin_pos = byte_before_the_zipfile; 654 ziinit.begin_pos = byte_before_the_zipfile;
655 ziinit.number_entry = number_entry_CD; 655 ziinit.number_entry = number_entry_CD;
656 656
657 if (ZSEEK(ziinit.z_filefunc, ziinit.filestream, 657 if (ZSEEK(ziinit.z_filefunc, ziinit.filestream,
658 offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0) 658 offset_central_dir+byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0)
659 err=ZIP_ERRNO; 659 err=ZIP_ERRNO;
660 } 660 }
661 661
662 if (globalcomment) 662 if (globalcomment)
663 { 663 {
664 *globalcomment = ziinit.globalcomment; 664 *globalcomment = ziinit.globalcomment;
665 } 665 }
666# endif /* !NO_ADDFILEINEXISTINGZIP*/ 666# endif /* !NO_ADDFILEINEXISTINGZIP*/
667 667
668 if (err != ZIP_OK) 668 if (err != ZIP_OK)
669 { 669 {
670# ifndef NO_ADDFILEINEXISTINGZIP 670# ifndef NO_ADDFILEINEXISTINGZIP
671 TRYFREE(ziinit.globalcomment); 671 TRYFREE(ziinit.globalcomment);
672# endif /* !NO_ADDFILEINEXISTINGZIP*/ 672# endif /* !NO_ADDFILEINEXISTINGZIP*/
673 TRYFREE(zi); 673 TRYFREE(zi);
674 return NULL; 674 return NULL;
675 } 675 }
676 else 676 else
677 { 677 {
678 *zi = ziinit; 678 *zi = ziinit;
679 return (zipFile)zi; 679 return (zipFile)zi;
680 } 680 }
681} 681}
682 682
683extern zipFile ZEXPORT zipOpen (pathname, append) 683extern zipFile ZEXPORT zipOpen (pathname, append)
684 const char *pathname; 684 const char *pathname;
685 int append; 685 int append;
686{ 686{
687 return zipOpen2(pathname,append,NULL,NULL); 687 return zipOpen2(pathname,append,NULL,NULL);
688} 688}
689 689
690extern int ZEXPORT zipOpenNewFileInZip3 (file, filename, zipfi, 690extern int ZEXPORT zipOpenNewFileInZip3 (file, filename, zipfi,
691 extrafield_local, size_extrafield_local, 691 extrafield_local, size_extrafield_local,
692 extrafield_global, size_extrafield_global, 692 extrafield_global, size_extrafield_global,
693 comment, method, level, raw, 693 comment, method, level, raw,
694 windowBits, memLevel, strategy, 694 windowBits, memLevel, strategy,
695 password, crcForCrypting) 695 password, crcForCrypting)
696 zipFile file; 696 zipFile file;
697 const char* filename; 697 const char* filename;
698 const zip_fileinfo* zipfi; 698 const zip_fileinfo* zipfi;
699 const void* extrafield_local; 699 const void* extrafield_local;
700 uInt size_extrafield_local; 700 uInt size_extrafield_local;
701 const void* extrafield_global; 701 const void* extrafield_global;
702 uInt size_extrafield_global; 702 uInt size_extrafield_global;
703 const char* comment; 703 const char* comment;
704 int method; 704 int method;
705 int level; 705 int level;
706 int raw; 706 int raw;
707 int windowBits; 707 int windowBits;
708 int memLevel; 708 int memLevel;
709 int strategy; 709 int strategy;
710 const char* password; 710 const char* password;
711 uLong crcForCrypting; 711 uLong crcForCrypting;
712{ 712{
713 zip_internal* zi; 713 zip_internal* zi;
714 uInt size_filename; 714 uInt size_filename;
715 uInt size_comment; 715 uInt size_comment;
716 uInt i; 716 uInt i;
717 int err = ZIP_OK; 717 int err = ZIP_OK;
718 718
719# ifdef NOCRYPT 719# ifdef NOCRYPT
720 if (password != NULL) 720 if (password != NULL)
721 return ZIP_PARAMERROR; 721 return ZIP_PARAMERROR;
722# endif 722# endif
723 723
724 if (file == NULL) 724 if (file == NULL)
725 return ZIP_PARAMERROR; 725 return ZIP_PARAMERROR;
726 if ((method!=0) && (method!=Z_DEFLATED)) 726 if ((method!=0) && (method!=Z_DEFLATED))
727 return ZIP_PARAMERROR; 727 return ZIP_PARAMERROR;
728 728
729 zi = (zip_internal*)file; 729 zi = (zip_internal*)file;
730 730
731 if (zi->in_opened_file_inzip == 1) 731 if (zi->in_opened_file_inzip == 1)
732 { 732 {
733 err = zipCloseFileInZip (file); 733 err = zipCloseFileInZip (file);
734 if (err != ZIP_OK) 734 if (err != ZIP_OK)
735 return err; 735 return err;
736 } 736 }
737 737
738 738
739 if (filename==NULL) 739 if (filename==NULL)
740 filename="-"; 740 filename="-";
741 741
742 if (comment==NULL) 742 if (comment==NULL)
743 size_comment = 0; 743 size_comment = 0;
744 else 744 else
745 size_comment = (uInt)strlen(comment); 745 size_comment = (uInt)strlen(comment);
746 746
747 size_filename = (uInt)strlen(filename); 747 size_filename = (uInt)strlen(filename);
748 748
749 if (zipfi == NULL) 749 if (zipfi == NULL)
750 zi->ci.dosDate = 0; 750 zi->ci.dosDate = 0;
751 else 751 else
752 { 752 {
753 if (zipfi->dosDate != 0) 753 if (zipfi->dosDate != 0)
754 zi->ci.dosDate = zipfi->dosDate; 754 zi->ci.dosDate = zipfi->dosDate;
755 else zi->ci.dosDate = ziplocal_TmzDateToDosDate(&zipfi->tmz_date,zipfi->dosDate); 755 else zi->ci.dosDate = ziplocal_TmzDateToDosDate(&zipfi->tmz_date,zipfi->dosDate);
756 } 756 }
757 757
758 zi->ci.flag = 0; 758 zi->ci.flag = 0;
759 if ((level==8) || (level==9)) 759 if ((level==8) || (level==9))
760 zi->ci.flag |= 2; 760 zi->ci.flag |= 2;
761 if ((level==2)) 761 if ((level==2))
762 zi->ci.flag |= 4; 762 zi->ci.flag |= 4;
763 if ((level==1)) 763 if ((level==1))
764 zi->ci.flag |= 6; 764 zi->ci.flag |= 6;
765 if (password != NULL) 765 if (password != NULL)
766 zi->ci.flag |= 1; 766 zi->ci.flag |= 1;
767 767
768 zi->ci.crc32 = 0; 768 zi->ci.crc32 = 0;
769 zi->ci.method = method; 769 zi->ci.method = method;
770 zi->ci.encrypt = 0; 770 zi->ci.encrypt = 0;
771 zi->ci.stream_initialised = 0; 771 zi->ci.stream_initialised = 0;
772 zi->ci.pos_in_buffered_data = 0; 772 zi->ci.pos_in_buffered_data = 0;
773 zi->ci.raw = raw; 773 zi->ci.raw = raw;
774 zi->ci.pos_local_header = ZTELL(zi->z_filefunc,zi->filestream) ; 774 zi->ci.pos_local_header = ZTELL(zi->z_filefunc,zi->filestream) ;
775 zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename + 775 zi->ci.size_centralheader = SIZECENTRALHEADER + size_filename +
776 size_extrafield_global + size_comment; 776 size_extrafield_global + size_comment;
777 zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader); 777 zi->ci.central_header = (char*)ALLOC((uInt)zi->ci.size_centralheader);
778 778
779 ziplocal_putValue_inmemory(zi->ci.central_header,(uLong)CENTRALHEADERMAGIC,4); 779 ziplocal_putValue_inmemory(zi->ci.central_header,(uLong)CENTRALHEADERMAGIC,4);
780 /* version info */ 780 /* version info */
781 ziplocal_putValue_inmemory(zi->ci.central_header+4,(uLong)VERSIONMADEBY,2); 781 ziplocal_putValue_inmemory(zi->ci.central_header+4,(uLong)VERSIONMADEBY,2);
782 ziplocal_putValue_inmemory(zi->ci.central_header+6,(uLong)20,2); 782 ziplocal_putValue_inmemory(zi->ci.central_header+6,(uLong)20,2);
783 ziplocal_putValue_inmemory(zi->ci.central_header+8,(uLong)zi->ci.flag,2); 783 ziplocal_putValue_inmemory(zi->ci.central_header+8,(uLong)zi->ci.flag,2);
784 ziplocal_putValue_inmemory(zi->ci.central_header+10,(uLong)zi->ci.method,2); 784 ziplocal_putValue_inmemory(zi->ci.central_header+10,(uLong)zi->ci.method,2);
785 ziplocal_putValue_inmemory(zi->ci.central_header+12,(uLong)zi->ci.dosDate,4); 785 ziplocal_putValue_inmemory(zi->ci.central_header+12,(uLong)zi->ci.dosDate,4);
786 ziplocal_putValue_inmemory(zi->ci.central_header+16,(uLong)0,4); /*crc*/ 786 ziplocal_putValue_inmemory(zi->ci.central_header+16,(uLong)0,4); /*crc*/
787 ziplocal_putValue_inmemory(zi->ci.central_header+20,(uLong)0,4); /*compr size*/ 787 ziplocal_putValue_inmemory(zi->ci.central_header+20,(uLong)0,4); /*compr size*/
788 ziplocal_putValue_inmemory(zi->ci.central_header+24,(uLong)0,4); /*uncompr size*/ 788 ziplocal_putValue_inmemory(zi->ci.central_header+24,(uLong)0,4); /*uncompr size*/
789 ziplocal_putValue_inmemory(zi->ci.central_header+28,(uLong)size_filename,2); 789 ziplocal_putValue_inmemory(zi->ci.central_header+28,(uLong)size_filename,2);
790 ziplocal_putValue_inmemory(zi->ci.central_header+30,(uLong)size_extrafield_global,2); 790 ziplocal_putValue_inmemory(zi->ci.central_header+30,(uLong)size_extrafield_global,2);
791 ziplocal_putValue_inmemory(zi->ci.central_header+32,(uLong)size_comment,2); 791 ziplocal_putValue_inmemory(zi->ci.central_header+32,(uLong)size_comment,2);
792 ziplocal_putValue_inmemory(zi->ci.central_header+34,(uLong)0,2); /*disk nm start*/ 792 ziplocal_putValue_inmemory(zi->ci.central_header+34,(uLong)0,2); /*disk nm start*/
793 793
794 if (zipfi==NULL) 794 if (zipfi==NULL)
795 ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)0,2); 795 ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)0,2);
796 else 796 else
797 ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)zipfi->internal_fa,2); 797 ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)zipfi->internal_fa,2);
798 798
799 if (zipfi==NULL) 799 if (zipfi==NULL)
800 ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)0,4); 800 ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)0,4);
801 else 801 else
802 ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)zipfi->external_fa,4); 802 ziplocal_putValue_inmemory(zi->ci.central_header+38,(uLong)zipfi->external_fa,4);
803 803
804 ziplocal_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header- zi->add_position_when_writting_offset,4); 804 ziplocal_putValue_inmemory(zi->ci.central_header+42,(uLong)zi->ci.pos_local_header- zi->add_position_when_writting_offset,4);
805 805
806 for (i=0;i<size_filename;i++) 806 for (i=0;i<size_filename;i++)
807 *(zi->ci.central_header+SIZECENTRALHEADER+i) = *(filename+i); 807 *(zi->ci.central_header+SIZECENTRALHEADER+i) = *(filename+i);
808 808
809 for (i=0;i<size_extrafield_global;i++) 809 for (i=0;i<size_extrafield_global;i++)
810 *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+i) = 810 *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+i) =
811 *(((const char*)extrafield_global)+i); 811 *(((const char*)extrafield_global)+i);
812 812
813 for (i=0;i<size_comment;i++) 813 for (i=0;i<size_comment;i++)
814 *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+ 814 *(zi->ci.central_header+SIZECENTRALHEADER+size_filename+
815 size_extrafield_global+i) = *(comment+i); 815 size_extrafield_global+i) = *(comment+i);
816 if (zi->ci.central_header == NULL) 816 if (zi->ci.central_header == NULL)
817 return ZIP_INTERNALERROR; 817 return ZIP_INTERNALERROR;
818 818
819 /* write the local header */ 819 /* write the local header */
820 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)LOCALHEADERMAGIC,4); 820 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)LOCALHEADERMAGIC,4);
821 821
822 if (err==ZIP_OK) 822 if (err==ZIP_OK)
823 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)20,2);/* version needed to extract */ 823 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)20,2);/* version needed to extract */
824 if (err==ZIP_OK) 824 if (err==ZIP_OK)
825 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.flag,2); 825 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.flag,2);
826 826
827 if (err==ZIP_OK) 827 if (err==ZIP_OK)
828 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.method,2); 828 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.method,2);
829 829
830 if (err==ZIP_OK) 830 if (err==ZIP_OK)
831 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.dosDate,4); 831 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->ci.dosDate,4);
832 832
833 if (err==ZIP_OK) 833 if (err==ZIP_OK)
834 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* crc 32, unknown */ 834 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* crc 32, unknown */
835 if (err==ZIP_OK) 835 if (err==ZIP_OK)
836 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* compressed size, unknown */ 836 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* compressed size, unknown */
837 if (err==ZIP_OK) 837 if (err==ZIP_OK)
838 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* uncompressed size, unknown */ 838 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,4); /* uncompressed size, unknown */
839 839
840 if (err==ZIP_OK) 840 if (err==ZIP_OK)
841 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_filename,2); 841 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_filename,2);
842 842
843 if (err==ZIP_OK) 843 if (err==ZIP_OK)
844 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_extrafield_local,2); 844 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_extrafield_local,2);
845 845
846 if ((err==ZIP_OK) && (size_filename>0)) 846 if ((err==ZIP_OK) && (size_filename>0))
847 if (ZWRITE(zi->z_filefunc,zi->filestream,filename,size_filename)!=size_filename) 847 if (ZWRITE(zi->z_filefunc,zi->filestream,filename,size_filename)!=size_filename)
848 err = ZIP_ERRNO; 848 err = ZIP_ERRNO;
849 849
850 if ((err==ZIP_OK) && (size_extrafield_local>0)) 850 if ((err==ZIP_OK) && (size_extrafield_local>0))
851 if (ZWRITE(zi->z_filefunc,zi->filestream,extrafield_local,size_extrafield_local) 851 if (ZWRITE(zi->z_filefunc,zi->filestream,extrafield_local,size_extrafield_local)
852 !=size_extrafield_local) 852 !=size_extrafield_local)
853 err = ZIP_ERRNO; 853 err = ZIP_ERRNO;
854 854
855 zi->ci.stream.avail_in = (uInt)0; 855 zi->ci.stream.avail_in = (uInt)0;
856 zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; 856 zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
857 zi->ci.stream.next_out = zi->ci.buffered_data; 857 zi->ci.stream.next_out = zi->ci.buffered_data;
858 zi->ci.stream.total_in = 0; 858 zi->ci.stream.total_in = 0;
859 zi->ci.stream.total_out = 0; 859 zi->ci.stream.total_out = 0;
860 860
861 if ((err==ZIP_OK) && (zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) 861 if ((err==ZIP_OK) && (zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
862 { 862 {
863 zi->ci.stream.zalloc = (alloc_func)0; 863 zi->ci.stream.zalloc = (alloc_func)0;
864 zi->ci.stream.zfree = (free_func)0; 864 zi->ci.stream.zfree = (free_func)0;
865 zi->ci.stream.opaque = (voidpf)0; 865 zi->ci.stream.opaque = (voidpf)0;
866 866
867 if (windowBits>0) 867 if (windowBits>0)
868 windowBits = -windowBits; 868 windowBits = -windowBits;
869 869
870 err = deflateInit2(&zi->ci.stream, level, 870 err = deflateInit2(&zi->ci.stream, level,
871 Z_DEFLATED, windowBits, memLevel, strategy); 871 Z_DEFLATED, windowBits, memLevel, strategy);
872 872
873 if (err==Z_OK) 873 if (err==Z_OK)
874 zi->ci.stream_initialised = 1; 874 zi->ci.stream_initialised = 1;
875 } 875 }
876# ifndef NOCRYPT 876# ifndef NOCRYPT
877 zi->ci.crypt_header_size = 0; 877 zi->ci.crypt_header_size = 0;
878 if ((err==Z_OK) && (password != NULL)) 878 if ((err==Z_OK) && (password != NULL))
879 { 879 {
880 unsigned char bufHead[RAND_HEAD_LEN]; 880 unsigned char bufHead[RAND_HEAD_LEN];
881 unsigned int sizeHead; 881 unsigned int sizeHead;
882 zi->ci.encrypt = 1; 882 zi->ci.encrypt = 1;
883 zi->ci.pcrc_32_tab = get_crc_table(); 883 zi->ci.pcrc_32_tab = get_crc_table();
884 /*init_keys(password,zi->ci.keys,zi->ci.pcrc_32_tab);*/ 884 /*init_keys(password,zi->ci.keys,zi->ci.pcrc_32_tab);*/
885 885
886 sizeHead=crypthead(password,bufHead,RAND_HEAD_LEN,zi->ci.keys,zi->ci.pcrc_32_tab,crcForCrypting); 886 sizeHead=crypthead(password,bufHead,RAND_HEAD_LEN,zi->ci.keys,zi->ci.pcrc_32_tab,crcForCrypting);
887 zi->ci.crypt_header_size = sizeHead; 887 zi->ci.crypt_header_size = sizeHead;
888 888
889 if (ZWRITE(zi->z_filefunc,zi->filestream,bufHead,sizeHead) != sizeHead) 889 if (ZWRITE(zi->z_filefunc,zi->filestream,bufHead,sizeHead) != sizeHead)
890 err = ZIP_ERRNO; 890 err = ZIP_ERRNO;
891 } 891 }
892# endif 892# endif
893 893
894 if (err==Z_OK) 894 if (err==Z_OK)
895 zi->in_opened_file_inzip = 1; 895 zi->in_opened_file_inzip = 1;
896 return err; 896 return err;
897} 897}
898 898
899extern int ZEXPORT zipOpenNewFileInZip2(file, filename, zipfi, 899extern int ZEXPORT zipOpenNewFileInZip2(file, filename, zipfi,
900 extrafield_local, size_extrafield_local, 900 extrafield_local, size_extrafield_local,
901 extrafield_global, size_extrafield_global, 901 extrafield_global, size_extrafield_global,
902 comment, method, level, raw) 902 comment, method, level, raw)
903 zipFile file; 903 zipFile file;
904 const char* filename; 904 const char* filename;
905 const zip_fileinfo* zipfi; 905 const zip_fileinfo* zipfi;
906 const void* extrafield_local; 906 const void* extrafield_local;
907 uInt size_extrafield_local; 907 uInt size_extrafield_local;
908 const void* extrafield_global; 908 const void* extrafield_global;
909 uInt size_extrafield_global; 909 uInt size_extrafield_global;
910 const char* comment; 910 const char* comment;
911 int method; 911 int method;
912 int level; 912 int level;
913 int raw; 913 int raw;
914{ 914{
915 return zipOpenNewFileInZip3 (file, filename, zipfi, 915 return zipOpenNewFileInZip3 (file, filename, zipfi,
916 extrafield_local, size_extrafield_local, 916 extrafield_local, size_extrafield_local,
917 extrafield_global, size_extrafield_global, 917 extrafield_global, size_extrafield_global,
918 comment, method, level, raw, 918 comment, method, level, raw,
919 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, 919 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
920 NULL, 0); 920 NULL, 0);
921} 921}
922 922
923extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi, 923extern int ZEXPORT zipOpenNewFileInZip (file, filename, zipfi,
924 extrafield_local, size_extrafield_local, 924 extrafield_local, size_extrafield_local,
925 extrafield_global, size_extrafield_global, 925 extrafield_global, size_extrafield_global,
926 comment, method, level) 926 comment, method, level)
927 zipFile file; 927 zipFile file;
928 const char* filename; 928 const char* filename;
929 const zip_fileinfo* zipfi; 929 const zip_fileinfo* zipfi;
930 const void* extrafield_local; 930 const void* extrafield_local;
931 uInt size_extrafield_local; 931 uInt size_extrafield_local;
932 const void* extrafield_global; 932 const void* extrafield_global;
933 uInt size_extrafield_global; 933 uInt size_extrafield_global;
934 const char* comment; 934 const char* comment;
935 int method; 935 int method;
936 int level; 936 int level;
937{ 937{
938 return zipOpenNewFileInZip2 (file, filename, zipfi, 938 return zipOpenNewFileInZip2 (file, filename, zipfi,
939 extrafield_local, size_extrafield_local, 939 extrafield_local, size_extrafield_local,
940 extrafield_global, size_extrafield_global, 940 extrafield_global, size_extrafield_global,
941 comment, method, level, 0); 941 comment, method, level, 0);
942} 942}
943 943
944local int zipFlushWriteBuffer(zi) 944local int zipFlushWriteBuffer(zi)
945 zip_internal* zi; 945 zip_internal* zi;
946{ 946{
947 int err=ZIP_OK; 947 int err=ZIP_OK;
948 948
949 if (zi->ci.encrypt != 0) 949 if (zi->ci.encrypt != 0)
950 { 950 {
951#ifndef NOCRYPT 951#ifndef NOCRYPT
952 uInt i; 952 uInt i;
953 int t; 953 int t;
954 for (i=0;i<zi->ci.pos_in_buffered_data;i++) 954 for (i=0;i<zi->ci.pos_in_buffered_data;i++)
955 zi->ci.buffered_data[i] = zencode(zi->ci.keys, zi->ci.pcrc_32_tab, 955 zi->ci.buffered_data[i] = zencode(zi->ci.keys, zi->ci.pcrc_32_tab,
956 zi->ci.buffered_data[i],t); 956 zi->ci.buffered_data[i],t);
957#endif 957#endif
958 } 958 }
959 if (ZWRITE(zi->z_filefunc,zi->filestream,zi->ci.buffered_data,zi->ci.pos_in_buffered_data) 959 if (ZWRITE(zi->z_filefunc,zi->filestream,zi->ci.buffered_data,zi->ci.pos_in_buffered_data)
960 !=zi->ci.pos_in_buffered_data) 960 !=zi->ci.pos_in_buffered_data)
961 err = ZIP_ERRNO; 961 err = ZIP_ERRNO;
962 zi->ci.pos_in_buffered_data = 0; 962 zi->ci.pos_in_buffered_data = 0;
963 return err; 963 return err;
964} 964}
965 965
966extern int ZEXPORT zipWriteInFileInZip (file, buf, len) 966extern int ZEXPORT zipWriteInFileInZip (file, buf, len)
967 zipFile file; 967 zipFile file;
968 const void* buf; 968 const void* buf;
969 unsigned len; 969 unsigned len;
970{ 970{
971 zip_internal* zi; 971 zip_internal* zi;
972 int err=ZIP_OK; 972 int err=ZIP_OK;
973 973
974 if (file == NULL) 974 if (file == NULL)
975 return ZIP_PARAMERROR; 975 return ZIP_PARAMERROR;
976 zi = (zip_internal*)file; 976 zi = (zip_internal*)file;
977 977
978 if (zi->in_opened_file_inzip == 0) 978 if (zi->in_opened_file_inzip == 0)
979 return ZIP_PARAMERROR; 979 return ZIP_PARAMERROR;
980 980
981 zi->ci.stream.next_in = (void*)buf; 981 zi->ci.stream.next_in = (void*)buf;
982 zi->ci.stream.avail_in = len; 982 zi->ci.stream.avail_in = len;
983 zi->ci.crc32 = crc32(zi->ci.crc32,buf,len); 983 zi->ci.crc32 = crc32(zi->ci.crc32,buf,len);
984 984
985 while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0)) 985 while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
986 { 986 {
987 if (zi->ci.stream.avail_out == 0) 987 if (zi->ci.stream.avail_out == 0)
988 { 988 {
989 if (zipFlushWriteBuffer(zi) == ZIP_ERRNO) 989 if (zipFlushWriteBuffer(zi) == ZIP_ERRNO)
990 err = ZIP_ERRNO; 990 err = ZIP_ERRNO;
991 zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; 991 zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
992 zi->ci.stream.next_out = zi->ci.buffered_data; 992 zi->ci.stream.next_out = zi->ci.buffered_data;
993 } 993 }
994 994
995 995
996 if(err != ZIP_OK) 996 if(err != ZIP_OK)
997 break; 997 break;
998 998
999 if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) 999 if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
1000 { 1000 {
1001 uLong uTotalOutBefore = zi->ci.stream.total_out; 1001 uLong uTotalOutBefore = zi->ci.stream.total_out;
1002 err=deflate(&zi->ci.stream, Z_NO_FLUSH); 1002 err=deflate(&zi->ci.stream, Z_NO_FLUSH);
1003 zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ; 1003 zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
1004 1004
1005 } 1005 }
1006 else 1006 else
1007 { 1007 {
1008 uInt copy_this,i; 1008 uInt copy_this,i;
1009 if (zi->ci.stream.avail_in < zi->ci.stream.avail_out) 1009 if (zi->ci.stream.avail_in < zi->ci.stream.avail_out)
1010 copy_this = zi->ci.stream.avail_in; 1010 copy_this = zi->ci.stream.avail_in;
1011 else 1011 else
1012 copy_this = zi->ci.stream.avail_out; 1012 copy_this = zi->ci.stream.avail_out;
1013 for (i=0;i<copy_this;i++) 1013 for (i=0;i<copy_this;i++)
1014 *(((char*)zi->ci.stream.next_out)+i) = 1014 *(((char*)zi->ci.stream.next_out)+i) =
1015 *(((const char*)zi->ci.stream.next_in)+i); 1015 *(((const char*)zi->ci.stream.next_in)+i);
1016 { 1016 {
1017 zi->ci.stream.avail_in -= copy_this; 1017 zi->ci.stream.avail_in -= copy_this;
1018 zi->ci.stream.avail_out-= copy_this; 1018 zi->ci.stream.avail_out-= copy_this;
1019 zi->ci.stream.next_in+= copy_this; 1019 zi->ci.stream.next_in+= copy_this;
1020 zi->ci.stream.next_out+= copy_this; 1020 zi->ci.stream.next_out+= copy_this;
1021 zi->ci.stream.total_in+= copy_this; 1021 zi->ci.stream.total_in+= copy_this;
1022 zi->ci.stream.total_out+= copy_this; 1022 zi->ci.stream.total_out+= copy_this;
1023 zi->ci.pos_in_buffered_data += copy_this; 1023 zi->ci.pos_in_buffered_data += copy_this;
1024 } 1024 }
1025 } 1025 }
1026 } 1026 }
1027 1027
1028 return err; 1028 return err;
1029} 1029}
1030 1030
1031extern int ZEXPORT zipCloseFileInZipRaw (file, uncompressed_size, crc32) 1031extern int ZEXPORT zipCloseFileInZipRaw (file, uncompressed_size, crc32)
1032 zipFile file; 1032 zipFile file;
1033 uLong uncompressed_size; 1033 uLong uncompressed_size;
1034 uLong crc32; 1034 uLong crc32;
1035{ 1035{
1036 zip_internal* zi; 1036 zip_internal* zi;
1037 uLong compressed_size; 1037 uLong compressed_size;
1038 int err=ZIP_OK; 1038 int err=ZIP_OK;
1039 1039
1040 if (file == NULL) 1040 if (file == NULL)
1041 return ZIP_PARAMERROR; 1041 return ZIP_PARAMERROR;
1042 zi = (zip_internal*)file; 1042 zi = (zip_internal*)file;
1043 1043
1044 if (zi->in_opened_file_inzip == 0) 1044 if (zi->in_opened_file_inzip == 0)
1045 return ZIP_PARAMERROR; 1045 return ZIP_PARAMERROR;
1046 zi->ci.stream.avail_in = 0; 1046 zi->ci.stream.avail_in = 0;
1047 1047
1048 if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) 1048 if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
1049 while (err==ZIP_OK) 1049 while (err==ZIP_OK)
1050 { 1050 {
1051 uLong uTotalOutBefore; 1051 uLong uTotalOutBefore;
1052 if (zi->ci.stream.avail_out == 0) 1052 if (zi->ci.stream.avail_out == 0)
1053 { 1053 {
1054 if (zipFlushWriteBuffer(zi) == ZIP_ERRNO) 1054 if (zipFlushWriteBuffer(zi) == ZIP_ERRNO)
1055 err = ZIP_ERRNO; 1055 err = ZIP_ERRNO;
1056 zi->ci.stream.avail_out = (uInt)Z_BUFSIZE; 1056 zi->ci.stream.avail_out = (uInt)Z_BUFSIZE;
1057 zi->ci.stream.next_out = zi->ci.buffered_data; 1057 zi->ci.stream.next_out = zi->ci.buffered_data;
1058 } 1058 }
1059 uTotalOutBefore = zi->ci.stream.total_out; 1059 uTotalOutBefore = zi->ci.stream.total_out;
1060 err=deflate(&zi->ci.stream, Z_FINISH); 1060 err=deflate(&zi->ci.stream, Z_FINISH);
1061 zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ; 1061 zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
1062 } 1062 }
1063 1063
1064 if (err==Z_STREAM_END) 1064 if (err==Z_STREAM_END)
1065 err=ZIP_OK; /* this is normal */ 1065 err=ZIP_OK; /* this is normal */
1066 1066
1067 if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK)) 1067 if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK))
1068 if (zipFlushWriteBuffer(zi)==ZIP_ERRNO) 1068 if (zipFlushWriteBuffer(zi)==ZIP_ERRNO)
1069 err = ZIP_ERRNO; 1069 err = ZIP_ERRNO;
1070 1070
1071 if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw)) 1071 if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
1072 { 1072 {
1073 err=deflateEnd(&zi->ci.stream); 1073 err=deflateEnd(&zi->ci.stream);
1074 zi->ci.stream_initialised = 0; 1074 zi->ci.stream_initialised = 0;
1075 } 1075 }
1076 1076
1077 if (!zi->ci.raw) 1077 if (!zi->ci.raw)
1078 { 1078 {
1079 crc32 = (uLong)zi->ci.crc32; 1079 crc32 = (uLong)zi->ci.crc32;
1080 uncompressed_size = (uLong)zi->ci.stream.total_in; 1080 uncompressed_size = (uLong)zi->ci.stream.total_in;
1081 } 1081 }
1082 compressed_size = (uLong)zi->ci.stream.total_out; 1082 compressed_size = (uLong)zi->ci.stream.total_out;
1083# ifndef NOCRYPT 1083# ifndef NOCRYPT
1084 compressed_size += zi->ci.crypt_header_size; 1084 compressed_size += zi->ci.crypt_header_size;
1085# endif 1085# endif
1086 1086
1087 ziplocal_putValue_inmemory(zi->ci.central_header+16,crc32,4); /*crc*/ 1087 ziplocal_putValue_inmemory(zi->ci.central_header+16,crc32,4); /*crc*/
1088 ziplocal_putValue_inmemory(zi->ci.central_header+20, 1088 ziplocal_putValue_inmemory(zi->ci.central_header+20,
1089 compressed_size,4); /*compr size*/ 1089 compressed_size,4); /*compr size*/
1090 if (zi->ci.stream.data_type == Z_ASCII) 1090 if (zi->ci.stream.data_type == Z_ASCII)
1091 ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)Z_ASCII,2); 1091 ziplocal_putValue_inmemory(zi->ci.central_header+36,(uLong)Z_ASCII,2);
1092 ziplocal_putValue_inmemory(zi->ci.central_header+24, 1092 ziplocal_putValue_inmemory(zi->ci.central_header+24,
1093 uncompressed_size,4); /*uncompr size*/ 1093 uncompressed_size,4); /*uncompr size*/
1094 1094
1095 if (err==ZIP_OK) 1095 if (err==ZIP_OK)
1096 err = add_data_in_datablock(&zi->central_dir,zi->ci.central_header, 1096 err = add_data_in_datablock(&zi->central_dir,zi->ci.central_header,
1097 (uLong)zi->ci.size_centralheader); 1097 (uLong)zi->ci.size_centralheader);
1098 free(zi->ci.central_header); 1098 free(zi->ci.central_header);
1099 1099
1100 if (err==ZIP_OK) 1100 if (err==ZIP_OK)
1101 { 1101 {
1102 long cur_pos_inzip = ZTELL(zi->z_filefunc,zi->filestream); 1102 long cur_pos_inzip = ZTELL(zi->z_filefunc,zi->filestream);
1103 if (ZSEEK(zi->z_filefunc,zi->filestream, 1103 if (ZSEEK(zi->z_filefunc,zi->filestream,
1104 zi->ci.pos_local_header + 14,ZLIB_FILEFUNC_SEEK_SET)!=0) 1104 zi->ci.pos_local_header + 14,ZLIB_FILEFUNC_SEEK_SET)!=0)
1105 err = ZIP_ERRNO; 1105 err = ZIP_ERRNO;
1106 1106
1107 if (err==ZIP_OK) 1107 if (err==ZIP_OK)
1108 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,crc32,4); /* crc 32, unknown */ 1108 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,crc32,4); /* crc 32, unknown */
1109 1109
1110 if (err==ZIP_OK) /* compressed size, unknown */ 1110 if (err==ZIP_OK) /* compressed size, unknown */
1111 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,compressed_size,4); 1111 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,compressed_size,4);
1112 1112
1113 if (err==ZIP_OK) /* uncompressed size, unknown */ 1113 if (err==ZIP_OK) /* uncompressed size, unknown */
1114 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,uncompressed_size,4); 1114 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,uncompressed_size,4);
1115 1115
1116 if (ZSEEK(zi->z_filefunc,zi->filestream, 1116 if (ZSEEK(zi->z_filefunc,zi->filestream,
1117 cur_pos_inzip,ZLIB_FILEFUNC_SEEK_SET)!=0) 1117 cur_pos_inzip,ZLIB_FILEFUNC_SEEK_SET)!=0)
1118 err = ZIP_ERRNO; 1118 err = ZIP_ERRNO;
1119 } 1119 }
1120 1120
1121 zi->number_entry ++; 1121 zi->number_entry ++;
1122 zi->in_opened_file_inzip = 0; 1122 zi->in_opened_file_inzip = 0;
1123 1123
1124 return err; 1124 return err;
1125} 1125}
1126 1126
1127extern int ZEXPORT zipCloseFileInZip (file) 1127extern int ZEXPORT zipCloseFileInZip (file)
1128 zipFile file; 1128 zipFile file;
1129{ 1129{
1130 return zipCloseFileInZipRaw (file,0,0); 1130 return zipCloseFileInZipRaw (file,0,0);
1131} 1131}
1132 1132
1133extern int ZEXPORT zipClose (file, global_comment) 1133extern int ZEXPORT zipClose (file, global_comment)
1134 zipFile file; 1134 zipFile file;
1135 const char* global_comment; 1135 const char* global_comment;
1136{ 1136{
1137 zip_internal* zi; 1137 zip_internal* zi;
1138 int err = 0; 1138 int err = 0;
1139 uLong size_centraldir = 0; 1139 uLong size_centraldir = 0;
1140 uLong centraldir_pos_inzip; 1140 uLong centraldir_pos_inzip;
1141 uInt size_global_comment; 1141 uInt size_global_comment;
1142 if (file == NULL) 1142 if (file == NULL)
1143 return ZIP_PARAMERROR; 1143 return ZIP_PARAMERROR;
1144 zi = (zip_internal*)file; 1144 zi = (zip_internal*)file;
1145 1145
1146 if (zi->in_opened_file_inzip == 1) 1146 if (zi->in_opened_file_inzip == 1)
1147 { 1147 {
1148 err = zipCloseFileInZip (file); 1148 err = zipCloseFileInZip (file);
1149 } 1149 }
1150 1150
1151#ifndef NO_ADDFILEINEXISTINGZIP 1151#ifndef NO_ADDFILEINEXISTINGZIP
1152 if (global_comment==NULL) 1152 if (global_comment==NULL)
1153 global_comment = zi->globalcomment; 1153 global_comment = zi->globalcomment;
1154#endif 1154#endif
1155 if (global_comment==NULL) 1155 if (global_comment==NULL)
1156 size_global_comment = 0; 1156 size_global_comment = 0;
1157 else 1157 else
1158 size_global_comment = (uInt)strlen(global_comment); 1158 size_global_comment = (uInt)strlen(global_comment);
1159 1159
1160 centraldir_pos_inzip = ZTELL(zi->z_filefunc,zi->filestream); 1160 centraldir_pos_inzip = ZTELL(zi->z_filefunc,zi->filestream);
1161 if (err==ZIP_OK) 1161 if (err==ZIP_OK)
1162 { 1162 {
1163 linkedlist_datablock_internal* ldi = zi->central_dir.first_block ; 1163 linkedlist_datablock_internal* ldi = zi->central_dir.first_block ;
1164 while (ldi!=NULL) 1164 while (ldi!=NULL)
1165 { 1165 {
1166 if ((err==ZIP_OK) && (ldi->filled_in_this_block>0)) 1166 if ((err==ZIP_OK) && (ldi->filled_in_this_block>0))
1167 if (ZWRITE(zi->z_filefunc,zi->filestream, 1167 if (ZWRITE(zi->z_filefunc,zi->filestream,
1168 ldi->data,ldi->filled_in_this_block) 1168 ldi->data,ldi->filled_in_this_block)
1169 !=ldi->filled_in_this_block ) 1169 !=ldi->filled_in_this_block )
1170 err = ZIP_ERRNO; 1170 err = ZIP_ERRNO;
1171 1171
1172 size_centraldir += ldi->filled_in_this_block; 1172 size_centraldir += ldi->filled_in_this_block;
1173 ldi = ldi->next_datablock; 1173 ldi = ldi->next_datablock;
1174 } 1174 }
1175 } 1175 }
1176 free_datablock(zi->central_dir.first_block); 1176 free_datablock(zi->central_dir.first_block);
1177 1177
1178 if (err==ZIP_OK) /* Magic End */ 1178 if (err==ZIP_OK) /* Magic End */
1179 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4); 1179 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4);
1180 1180
1181 if (err==ZIP_OK) /* number of this disk */ 1181 if (err==ZIP_OK) /* number of this disk */
1182 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2); 1182 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2);
1183 1183
1184 if (err==ZIP_OK) /* number of the disk with the start of the central directory */ 1184 if (err==ZIP_OK) /* number of the disk with the start of the central directory */
1185 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2); 1185 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)0,2);
1186 1186
1187 if (err==ZIP_OK) /* total number of entries in the central dir on this disk */ 1187 if (err==ZIP_OK) /* total number of entries in the central dir on this disk */
1188 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2); 1188 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2);
1189 1189
1190 if (err==ZIP_OK) /* total number of entries in the central dir */ 1190 if (err==ZIP_OK) /* total number of entries in the central dir */
1191 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2); 1191 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)zi->number_entry,2);
1192 1192
1193 if (err==ZIP_OK) /* size of the central directory */ 1193 if (err==ZIP_OK) /* size of the central directory */
1194 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_centraldir,4); 1194 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_centraldir,4);
1195 1195
1196 if (err==ZIP_OK) /* offset of start of central directory with respect to the 1196 if (err==ZIP_OK) /* offset of start of central directory with respect to the
1197 starting disk number */ 1197 starting disk number */
1198 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream, 1198 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,
1199 (uLong)(centraldir_pos_inzip - zi->add_position_when_writting_offset),4); 1199 (uLong)(centraldir_pos_inzip - zi->add_position_when_writting_offset),4);
1200 1200
1201 if (err==ZIP_OK) /* zipfile comment length */ 1201 if (err==ZIP_OK) /* zipfile comment length */
1202 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_global_comment,2); 1202 err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)size_global_comment,2);
1203 1203
1204 if ((err==ZIP_OK) && (size_global_comment>0)) 1204 if ((err==ZIP_OK) && (size_global_comment>0))
1205 if (ZWRITE(zi->z_filefunc,zi->filestream, 1205 if (ZWRITE(zi->z_filefunc,zi->filestream,
1206 global_comment,size_global_comment) != size_global_comment) 1206 global_comment,size_global_comment) != size_global_comment)
1207 err = ZIP_ERRNO; 1207 err = ZIP_ERRNO;
1208 1208
1209 if (ZCLOSE(zi->z_filefunc,zi->filestream) != 0) 1209 if (ZCLOSE(zi->z_filefunc,zi->filestream) != 0)
1210 if (err == ZIP_OK) 1210 if (err == ZIP_OK)
1211 err = ZIP_ERRNO; 1211 err = ZIP_ERRNO;
1212 1212
1213#ifndef NO_ADDFILEINEXISTINGZIP 1213#ifndef NO_ADDFILEINEXISTINGZIP
1214 TRYFREE(zi->globalcomment); 1214 TRYFREE(zi->globalcomment);
1215#endif 1215#endif
1216 TRYFREE(zi); 1216 TRYFREE(zi);
1217 1217
1218 return err; 1218 return err;
1219} 1219}
diff --git a/contrib/minizip/zip.h b/contrib/minizip/zip.h
index cd38b67..acacce8 100644
--- a/contrib/minizip/zip.h
+++ b/contrib/minizip/zip.h
@@ -1,235 +1,235 @@
1/* zip.h -- IO for compress .zip files using zlib 1/* zip.h -- IO for compress .zip files using zlib
2 Version 1.01e, February 12th, 2005 2 Version 1.01e, February 12th, 2005
3 3
4 Copyright (C) 1998-2005 Gilles Vollant 4 Copyright (C) 1998-2005 Gilles Vollant
5 5
6 This unzip package allow creates .ZIP file, compatible with PKZip 2.04g 6 This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
7 WinZip, InfoZip tools and compatible. 7 WinZip, InfoZip tools and compatible.
8 Multi volume ZipFile (span) are not supported. 8 Multi volume ZipFile (span) are not supported.
9 Encryption compatible with pkzip 2.04g only supported 9 Encryption compatible with pkzip 2.04g only supported
10 Old compressions used by old PKZip 1.x are not supported 10 Old compressions used by old PKZip 1.x are not supported
11 11
12 For uncompress .zip file, look at unzip.h 12 For uncompress .zip file, look at unzip.h
13 13
14 14
15 I WAIT FEEDBACK at mail info@winimage.com 15 I WAIT FEEDBACK at mail info@winimage.com
16 Visit also http://www.winimage.com/zLibDll/unzip.html for evolution 16 Visit also http://www.winimage.com/zLibDll/unzip.html for evolution
17 17
18 Condition of use and distribution are the same than zlib : 18 Condition of use and distribution are the same than zlib :
19 19
20 This software is provided 'as-is', without any express or implied 20 This software is provided 'as-is', without any express or implied
21 warranty. In no event will the authors be held liable for any damages 21 warranty. In no event will the authors be held liable for any damages
22 arising from the use of this software. 22 arising from the use of this software.
23 23
24 Permission is granted to anyone to use this software for any purpose, 24 Permission is granted to anyone to use this software for any purpose,
25 including commercial applications, and to alter it and redistribute it 25 including commercial applications, and to alter it and redistribute it
26 freely, subject to the following restrictions: 26 freely, subject to the following restrictions:
27 27
28 1. The origin of this software must not be misrepresented; you must not 28 1. The origin of this software must not be misrepresented; you must not
29 claim that you wrote the original software. If you use this software 29 claim that you wrote the original software. If you use this software
30 in a product, an acknowledgment in the product documentation would be 30 in a product, an acknowledgment in the product documentation would be
31 appreciated but is not required. 31 appreciated but is not required.
32 2. Altered source versions must be plainly marked as such, and must not be 32 2. Altered source versions must be plainly marked as such, and must not be
33 misrepresented as being the original software. 33 misrepresented as being the original software.
34 3. This notice may not be removed or altered from any source distribution. 34 3. This notice may not be removed or altered from any source distribution.
35 35
36 36
37*/ 37*/
38 38
39/* for more info about .ZIP format, see 39/* for more info about .ZIP format, see
40 http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip 40 http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
41 http://www.info-zip.org/pub/infozip/doc/ 41 http://www.info-zip.org/pub/infozip/doc/
42 PkWare has also a specification at : 42 PkWare has also a specification at :
43 ftp://ftp.pkware.com/probdesc.zip 43 ftp://ftp.pkware.com/probdesc.zip
44*/ 44*/
45 45
46#ifndef _zip_H 46#ifndef _zip_H
47#define _zip_H 47#define _zip_H
48 48
49#ifdef __cplusplus 49#ifdef __cplusplus
50extern "C" { 50extern "C" {
51#endif 51#endif
52 52
53#ifndef _ZLIB_H 53#ifndef _ZLIB_H
54#include "zlib.h" 54#include "zlib.h"
55#endif 55#endif
56 56
57#ifndef _ZLIBIOAPI_H 57#ifndef _ZLIBIOAPI_H
58#include "ioapi.h" 58#include "ioapi.h"
59#endif 59#endif
60 60
61#if defined(STRICTZIP) || defined(STRICTZIPUNZIP) 61#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
62/* like the STRICT of WIN32, we define a pointer that cannot be converted 62/* like the STRICT of WIN32, we define a pointer that cannot be converted
63 from (void*) without cast */ 63 from (void*) without cast */
64typedef struct TagzipFile__ { int unused; } zipFile__; 64typedef struct TagzipFile__ { int unused; } zipFile__;
65typedef zipFile__ *zipFile; 65typedef zipFile__ *zipFile;
66#else 66#else
67typedef voidp zipFile; 67typedef voidp zipFile;
68#endif 68#endif
69 69
70#define ZIP_OK (0) 70#define ZIP_OK (0)
71#define ZIP_EOF (0) 71#define ZIP_EOF (0)
72#define ZIP_ERRNO (Z_ERRNO) 72#define ZIP_ERRNO (Z_ERRNO)
73#define ZIP_PARAMERROR (-102) 73#define ZIP_PARAMERROR (-102)
74#define ZIP_BADZIPFILE (-103) 74#define ZIP_BADZIPFILE (-103)
75#define ZIP_INTERNALERROR (-104) 75#define ZIP_INTERNALERROR (-104)
76 76
77#ifndef DEF_MEM_LEVEL 77#ifndef DEF_MEM_LEVEL
78# if MAX_MEM_LEVEL >= 8 78# if MAX_MEM_LEVEL >= 8
79# define DEF_MEM_LEVEL 8 79# define DEF_MEM_LEVEL 8
80# else 80# else
81# define DEF_MEM_LEVEL MAX_MEM_LEVEL 81# define DEF_MEM_LEVEL MAX_MEM_LEVEL
82# endif 82# endif
83#endif 83#endif
84/* default memLevel */ 84/* default memLevel */
85 85
86/* tm_zip contain date/time info */ 86/* tm_zip contain date/time info */
87typedef struct tm_zip_s 87typedef struct tm_zip_s
88{ 88{
89 uInt tm_sec; /* seconds after the minute - [0,59] */ 89 uInt tm_sec; /* seconds after the minute - [0,59] */
90 uInt tm_min; /* minutes after the hour - [0,59] */ 90 uInt tm_min; /* minutes after the hour - [0,59] */
91 uInt tm_hour; /* hours since midnight - [0,23] */ 91 uInt tm_hour; /* hours since midnight - [0,23] */
92 uInt tm_mday; /* day of the month - [1,31] */ 92 uInt tm_mday; /* day of the month - [1,31] */
93 uInt tm_mon; /* months since January - [0,11] */ 93 uInt tm_mon; /* months since January - [0,11] */
94 uInt tm_year; /* years - [1980..2044] */ 94 uInt tm_year; /* years - [1980..2044] */
95} tm_zip; 95} tm_zip;
96 96
97typedef struct 97typedef struct
98{ 98{
99 tm_zip tmz_date; /* date in understandable format */ 99 tm_zip tmz_date; /* date in understandable format */
100 uLong dosDate; /* if dos_date == 0, tmu_date is used */ 100 uLong dosDate; /* if dos_date == 0, tmu_date is used */
101/* uLong flag; */ /* general purpose bit flag 2 bytes */ 101/* uLong flag; */ /* general purpose bit flag 2 bytes */
102 102
103 uLong internal_fa; /* internal file attributes 2 bytes */ 103 uLong internal_fa; /* internal file attributes 2 bytes */
104 uLong external_fa; /* external file attributes 4 bytes */ 104 uLong external_fa; /* external file attributes 4 bytes */
105} zip_fileinfo; 105} zip_fileinfo;
106 106
107typedef const char* zipcharpc; 107typedef const char* zipcharpc;
108 108
109 109
110#define APPEND_STATUS_CREATE (0) 110#define APPEND_STATUS_CREATE (0)
111#define APPEND_STATUS_CREATEAFTER (1) 111#define APPEND_STATUS_CREATEAFTER (1)
112#define APPEND_STATUS_ADDINZIP (2) 112#define APPEND_STATUS_ADDINZIP (2)
113 113
114extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append)); 114extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
115/* 115/*
116 Create a zipfile. 116 Create a zipfile.
117 pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on 117 pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
118 an Unix computer "zlib/zlib113.zip". 118 an Unix computer "zlib/zlib113.zip".
119 if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip 119 if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
120 will be created at the end of the file. 120 will be created at the end of the file.
121 (useful if the file contain a self extractor code) 121 (useful if the file contain a self extractor code)
122 if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will 122 if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
123 add files in existing zip (be sure you don't add file that doesn't exist) 123 add files in existing zip (be sure you don't add file that doesn't exist)
124 If the zipfile cannot be opened, the return value is NULL. 124 If the zipfile cannot be opened, the return value is NULL.
125 Else, the return value is a zipFile Handle, usable with other function 125 Else, the return value is a zipFile Handle, usable with other function
126 of this zip package. 126 of this zip package.
127*/ 127*/
128 128
129/* Note : there is no delete function into a zipfile. 129/* Note : there is no delete function into a zipfile.
130 If you want delete file into a zipfile, you must open a zipfile, and create another 130 If you want delete file into a zipfile, you must open a zipfile, and create another
131 Of couse, you can use RAW reading and writing to copy the file you did not want delte 131 Of couse, you can use RAW reading and writing to copy the file you did not want delte
132*/ 132*/
133 133
134extern zipFile ZEXPORT zipOpen2 OF((const char *pathname, 134extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
135 int append, 135 int append,
136 zipcharpc* globalcomment, 136 zipcharpc* globalcomment,
137 zlib_filefunc_def* pzlib_filefunc_def)); 137 zlib_filefunc_def* pzlib_filefunc_def));
138 138
139extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file, 139extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
140 const char* filename, 140 const char* filename,
141 const zip_fileinfo* zipfi, 141 const zip_fileinfo* zipfi,
142 const void* extrafield_local, 142 const void* extrafield_local,
143 uInt size_extrafield_local, 143 uInt size_extrafield_local,
144 const void* extrafield_global, 144 const void* extrafield_global,
145 uInt size_extrafield_global, 145 uInt size_extrafield_global,
146 const char* comment, 146 const char* comment,
147 int method, 147 int method,
148 int level)); 148 int level));
149/* 149/*
150 Open a file in the ZIP for writing. 150 Open a file in the ZIP for writing.
151 filename : the filename in zip (if NULL, '-' without quote will be used 151 filename : the filename in zip (if NULL, '-' without quote will be used
152 *zipfi contain supplemental information 152 *zipfi contain supplemental information
153 if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local 153 if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
154 contains the extrafield data the the local header 154 contains the extrafield data the the local header
155 if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global 155 if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
156 contains the extrafield data the the local header 156 contains the extrafield data the the local header
157 if comment != NULL, comment contain the comment string 157 if comment != NULL, comment contain the comment string
158 method contain the compression method (0 for store, Z_DEFLATED for deflate) 158 method contain the compression method (0 for store, Z_DEFLATED for deflate)
159 level contain the level of compression (can be Z_DEFAULT_COMPRESSION) 159 level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
160*/ 160*/
161 161
162 162
163extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file, 163extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
164 const char* filename, 164 const char* filename,
165 const zip_fileinfo* zipfi, 165 const zip_fileinfo* zipfi,
166 const void* extrafield_local, 166 const void* extrafield_local,
167 uInt size_extrafield_local, 167 uInt size_extrafield_local,
168 const void* extrafield_global, 168 const void* extrafield_global,
169 uInt size_extrafield_global, 169 uInt size_extrafield_global,
170 const char* comment, 170 const char* comment,
171 int method, 171 int method,
172 int level, 172 int level,
173 int raw)); 173 int raw));
174 174
175/* 175/*
176 Same than zipOpenNewFileInZip, except if raw=1, we write raw file 176 Same than zipOpenNewFileInZip, except if raw=1, we write raw file
177 */ 177 */
178 178
179extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file, 179extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
180 const char* filename, 180 const char* filename,
181 const zip_fileinfo* zipfi, 181 const zip_fileinfo* zipfi,
182 const void* extrafield_local, 182 const void* extrafield_local,
183 uInt size_extrafield_local, 183 uInt size_extrafield_local,
184 const void* extrafield_global, 184 const void* extrafield_global,
185 uInt size_extrafield_global, 185 uInt size_extrafield_global,
186 const char* comment, 186 const char* comment,
187 int method, 187 int method,
188 int level, 188 int level,
189 int raw, 189 int raw,
190 int windowBits, 190 int windowBits,
191 int memLevel, 191 int memLevel,
192 int strategy, 192 int strategy,
193 const char* password, 193 const char* password,
194 uLong crcForCtypting)); 194 uLong crcForCtypting));
195 195
196/* 196/*
197 Same than zipOpenNewFileInZip2, except 197 Same than zipOpenNewFileInZip2, except
198 windowBits,memLevel,,strategy : see parameter strategy in deflateInit2 198 windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
199 password : crypting password (NULL for no crypting) 199 password : crypting password (NULL for no crypting)
200 crcForCtypting : crc of file to compress (needed for crypting) 200 crcForCtypting : crc of file to compress (needed for crypting)
201 */ 201 */
202 202
203 203
204extern int ZEXPORT zipWriteInFileInZip OF((zipFile file, 204extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
205 const void* buf, 205 const void* buf,
206 unsigned len)); 206 unsigned len));
207/* 207/*
208 Write data in the zipfile 208 Write data in the zipfile
209*/ 209*/
210 210
211extern int ZEXPORT zipCloseFileInZip OF((zipFile file)); 211extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
212/* 212/*
213 Close the current file in the zipfile 213 Close the current file in the zipfile
214*/ 214*/
215 215
216extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file, 216extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
217 uLong uncompressed_size, 217 uLong uncompressed_size,
218 uLong crc32)); 218 uLong crc32));
219/* 219/*
220 Close the current file in the zipfile, for fiel opened with 220 Close the current file in the zipfile, for fiel opened with
221 parameter raw=1 in zipOpenNewFileInZip2 221 parameter raw=1 in zipOpenNewFileInZip2
222 uncompressed_size and crc32 are value for the uncompressed size 222 uncompressed_size and crc32 are value for the uncompressed size
223*/ 223*/
224 224
225extern int ZEXPORT zipClose OF((zipFile file, 225extern int ZEXPORT zipClose OF((zipFile file,
226 const char* global_comment)); 226 const char* global_comment));
227/* 227/*
228 Close the zipfile 228 Close the zipfile
229*/ 229*/
230 230
231#ifdef __cplusplus 231#ifdef __cplusplus
232} 232}
233#endif 233#endif
234 234
235#endif /* _zip_H */ 235#endif /* _zip_H */
diff --git a/contrib/pascal/zlibpas.pas b/contrib/pascal/zlibpas.pas
index 94103d2..836848c 100644
--- a/contrib/pascal/zlibpas.pas
+++ b/contrib/pascal/zlibpas.pas
@@ -10,7 +10,7 @@ unit zlibpas;
10interface 10interface
11 11
12const 12const
13 ZLIB_VERSION = '1.2.2'; 13 ZLIB_VERSION = '1.2.3';
14 14
15type 15type
16 alloc_func = function(opaque: Pointer; items, size: Integer): Pointer; 16 alloc_func = function(opaque: Pointer; items, size: Integer): Pointer;
diff --git a/contrib/testzlib/rdtsc64.asm b/contrib/testzlib/rdtsc64.asm
deleted file mode 100644
index 6b78a8b..0000000
--- a/contrib/testzlib/rdtsc64.asm
+++ /dev/null
@@ -1,18 +0,0 @@
1; rdtsc64.asm
2;
3; unsigned _int64 myrdtsc();
4;
5; return the performance rdtsc value, on AMD64/Intel EM64T
6;
7; compile with :
8; ml64.exe" /Flrdtsc64 /c /Zi rdtsc64.asm
9;
10.code
11myrdtsc PROC
12 rdtsc
13 shl rdx,32
14 or rax,rdx
15 ret
16myrdtsc ENDP
17
18END
diff --git a/contrib/testzlib/rdtsc64.obj b/contrib/testzlib/rdtsc64.obj
deleted file mode 100644
index 7905142..0000000
--- a/contrib/testzlib/rdtsc64.obj
+++ /dev/null
Binary files differ
diff --git a/contrib/testzlib/testzlib.c b/contrib/testzlib/testzlib.c
index 6c3ff9f..e5574f4 100644
--- a/contrib/testzlib/testzlib.c
+++ b/contrib/testzlib/testzlib.c
@@ -1,7 +1,7 @@
1
2#include <stdio.h> 1#include <stdio.h>
3#include <stdlib.h> 2#include <stdlib.h>
4#include <windows.h> 3#include <windows.h>
4
5#include "zlib.h" 5#include "zlib.h"
6 6
7 7
@@ -17,23 +17,25 @@ void MyDoMinus64(LARGE_INTEGER *R,LARGE_INTEGER A,LARGE_INTEGER B)
17 } 17 }
18} 18}
19 19
20#ifdef _AMD64_ 20#ifdef _M_X64
21unsigned _int64 myrdtsc(); 21// see http://msdn2.microsoft.com/library/twchhe95(en-us,vs.80).aspx for __rdtsc
22unsigned __int64 __rdtsc(void);
22void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64) 23void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
23{ 24{
24 // printf("rdtsc = %I64x\n",myrdtsc()); 25 // printf("rdtsc = %I64x\n",__rdtsc());
25 pbeginTime64->QuadPart=myrdtsc(); 26 pbeginTime64->QuadPart=__rdtsc();
26} 27}
27 28
28LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf) 29LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
29{ 30{
30 LARGE_INTEGER LIres; 31 LARGE_INTEGER LIres;
31 unsigned _int64 res=myrdtsc()-((unsigned _int64)(beginTime64.QuadPart)); 32 unsigned _int64 res=__rdtsc()-((unsigned _int64)(beginTime64.QuadPart));
32 LIres.QuadPart=res; 33 LIres.QuadPart=res;
33 // printf("rdtsc = %I64x\n",myrdtsc()); 34 // printf("rdtsc = %I64x\n",__rdtsc());
34 return LIres; 35 return LIres;
35} 36}
36#else 37#else
38#ifdef _M_IX86
37void myGetRDTSC32(LARGE_INTEGER * pbeginTime64) 39void myGetRDTSC32(LARGE_INTEGER * pbeginTime64)
38{ 40{
39 DWORD dwEdx,dwEax; 41 DWORD dwEdx,dwEax;
@@ -61,8 +63,23 @@ LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
61 MyDoMinus64(&LIres,endTime64,beginTime64); 63 MyDoMinus64(&LIres,endTime64,beginTime64);
62 return LIres; 64 return LIres;
63} 65}
64#endif 66#else
67void myGetRDTSC32(LARGE_INTEGER * pbeginTime64)
68{
69}
70
71void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
72{
73}
65 74
75LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
76{
77 LARGE_INTEGER lr;
78 lr.QuadPart=0;
79 return lr;
80}
81#endif
82#endif
66 83
67void BeginCountPerfCounter(LARGE_INTEGER * pbeginTime64,BOOL fComputeTimeQueryPerf) 84void BeginCountPerfCounter(LARGE_INTEGER * pbeginTime64,BOOL fComputeTimeQueryPerf)
68{ 85{
diff --git a/contrib/testzlib/testzlib.sln b/contrib/testzlib/testzlib.sln
deleted file mode 100644
index 86da716..0000000
--- a/contrib/testzlib/testzlib.sln
+++ /dev/null
@@ -1,21 +0,0 @@
1Microsoft Visual Studio Solution File, Format Version 7.00
2Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}"
3EndProject
4Global
5 GlobalSection(SolutionConfiguration) = preSolution
6 ConfigName.0 = Debug
7 ConfigName.1 = Release
8 EndGlobalSection
9 GlobalSection(ProjectDependencies) = postSolution
10 EndGlobalSection
11 GlobalSection(ProjectConfiguration) = postSolution
12 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug.ActiveCfg = Debug|Win32
13 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug.Build.0 = Debug|Win32
14 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release.ActiveCfg = Release|Win32
15 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release.Build.0 = Release|Win32
16 EndGlobalSection
17 GlobalSection(ExtensibilityGlobals) = postSolution
18 EndGlobalSection
19 GlobalSection(ExtensibilityAddIns) = postSolution
20 EndGlobalSection
21EndGlobal
diff --git a/contrib/testzlib/testzlib8.sln b/contrib/testzlib/testzlib8.sln
deleted file mode 100644
index 794f72d..0000000
--- a/contrib/testzlib/testzlib8.sln
+++ /dev/null
@@ -1,32 +0,0 @@
1
2Microsoft Visual Studio Solution File, Format Version 9.00
3# Visual Studio 2005
4Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib8", "testzlib8.vcproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}"
5EndProject
6Global
7 GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 Debug|Win32 = Debug|Win32
9 Debug|Win64 (AMD64) = Debug|Win64 (AMD64)
10 Release|Win32 = Release|Win32
11 Release|Win64 (AMD64) = Release|Win64 (AMD64)
12 ReleaseAsm|Win32 = ReleaseAsm|Win32
13 ReleaseAsm|Win64 (AMD64) = ReleaseAsm|Win64 (AMD64)
14 EndGlobalSection
15 GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32
17 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32
18 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win64 (AMD64).ActiveCfg = Debug|Win64 (AMD64)
19 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win64 (AMD64).Build.0 = Debug|Win64 (AMD64)
20 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32
21 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32
22 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win64 (AMD64).ActiveCfg = Release|Win64 (AMD64)
23 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win64 (AMD64).Build.0 = Release|Win64 (AMD64)
24 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseAsm|Win32.ActiveCfg = ReleaseAsm|Win32
25 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseAsm|Win32.Build.0 = ReleaseAsm|Win32
26 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseAsm|Win64 (AMD64).ActiveCfg = ReleaseAsm|Win64 (AMD64)
27 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseAsm|Win64 (AMD64).Build.0 = ReleaseAsm|Win64 (AMD64)
28 EndGlobalSection
29 GlobalSection(SolutionProperties) = preSolution
30 HideSolutionNode = FALSE
31 EndGlobalSection
32EndGlobal
diff --git a/contrib/vstudio/readme.txt b/contrib/vstudio/readme.txt
index e709d1b..16159f9 100644
--- a/contrib/vstudio/readme.txt
+++ b/contrib/vstudio/readme.txt
@@ -1,8 +1,8 @@
1Building instructions for the DLL versions of Zlib 1.2.x 1Building instructions for the DLL versions of Zlib 1.2.3
2======================================================= 2========================================================
3 3
4This directory contains projects that build zlib and minizip using 4This directory contains projects that build zlib and minizip using
5Microsoft Visual C++ 7.0/7.1. 5Microsoft Visual C++ 7.0/7.1, and Visual C++ .
6 6
7You don't need to build these projects yourself. You can download the 7You don't need to build these projects yourself. You can download the
8binaries from: 8binaries from:
@@ -11,18 +11,36 @@ binaries from:
11More information can be found at this site. 11More information can be found at this site.
12 12
13 13
14Build instructions 14Build instructions for Visual Studio 7.x (32 bits)
15------------------ 15--------------------------------------------------
16- Unzip zlib*.zip and copy the files from contrib\vstudio\vc7, 16- Uncompress current zlib, including all contrib/* files
17 from contrib\vstudio\masmx86 and from contrib\minizip into the same
18 directory.
19- Download the crtdll library from 17- Download the crtdll library from
20 http://www.winimage.com/zLibDll/crtdll.zip 18 http://www.winimage.com/zLibDll/crtdll.zip
21 Unzip crtdll.zip to extract crtdll.lib. 19 Unzip crtdll.zip to extract crtdll.lib on contrib\vstudio\vc7.
22- If you are using x86, use the Release target. 20- Open contrib\vstudio\vc7\zlibvc.sln with Microsoft Visual C++ 7.x
23- Open zlibvc.sln with Microsoft Visual C++ 7.0 or 7.1
24 (Visual Studio .Net 2002 or 2003). 21 (Visual Studio .Net 2002 or 2003).
25 22
23Build instructions for Visual Studio 2005 (32 bits or 64 bits)
24--------------------------------------------------------------
25- Uncompress current zlib, including all contrib/* files
26- For 32 bits only: download the crtdll library from
27 http://www.winimage.com/zLibDll/crtdll.zip
28 Unzip crtdll.zip to extract crtdll.lib on contrib\vstudio\vc8.
29- Open contrib\vstudio\vc8\zlibvc.sln with Microsoft Visual C++ 8.0
30
31Build instructions for Visual Studio 2005 64 bits, PSDK compiler
32----------------------------------------------------------------
33at the time of writing this text file, Visual Studio 2005 (and
34 Microsoft Visual C++ 8.0) is on the beta 2 stage.
35Using you can get the free 64 bits compiler from Platform SDK,
36 which is NOT a beta, and compile using the Visual studio 2005 IDE
37see http://www.winimage.com/misc/sdk64onvs2005/ for instruction
38
39- Uncompress current zlib, including all contrib/* files
40- start Visual Studio 2005 from a platform SDK command prompt, using
41 the /useenv switch
42- Open contrib\vstudio\vc8\zlibvc.sln with Microsoft Visual C++ 8.0
43
26 44
27Important 45Important
28--------- 46---------
diff --git a/contrib/vstudio/vc7/miniunz.vcproj b/contrib/vstudio/vc7/miniunz.vcproj
index 935c250..ad5117c 100644
--- a/contrib/vstudio/vc7/miniunz.vcproj
+++ b/contrib/vstudio/vc7/miniunz.vcproj
@@ -19,6 +19,7 @@
19 <Tool 19 <Tool
20 Name="VCCLCompilerTool" 20 Name="VCCLCompilerTool"
21 Optimization="0" 21 Optimization="0"
22 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
22 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE" 23 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE"
23 MinimalRebuild="TRUE" 24 MinimalRebuild="TRUE"
24 BasicRuntimeChecks="3" 25 BasicRuntimeChecks="3"
@@ -63,6 +64,7 @@
63 Optimization="2" 64 Optimization="2"
64 InlineFunctionExpansion="1" 65 InlineFunctionExpansion="1"
65 OmitFramePointers="TRUE" 66 OmitFramePointers="TRUE"
67 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
66 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE" 68 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE"
67 StringPooling="TRUE" 69 StringPooling="TRUE"
68 RuntimeLibrary="4" 70 RuntimeLibrary="4"
@@ -104,7 +106,7 @@
104 Name="Source Files" 106 Name="Source Files"
105 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> 107 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
106 <File 108 <File
107 RelativePath="miniunz.c"> 109 RelativePath="..\..\minizip\miniunz.c">
108 </File> 110 </File>
109 </Filter> 111 </Filter>
110 <Filter 112 <Filter
@@ -116,7 +118,7 @@
116 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> 118 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
117 </Filter> 119 </Filter>
118 <File 120 <File
119 RelativePath="zlibwapi.lib"> 121 RelativePath="ReleaseDll\zlibwapi.lib">
120 </File> 122 </File>
121 </Files> 123 </Files>
122 <Globals> 124 <Globals>
diff --git a/contrib/vstudio/vc7/minizip.vcproj b/contrib/vstudio/vc7/minizip.vcproj
index e6f9107..fb5b632 100644
--- a/contrib/vstudio/vc7/minizip.vcproj
+++ b/contrib/vstudio/vc7/minizip.vcproj
@@ -19,6 +19,7 @@
19 <Tool 19 <Tool
20 Name="VCCLCompilerTool" 20 Name="VCCLCompilerTool"
21 Optimization="0" 21 Optimization="0"
22 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
22 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE" 23 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE"
23 MinimalRebuild="TRUE" 24 MinimalRebuild="TRUE"
24 BasicRuntimeChecks="3" 25 BasicRuntimeChecks="3"
@@ -63,6 +64,7 @@
63 Optimization="2" 64 Optimization="2"
64 InlineFunctionExpansion="1" 65 InlineFunctionExpansion="1"
65 OmitFramePointers="TRUE" 66 OmitFramePointers="TRUE"
67 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
66 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE" 68 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE"
67 StringPooling="TRUE" 69 StringPooling="TRUE"
68 RuntimeLibrary="4" 70 RuntimeLibrary="4"
@@ -104,7 +106,7 @@
104 Name="Source Files" 106 Name="Source Files"
105 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> 107 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
106 <File 108 <File
107 RelativePath="minizip.c"> 109 RelativePath="..\..\minizip\minizip.c">
108 </File> 110 </File>
109 </Filter> 111 </Filter>
110 <Filter 112 <Filter
@@ -116,7 +118,7 @@
116 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> 118 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
117 </Filter> 119 </Filter>
118 <File 120 <File
119 RelativePath="zlibwapi.lib"> 121 RelativePath="ReleaseDll\zlibwapi.lib">
120 </File> 122 </File>
121 </Files> 123 </Files>
122 <Globals> 124 <Globals>
diff --git a/contrib/testzlib/testzlib.vcproj b/contrib/vstudio/vc7/testzlib.vcproj
index bd9b39b..97bc3e8 100644
--- a/contrib/testzlib/testzlib.vcproj
+++ b/contrib/vstudio/vc7/testzlib.vcproj
@@ -2,8 +2,8 @@
2<VisualStudioProject 2<VisualStudioProject
3 ProjectType="Visual C++" 3 ProjectType="Visual C++"
4 Version="7.00" 4 Version="7.00"
5 Name="testzlib" 5 Name="testZlibDll"
6 ProjectGUID="{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" 6 ProjectGUID="{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}"
7 Keyword="Win32Proj"> 7 Keyword="Win32Proj">
8 <Platforms> 8 <Platforms>
9 <Platform 9 <Platform
@@ -19,6 +19,7 @@
19 <Tool 19 <Tool
20 Name="VCCLCompilerTool" 20 Name="VCCLCompilerTool"
21 Optimization="0" 21 Optimization="0"
22 AdditionalIncludeDirectories="..\..\.."
22 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE" 23 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE"
23 MinimalRebuild="TRUE" 24 MinimalRebuild="TRUE"
24 BasicRuntimeChecks="3" 25 BasicRuntimeChecks="3"
@@ -63,6 +64,7 @@
63 Optimization="2" 64 Optimization="2"
64 InlineFunctionExpansion="1" 65 InlineFunctionExpansion="1"
65 OmitFramePointers="TRUE" 66 OmitFramePointers="TRUE"
67 AdditionalIncludeDirectories="..\..\.."
66 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE" 68 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE"
67 StringPooling="TRUE" 69 StringPooling="TRUE"
68 RuntimeLibrary="4" 70 RuntimeLibrary="4"
@@ -104,7 +106,7 @@
104 Name="Source Files" 106 Name="Source Files"
105 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> 107 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
106 <File 108 <File
107 RelativePath="testzlib.c"> 109 RelativePath="..\..\testzlib\testzlib.c">
108 </File> 110 </File>
109 </Filter> 111 </Filter>
110 <Filter 112 <Filter
@@ -116,7 +118,7 @@
116 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"> 118 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
117 </Filter> 119 </Filter>
118 <File 120 <File
119 RelativePath="zlibwapi.lib"> 121 RelativePath="ReleaseDll\zlibwapi.lib">
120 </File> 122 </File>
121 </Files> 123 </Files>
122 <Globals> 124 <Globals>
diff --git a/contrib/vstudio/vc7/zlib.rc b/contrib/vstudio/vc7/zlib.rc
index e9d748f..72cb8b4 100644
--- a/contrib/vstudio/vc7/zlib.rc
+++ b/contrib/vstudio/vc7/zlib.rc
@@ -2,8 +2,8 @@
2 2
3#define IDR_VERSION1 1 3#define IDR_VERSION1 1
4IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 4IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
5 FILEVERSION 1,2,2,4 5 FILEVERSION 1,2,3,0
6 PRODUCTVERSION 1,2,2,4 6 PRODUCTVERSION 1,2,3,0
7 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 7 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
8 FILEFLAGS 0 8 FILEFLAGS 0
9 FILEOS VOS_DOS_WINDOWS32 9 FILEOS VOS_DOS_WINDOWS32
@@ -17,7 +17,7 @@ BEGIN
17 17
18 BEGIN 18 BEGIN
19 VALUE "FileDescription", "zlib data compression library\0" 19 VALUE "FileDescription", "zlib data compression library\0"
20 VALUE "FileVersion", "1.2.2.4\0" 20 VALUE "FileVersion", "1.2.3.0\0"
21 VALUE "InternalName", "zlib\0" 21 VALUE "InternalName", "zlib\0"
22 VALUE "OriginalFilename", "zlib.dll\0" 22 VALUE "OriginalFilename", "zlib.dll\0"
23 VALUE "ProductName", "ZLib.DLL\0" 23 VALUE "ProductName", "ZLib.DLL\0"
diff --git a/contrib/vstudio/vc7/zlibstat.vcproj b/contrib/vstudio/vc7/zlibstat.vcproj
index eb182f7..766d7a4 100644
--- a/contrib/vstudio/vc7/zlibstat.vcproj
+++ b/contrib/vstudio/vc7/zlibstat.vcproj
@@ -20,6 +20,7 @@
20 <Tool 20 <Tool
21 Name="VCCLCompilerTool" 21 Name="VCCLCompilerTool"
22 Optimization="0" 22 Optimization="0"
23 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
23 PreprocessorDefinitions="WIN32;ZLIB_WINAPI" 24 PreprocessorDefinitions="WIN32;ZLIB_WINAPI"
24 ExceptionHandling="FALSE" 25 ExceptionHandling="FALSE"
25 RuntimeLibrary="5" 26 RuntimeLibrary="5"
@@ -61,6 +62,7 @@
61 <Tool 62 <Tool
62 Name="VCCLCompilerTool" 63 Name="VCCLCompilerTool"
63 InlineFunctionExpansion="1" 64 InlineFunctionExpansion="1"
65 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
64 PreprocessorDefinitions="WIN32;ZLIB_WINAPI" 66 PreprocessorDefinitions="WIN32;ZLIB_WINAPI"
65 StringPooling="TRUE" 67 StringPooling="TRUE"
66 ExceptionHandling="FALSE" 68 ExceptionHandling="FALSE"
@@ -102,6 +104,7 @@
102 <Tool 104 <Tool
103 Name="VCCLCompilerTool" 105 Name="VCCLCompilerTool"
104 InlineFunctionExpansion="1" 106 InlineFunctionExpansion="1"
107 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
105 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;ASMV;ASMINF" 108 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;ASMV;ASMINF"
106 StringPooling="TRUE" 109 StringPooling="TRUE"
107 ExceptionHandling="FALSE" 110 ExceptionHandling="FALSE"
@@ -117,7 +120,7 @@
117 Name="VCCustomBuildTool"/> 120 Name="VCCustomBuildTool"/>
118 <Tool 121 <Tool
119 Name="VCLibrarianTool" 122 Name="VCLibrarianTool"
120 AdditionalOptions="gvmat32.obj inffas32.obj /NODEFAULTLIB " 123 AdditionalOptions="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj /NODEFAULTLIB "
121 OutputFile=".\zlibstat\zlibstat.lib" 124 OutputFile=".\zlibstat\zlibstat.lib"
122 SuppressStartupBanner="TRUE"/> 125 SuppressStartupBanner="TRUE"/>
123 <Tool 126 <Tool
@@ -144,6 +147,7 @@
144 <Tool 147 <Tool
145 Name="VCCLCompilerTool" 148 Name="VCCLCompilerTool"
146 InlineFunctionExpansion="1" 149 InlineFunctionExpansion="1"
150 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
147 PreprocessorDefinitions="WIN32;ZLIB_WINAPI" 151 PreprocessorDefinitions="WIN32;ZLIB_WINAPI"
148 StringPooling="TRUE" 152 StringPooling="TRUE"
149 ExceptionHandling="FALSE" 153 ExceptionHandling="FALSE"
@@ -182,49 +186,49 @@
182 Name="Source Files" 186 Name="Source Files"
183 Filter=""> 187 Filter="">
184 <File 188 <File
185 RelativePath=".\adler32.c"> 189 RelativePath="..\..\..\adler32.c">
186 </File> 190 </File>
187 <File 191 <File
188 RelativePath=".\compress.c"> 192 RelativePath="..\..\..\compress.c">
189 </File> 193 </File>
190 <File 194 <File
191 RelativePath=".\crc32.c"> 195 RelativePath="..\..\..\crc32.c">
192 </File> 196 </File>
193 <File 197 <File
194 RelativePath=".\deflate.c"> 198 RelativePath="..\..\..\deflate.c">
195 </File> 199 </File>
196 <File 200 <File
197 RelativePath=".\gvmat32c.c"> 201 RelativePath="..\..\masmx86\gvmat32c.c">
198 </File> 202 </File>
199 <File 203 <File
200 RelativePath=".\gzio.c"> 204 RelativePath="..\..\..\gzio.c">
201 </File> 205 </File>
202 <File 206 <File
203 RelativePath=".\infback.c"> 207 RelativePath="..\..\..\infback.c">
204 </File> 208 </File>
205 <File 209 <File
206 RelativePath=".\inffast.c"> 210 RelativePath="..\..\..\inffast.c">
207 </File> 211 </File>
208 <File 212 <File
209 RelativePath=".\inflate.c"> 213 RelativePath="..\..\..\inflate.c">
210 </File> 214 </File>
211 <File 215 <File
212 RelativePath=".\inftrees.c"> 216 RelativePath="..\..\..\inftrees.c">
213 </File> 217 </File>
214 <File 218 <File
215 RelativePath=".\ioapi.c"> 219 RelativePath="..\..\minizip\ioapi.c">
216 </File> 220 </File>
217 <File 221 <File
218 RelativePath=".\trees.c"> 222 RelativePath="..\..\..\trees.c">
219 </File> 223 </File>
220 <File 224 <File
221 RelativePath=".\uncompr.c"> 225 RelativePath="..\..\..\uncompr.c">
222 </File> 226 </File>
223 <File 227 <File
224 RelativePath=".\unzip.c"> 228 RelativePath="..\..\minizip\unzip.c">
225 </File> 229 </File>
226 <File 230 <File
227 RelativePath=".\zip.c"> 231 RelativePath="..\..\minizip\zip.c">
228 </File> 232 </File>
229 <File 233 <File
230 RelativePath=".\zlib.rc"> 234 RelativePath=".\zlib.rc">
@@ -233,7 +237,7 @@
233 RelativePath=".\zlibvc.def"> 237 RelativePath=".\zlibvc.def">
234 </File> 238 </File>
235 <File 239 <File
236 RelativePath=".\zutil.c"> 240 RelativePath="..\..\..\zutil.c">
237 </File> 241 </File>
238 </Filter> 242 </Filter>
239 </Files> 243 </Files>
diff --git a/contrib/vstudio/vc7/zlibvc.def b/contrib/vstudio/vc7/zlibvc.def
index 6bc26c4..a40e715 100644
--- a/contrib/vstudio/vc7/zlibvc.def
+++ b/contrib/vstudio/vc7/zlibvc.def
@@ -1,5 +1,5 @@
1 1
2VERSION 1.21 2VERSION 1.23
3 3
4HEAPSIZE 1048576,8192 4HEAPSIZE 1048576,8192
5 5
@@ -53,7 +53,7 @@ EXPORTS
53 deflateBound @47 53 deflateBound @47
54 gzclearerr @48 54 gzclearerr @48
55 gzungetc @49 55 gzungetc @49
56 zlibCompileFlags @50 56 zlibCompileFlags @50
57 deflatePrime @51 57 deflatePrime @51
58 58
59 unzOpen @61 59 unzOpen @61
diff --git a/contrib/vstudio/vc7/zlibvc.sln b/contrib/vstudio/vc7/zlibvc.sln
index 5a007ff..927b42b 100644
--- a/contrib/vstudio/vc7/zlibvc.sln
+++ b/contrib/vstudio/vc7/zlibvc.sln
@@ -7,6 +7,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcproj",
7EndProject 7EndProject
8Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" 8Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}"
9EndProject 9EndProject
10Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testZlibDll", "testzlib.vcproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}"
11EndProject
10Global 12Global
11 GlobalSection(SolutionConfiguration) = preSolution 13 GlobalSection(SolutionConfiguration) = preSolution
12 ConfigName.0 = Debug 14 ConfigName.0 = Debug
@@ -58,6 +60,16 @@ Global
58 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm.Build.0 = Release|Win32 60 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm.Build.0 = Release|Win32
59 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutCrtdll.ActiveCfg = Release|Win32 61 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutCrtdll.ActiveCfg = Release|Win32
60 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutCrtdll.Build.0 = Release|Win32 62 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutCrtdll.Build.0 = Release|Win32
63 {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Debug.ActiveCfg = Debug|Win32
64 {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Debug.Build.0 = Debug|Win32
65 {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Release.ActiveCfg = Release|Win32
66 {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Release.Build.0 = Release|Win32
67 {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseAxp.ActiveCfg = Release|Win32
68 {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseAxp.Build.0 = Release|Win32
69 {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutAsm.ActiveCfg = Release|Win32
70 {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutAsm.Build.0 = Release|Win32
71 {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutCrtdll.ActiveCfg = Release|Win32
72 {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutCrtdll.Build.0 = Release|Win32
61 EndGlobalSection 73 EndGlobalSection
62 GlobalSection(ExtensibilityGlobals) = postSolution 74 GlobalSection(ExtensibilityGlobals) = postSolution
63 EndGlobalSection 75 EndGlobalSection
diff --git a/contrib/vstudio/vc7/zlibvc.vcproj b/contrib/vstudio/vc7/zlibvc.vcproj
index 4e57bcd..8533b49 100644
--- a/contrib/vstudio/vc7/zlibvc.vcproj
+++ b/contrib/vstudio/vc7/zlibvc.vcproj
@@ -20,6 +20,7 @@
20 <Tool 20 <Tool
21 Name="VCCLCompilerTool" 21 Name="VCCLCompilerTool"
22 Optimization="0" 22 Optimization="0"
23 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
23 PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF" 24 PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF"
24 ExceptionHandling="FALSE" 25 ExceptionHandling="FALSE"
25 RuntimeLibrary="1" 26 RuntimeLibrary="1"
@@ -35,7 +36,7 @@
35 <Tool 36 <Tool
36 Name="VCLinkerTool" 37 Name="VCLinkerTool"
37 AdditionalOptions="/MACHINE:I386" 38 AdditionalOptions="/MACHINE:I386"
38 AdditionalDependencies="gvmat32.obj inffas32.obj" 39 AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj"
39 OutputFile=".\DebugDll\zlibwapi.dll" 40 OutputFile=".\DebugDll\zlibwapi.dll"
40 LinkIncremental="2" 41 LinkIncremental="2"
41 SuppressStartupBanner="TRUE" 42 SuppressStartupBanner="TRUE"
@@ -72,10 +73,12 @@
72 IntermediateDirectory=".\zlibDllWithoutAsm" 73 IntermediateDirectory=".\zlibDllWithoutAsm"
73 ConfigurationType="2" 74 ConfigurationType="2"
74 UseOfMFC="0" 75 UseOfMFC="0"
75 ATLMinimizesCRunTimeLibraryUsage="FALSE"> 76 ATLMinimizesCRunTimeLibraryUsage="FALSE"
77 WholeProgramOptimization="TRUE">
76 <Tool 78 <Tool
77 Name="VCCLCompilerTool" 79 Name="VCCLCompilerTool"
78 InlineFunctionExpansion="1" 80 InlineFunctionExpansion="1"
81 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
79 PreprocessorDefinitions="WIN32,ZLIB_WINAPI" 82 PreprocessorDefinitions="WIN32,ZLIB_WINAPI"
80 StringPooling="TRUE" 83 StringPooling="TRUE"
81 ExceptionHandling="FALSE" 84 ExceptionHandling="FALSE"
@@ -134,10 +137,12 @@
134 IntermediateDirectory=".\zlibDllWithoutCrtDll" 137 IntermediateDirectory=".\zlibDllWithoutCrtDll"
135 ConfigurationType="2" 138 ConfigurationType="2"
136 UseOfMFC="0" 139 UseOfMFC="0"
137 ATLMinimizesCRunTimeLibraryUsage="FALSE"> 140 ATLMinimizesCRunTimeLibraryUsage="FALSE"
141 WholeProgramOptimization="TRUE">
138 <Tool 142 <Tool
139 Name="VCCLCompilerTool" 143 Name="VCCLCompilerTool"
140 InlineFunctionExpansion="1" 144 InlineFunctionExpansion="1"
145 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
141 PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF" 146 PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF"
142 StringPooling="TRUE" 147 StringPooling="TRUE"
143 ExceptionHandling="FALSE" 148 ExceptionHandling="FALSE"
@@ -156,7 +161,7 @@
156 <Tool 161 <Tool
157 Name="VCLinkerTool" 162 Name="VCLinkerTool"
158 AdditionalOptions="/MACHINE:I386" 163 AdditionalOptions="/MACHINE:I386"
159 AdditionalDependencies="gvmat32.obj inffas32.obj " 164 AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj "
160 OutputFile=".\zlibDllWithoutCrtDll\zlibwapi.dll" 165 OutputFile=".\zlibDllWithoutCrtDll\zlibwapi.dll"
161 LinkIncremental="1" 166 LinkIncremental="1"
162 SuppressStartupBanner="TRUE" 167 SuppressStartupBanner="TRUE"
@@ -196,10 +201,12 @@
196 IntermediateDirectory=".\zlibvc__" 201 IntermediateDirectory=".\zlibvc__"
197 ConfigurationType="2" 202 ConfigurationType="2"
198 UseOfMFC="0" 203 UseOfMFC="0"
199 ATLMinimizesCRunTimeLibraryUsage="FALSE"> 204 ATLMinimizesCRunTimeLibraryUsage="FALSE"
205 WholeProgramOptimization="TRUE">
200 <Tool 206 <Tool
201 Name="VCCLCompilerTool" 207 Name="VCCLCompilerTool"
202 InlineFunctionExpansion="1" 208 InlineFunctionExpansion="1"
209 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
203 PreprocessorDefinitions="WIN32,ZLIB_WINAPI" 210 PreprocessorDefinitions="WIN32,ZLIB_WINAPI"
204 StringPooling="TRUE" 211 StringPooling="TRUE"
205 ExceptionHandling="FALSE" 212 ExceptionHandling="FALSE"
@@ -256,10 +263,12 @@
256 IntermediateDirectory=".\ReleaseDll" 263 IntermediateDirectory=".\ReleaseDll"
257 ConfigurationType="2" 264 ConfigurationType="2"
258 UseOfMFC="0" 265 UseOfMFC="0"
259 ATLMinimizesCRunTimeLibraryUsage="FALSE"> 266 ATLMinimizesCRunTimeLibraryUsage="FALSE"
267 WholeProgramOptimization="TRUE">
260 <Tool 268 <Tool
261 Name="VCCLCompilerTool" 269 Name="VCCLCompilerTool"
262 InlineFunctionExpansion="1" 270 InlineFunctionExpansion="1"
271 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
263 PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF" 272 PreprocessorDefinitions="WIN32,ZLIB_WINAPI,ASMV,ASMINF"
264 StringPooling="TRUE" 273 StringPooling="TRUE"
265 ExceptionHandling="FALSE" 274 ExceptionHandling="FALSE"
@@ -278,7 +287,7 @@
278 <Tool 287 <Tool
279 Name="VCLinkerTool" 288 Name="VCLinkerTool"
280 AdditionalOptions="/MACHINE:I386" 289 AdditionalOptions="/MACHINE:I386"
281 AdditionalDependencies="gvmat32.obj inffas32.obj crtdll.lib" 290 AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj crtdll.lib"
282 OutputFile=".\ReleaseDll\zlibwapi.dll" 291 OutputFile=".\ReleaseDll\zlibwapi.dll"
283 LinkIncremental="1" 292 LinkIncremental="1"
284 SuppressStartupBanner="TRUE" 293 SuppressStartupBanner="TRUE"
@@ -318,19 +327,19 @@
318 Name="Source Files" 327 Name="Source Files"
319 Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"> 328 Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90">
320 <File 329 <File
321 RelativePath=".\adler32.c"> 330 RelativePath="..\..\..\adler32.c">
322 </File> 331 </File>
323 <File 332 <File
324 RelativePath=".\compress.c"> 333 RelativePath="..\..\..\compress.c">
325 </File> 334 </File>
326 <File 335 <File
327 RelativePath=".\crc32.c"> 336 RelativePath="..\..\..\crc32.c">
328 </File> 337 </File>
329 <File 338 <File
330 RelativePath=".\deflate.c"> 339 RelativePath="..\..\..\deflate.c">
331 </File> 340 </File>
332 <File 341 <File
333 RelativePath=".\gvmat32c.c"> 342 RelativePath="..\..\masmx86\gvmat32c.c">
334 <FileConfiguration 343 <FileConfiguration
335 Name="ReleaseWithoutAsm|Win32" 344 Name="ReleaseWithoutAsm|Win32"
336 ExcludedFromBuild="TRUE"> 345 ExcludedFromBuild="TRUE">
@@ -339,34 +348,34 @@
339 </FileConfiguration> 348 </FileConfiguration>
340 </File> 349 </File>
341 <File 350 <File
342 RelativePath=".\gzio.c"> 351 RelativePath="..\..\..\gzio.c">
343 </File> 352 </File>
344 <File 353 <File
345 RelativePath=".\infback.c"> 354 RelativePath="..\..\..\infback.c">
346 </File> 355 </File>
347 <File 356 <File
348 RelativePath=".\inffast.c"> 357 RelativePath="..\..\..\inffast.c">
349 </File> 358 </File>
350 <File 359 <File
351 RelativePath=".\inflate.c"> 360 RelativePath="..\..\..\inflate.c">
352 </File> 361 </File>
353 <File 362 <File
354 RelativePath=".\inftrees.c"> 363 RelativePath="..\..\..\inftrees.c">
355 </File> 364 </File>
356 <File 365 <File
357 RelativePath=".\ioapi.c"> 366 RelativePath="..\..\minizip\ioapi.c">
358 </File> 367 </File>
359 <File 368 <File
360 RelativePath=".\iowin32.c"> 369 RelativePath="..\..\minizip\iowin32.c">
361 </File> 370 </File>
362 <File 371 <File
363 RelativePath=".\trees.c"> 372 RelativePath="..\..\..\trees.c">
364 </File> 373 </File>
365 <File 374 <File
366 RelativePath=".\uncompr.c"> 375 RelativePath="..\..\..\uncompr.c">
367 </File> 376 </File>
368 <File 377 <File
369 RelativePath=".\unzip.c"> 378 RelativePath="..\..\minizip\unzip.c">
370 <FileConfiguration 379 <FileConfiguration
371 Name="Release|Win32"> 380 Name="Release|Win32">
372 <Tool 381 <Tool
@@ -376,7 +385,7 @@
376 </FileConfiguration> 385 </FileConfiguration>
377 </File> 386 </File>
378 <File 387 <File
379 RelativePath=".\zip.c"> 388 RelativePath="..\..\minizip\zip.c">
380 <FileConfiguration 389 <FileConfiguration
381 Name="Release|Win32"> 390 Name="Release|Win32">
382 <Tool 391 <Tool
@@ -392,38 +401,38 @@
392 RelativePath=".\zlibvc.def"> 401 RelativePath=".\zlibvc.def">
393 </File> 402 </File>
394 <File 403 <File
395 RelativePath=".\zutil.c"> 404 RelativePath="..\..\..\zutil.c">
396 </File> 405 </File>
397 </Filter> 406 </Filter>
398 <Filter 407 <Filter
399 Name="Header Files" 408 Name="Header Files"
400 Filter="h;hpp;hxx;hm;inl;fi;fd"> 409 Filter="h;hpp;hxx;hm;inl;fi;fd">
401 <File 410 <File
402 RelativePath=".\deflate.h"> 411 RelativePath="..\..\..\deflate.h">
403 </File> 412 </File>
404 <File 413 <File
405 RelativePath=".\infblock.h"> 414 RelativePath="..\..\..\infblock.h">
406 </File> 415 </File>
407 <File 416 <File
408 RelativePath=".\infcodes.h"> 417 RelativePath="..\..\..\infcodes.h">
409 </File> 418 </File>
410 <File 419 <File
411 RelativePath=".\inffast.h"> 420 RelativePath="..\..\..\inffast.h">
412 </File> 421 </File>
413 <File 422 <File
414 RelativePath=".\inftrees.h"> 423 RelativePath="..\..\..\inftrees.h">
415 </File> 424 </File>
416 <File 425 <File
417 RelativePath=".\infutil.h"> 426 RelativePath="..\..\..\infutil.h">
418 </File> 427 </File>
419 <File 428 <File
420 RelativePath=".\zconf.h"> 429 RelativePath="..\..\..\zconf.h">
421 </File> 430 </File>
422 <File 431 <File
423 RelativePath=".\zlib.h"> 432 RelativePath="..\..\..\zlib.h">
424 </File> 433 </File>
425 <File 434 <File
426 RelativePath=".\zutil.h"> 435 RelativePath="..\..\..\zutil.h">
427 </File> 436 </File>
428 </Filter> 437 </Filter>
429 <Filter 438 <Filter
diff --git a/contrib/vstudio/vc8/miniunz.vcproj b/contrib/vstudio/vc8/miniunz.vcproj
new file mode 100644
index 0000000..4af53e8
--- /dev/null
+++ b/contrib/vstudio/vc8/miniunz.vcproj
@@ -0,0 +1,566 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="8,00"
5 Name="miniunz"
6 ProjectGUID="{C52F9E7B-498A-42BE-8DB4-85A15694382A}"
7 Keyword="Win32Proj"
8 >
9 <Platforms>
10 <Platform
11 Name="Win32"
12 />
13 <Platform
14 Name="x64"
15 />
16 <Platform
17 Name="Itanium"
18 />
19 </Platforms>
20 <ToolFiles>
21 </ToolFiles>
22 <Configurations>
23 <Configuration
24 Name="Debug|Win32"
25 OutputDirectory="x86\MiniUnzip$(ConfigurationName)"
26 IntermediateDirectory="x86\MiniUnzip$(ConfigurationName)\Tmp"
27 ConfigurationType="1"
28 InheritedPropertySheets="UpgradeFromVC70.vsprops"
29 CharacterSet="2"
30 >
31 <Tool
32 Name="VCPreBuildEventTool"
33 />
34 <Tool
35 Name="VCCustomBuildTool"
36 />
37 <Tool
38 Name="VCXMLDataGeneratorTool"
39 />
40 <Tool
41 Name="VCWebServiceProxyGeneratorTool"
42 />
43 <Tool
44 Name="VCMIDLTool"
45 />
46 <Tool
47 Name="VCCLCompilerTool"
48 Optimization="0"
49 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
50 PreprocessorDefinitions="WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE"
51 MinimalRebuild="true"
52 BasicRuntimeChecks="0"
53 RuntimeLibrary="1"
54 BufferSecurityCheck="false"
55 UsePrecompiledHeader="0"
56 AssemblerListingLocation="$(IntDir)\"
57 WarningLevel="3"
58 Detect64BitPortabilityProblems="true"
59 DebugInformationFormat="4"
60 />
61 <Tool
62 Name="VCManagedResourceCompilerTool"
63 />
64 <Tool
65 Name="VCResourceCompilerTool"
66 />
67 <Tool
68 Name="VCPreLinkEventTool"
69 />
70 <Tool
71 Name="VCLinkerTool"
72 AdditionalDependencies="x86\ZlibDllDebug\zlibwapi.lib"
73 OutputFile="$(OutDir)/miniunz.exe"
74 LinkIncremental="2"
75 GenerateManifest="false"
76 GenerateDebugInformation="true"
77 ProgramDatabaseFile="$(OutDir)/miniunz.pdb"
78 SubSystem="1"
79 TargetMachine="1"
80 />
81 <Tool
82 Name="VCALinkTool"
83 />
84 <Tool
85 Name="VCManifestTool"
86 />
87 <Tool
88 Name="VCXDCMakeTool"
89 />
90 <Tool
91 Name="VCBscMakeTool"
92 />
93 <Tool
94 Name="VCFxCopTool"
95 />
96 <Tool
97 Name="VCAppVerifierTool"
98 />
99 <Tool
100 Name="VCWebDeploymentTool"
101 />
102 <Tool
103 Name="VCPostBuildEventTool"
104 />
105 </Configuration>
106 <Configuration
107 Name="Debug|x64"
108 OutputDirectory="x64\MiniUnzip$(ConfigurationName)"
109 IntermediateDirectory="x64\MiniUnzip$(ConfigurationName)\Tmp"
110 ConfigurationType="1"
111 InheritedPropertySheets="UpgradeFromVC70.vsprops"
112 CharacterSet="2"
113 >
114 <Tool
115 Name="VCPreBuildEventTool"
116 />
117 <Tool
118 Name="VCCustomBuildTool"
119 />
120 <Tool
121 Name="VCXMLDataGeneratorTool"
122 />
123 <Tool
124 Name="VCWebServiceProxyGeneratorTool"
125 />
126 <Tool
127 Name="VCMIDLTool"
128 TargetEnvironment="3"
129 />
130 <Tool
131 Name="VCCLCompilerTool"
132 Optimization="0"
133 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
134 PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64"
135 MinimalRebuild="true"
136 BasicRuntimeChecks="0"
137 RuntimeLibrary="3"
138 BufferSecurityCheck="false"
139 UsePrecompiledHeader="0"
140 AssemblerListingLocation="$(IntDir)\"
141 WarningLevel="3"
142 Detect64BitPortabilityProblems="true"
143 DebugInformationFormat="3"
144 />
145 <Tool
146 Name="VCManagedResourceCompilerTool"
147 />
148 <Tool
149 Name="VCResourceCompilerTool"
150 />
151 <Tool
152 Name="VCPreLinkEventTool"
153 />
154 <Tool
155 Name="VCLinkerTool"
156 AdditionalDependencies="x64\ZlibDllDebug\zlibwapi.lib"
157 OutputFile="$(OutDir)/miniunz.exe"
158 LinkIncremental="2"
159 GenerateManifest="false"
160 GenerateDebugInformation="true"
161 ProgramDatabaseFile="$(OutDir)/miniunz.pdb"
162 SubSystem="1"
163 TargetMachine="17"
164 />
165 <Tool
166 Name="VCALinkTool"
167 />
168 <Tool
169 Name="VCManifestTool"
170 />
171 <Tool
172 Name="VCXDCMakeTool"
173 />
174 <Tool
175 Name="VCBscMakeTool"
176 />
177 <Tool
178 Name="VCFxCopTool"
179 />
180 <Tool
181 Name="VCAppVerifierTool"
182 />
183 <Tool
184 Name="VCWebDeploymentTool"
185 />
186 <Tool
187 Name="VCPostBuildEventTool"
188 />
189 </Configuration>
190 <Configuration
191 Name="Debug|Itanium"
192 OutputDirectory="ia64\MiniUnzip$(ConfigurationName)"
193 IntermediateDirectory="ia64\MiniUnzip$(ConfigurationName)\Tmp"
194 ConfigurationType="1"
195 InheritedPropertySheets="UpgradeFromVC70.vsprops"
196 CharacterSet="2"
197 >
198 <Tool
199 Name="VCPreBuildEventTool"
200 />
201 <Tool
202 Name="VCCustomBuildTool"
203 />
204 <Tool
205 Name="VCXMLDataGeneratorTool"
206 />
207 <Tool
208 Name="VCWebServiceProxyGeneratorTool"
209 />
210 <Tool
211 Name="VCMIDLTool"
212 TargetEnvironment="2"
213 />
214 <Tool
215 Name="VCCLCompilerTool"
216 Optimization="0"
217 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
218 PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64"
219 MinimalRebuild="true"
220 BasicRuntimeChecks="0"
221 RuntimeLibrary="3"
222 BufferSecurityCheck="false"
223 UsePrecompiledHeader="0"
224 AssemblerListingLocation="$(IntDir)\"
225 WarningLevel="3"
226 Detect64BitPortabilityProblems="true"
227 DebugInformationFormat="3"
228 />
229 <Tool
230 Name="VCManagedResourceCompilerTool"
231 />
232 <Tool
233 Name="VCResourceCompilerTool"
234 />
235 <Tool
236 Name="VCPreLinkEventTool"
237 />
238 <Tool
239 Name="VCLinkerTool"
240 AdditionalDependencies="ia64\ZlibDllDebug\zlibwapi.lib"
241 OutputFile="$(OutDir)/miniunz.exe"
242 LinkIncremental="2"
243 GenerateManifest="false"
244 GenerateDebugInformation="true"
245 ProgramDatabaseFile="$(OutDir)/miniunz.pdb"
246 SubSystem="1"
247 TargetMachine="5"
248 />
249 <Tool
250 Name="VCALinkTool"
251 />
252 <Tool
253 Name="VCManifestTool"
254 />
255 <Tool
256 Name="VCXDCMakeTool"
257 />
258 <Tool
259 Name="VCBscMakeTool"
260 />
261 <Tool
262 Name="VCFxCopTool"
263 />
264 <Tool
265 Name="VCAppVerifierTool"
266 />
267 <Tool
268 Name="VCWebDeploymentTool"
269 />
270 <Tool
271 Name="VCPostBuildEventTool"
272 />
273 </Configuration>
274 <Configuration
275 Name="Release|Win32"
276 OutputDirectory="x86\MiniUnzip$(ConfigurationName)"
277 IntermediateDirectory="x86\MiniUnzip$(ConfigurationName)\Tmp"
278 ConfigurationType="1"
279 InheritedPropertySheets="UpgradeFromVC70.vsprops"
280 CharacterSet="2"
281 >
282 <Tool
283 Name="VCPreBuildEventTool"
284 />
285 <Tool
286 Name="VCCustomBuildTool"
287 />
288 <Tool
289 Name="VCXMLDataGeneratorTool"
290 />
291 <Tool
292 Name="VCWebServiceProxyGeneratorTool"
293 />
294 <Tool
295 Name="VCMIDLTool"
296 />
297 <Tool
298 Name="VCCLCompilerTool"
299 Optimization="2"
300 InlineFunctionExpansion="1"
301 OmitFramePointers="true"
302 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
303 PreprocessorDefinitions="WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE"
304 StringPooling="true"
305 BasicRuntimeChecks="0"
306 RuntimeLibrary="0"
307 BufferSecurityCheck="false"
308 EnableFunctionLevelLinking="true"
309 UsePrecompiledHeader="0"
310 AssemblerListingLocation="$(IntDir)\"
311 WarningLevel="3"
312 Detect64BitPortabilityProblems="true"
313 DebugInformationFormat="3"
314 />
315 <Tool
316 Name="VCManagedResourceCompilerTool"
317 />
318 <Tool
319 Name="VCResourceCompilerTool"
320 />
321 <Tool
322 Name="VCPreLinkEventTool"
323 />
324 <Tool
325 Name="VCLinkerTool"
326 AdditionalDependencies="x86\ZlibDllRelease\zlibwapi.lib"
327 OutputFile="$(OutDir)/miniunz.exe"
328 LinkIncremental="1"
329 GenerateManifest="false"
330 GenerateDebugInformation="true"
331 SubSystem="1"
332 OptimizeReferences="2"
333 EnableCOMDATFolding="2"
334 OptimizeForWindows98="1"
335 TargetMachine="1"
336 />
337 <Tool
338 Name="VCALinkTool"
339 />
340 <Tool
341 Name="VCManifestTool"
342 />
343 <Tool
344 Name="VCXDCMakeTool"
345 />
346 <Tool
347 Name="VCBscMakeTool"
348 />
349 <Tool
350 Name="VCFxCopTool"
351 />
352 <Tool
353 Name="VCAppVerifierTool"
354 />
355 <Tool
356 Name="VCWebDeploymentTool"
357 />
358 <Tool
359 Name="VCPostBuildEventTool"
360 />
361 </Configuration>
362 <Configuration
363 Name="Release|x64"
364 OutputDirectory="x64\MiniUnzip$(ConfigurationName)"
365 IntermediateDirectory="x64\MiniUnzip$(ConfigurationName)\Tmp"
366 ConfigurationType="1"
367 InheritedPropertySheets="UpgradeFromVC70.vsprops"
368 CharacterSet="2"
369 >
370 <Tool
371 Name="VCPreBuildEventTool"
372 />
373 <Tool
374 Name="VCCustomBuildTool"
375 />
376 <Tool
377 Name="VCXMLDataGeneratorTool"
378 />
379 <Tool
380 Name="VCWebServiceProxyGeneratorTool"
381 />
382 <Tool
383 Name="VCMIDLTool"
384 TargetEnvironment="3"
385 />
386 <Tool
387 Name="VCCLCompilerTool"
388 Optimization="2"
389 InlineFunctionExpansion="1"
390 OmitFramePointers="true"
391 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
392 PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64"
393 StringPooling="true"
394 BasicRuntimeChecks="0"
395 RuntimeLibrary="2"
396 BufferSecurityCheck="false"
397 EnableFunctionLevelLinking="true"
398 UsePrecompiledHeader="0"
399 AssemblerListingLocation="$(IntDir)\"
400 WarningLevel="3"
401 Detect64BitPortabilityProblems="true"
402 DebugInformationFormat="3"
403 />
404 <Tool
405 Name="VCManagedResourceCompilerTool"
406 />
407 <Tool
408 Name="VCResourceCompilerTool"
409 />
410 <Tool
411 Name="VCPreLinkEventTool"
412 />
413 <Tool
414 Name="VCLinkerTool"
415 AdditionalDependencies="x64\ZlibDllRelease\zlibwapi.lib"
416 OutputFile="$(OutDir)/miniunz.exe"
417 LinkIncremental="1"
418 GenerateManifest="false"
419 GenerateDebugInformation="true"
420 SubSystem="1"
421 OptimizeReferences="2"
422 EnableCOMDATFolding="2"
423 OptimizeForWindows98="1"
424 TargetMachine="17"
425 />
426 <Tool
427 Name="VCALinkTool"
428 />
429 <Tool
430 Name="VCManifestTool"
431 />
432 <Tool
433 Name="VCXDCMakeTool"
434 />
435 <Tool
436 Name="VCBscMakeTool"
437 />
438 <Tool
439 Name="VCFxCopTool"
440 />
441 <Tool
442 Name="VCAppVerifierTool"
443 />
444 <Tool
445 Name="VCWebDeploymentTool"
446 />
447 <Tool
448 Name="VCPostBuildEventTool"
449 />
450 </Configuration>
451 <Configuration
452 Name="Release|Itanium"
453 OutputDirectory="ia64\MiniUnzip$(ConfigurationName)"
454 IntermediateDirectory="ia64\MiniUnzip$(ConfigurationName)\Tmp"
455 ConfigurationType="1"
456 InheritedPropertySheets="UpgradeFromVC70.vsprops"
457 CharacterSet="2"
458 >
459 <Tool
460 Name="VCPreBuildEventTool"
461 />
462 <Tool
463 Name="VCCustomBuildTool"
464 />
465 <Tool
466 Name="VCXMLDataGeneratorTool"
467 />
468 <Tool
469 Name="VCWebServiceProxyGeneratorTool"
470 />
471 <Tool
472 Name="VCMIDLTool"
473 TargetEnvironment="2"
474 />
475 <Tool
476 Name="VCCLCompilerTool"
477 Optimization="2"
478 InlineFunctionExpansion="1"
479 OmitFramePointers="true"
480 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
481 PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64"
482 StringPooling="true"
483 BasicRuntimeChecks="0"
484 RuntimeLibrary="2"
485 BufferSecurityCheck="false"
486 EnableFunctionLevelLinking="true"
487 UsePrecompiledHeader="0"
488 AssemblerListingLocation="$(IntDir)\"
489 WarningLevel="3"
490 Detect64BitPortabilityProblems="true"
491 DebugInformationFormat="3"
492 />
493 <Tool
494 Name="VCManagedResourceCompilerTool"
495 />
496 <Tool
497 Name="VCResourceCompilerTool"
498 />
499 <Tool
500 Name="VCPreLinkEventTool"
501 />
502 <Tool
503 Name="VCLinkerTool"
504 AdditionalDependencies="ia64\ZlibDllRelease\zlibwapi.lib"
505 OutputFile="$(OutDir)/miniunz.exe"
506 LinkIncremental="1"
507 GenerateManifest="false"
508 GenerateDebugInformation="true"
509 SubSystem="1"
510 OptimizeReferences="2"
511 EnableCOMDATFolding="2"
512 OptimizeForWindows98="1"
513 TargetMachine="5"
514 />
515 <Tool
516 Name="VCALinkTool"
517 />
518 <Tool
519 Name="VCManifestTool"
520 />
521 <Tool
522 Name="VCXDCMakeTool"
523 />
524 <Tool
525 Name="VCBscMakeTool"
526 />
527 <Tool
528 Name="VCFxCopTool"
529 />
530 <Tool
531 Name="VCAppVerifierTool"
532 />
533 <Tool
534 Name="VCWebDeploymentTool"
535 />
536 <Tool
537 Name="VCPostBuildEventTool"
538 />
539 </Configuration>
540 </Configurations>
541 <References>
542 </References>
543 <Files>
544 <Filter
545 Name="Source Files"
546 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
547 >
548 <File
549 RelativePath="..\..\minizip\miniunz.c"
550 >
551 </File>
552 </Filter>
553 <Filter
554 Name="Header Files"
555 Filter="h;hpp;hxx;hm;inl;inc"
556 >
557 </Filter>
558 <Filter
559 Name="Resource Files"
560 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
561 >
562 </Filter>
563 </Files>
564 <Globals>
565 </Globals>
566</VisualStudioProject>
diff --git a/contrib/vstudio/vc8/minizip.vcproj b/contrib/vstudio/vc8/minizip.vcproj
new file mode 100644
index 0000000..85f64c4
--- /dev/null
+++ b/contrib/vstudio/vc8/minizip.vcproj
@@ -0,0 +1,563 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="8,00"
5 Name="minizip"
6 ProjectGUID="{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}"
7 Keyword="Win32Proj"
8 >
9 <Platforms>
10 <Platform
11 Name="Win32"
12 />
13 <Platform
14 Name="x64"
15 />
16 <Platform
17 Name="Itanium"
18 />
19 </Platforms>
20 <ToolFiles>
21 </ToolFiles>
22 <Configurations>
23 <Configuration
24 Name="Debug|Win32"
25 OutputDirectory="x86\MiniZip$(ConfigurationName)"
26 IntermediateDirectory="x86\MiniZip$(ConfigurationName)\Tmp"
27 ConfigurationType="1"
28 InheritedPropertySheets="UpgradeFromVC70.vsprops"
29 CharacterSet="2"
30 >
31 <Tool
32 Name="VCPreBuildEventTool"
33 />
34 <Tool
35 Name="VCCustomBuildTool"
36 />
37 <Tool
38 Name="VCXMLDataGeneratorTool"
39 />
40 <Tool
41 Name="VCWebServiceProxyGeneratorTool"
42 />
43 <Tool
44 Name="VCMIDLTool"
45 />
46 <Tool
47 Name="VCCLCompilerTool"
48 Optimization="0"
49 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
50 PreprocessorDefinitions="WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE"
51 MinimalRebuild="true"
52 BasicRuntimeChecks="0"
53 RuntimeLibrary="1"
54 BufferSecurityCheck="false"
55 UsePrecompiledHeader="0"
56 AssemblerListingLocation="$(IntDir)\"
57 WarningLevel="3"
58 Detect64BitPortabilityProblems="true"
59 DebugInformationFormat="4"
60 />
61 <Tool
62 Name="VCManagedResourceCompilerTool"
63 />
64 <Tool
65 Name="VCResourceCompilerTool"
66 />
67 <Tool
68 Name="VCPreLinkEventTool"
69 />
70 <Tool
71 Name="VCLinkerTool"
72 AdditionalDependencies="x86\ZlibDllDebug\zlibwapi.lib"
73 OutputFile="$(OutDir)/minizip.exe"
74 LinkIncremental="2"
75 GenerateManifest="false"
76 GenerateDebugInformation="true"
77 ProgramDatabaseFile="$(OutDir)/minizip.pdb"
78 SubSystem="1"
79 TargetMachine="1"
80 />
81 <Tool
82 Name="VCALinkTool"
83 />
84 <Tool
85 Name="VCManifestTool"
86 />
87 <Tool
88 Name="VCXDCMakeTool"
89 />
90 <Tool
91 Name="VCBscMakeTool"
92 />
93 <Tool
94 Name="VCFxCopTool"
95 />
96 <Tool
97 Name="VCAppVerifierTool"
98 />
99 <Tool
100 Name="VCWebDeploymentTool"
101 />
102 <Tool
103 Name="VCPostBuildEventTool"
104 />
105 </Configuration>
106 <Configuration
107 Name="Debug|x64"
108 OutputDirectory="x64\$(ConfigurationName)"
109 IntermediateDirectory="x64\$(ConfigurationName)"
110 ConfigurationType="1"
111 InheritedPropertySheets="UpgradeFromVC70.vsprops"
112 CharacterSet="2"
113 >
114 <Tool
115 Name="VCPreBuildEventTool"
116 />
117 <Tool
118 Name="VCCustomBuildTool"
119 />
120 <Tool
121 Name="VCXMLDataGeneratorTool"
122 />
123 <Tool
124 Name="VCWebServiceProxyGeneratorTool"
125 />
126 <Tool
127 Name="VCMIDLTool"
128 TargetEnvironment="3"
129 />
130 <Tool
131 Name="VCCLCompilerTool"
132 Optimization="0"
133 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
134 PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64"
135 MinimalRebuild="true"
136 BasicRuntimeChecks="0"
137 RuntimeLibrary="3"
138 BufferSecurityCheck="false"
139 UsePrecompiledHeader="0"
140 AssemblerListingLocation="$(IntDir)\"
141 WarningLevel="3"
142 Detect64BitPortabilityProblems="true"
143 DebugInformationFormat="3"
144 />
145 <Tool
146 Name="VCManagedResourceCompilerTool"
147 />
148 <Tool
149 Name="VCResourceCompilerTool"
150 />
151 <Tool
152 Name="VCPreLinkEventTool"
153 />
154 <Tool
155 Name="VCLinkerTool"
156 AdditionalDependencies="x64\ZlibDllDebug\zlibwapi.lib"
157 OutputFile="$(OutDir)/minizip.exe"
158 LinkIncremental="2"
159 GenerateManifest="false"
160 GenerateDebugInformation="true"
161 ProgramDatabaseFile="$(OutDir)/minizip.pdb"
162 SubSystem="1"
163 TargetMachine="17"
164 />
165 <Tool
166 Name="VCALinkTool"
167 />
168 <Tool
169 Name="VCManifestTool"
170 />
171 <Tool
172 Name="VCXDCMakeTool"
173 />
174 <Tool
175 Name="VCBscMakeTool"
176 />
177 <Tool
178 Name="VCFxCopTool"
179 />
180 <Tool
181 Name="VCAppVerifierTool"
182 />
183 <Tool
184 Name="VCWebDeploymentTool"
185 />
186 <Tool
187 Name="VCPostBuildEventTool"
188 />
189 </Configuration>
190 <Configuration
191 Name="Debug|Itanium"
192 OutputDirectory="ia64\$(ConfigurationName)"
193 IntermediateDirectory="ia64\$(ConfigurationName)"
194 ConfigurationType="1"
195 InheritedPropertySheets="UpgradeFromVC70.vsprops"
196 CharacterSet="2"
197 >
198 <Tool
199 Name="VCPreBuildEventTool"
200 />
201 <Tool
202 Name="VCCustomBuildTool"
203 />
204 <Tool
205 Name="VCXMLDataGeneratorTool"
206 />
207 <Tool
208 Name="VCWebServiceProxyGeneratorTool"
209 />
210 <Tool
211 Name="VCMIDLTool"
212 TargetEnvironment="2"
213 />
214 <Tool
215 Name="VCCLCompilerTool"
216 Optimization="0"
217 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
218 PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64"
219 MinimalRebuild="true"
220 BasicRuntimeChecks="0"
221 RuntimeLibrary="3"
222 BufferSecurityCheck="false"
223 UsePrecompiledHeader="0"
224 AssemblerListingLocation="$(IntDir)\"
225 WarningLevel="3"
226 Detect64BitPortabilityProblems="true"
227 DebugInformationFormat="3"
228 />
229 <Tool
230 Name="VCManagedResourceCompilerTool"
231 />
232 <Tool
233 Name="VCResourceCompilerTool"
234 />
235 <Tool
236 Name="VCPreLinkEventTool"
237 />
238 <Tool
239 Name="VCLinkerTool"
240 AdditionalDependencies="ia64\ZlibDllDebug\zlibwapi.lib"
241 OutputFile="$(OutDir)/minizip.exe"
242 LinkIncremental="2"
243 GenerateManifest="false"
244 GenerateDebugInformation="true"
245 ProgramDatabaseFile="$(OutDir)/minizip.pdb"
246 SubSystem="1"
247 TargetMachine="5"
248 />
249 <Tool
250 Name="VCALinkTool"
251 />
252 <Tool
253 Name="VCManifestTool"
254 />
255 <Tool
256 Name="VCXDCMakeTool"
257 />
258 <Tool
259 Name="VCBscMakeTool"
260 />
261 <Tool
262 Name="VCFxCopTool"
263 />
264 <Tool
265 Name="VCAppVerifierTool"
266 />
267 <Tool
268 Name="VCWebDeploymentTool"
269 />
270 <Tool
271 Name="VCPostBuildEventTool"
272 />
273 </Configuration>
274 <Configuration
275 Name="Release|Win32"
276 OutputDirectory="x86\MiniZip$(ConfigurationName)"
277 IntermediateDirectory="x86\MiniZip$(ConfigurationName)\Tmp"
278 ConfigurationType="1"
279 InheritedPropertySheets="UpgradeFromVC70.vsprops"
280 CharacterSet="2"
281 >
282 <Tool
283 Name="VCPreBuildEventTool"
284 />
285 <Tool
286 Name="VCCustomBuildTool"
287 />
288 <Tool
289 Name="VCXMLDataGeneratorTool"
290 />
291 <Tool
292 Name="VCWebServiceProxyGeneratorTool"
293 />
294 <Tool
295 Name="VCMIDLTool"
296 />
297 <Tool
298 Name="VCCLCompilerTool"
299 Optimization="2"
300 InlineFunctionExpansion="1"
301 OmitFramePointers="true"
302 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
303 PreprocessorDefinitions="WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE"
304 StringPooling="true"
305 BasicRuntimeChecks="0"
306 RuntimeLibrary="0"
307 BufferSecurityCheck="false"
308 EnableFunctionLevelLinking="true"
309 UsePrecompiledHeader="0"
310 AssemblerListingLocation="$(IntDir)\"
311 WarningLevel="3"
312 Detect64BitPortabilityProblems="true"
313 DebugInformationFormat="3"
314 />
315 <Tool
316 Name="VCManagedResourceCompilerTool"
317 />
318 <Tool
319 Name="VCResourceCompilerTool"
320 />
321 <Tool
322 Name="VCPreLinkEventTool"
323 />
324 <Tool
325 Name="VCLinkerTool"
326 AdditionalDependencies="x86\ZlibDllRelease\zlibwapi.lib"
327 OutputFile="$(OutDir)/minizip.exe"
328 LinkIncremental="1"
329 GenerateDebugInformation="true"
330 SubSystem="1"
331 OptimizeReferences="2"
332 EnableCOMDATFolding="2"
333 OptimizeForWindows98="1"
334 TargetMachine="1"
335 />
336 <Tool
337 Name="VCALinkTool"
338 />
339 <Tool
340 Name="VCManifestTool"
341 />
342 <Tool
343 Name="VCXDCMakeTool"
344 />
345 <Tool
346 Name="VCBscMakeTool"
347 />
348 <Tool
349 Name="VCFxCopTool"
350 />
351 <Tool
352 Name="VCAppVerifierTool"
353 />
354 <Tool
355 Name="VCWebDeploymentTool"
356 />
357 <Tool
358 Name="VCPostBuildEventTool"
359 />
360 </Configuration>
361 <Configuration
362 Name="Release|x64"
363 OutputDirectory="x64\$(ConfigurationName)"
364 IntermediateDirectory="x64\$(ConfigurationName)"
365 ConfigurationType="1"
366 InheritedPropertySheets="UpgradeFromVC70.vsprops"
367 CharacterSet="2"
368 >
369 <Tool
370 Name="VCPreBuildEventTool"
371 />
372 <Tool
373 Name="VCCustomBuildTool"
374 />
375 <Tool
376 Name="VCXMLDataGeneratorTool"
377 />
378 <Tool
379 Name="VCWebServiceProxyGeneratorTool"
380 />
381 <Tool
382 Name="VCMIDLTool"
383 TargetEnvironment="3"
384 />
385 <Tool
386 Name="VCCLCompilerTool"
387 Optimization="2"
388 InlineFunctionExpansion="1"
389 OmitFramePointers="true"
390 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
391 PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64"
392 StringPooling="true"
393 BasicRuntimeChecks="0"
394 RuntimeLibrary="2"
395 BufferSecurityCheck="false"
396 EnableFunctionLevelLinking="true"
397 UsePrecompiledHeader="0"
398 AssemblerListingLocation="$(IntDir)\"
399 WarningLevel="3"
400 Detect64BitPortabilityProblems="true"
401 DebugInformationFormat="3"
402 />
403 <Tool
404 Name="VCManagedResourceCompilerTool"
405 />
406 <Tool
407 Name="VCResourceCompilerTool"
408 />
409 <Tool
410 Name="VCPreLinkEventTool"
411 />
412 <Tool
413 Name="VCLinkerTool"
414 AdditionalDependencies="x64\ZlibDllRelease\zlibwapi.lib"
415 OutputFile="$(OutDir)/minizip.exe"
416 LinkIncremental="1"
417 GenerateDebugInformation="true"
418 SubSystem="1"
419 OptimizeReferences="2"
420 EnableCOMDATFolding="2"
421 OptimizeForWindows98="1"
422 TargetMachine="17"
423 />
424 <Tool
425 Name="VCALinkTool"
426 />
427 <Tool
428 Name="VCManifestTool"
429 />
430 <Tool
431 Name="VCXDCMakeTool"
432 />
433 <Tool
434 Name="VCBscMakeTool"
435 />
436 <Tool
437 Name="VCFxCopTool"
438 />
439 <Tool
440 Name="VCAppVerifierTool"
441 />
442 <Tool
443 Name="VCWebDeploymentTool"
444 />
445 <Tool
446 Name="VCPostBuildEventTool"
447 />
448 </Configuration>
449 <Configuration
450 Name="Release|Itanium"
451 OutputDirectory="ia64\$(ConfigurationName)"
452 IntermediateDirectory="ia64\$(ConfigurationName)"
453 ConfigurationType="1"
454 InheritedPropertySheets="UpgradeFromVC70.vsprops"
455 CharacterSet="2"
456 >
457 <Tool
458 Name="VCPreBuildEventTool"
459 />
460 <Tool
461 Name="VCCustomBuildTool"
462 />
463 <Tool
464 Name="VCXMLDataGeneratorTool"
465 />
466 <Tool
467 Name="VCWebServiceProxyGeneratorTool"
468 />
469 <Tool
470 Name="VCMIDLTool"
471 TargetEnvironment="2"
472 />
473 <Tool
474 Name="VCCLCompilerTool"
475 Optimization="2"
476 InlineFunctionExpansion="1"
477 OmitFramePointers="true"
478 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
479 PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64"
480 StringPooling="true"
481 BasicRuntimeChecks="0"
482 RuntimeLibrary="2"
483 BufferSecurityCheck="false"
484 EnableFunctionLevelLinking="true"
485 UsePrecompiledHeader="0"
486 AssemblerListingLocation="$(IntDir)\"
487 WarningLevel="3"
488 Detect64BitPortabilityProblems="true"
489 DebugInformationFormat="3"
490 />
491 <Tool
492 Name="VCManagedResourceCompilerTool"
493 />
494 <Tool
495 Name="VCResourceCompilerTool"
496 />
497 <Tool
498 Name="VCPreLinkEventTool"
499 />
500 <Tool
501 Name="VCLinkerTool"
502 AdditionalDependencies="ia64\ZlibDllRelease\zlibwapi.lib"
503 OutputFile="$(OutDir)/minizip.exe"
504 LinkIncremental="1"
505 GenerateDebugInformation="true"
506 SubSystem="1"
507 OptimizeReferences="2"
508 EnableCOMDATFolding="2"
509 OptimizeForWindows98="1"
510 TargetMachine="5"
511 />
512 <Tool
513 Name="VCALinkTool"
514 />
515 <Tool
516 Name="VCManifestTool"
517 />
518 <Tool
519 Name="VCXDCMakeTool"
520 />
521 <Tool
522 Name="VCBscMakeTool"
523 />
524 <Tool
525 Name="VCFxCopTool"
526 />
527 <Tool
528 Name="VCAppVerifierTool"
529 />
530 <Tool
531 Name="VCWebDeploymentTool"
532 />
533 <Tool
534 Name="VCPostBuildEventTool"
535 />
536 </Configuration>
537 </Configurations>
538 <References>
539 </References>
540 <Files>
541 <Filter
542 Name="Source Files"
543 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
544 >
545 <File
546 RelativePath="..\..\minizip\minizip.c"
547 >
548 </File>
549 </Filter>
550 <Filter
551 Name="Header Files"
552 Filter="h;hpp;hxx;hm;inl;inc"
553 >
554 </Filter>
555 <Filter
556 Name="Resource Files"
557 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
558 >
559 </Filter>
560 </Files>
561 <Globals>
562 </Globals>
563</VisualStudioProject>
diff --git a/contrib/vstudio/vc8/testzlib.vcproj b/contrib/vstudio/vc8/testzlib.vcproj
new file mode 100644
index 0000000..68c3539
--- /dev/null
+++ b/contrib/vstudio/vc8/testzlib.vcproj
@@ -0,0 +1,948 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="8,00"
5 Name="testzlib"
6 ProjectGUID="{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}"
7 RootNamespace="testzlib"
8 Keyword="Win32Proj"
9 >
10 <Platforms>
11 <Platform
12 Name="Win32"
13 />
14 <Platform
15 Name="x64"
16 />
17 <Platform
18 Name="Itanium"
19 />
20 </Platforms>
21 <ToolFiles>
22 </ToolFiles>
23 <Configurations>
24 <Configuration
25 Name="Debug|Win32"
26 OutputDirectory="x86\TestZlib$(ConfigurationName)"
27 IntermediateDirectory="x86\TestZlib$(ConfigurationName)\Tmp"
28 ConfigurationType="1"
29 CharacterSet="2"
30 >
31 <Tool
32 Name="VCPreBuildEventTool"
33 />
34 <Tool
35 Name="VCCustomBuildTool"
36 />
37 <Tool
38 Name="VCXMLDataGeneratorTool"
39 />
40 <Tool
41 Name="VCWebServiceProxyGeneratorTool"
42 />
43 <Tool
44 Name="VCMIDLTool"
45 />
46 <Tool
47 Name="VCCLCompilerTool"
48 Optimization="0"
49 AdditionalIncludeDirectories="..\..\.."
50 PreprocessorDefinitions="ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
51 MinimalRebuild="true"
52 BasicRuntimeChecks="0"
53 RuntimeLibrary="1"
54 BufferSecurityCheck="false"
55 UsePrecompiledHeader="0"
56 AssemblerOutput="4"
57 AssemblerListingLocation="$(IntDir)\"
58 WarningLevel="3"
59 Detect64BitPortabilityProblems="true"
60 DebugInformationFormat="4"
61 />
62 <Tool
63 Name="VCManagedResourceCompilerTool"
64 />
65 <Tool
66 Name="VCResourceCompilerTool"
67 />
68 <Tool
69 Name="VCPreLinkEventTool"
70 />
71 <Tool
72 Name="VCLinkerTool"
73 AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj"
74 OutputFile="$(OutDir)/testzlib.exe"
75 LinkIncremental="2"
76 GenerateManifest="false"
77 GenerateDebugInformation="true"
78 ProgramDatabaseFile="$(OutDir)/testzlib.pdb"
79 SubSystem="1"
80 TargetMachine="1"
81 />
82 <Tool
83 Name="VCALinkTool"
84 />
85 <Tool
86 Name="VCManifestTool"
87 />
88 <Tool
89 Name="VCXDCMakeTool"
90 />
91 <Tool
92 Name="VCBscMakeTool"
93 />
94 <Tool
95 Name="VCFxCopTool"
96 />
97 <Tool
98 Name="VCAppVerifierTool"
99 />
100 <Tool
101 Name="VCWebDeploymentTool"
102 />
103 <Tool
104 Name="VCPostBuildEventTool"
105 />
106 </Configuration>
107 <Configuration
108 Name="Debug|x64"
109 OutputDirectory="x64\TestZlib$(ConfigurationName)"
110 IntermediateDirectory="x64\TestZlib$(ConfigurationName)\Tmp"
111 ConfigurationType="1"
112 >
113 <Tool
114 Name="VCPreBuildEventTool"
115 />
116 <Tool
117 Name="VCCustomBuildTool"
118 />
119 <Tool
120 Name="VCXMLDataGeneratorTool"
121 />
122 <Tool
123 Name="VCWebServiceProxyGeneratorTool"
124 />
125 <Tool
126 Name="VCMIDLTool"
127 />
128 <Tool
129 Name="VCCLCompilerTool"
130 AdditionalIncludeDirectories="..\..\.."
131 PreprocessorDefinitions="ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
132 BasicRuntimeChecks="0"
133 RuntimeLibrary="3"
134 BufferSecurityCheck="false"
135 AssemblerListingLocation="$(IntDir)\"
136 />
137 <Tool
138 Name="VCManagedResourceCompilerTool"
139 />
140 <Tool
141 Name="VCResourceCompilerTool"
142 />
143 <Tool
144 Name="VCPreLinkEventTool"
145 />
146 <Tool
147 Name="VCLinkerTool"
148 AdditionalDependencies="..\..\masmx64\gvmat64.obj ..\..\masmx64\inffasx64.obj"
149 GenerateManifest="false"
150 />
151 <Tool
152 Name="VCALinkTool"
153 />
154 <Tool
155 Name="VCManifestTool"
156 />
157 <Tool
158 Name="VCXDCMakeTool"
159 />
160 <Tool
161 Name="VCBscMakeTool"
162 />
163 <Tool
164 Name="VCFxCopTool"
165 />
166 <Tool
167 Name="VCAppVerifierTool"
168 />
169 <Tool
170 Name="VCWebDeploymentTool"
171 />
172 <Tool
173 Name="VCPostBuildEventTool"
174 />
175 </Configuration>
176 <Configuration
177 Name="Debug|Itanium"
178 OutputDirectory="ia64\TestZlib$(ConfigurationName)"
179 IntermediateDirectory="ia64\TestZlib$(ConfigurationName)\Tmp"
180 ConfigurationType="1"
181 CharacterSet="2"
182 >
183 <Tool
184 Name="VCPreBuildEventTool"
185 />
186 <Tool
187 Name="VCCustomBuildTool"
188 />
189 <Tool
190 Name="VCXMLDataGeneratorTool"
191 />
192 <Tool
193 Name="VCWebServiceProxyGeneratorTool"
194 />
195 <Tool
196 Name="VCMIDLTool"
197 TargetEnvironment="2"
198 />
199 <Tool
200 Name="VCCLCompilerTool"
201 Optimization="0"
202 AdditionalIncludeDirectories="..\..\.."
203 PreprocessorDefinitions="ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
204 MinimalRebuild="true"
205 BasicRuntimeChecks="0"
206 RuntimeLibrary="3"
207 BufferSecurityCheck="false"
208 UsePrecompiledHeader="0"
209 AssemblerOutput="4"
210 AssemblerListingLocation="$(IntDir)\"
211 WarningLevel="3"
212 Detect64BitPortabilityProblems="true"
213 DebugInformationFormat="3"
214 />
215 <Tool
216 Name="VCManagedResourceCompilerTool"
217 />
218 <Tool
219 Name="VCResourceCompilerTool"
220 />
221 <Tool
222 Name="VCPreLinkEventTool"
223 />
224 <Tool
225 Name="VCLinkerTool"
226 OutputFile="$(OutDir)/testzlib.exe"
227 LinkIncremental="2"
228 GenerateManifest="false"
229 GenerateDebugInformation="true"
230 ProgramDatabaseFile="$(OutDir)/testzlib.pdb"
231 SubSystem="1"
232 TargetMachine="5"
233 />
234 <Tool
235 Name="VCALinkTool"
236 />
237 <Tool
238 Name="VCManifestTool"
239 />
240 <Tool
241 Name="VCXDCMakeTool"
242 />
243 <Tool
244 Name="VCBscMakeTool"
245 />
246 <Tool
247 Name="VCFxCopTool"
248 />
249 <Tool
250 Name="VCAppVerifierTool"
251 />
252 <Tool
253 Name="VCWebDeploymentTool"
254 />
255 <Tool
256 Name="VCPostBuildEventTool"
257 />
258 </Configuration>
259 <Configuration
260 Name="ReleaseWithoutAsm|Win32"
261 OutputDirectory="x86\TestZlib$(ConfigurationName)"
262 IntermediateDirectory="x86\TestZlib$(ConfigurationName)\Tmp"
263 ConfigurationType="1"
264 CharacterSet="2"
265 WholeProgramOptimization="1"
266 >
267 <Tool
268 Name="VCPreBuildEventTool"
269 />
270 <Tool
271 Name="VCCustomBuildTool"
272 />
273 <Tool
274 Name="VCXMLDataGeneratorTool"
275 />
276 <Tool
277 Name="VCWebServiceProxyGeneratorTool"
278 />
279 <Tool
280 Name="VCMIDLTool"
281 />
282 <Tool
283 Name="VCCLCompilerTool"
284 Optimization="2"
285 InlineFunctionExpansion="1"
286 OmitFramePointers="true"
287 AdditionalIncludeDirectories="..\..\.."
288 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
289 StringPooling="true"
290 BasicRuntimeChecks="0"
291 RuntimeLibrary="0"
292 BufferSecurityCheck="false"
293 EnableFunctionLevelLinking="true"
294 UsePrecompiledHeader="0"
295 AssemblerListingLocation="$(IntDir)\"
296 WarningLevel="3"
297 Detect64BitPortabilityProblems="true"
298 DebugInformationFormat="3"
299 />
300 <Tool
301 Name="VCManagedResourceCompilerTool"
302 />
303 <Tool
304 Name="VCResourceCompilerTool"
305 />
306 <Tool
307 Name="VCPreLinkEventTool"
308 />
309 <Tool
310 Name="VCLinkerTool"
311 OutputFile="$(OutDir)/testzlib.exe"
312 LinkIncremental="1"
313 GenerateManifest="false"
314 GenerateDebugInformation="true"
315 SubSystem="1"
316 OptimizeReferences="2"
317 EnableCOMDATFolding="2"
318 OptimizeForWindows98="1"
319 TargetMachine="1"
320 />
321 <Tool
322 Name="VCALinkTool"
323 />
324 <Tool
325 Name="VCManifestTool"
326 />
327 <Tool
328 Name="VCXDCMakeTool"
329 />
330 <Tool
331 Name="VCBscMakeTool"
332 />
333 <Tool
334 Name="VCFxCopTool"
335 />
336 <Tool
337 Name="VCAppVerifierTool"
338 />
339 <Tool
340 Name="VCWebDeploymentTool"
341 />
342 <Tool
343 Name="VCPostBuildEventTool"
344 />
345 </Configuration>
346 <Configuration
347 Name="ReleaseWithoutAsm|x64"
348 OutputDirectory="x64\TestZlib$(ConfigurationName)"
349 IntermediateDirectory="x64\TestZlib$(ConfigurationName)\Tmp"
350 ConfigurationType="1"
351 WholeProgramOptimization="1"
352 >
353 <Tool
354 Name="VCPreBuildEventTool"
355 />
356 <Tool
357 Name="VCCustomBuildTool"
358 />
359 <Tool
360 Name="VCXMLDataGeneratorTool"
361 />
362 <Tool
363 Name="VCWebServiceProxyGeneratorTool"
364 />
365 <Tool
366 Name="VCMIDLTool"
367 />
368 <Tool
369 Name="VCCLCompilerTool"
370 AdditionalIncludeDirectories="..\..\.."
371 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
372 BasicRuntimeChecks="0"
373 RuntimeLibrary="2"
374 BufferSecurityCheck="false"
375 AssemblerListingLocation="$(IntDir)\"
376 />
377 <Tool
378 Name="VCManagedResourceCompilerTool"
379 />
380 <Tool
381 Name="VCResourceCompilerTool"
382 />
383 <Tool
384 Name="VCPreLinkEventTool"
385 />
386 <Tool
387 Name="VCLinkerTool"
388 AdditionalDependencies=""
389 GenerateManifest="false"
390 />
391 <Tool
392 Name="VCALinkTool"
393 />
394 <Tool
395 Name="VCManifestTool"
396 />
397 <Tool
398 Name="VCXDCMakeTool"
399 />
400 <Tool
401 Name="VCBscMakeTool"
402 />
403 <Tool
404 Name="VCFxCopTool"
405 />
406 <Tool
407 Name="VCAppVerifierTool"
408 />
409 <Tool
410 Name="VCWebDeploymentTool"
411 />
412 <Tool
413 Name="VCPostBuildEventTool"
414 />
415 </Configuration>
416 <Configuration
417 Name="ReleaseWithoutAsm|Itanium"
418 OutputDirectory="ia64\TestZlib$(ConfigurationName)"
419 IntermediateDirectory="ia64\TestZlib$(ConfigurationName)\Tmp"
420 ConfigurationType="1"
421 CharacterSet="2"
422 WholeProgramOptimization="1"
423 >
424 <Tool
425 Name="VCPreBuildEventTool"
426 />
427 <Tool
428 Name="VCCustomBuildTool"
429 />
430 <Tool
431 Name="VCXMLDataGeneratorTool"
432 />
433 <Tool
434 Name="VCWebServiceProxyGeneratorTool"
435 />
436 <Tool
437 Name="VCMIDLTool"
438 TargetEnvironment="2"
439 />
440 <Tool
441 Name="VCCLCompilerTool"
442 Optimization="2"
443 InlineFunctionExpansion="1"
444 OmitFramePointers="true"
445 AdditionalIncludeDirectories="..\..\.."
446 PreprocessorDefinitions="ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
447 StringPooling="true"
448 BasicRuntimeChecks="0"
449 RuntimeLibrary="2"
450 BufferSecurityCheck="false"
451 EnableFunctionLevelLinking="true"
452 UsePrecompiledHeader="0"
453 AssemblerListingLocation="$(IntDir)\"
454 WarningLevel="3"
455 Detect64BitPortabilityProblems="true"
456 DebugInformationFormat="3"
457 />
458 <Tool
459 Name="VCManagedResourceCompilerTool"
460 />
461 <Tool
462 Name="VCResourceCompilerTool"
463 />
464 <Tool
465 Name="VCPreLinkEventTool"
466 />
467 <Tool
468 Name="VCLinkerTool"
469 OutputFile="$(OutDir)/testzlib.exe"
470 LinkIncremental="1"
471 GenerateManifest="false"
472 GenerateDebugInformation="true"
473 SubSystem="1"
474 OptimizeReferences="2"
475 EnableCOMDATFolding="2"
476 OptimizeForWindows98="1"
477 TargetMachine="5"
478 />
479 <Tool
480 Name="VCALinkTool"
481 />
482 <Tool
483 Name="VCManifestTool"
484 />
485 <Tool
486 Name="VCXDCMakeTool"
487 />
488 <Tool
489 Name="VCBscMakeTool"
490 />
491 <Tool
492 Name="VCFxCopTool"
493 />
494 <Tool
495 Name="VCAppVerifierTool"
496 />
497 <Tool
498 Name="VCWebDeploymentTool"
499 />
500 <Tool
501 Name="VCPostBuildEventTool"
502 />
503 </Configuration>
504 <Configuration
505 Name="Release|Win32"
506 OutputDirectory="x86\TestZlib$(ConfigurationName)"
507 IntermediateDirectory="x86\TestZlib$(ConfigurationName)\Tmp"
508 ConfigurationType="1"
509 CharacterSet="2"
510 WholeProgramOptimization="1"
511 >
512 <Tool
513 Name="VCPreBuildEventTool"
514 />
515 <Tool
516 Name="VCCustomBuildTool"
517 />
518 <Tool
519 Name="VCXMLDataGeneratorTool"
520 />
521 <Tool
522 Name="VCWebServiceProxyGeneratorTool"
523 />
524 <Tool
525 Name="VCMIDLTool"
526 />
527 <Tool
528 Name="VCCLCompilerTool"
529 Optimization="2"
530 InlineFunctionExpansion="1"
531 OmitFramePointers="true"
532 AdditionalIncludeDirectories="..\..\.."
533 PreprocessorDefinitions="ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
534 StringPooling="true"
535 BasicRuntimeChecks="0"
536 RuntimeLibrary="0"
537 BufferSecurityCheck="false"
538 EnableFunctionLevelLinking="true"
539 UsePrecompiledHeader="0"
540 AssemblerListingLocation="$(IntDir)\"
541 WarningLevel="3"
542 Detect64BitPortabilityProblems="true"
543 DebugInformationFormat="3"
544 />
545 <Tool
546 Name="VCManagedResourceCompilerTool"
547 />
548 <Tool
549 Name="VCResourceCompilerTool"
550 />
551 <Tool
552 Name="VCPreLinkEventTool"
553 />
554 <Tool
555 Name="VCLinkerTool"
556 AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj"
557 OutputFile="$(OutDir)/testzlib.exe"
558 LinkIncremental="1"
559 GenerateManifest="false"
560 GenerateDebugInformation="true"
561 SubSystem="1"
562 OptimizeReferences="2"
563 EnableCOMDATFolding="2"
564 OptimizeForWindows98="1"
565 TargetMachine="1"
566 />
567 <Tool
568 Name="VCALinkTool"
569 />
570 <Tool
571 Name="VCManifestTool"
572 />
573 <Tool
574 Name="VCXDCMakeTool"
575 />
576 <Tool
577 Name="VCBscMakeTool"
578 />
579 <Tool
580 Name="VCFxCopTool"
581 />
582 <Tool
583 Name="VCAppVerifierTool"
584 />
585 <Tool
586 Name="VCWebDeploymentTool"
587 />
588 <Tool
589 Name="VCPostBuildEventTool"
590 />
591 </Configuration>
592 <Configuration
593 Name="Release|x64"
594 OutputDirectory="x64\TestZlib$(ConfigurationName)"
595 IntermediateDirectory="x64\TestZlib$(ConfigurationName)\Tmp"
596 ConfigurationType="1"
597 WholeProgramOptimization="1"
598 >
599 <Tool
600 Name="VCPreBuildEventTool"
601 />
602 <Tool
603 Name="VCCustomBuildTool"
604 />
605 <Tool
606 Name="VCXMLDataGeneratorTool"
607 />
608 <Tool
609 Name="VCWebServiceProxyGeneratorTool"
610 />
611 <Tool
612 Name="VCMIDLTool"
613 />
614 <Tool
615 Name="VCCLCompilerTool"
616 AdditionalIncludeDirectories="..\..\.."
617 PreprocessorDefinitions="ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
618 BasicRuntimeChecks="0"
619 RuntimeLibrary="2"
620 BufferSecurityCheck="false"
621 AssemblerListingLocation="$(IntDir)\"
622 />
623 <Tool
624 Name="VCManagedResourceCompilerTool"
625 />
626 <Tool
627 Name="VCResourceCompilerTool"
628 />
629 <Tool
630 Name="VCPreLinkEventTool"
631 />
632 <Tool
633 Name="VCLinkerTool"
634 AdditionalDependencies="..\..\masmx64\gvmat64.obj ..\..\masmx64\inffasx64.obj"
635 GenerateManifest="false"
636 />
637 <Tool
638 Name="VCALinkTool"
639 />
640 <Tool
641 Name="VCManifestTool"
642 />
643 <Tool
644 Name="VCXDCMakeTool"
645 />
646 <Tool
647 Name="VCBscMakeTool"
648 />
649 <Tool
650 Name="VCFxCopTool"
651 />
652 <Tool
653 Name="VCAppVerifierTool"
654 />
655 <Tool
656 Name="VCWebDeploymentTool"
657 />
658 <Tool
659 Name="VCPostBuildEventTool"
660 />
661 </Configuration>
662 <Configuration
663 Name="Release|Itanium"
664 OutputDirectory="ia64\TestZlib$(ConfigurationName)"
665 IntermediateDirectory="ia64\TestZlib$(ConfigurationName)\Tmp"
666 ConfigurationType="1"
667 CharacterSet="2"
668 WholeProgramOptimization="1"
669 >
670 <Tool
671 Name="VCPreBuildEventTool"
672 />
673 <Tool
674 Name="VCCustomBuildTool"
675 />
676 <Tool
677 Name="VCXMLDataGeneratorTool"
678 />
679 <Tool
680 Name="VCWebServiceProxyGeneratorTool"
681 />
682 <Tool
683 Name="VCMIDLTool"
684 TargetEnvironment="2"
685 />
686 <Tool
687 Name="VCCLCompilerTool"
688 Optimization="2"
689 InlineFunctionExpansion="1"
690 OmitFramePointers="true"
691 AdditionalIncludeDirectories="..\..\.."
692 PreprocessorDefinitions="ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
693 StringPooling="true"
694 BasicRuntimeChecks="0"
695 RuntimeLibrary="2"
696 BufferSecurityCheck="false"
697 EnableFunctionLevelLinking="true"
698 UsePrecompiledHeader="0"
699 AssemblerListingLocation="$(IntDir)\"
700 WarningLevel="3"
701 Detect64BitPortabilityProblems="true"
702 DebugInformationFormat="3"
703 />
704 <Tool
705 Name="VCManagedResourceCompilerTool"
706 />
707 <Tool
708 Name="VCResourceCompilerTool"
709 />
710 <Tool
711 Name="VCPreLinkEventTool"
712 />
713 <Tool
714 Name="VCLinkerTool"
715 OutputFile="$(OutDir)/testzlib.exe"
716 LinkIncremental="1"
717 GenerateManifest="false"
718 GenerateDebugInformation="true"
719 SubSystem="1"
720 OptimizeReferences="2"
721 EnableCOMDATFolding="2"
722 OptimizeForWindows98="1"
723 TargetMachine="5"
724 />
725 <Tool
726 Name="VCALinkTool"
727 />
728 <Tool
729 Name="VCManifestTool"
730 />
731 <Tool
732 Name="VCXDCMakeTool"
733 />
734 <Tool
735 Name="VCBscMakeTool"
736 />
737 <Tool
738 Name="VCFxCopTool"
739 />
740 <Tool
741 Name="VCAppVerifierTool"
742 />
743 <Tool
744 Name="VCWebDeploymentTool"
745 />
746 <Tool
747 Name="VCPostBuildEventTool"
748 />
749 </Configuration>
750 </Configurations>
751 <References>
752 </References>
753 <Files>
754 <Filter
755 Name="Source Files"
756 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
757 >
758 <File
759 RelativePath="..\..\..\adler32.c"
760 >
761 </File>
762 <File
763 RelativePath="..\..\..\compress.c"
764 >
765 </File>
766 <File
767 RelativePath="..\..\..\crc32.c"
768 >
769 </File>
770 <File
771 RelativePath="..\..\..\deflate.c"
772 >
773 </File>
774 <File
775 RelativePath="..\..\masmx86\gvmat32c.c"
776 >
777 <FileConfiguration
778 Name="Debug|x64"
779 ExcludedFromBuild="true"
780 >
781 <Tool
782 Name="VCCLCompilerTool"
783 />
784 </FileConfiguration>
785 <FileConfiguration
786 Name="Debug|Itanium"
787 ExcludedFromBuild="true"
788 >
789 <Tool
790 Name="VCCLCompilerTool"
791 />
792 </FileConfiguration>
793 <FileConfiguration
794 Name="ReleaseWithoutAsm|x64"
795 ExcludedFromBuild="true"
796 >
797 <Tool
798 Name="VCCLCompilerTool"
799 />
800 </FileConfiguration>
801 <FileConfiguration
802 Name="ReleaseWithoutAsm|Itanium"
803 ExcludedFromBuild="true"
804 >
805 <Tool
806 Name="VCCLCompilerTool"
807 />
808 </FileConfiguration>
809 <FileConfiguration
810 Name="Release|x64"
811 ExcludedFromBuild="true"
812 >
813 <Tool
814 Name="VCCLCompilerTool"
815 />
816 </FileConfiguration>
817 <FileConfiguration
818 Name="Release|Itanium"
819 ExcludedFromBuild="true"
820 >
821 <Tool
822 Name="VCCLCompilerTool"
823 />
824 </FileConfiguration>
825 <FileConfiguration
826 Name="Debug|Win64 (AMD64)"
827 ExcludedFromBuild="TRUE"
828 >
829 <Tool
830 Name="VCCLCompilerTool"
831 />
832 </FileConfiguration>
833 <FileConfiguration
834 Name="Release|Win64 (AMD64)"
835 ExcludedFromBuild="TRUE"
836 >
837 <Tool
838 Name="VCCLCompilerTool"
839 />
840 </FileConfiguration>
841 <FileConfiguration
842 Name="ReleaseAsm|Win64 (AMD64)"
843 ExcludedFromBuild="TRUE"
844 >
845 <Tool
846 Name="VCCLCompilerTool"
847 />
848 </FileConfiguration>
849 </File>
850 <File
851 RelativePath="..\..\..\infback.c"
852 >
853 </File>
854 <File
855 RelativePath="..\..\masmx64\inffas8664.c"
856 >
857 <FileConfiguration
858 Name="Debug|Win32"
859 ExcludedFromBuild="true"
860 >
861 <Tool
862 Name="VCCLCompilerTool"
863 />
864 </FileConfiguration>
865 <FileConfiguration
866 Name="Debug|Itanium"
867 ExcludedFromBuild="true"
868 >
869 <Tool
870 Name="VCCLCompilerTool"
871 />
872 </FileConfiguration>
873 <FileConfiguration
874 Name="ReleaseWithoutAsm|Win32"
875 ExcludedFromBuild="true"
876 >
877 <Tool
878 Name="VCCLCompilerTool"
879 />
880 </FileConfiguration>
881 <FileConfiguration
882 Name="ReleaseWithoutAsm|Itanium"
883 ExcludedFromBuild="true"
884 >
885 <Tool
886 Name="VCCLCompilerTool"
887 />
888 </FileConfiguration>
889 <FileConfiguration
890 Name="Release|Win32"
891 ExcludedFromBuild="true"
892 >
893 <Tool
894 Name="VCCLCompilerTool"
895 />
896 </FileConfiguration>
897 <FileConfiguration
898 Name="Release|Itanium"
899 ExcludedFromBuild="true"
900 >
901 <Tool
902 Name="VCCLCompilerTool"
903 />
904 </FileConfiguration>
905 </File>
906 <File
907 RelativePath="..\..\..\inffast.c"
908 >
909 </File>
910 <File
911 RelativePath="..\..\..\inflate.c"
912 >
913 </File>
914 <File
915 RelativePath="..\..\..\inftrees.c"
916 >
917 </File>
918 <File
919 RelativePath="..\..\testzlib\testzlib.c"
920 >
921 </File>
922 <File
923 RelativePath="..\..\..\trees.c"
924 >
925 </File>
926 <File
927 RelativePath="..\..\..\uncompr.c"
928 >
929 </File>
930 <File
931 RelativePath="..\..\..\zutil.c"
932 >
933 </File>
934 </Filter>
935 <Filter
936 Name="Header Files"
937 Filter="h;hpp;hxx;hm;inl;inc"
938 >
939 </Filter>
940 <Filter
941 Name="Resource Files"
942 Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
943 >
944 </Filter>
945 </Files>
946 <Globals>
947 </Globals>
948</VisualStudioProject>
diff --git a/contrib/testzlib/testzlib8.vcproj b/contrib/vstudio/vc8/testzlibdll.vcproj
index 3cab776..f38ab5e 100644
--- a/contrib/testzlib/testzlib8.vcproj
+++ b/contrib/vstudio/vc8/testzlibdll.vcproj
@@ -2,29 +2,31 @@
2<VisualStudioProject 2<VisualStudioProject
3 ProjectType="Visual C++" 3 ProjectType="Visual C++"
4 Version="8,00" 4 Version="8,00"
5 Name="testzlib8" 5 Name="TestZlibDll"
6 ProjectGUID="{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" 6 ProjectGUID="{C52F9E7B-498A-42BE-8DB4-85A15694366A}"
7 Keyword="Win32Proj" 7 Keyword="Win32Proj"
8 SignManifests="true"
8 > 9 >
9 <Platforms> 10 <Platforms>
10 <Platform 11 <Platform
11 Name="Win32" 12 Name="Win32"
12 /> 13 />
13 <Platform 14 <Platform
14 Name="Win64 (AMD64)" 15 Name="x64"
16 />
17 <Platform
18 Name="Itanium"
15 /> 19 />
16 </Platforms> 20 </Platforms>
17 <ToolFiles> 21 <ToolFiles>
18 <DefaultToolFile
19 FileName="masm.tool"
20 />
21 </ToolFiles> 22 </ToolFiles>
22 <Configurations> 23 <Configurations>
23 <Configuration 24 <Configuration
24 Name="Debug|Win32" 25 Name="Debug|Win32"
25 OutputDirectory="x86\$(ConfigurationName)" 26 OutputDirectory="x86\TestZlibDll$(ConfigurationName)"
26 IntermediateDirectory="x86\$(ConfigurationName)" 27 IntermediateDirectory="x86\TestZlibDll$(ConfigurationName)\Tmp"
27 ConfigurationType="1" 28 ConfigurationType="1"
29 InheritedPropertySheets="UpgradeFromVC70.vsprops"
28 CharacterSet="2" 30 CharacterSet="2"
29 > 31 >
30 <Tool 32 <Tool
@@ -34,9 +36,6 @@
34 Name="VCCustomBuildTool" 36 Name="VCCustomBuildTool"
35 /> 37 />
36 <Tool 38 <Tool
37 Name="MASM"
38 />
39 <Tool
40 Name="VCXMLDataGeneratorTool" 39 Name="VCXMLDataGeneratorTool"
41 /> 40 />
42 <Tool 41 <Tool
@@ -48,14 +47,16 @@
48 <Tool 47 <Tool
49 Name="VCCLCompilerTool" 48 Name="VCCLCompilerTool"
50 Optimization="0" 49 Optimization="0"
51 PreprocessorDefinitions="ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE" 50 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
52 MinimalRebuild="TRUE" 51 PreprocessorDefinitions="WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE"
53 BasicRuntimeChecks="3" 52 MinimalRebuild="true"
53 BasicRuntimeChecks="0"
54 RuntimeLibrary="1" 54 RuntimeLibrary="1"
55 BufferSecurityCheck="false"
55 UsePrecompiledHeader="0" 56 UsePrecompiledHeader="0"
56 AssemblerOutput="4" 57 AssemblerListingLocation="$(IntDir)\"
57 WarningLevel="3" 58 WarningLevel="3"
58 Detect64BitPortabilityProblems="TRUE" 59 Detect64BitPortabilityProblems="true"
59 DebugInformationFormat="4" 60 DebugInformationFormat="4"
60 /> 61 />
61 <Tool 62 <Tool
@@ -69,10 +70,11 @@
69 /> 70 />
70 <Tool 71 <Tool
71 Name="VCLinkerTool" 72 Name="VCLinkerTool"
72 AdditionalDependencies="gvmat32.obj inffas32.obj" 73 AdditionalDependencies="x86\ZlibDllDebug\zlibwapi.lib"
73 OutputFile="$(OutDir)/testzlib.exe" 74 OutputFile="$(OutDir)/testzlib.exe"
74 LinkIncremental="2" 75 LinkIncremental="2"
75 GenerateDebugInformation="TRUE" 76 GenerateManifest="false"
77 GenerateDebugInformation="true"
76 ProgramDatabaseFile="$(OutDir)/testzlib.pdb" 78 ProgramDatabaseFile="$(OutDir)/testzlib.pdb"
77 SubSystem="1" 79 SubSystem="1"
78 TargetMachine="1" 80 TargetMachine="1"
@@ -90,6 +92,9 @@
90 Name="VCBscMakeTool" 92 Name="VCBscMakeTool"
91 /> 93 />
92 <Tool 94 <Tool
95 Name="VCFxCopTool"
96 />
97 <Tool
93 Name="VCAppVerifierTool" 98 Name="VCAppVerifierTool"
94 /> 99 />
95 <Tool 100 <Tool
@@ -100,10 +105,11 @@
100 /> 105 />
101 </Configuration> 106 </Configuration>
102 <Configuration 107 <Configuration
103 Name="Debug|Win64 (AMD64)" 108 Name="Debug|x64"
104 OutputDirectory="amd64\$(ConfigurationName)" 109 OutputDirectory="x64\TestZlibDll$(ConfigurationName)"
105 IntermediateDirectory="amd64\$(ConfigurationName)" 110 IntermediateDirectory="x64\TestZlibDll$(ConfigurationName)\Tmp"
106 ConfigurationType="1" 111 ConfigurationType="1"
112 InheritedPropertySheets="UpgradeFromVC70.vsprops"
107 CharacterSet="2" 113 CharacterSet="2"
108 > 114 >
109 <Tool 115 <Tool
@@ -113,9 +119,6 @@
113 Name="VCCustomBuildTool" 119 Name="VCCustomBuildTool"
114 /> 120 />
115 <Tool 121 <Tool
116 Name="MASM"
117 />
118 <Tool
119 Name="VCXMLDataGeneratorTool" 122 Name="VCXMLDataGeneratorTool"
120 /> 123 />
121 <Tool 124 <Tool
@@ -128,14 +131,16 @@
128 <Tool 131 <Tool
129 Name="VCCLCompilerTool" 132 Name="VCCLCompilerTool"
130 Optimization="0" 133 Optimization="0"
131 PreprocessorDefinitions="ASMV;ASMINF;WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE" 134 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
132 MinimalRebuild="TRUE" 135 PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64"
133 BasicRuntimeChecks="3" 136 MinimalRebuild="true"
134 RuntimeLibrary="1" 137 BasicRuntimeChecks="0"
138 RuntimeLibrary="3"
139 BufferSecurityCheck="false"
135 UsePrecompiledHeader="0" 140 UsePrecompiledHeader="0"
136 AssemblerOutput="4" 141 AssemblerListingLocation="$(IntDir)\"
137 WarningLevel="3" 142 WarningLevel="3"
138 Detect64BitPortabilityProblems="TRUE" 143 Detect64BitPortabilityProblems="true"
139 DebugInformationFormat="3" 144 DebugInformationFormat="3"
140 /> 145 />
141 <Tool 146 <Tool
@@ -146,14 +151,14 @@
146 /> 151 />
147 <Tool 152 <Tool
148 Name="VCPreLinkEventTool" 153 Name="VCPreLinkEventTool"
149 CommandLine=""
150 /> 154 />
151 <Tool 155 <Tool
152 Name="VCLinkerTool" 156 Name="VCLinkerTool"
153 AdditionalDependencies="gvmat64.obj inffasx64.obj rdtsc64.obj" 157 AdditionalDependencies="x64\ZlibDllDebug\zlibwapi.lib"
154 OutputFile="$(OutDir)/testzlib.exe" 158 OutputFile="$(OutDir)/testzlib.exe"
155 LinkIncremental="2" 159 LinkIncremental="2"
156 GenerateDebugInformation="TRUE" 160 GenerateManifest="false"
161 GenerateDebugInformation="true"
157 ProgramDatabaseFile="$(OutDir)/testzlib.pdb" 162 ProgramDatabaseFile="$(OutDir)/testzlib.pdb"
158 SubSystem="1" 163 SubSystem="1"
159 TargetMachine="17" 164 TargetMachine="17"
@@ -171,6 +176,12 @@
171 Name="VCBscMakeTool" 176 Name="VCBscMakeTool"
172 /> 177 />
173 <Tool 178 <Tool
179 Name="VCFxCopTool"
180 />
181 <Tool
182 Name="VCAppVerifierTool"
183 />
184 <Tool
174 Name="VCWebDeploymentTool" 185 Name="VCWebDeploymentTool"
175 /> 186 />
176 <Tool 187 <Tool
@@ -178,10 +189,11 @@
178 /> 189 />
179 </Configuration> 190 </Configuration>
180 <Configuration 191 <Configuration
181 Name="Release|Win32" 192 Name="Debug|Itanium"
182 OutputDirectory="x86\$(ConfigurationName)" 193 OutputDirectory="ia64\TestZlibDll$(ConfigurationName)"
183 IntermediateDirectory="x86\$(ConfigurationName)" 194 IntermediateDirectory="ia64\TestZlibDll$(ConfigurationName)\Tmp"
184 ConfigurationType="1" 195 ConfigurationType="1"
196 InheritedPropertySheets="UpgradeFromVC70.vsprops"
185 CharacterSet="2" 197 CharacterSet="2"
186 > 198 >
187 <Tool 199 <Tool
@@ -191,9 +203,6 @@
191 Name="VCCustomBuildTool" 203 Name="VCCustomBuildTool"
192 /> 204 />
193 <Tool 205 <Tool
194 Name="MASM"
195 />
196 <Tool
197 Name="VCXMLDataGeneratorTool" 206 Name="VCXMLDataGeneratorTool"
198 /> 207 />
199 <Tool 208 <Tool
@@ -201,19 +210,21 @@
201 /> 210 />
202 <Tool 211 <Tool
203 Name="VCMIDLTool" 212 Name="VCMIDLTool"
213 TargetEnvironment="2"
204 /> 214 />
205 <Tool 215 <Tool
206 Name="VCCLCompilerTool" 216 Name="VCCLCompilerTool"
207 Optimization="2" 217 Optimization="0"
208 InlineFunctionExpansion="1" 218 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
209 OmitFramePointers="TRUE" 219 PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64"
210 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE" 220 MinimalRebuild="true"
211 StringPooling="TRUE" 221 BasicRuntimeChecks="0"
212 RuntimeLibrary="0" 222 RuntimeLibrary="3"
213 EnableFunctionLevelLinking="TRUE" 223 BufferSecurityCheck="false"
214 UsePrecompiledHeader="0" 224 UsePrecompiledHeader="0"
225 AssemblerListingLocation="$(IntDir)\"
215 WarningLevel="3" 226 WarningLevel="3"
216 Detect64BitPortabilityProblems="TRUE" 227 Detect64BitPortabilityProblems="true"
217 DebugInformationFormat="3" 228 DebugInformationFormat="3"
218 /> 229 />
219 <Tool 230 <Tool
@@ -227,14 +238,14 @@
227 /> 238 />
228 <Tool 239 <Tool
229 Name="VCLinkerTool" 240 Name="VCLinkerTool"
241 AdditionalDependencies="ia64\ZlibDllDebug\zlibwapi.lib"
230 OutputFile="$(OutDir)/testzlib.exe" 242 OutputFile="$(OutDir)/testzlib.exe"
231 LinkIncremental="1" 243 LinkIncremental="2"
232 GenerateDebugInformation="TRUE" 244 GenerateManifest="false"
245 GenerateDebugInformation="true"
246 ProgramDatabaseFile="$(OutDir)/testzlib.pdb"
233 SubSystem="1" 247 SubSystem="1"
234 OptimizeReferences="2" 248 TargetMachine="5"
235 EnableCOMDATFolding="2"
236 OptimizeForWindows98="1"
237 TargetMachine="1"
238 /> 249 />
239 <Tool 250 <Tool
240 Name="VCALinkTool" 251 Name="VCALinkTool"
@@ -249,6 +260,9 @@
249 Name="VCBscMakeTool" 260 Name="VCBscMakeTool"
250 /> 261 />
251 <Tool 262 <Tool
263 Name="VCFxCopTool"
264 />
265 <Tool
252 Name="VCAppVerifierTool" 266 Name="VCAppVerifierTool"
253 /> 267 />
254 <Tool 268 <Tool
@@ -259,10 +273,11 @@
259 /> 273 />
260 </Configuration> 274 </Configuration>
261 <Configuration 275 <Configuration
262 Name="Release|Win64 (AMD64)" 276 Name="Release|Win32"
263 OutputDirectory="amd64\$(ConfigurationName)" 277 OutputDirectory="x86\TestZlibDll$(ConfigurationName)"
264 IntermediateDirectory="amd64\$(ConfigurationName)" 278 IntermediateDirectory="x86\TestZlibDll$(ConfigurationName)\Tmp"
265 ConfigurationType="1" 279 ConfigurationType="1"
280 InheritedPropertySheets="UpgradeFromVC70.vsprops"
266 CharacterSet="2" 281 CharacterSet="2"
267 > 282 >
268 <Tool 283 <Tool
@@ -272,9 +287,6 @@
272 Name="VCCustomBuildTool" 287 Name="VCCustomBuildTool"
273 /> 288 />
274 <Tool 289 <Tool
275 Name="MASM"
276 />
277 <Tool
278 Name="VCXMLDataGeneratorTool" 290 Name="VCXMLDataGeneratorTool"
279 /> 291 />
280 <Tool 292 <Tool
@@ -282,20 +294,23 @@
282 /> 294 />
283 <Tool 295 <Tool
284 Name="VCMIDLTool" 296 Name="VCMIDLTool"
285 TargetEnvironment="3"
286 /> 297 />
287 <Tool 298 <Tool
288 Name="VCCLCompilerTool" 299 Name="VCCLCompilerTool"
289 Optimization="2" 300 Optimization="2"
290 InlineFunctionExpansion="1" 301 InlineFunctionExpansion="1"
291 OmitFramePointers="TRUE" 302 OmitFramePointers="true"
292 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE" 303 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
293 StringPooling="TRUE" 304 PreprocessorDefinitions="WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE"
305 StringPooling="true"
306 BasicRuntimeChecks="0"
294 RuntimeLibrary="0" 307 RuntimeLibrary="0"
295 EnableFunctionLevelLinking="TRUE" 308 BufferSecurityCheck="false"
309 EnableFunctionLevelLinking="true"
296 UsePrecompiledHeader="0" 310 UsePrecompiledHeader="0"
311 AssemblerListingLocation="$(IntDir)\"
297 WarningLevel="3" 312 WarningLevel="3"
298 Detect64BitPortabilityProblems="TRUE" 313 Detect64BitPortabilityProblems="true"
299 DebugInformationFormat="3" 314 DebugInformationFormat="3"
300 /> 315 />
301 <Tool 316 <Tool
@@ -309,15 +324,16 @@
309 /> 324 />
310 <Tool 325 <Tool
311 Name="VCLinkerTool" 326 Name="VCLinkerTool"
312 AdditionalDependencies="rdtsc64.obj" 327 AdditionalDependencies="x86\ZlibDllRelease\zlibwapi.lib"
313 OutputFile="$(OutDir)/testzlib.exe" 328 OutputFile="$(OutDir)/testzlib.exe"
314 LinkIncremental="1" 329 LinkIncremental="1"
315 GenerateDebugInformation="TRUE" 330 GenerateManifest="false"
331 GenerateDebugInformation="true"
316 SubSystem="1" 332 SubSystem="1"
317 OptimizeReferences="2" 333 OptimizeReferences="2"
318 EnableCOMDATFolding="2" 334 EnableCOMDATFolding="2"
319 OptimizeForWindows98="1" 335 OptimizeForWindows98="1"
320 TargetMachine="17" 336 TargetMachine="1"
321 /> 337 />
322 <Tool 338 <Tool
323 Name="VCALinkTool" 339 Name="VCALinkTool"
@@ -332,6 +348,12 @@
332 Name="VCBscMakeTool" 348 Name="VCBscMakeTool"
333 /> 349 />
334 <Tool 350 <Tool
351 Name="VCFxCopTool"
352 />
353 <Tool
354 Name="VCAppVerifierTool"
355 />
356 <Tool
335 Name="VCWebDeploymentTool" 357 Name="VCWebDeploymentTool"
336 /> 358 />
337 <Tool 359 <Tool
@@ -339,10 +361,11 @@
339 /> 361 />
340 </Configuration> 362 </Configuration>
341 <Configuration 363 <Configuration
342 Name="ReleaseAsm|Win32" 364 Name="Release|x64"
343 OutputDirectory="x86\$(ConfigurationName)" 365 OutputDirectory="x64\TestZlibDll$(ConfigurationName)"
344 IntermediateDirectory="x86\$(ConfigurationName)" 366 IntermediateDirectory="x64\TestZlibDll$(ConfigurationName)\Tmp"
345 ConfigurationType="1" 367 ConfigurationType="1"
368 InheritedPropertySheets="UpgradeFromVC70.vsprops"
346 CharacterSet="2" 369 CharacterSet="2"
347 > 370 >
348 <Tool 371 <Tool
@@ -352,9 +375,6 @@
352 Name="VCCustomBuildTool" 375 Name="VCCustomBuildTool"
353 /> 376 />
354 <Tool 377 <Tool
355 Name="MASM"
356 />
357 <Tool
358 Name="VCXMLDataGeneratorTool" 378 Name="VCXMLDataGeneratorTool"
359 /> 379 />
360 <Tool 380 <Tool
@@ -362,19 +382,24 @@
362 /> 382 />
363 <Tool 383 <Tool
364 Name="VCMIDLTool" 384 Name="VCMIDLTool"
385 TargetEnvironment="3"
365 /> 386 />
366 <Tool 387 <Tool
367 Name="VCCLCompilerTool" 388 Name="VCCLCompilerTool"
368 Optimization="2" 389 Optimization="2"
369 InlineFunctionExpansion="1" 390 InlineFunctionExpansion="1"
370 OmitFramePointers="TRUE" 391 OmitFramePointers="true"
371 PreprocessorDefinitions="ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE" 392 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
372 StringPooling="TRUE" 393 PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64"
373 RuntimeLibrary="0" 394 StringPooling="true"
374 EnableFunctionLevelLinking="TRUE" 395 BasicRuntimeChecks="0"
396 RuntimeLibrary="2"
397 BufferSecurityCheck="false"
398 EnableFunctionLevelLinking="true"
375 UsePrecompiledHeader="0" 399 UsePrecompiledHeader="0"
400 AssemblerListingLocation="$(IntDir)\"
376 WarningLevel="3" 401 WarningLevel="3"
377 Detect64BitPortabilityProblems="TRUE" 402 Detect64BitPortabilityProblems="true"
378 DebugInformationFormat="3" 403 DebugInformationFormat="3"
379 /> 404 />
380 <Tool 405 <Tool
@@ -388,15 +413,16 @@
388 /> 413 />
389 <Tool 414 <Tool
390 Name="VCLinkerTool" 415 Name="VCLinkerTool"
391 AdditionalDependencies="gvmat32.obj inffas32.obj" 416 AdditionalDependencies="x64\ZlibDllRelease\zlibwapi.lib"
392 OutputFile="$(OutDir)/testzlib.exe" 417 OutputFile="$(OutDir)/testzlib.exe"
393 LinkIncremental="1" 418 LinkIncremental="1"
394 GenerateDebugInformation="TRUE" 419 GenerateManifest="false"
420 GenerateDebugInformation="true"
395 SubSystem="1" 421 SubSystem="1"
396 OptimizeReferences="2" 422 OptimizeReferences="2"
397 EnableCOMDATFolding="2" 423 EnableCOMDATFolding="2"
398 OptimizeForWindows98="1" 424 OptimizeForWindows98="1"
399 TargetMachine="1" 425 TargetMachine="17"
400 /> 426 />
401 <Tool 427 <Tool
402 Name="VCALinkTool" 428 Name="VCALinkTool"
@@ -411,6 +437,9 @@
411 Name="VCBscMakeTool" 437 Name="VCBscMakeTool"
412 /> 438 />
413 <Tool 439 <Tool
440 Name="VCFxCopTool"
441 />
442 <Tool
414 Name="VCAppVerifierTool" 443 Name="VCAppVerifierTool"
415 /> 444 />
416 <Tool 445 <Tool
@@ -421,23 +450,20 @@
421 /> 450 />
422 </Configuration> 451 </Configuration>
423 <Configuration 452 <Configuration
424 Name="ReleaseAsm|Win64 (AMD64)" 453 Name="Release|Itanium"
425 OutputDirectory="amd64\$(ConfigurationName)" 454 OutputDirectory="ia64\TestZlibDll$(ConfigurationName)"
426 IntermediateDirectory="amd64\$(ConfigurationName)" 455 IntermediateDirectory="ia64\TestZlibDll$(ConfigurationName)\Tmp"
427 ConfigurationType="1" 456 ConfigurationType="1"
457 InheritedPropertySheets="UpgradeFromVC70.vsprops"
428 CharacterSet="2" 458 CharacterSet="2"
429 > 459 >
430 <Tool 460 <Tool
431 Name="VCPreBuildEventTool" 461 Name="VCPreBuildEventTool"
432 CommandLine=""
433 /> 462 />
434 <Tool 463 <Tool
435 Name="VCCustomBuildTool" 464 Name="VCCustomBuildTool"
436 /> 465 />
437 <Tool 466 <Tool
438 Name="MASM"
439 />
440 <Tool
441 Name="VCXMLDataGeneratorTool" 467 Name="VCXMLDataGeneratorTool"
442 /> 468 />
443 <Tool 469 <Tool
@@ -445,21 +471,24 @@
445 /> 471 />
446 <Tool 472 <Tool
447 Name="VCMIDLTool" 473 Name="VCMIDLTool"
448 TargetEnvironment="3" 474 TargetEnvironment="2"
449 /> 475 />
450 <Tool 476 <Tool
451 Name="VCCLCompilerTool" 477 Name="VCCLCompilerTool"
452 Optimization="2" 478 Optimization="2"
453 InlineFunctionExpansion="1" 479 InlineFunctionExpansion="1"
454 OmitFramePointers="TRUE" 480 OmitFramePointers="true"
455 PreprocessorDefinitions="ASMV;ASMINF;WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE" 481 AdditionalIncludeDirectories="..\..\..;..\..\minizip"
456 StringPooling="TRUE" 482 PreprocessorDefinitions="_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64"
457 RuntimeLibrary="0" 483 StringPooling="true"
458 EnableFunctionLevelLinking="TRUE" 484 BasicRuntimeChecks="0"
485 RuntimeLibrary="2"
486 BufferSecurityCheck="false"
487 EnableFunctionLevelLinking="true"
459 UsePrecompiledHeader="0" 488 UsePrecompiledHeader="0"
460 AssemblerOutput="4" 489 AssemblerListingLocation="$(IntDir)\"
461 WarningLevel="3" 490 WarningLevel="3"
462 Detect64BitPortabilityProblems="TRUE" 491 Detect64BitPortabilityProblems="true"
463 DebugInformationFormat="3" 492 DebugInformationFormat="3"
464 /> 493 />
465 <Tool 494 <Tool
@@ -470,19 +499,19 @@
470 /> 499 />
471 <Tool 500 <Tool
472 Name="VCPreLinkEventTool" 501 Name="VCPreLinkEventTool"
473 CommandLine=""
474 /> 502 />
475 <Tool 503 <Tool
476 Name="VCLinkerTool" 504 Name="VCLinkerTool"
477 AdditionalDependencies="gvmat64.obj inffasx64.obj rdtsc64.obj" 505 AdditionalDependencies="ia64\ZlibDllRelease\zlibwapi.lib"
478 OutputFile="$(OutDir)/testzlib.exe" 506 OutputFile="$(OutDir)/testzlib.exe"
479 LinkIncremental="1" 507 LinkIncremental="1"
480 GenerateDebugInformation="TRUE" 508 GenerateManifest="false"
509 GenerateDebugInformation="true"
481 SubSystem="1" 510 SubSystem="1"
482 OptimizeReferences="2" 511 OptimizeReferences="2"
483 EnableCOMDATFolding="2" 512 EnableCOMDATFolding="2"
484 OptimizeForWindows98="1" 513 OptimizeForWindows98="1"
485 TargetMachine="17" 514 TargetMachine="5"
486 /> 515 />
487 <Tool 516 <Tool
488 Name="VCALinkTool" 517 Name="VCALinkTool"
@@ -497,6 +526,12 @@
497 Name="VCBscMakeTool" 526 Name="VCBscMakeTool"
498 /> 527 />
499 <Tool 528 <Tool
529 Name="VCFxCopTool"
530 />
531 <Tool
532 Name="VCAppVerifierTool"
533 />
534 <Tool
500 Name="VCWebDeploymentTool" 535 Name="VCWebDeploymentTool"
501 /> 536 />
502 <Tool 537 <Tool
@@ -512,113 +547,7 @@
512 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm" 547 Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"
513 > 548 >
514 <File 549 <File
515 RelativePath=".\adler32.c" 550 RelativePath="..\..\testzlib\testzlib.c"
516 >
517 </File>
518 <File
519 RelativePath=".\compress.c"
520 >
521 </File>
522 <File
523 RelativePath=".\crc32.c"
524 >
525 </File>
526 <File
527 RelativePath=".\deflate.c"
528 >
529 </File>
530 <File
531 RelativePath=".\gvmat32c.c"
532 >
533 <FileConfiguration
534 Name="Debug|Win64 (AMD64)"
535 ExcludedFromBuild="TRUE"
536 >
537 <Tool
538 Name="VCCLCompilerTool"
539 />
540 </FileConfiguration>
541 <FileConfiguration
542 Name="Release|Win64 (AMD64)"
543 ExcludedFromBuild="TRUE"
544 >
545 <Tool
546 Name="VCCLCompilerTool"
547 />
548 </FileConfiguration>
549 <FileConfiguration
550 Name="ReleaseAsm|Win32"
551 >
552 <Tool
553 Name="VCCLCompilerTool"
554 />
555 </FileConfiguration>
556 <FileConfiguration
557 Name="ReleaseAsm|Win64 (AMD64)"
558 ExcludedFromBuild="TRUE"
559 >
560 <Tool
561 Name="VCCLCompilerTool"
562 />
563 </FileConfiguration>
564 </File>
565 <File
566 RelativePath=".\infback.c"
567 >
568 </File>
569 <File
570 RelativePath=".\inffas8664.c"
571 >
572 <FileConfiguration
573 Name="Debug|Win32"
574 ExcludedFromBuild="TRUE"
575 >
576 <Tool
577 Name="VCCLCompilerTool"
578 />
579 </FileConfiguration>
580 <FileConfiguration
581 Name="Release|Win32"
582 >
583 <Tool
584 Name="VCCLCompilerTool"
585 />
586 </FileConfiguration>
587 <FileConfiguration
588 Name="ReleaseAsm|Win32"
589 ExcludedFromBuild="TRUE"
590 >
591 <Tool
592 Name="VCCLCompilerTool"
593 />
594 </FileConfiguration>
595 </File>
596 <File
597 RelativePath=".\inffast.c"
598 >
599 </File>
600 <File
601 RelativePath=".\inflate.c"
602 >
603 </File>
604 <File
605 RelativePath=".\inftrees.c"
606 >
607 </File>
608 <File
609 RelativePath="testzlib.c"
610 >
611 </File>
612 <File
613 RelativePath=".\trees.c"
614 >
615 </File>
616 <File
617 RelativePath=".\uncompr.c"
618 >
619 </File>
620 <File
621 RelativePath=".\zutil.c"
622 > 551 >
623 </File> 552 </File>
624 </Filter> 553 </Filter>
diff --git a/contrib/vstudio/vc8/zlib.rc b/contrib/vstudio/vc8/zlib.rc
new file mode 100644
index 0000000..72cb8b4
--- /dev/null
+++ b/contrib/vstudio/vc8/zlib.rc
@@ -0,0 +1,32 @@
1#include <windows.h>
2
3#define IDR_VERSION1 1
4IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
5 FILEVERSION 1,2,3,0
6 PRODUCTVERSION 1,2,3,0
7 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
8 FILEFLAGS 0
9 FILEOS VOS_DOS_WINDOWS32
10 FILETYPE VFT_DLL
11 FILESUBTYPE 0 // not used
12BEGIN
13 BLOCK "StringFileInfo"
14 BEGIN
15 BLOCK "040904E4"
16 //language ID = U.S. English, char set = Windows, Multilingual
17
18 BEGIN
19 VALUE "FileDescription", "zlib data compression library\0"
20 VALUE "FileVersion", "1.2.3.0\0"
21 VALUE "InternalName", "zlib\0"
22 VALUE "OriginalFilename", "zlib.dll\0"
23 VALUE "ProductName", "ZLib.DLL\0"
24 VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
25 VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0"
26 END
27 END
28 BLOCK "VarFileInfo"
29 BEGIN
30 VALUE "Translation", 0x0409, 1252
31 END
32END
diff --git a/contrib/vstudio/vc8/zlibstat.vcproj b/contrib/vstudio/vc8/zlibstat.vcproj
new file mode 100644
index 0000000..fb97037
--- /dev/null
+++ b/contrib/vstudio/vc8/zlibstat.vcproj
@@ -0,0 +1,870 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="8,00"
5 Name="zlibstat"
6 ProjectGUID="{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}"
7 >
8 <Platforms>
9 <Platform
10 Name="Win32"
11 />
12 <Platform
13 Name="x64"
14 />
15 <Platform
16 Name="Itanium"
17 />
18 </Platforms>
19 <ToolFiles>
20 </ToolFiles>
21 <Configurations>
22 <Configuration
23 Name="Debug|Win32"
24 OutputDirectory="x86\ZlibStat$(ConfigurationName)"
25 IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp"
26 ConfigurationType="4"
27 InheritedPropertySheets="UpgradeFromVC70.vsprops"
28 UseOfMFC="0"
29 ATLMinimizesCRunTimeLibraryUsage="false"
30 >
31 <Tool
32 Name="VCPreBuildEventTool"
33 />
34 <Tool
35 Name="VCCustomBuildTool"
36 />
37 <Tool
38 Name="VCXMLDataGeneratorTool"
39 />
40 <Tool
41 Name="VCWebServiceProxyGeneratorTool"
42 />
43 <Tool
44 Name="VCMIDLTool"
45 />
46 <Tool
47 Name="VCCLCompilerTool"
48 Optimization="0"
49 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
50 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
51 ExceptionHandling="0"
52 RuntimeLibrary="1"
53 BufferSecurityCheck="false"
54 PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
55 AssemblerListingLocation="$(IntDir)\"
56 ObjectFile="$(IntDir)\"
57 ProgramDataBaseFileName="$(OutDir)\"
58 WarningLevel="3"
59 SuppressStartupBanner="true"
60 Detect64BitPortabilityProblems="true"
61 DebugInformationFormat="1"
62 />
63 <Tool
64 Name="VCManagedResourceCompilerTool"
65 />
66 <Tool
67 Name="VCResourceCompilerTool"
68 Culture="1036"
69 />
70 <Tool
71 Name="VCPreLinkEventTool"
72 />
73 <Tool
74 Name="VCLibrarianTool"
75 AdditionalOptions="/MACHINE:X86 /NODEFAULTLIB"
76 OutputFile="$(OutDir)\zlibstat.lib"
77 SuppressStartupBanner="true"
78 />
79 <Tool
80 Name="VCALinkTool"
81 />
82 <Tool
83 Name="VCXDCMakeTool"
84 />
85 <Tool
86 Name="VCBscMakeTool"
87 />
88 <Tool
89 Name="VCFxCopTool"
90 />
91 <Tool
92 Name="VCPostBuildEventTool"
93 />
94 </Configuration>
95 <Configuration
96 Name="Debug|x64"
97 OutputDirectory="x64\ZlibStat$(ConfigurationName)"
98 IntermediateDirectory="x64\ZlibStat$(ConfigurationName)\Tmp"
99 ConfigurationType="4"
100 InheritedPropertySheets="UpgradeFromVC70.vsprops"
101 UseOfMFC="0"
102 ATLMinimizesCRunTimeLibraryUsage="false"
103 >
104 <Tool
105 Name="VCPreBuildEventTool"
106 />
107 <Tool
108 Name="VCCustomBuildTool"
109 />
110 <Tool
111 Name="VCXMLDataGeneratorTool"
112 />
113 <Tool
114 Name="VCWebServiceProxyGeneratorTool"
115 />
116 <Tool
117 Name="VCMIDLTool"
118 TargetEnvironment="3"
119 />
120 <Tool
121 Name="VCCLCompilerTool"
122 Optimization="0"
123 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
124 PreprocessorDefinitions="ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
125 ExceptionHandling="0"
126 RuntimeLibrary="3"
127 BufferSecurityCheck="false"
128 PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
129 AssemblerListingLocation="$(IntDir)\"
130 ObjectFile="$(IntDir)\"
131 ProgramDataBaseFileName="$(OutDir)\"
132 WarningLevel="3"
133 SuppressStartupBanner="true"
134 Detect64BitPortabilityProblems="true"
135 DebugInformationFormat="1"
136 />
137 <Tool
138 Name="VCManagedResourceCompilerTool"
139 />
140 <Tool
141 Name="VCResourceCompilerTool"
142 Culture="1036"
143 />
144 <Tool
145 Name="VCPreLinkEventTool"
146 />
147 <Tool
148 Name="VCLibrarianTool"
149 AdditionalOptions="/MACHINE:AMD64 /NODEFAULTLIB"
150 OutputFile="$(OutDir)\zlibstat.lib"
151 SuppressStartupBanner="true"
152 />
153 <Tool
154 Name="VCALinkTool"
155 />
156 <Tool
157 Name="VCXDCMakeTool"
158 />
159 <Tool
160 Name="VCBscMakeTool"
161 />
162 <Tool
163 Name="VCFxCopTool"
164 />
165 <Tool
166 Name="VCPostBuildEventTool"
167 />
168 </Configuration>
169 <Configuration
170 Name="Debug|Itanium"
171 OutputDirectory="ia64\ZlibStat$(ConfigurationName)"
172 IntermediateDirectory="ia64\ZlibStat$(ConfigurationName)\Tmp"
173 ConfigurationType="4"
174 InheritedPropertySheets="UpgradeFromVC70.vsprops"
175 UseOfMFC="0"
176 ATLMinimizesCRunTimeLibraryUsage="false"
177 >
178 <Tool
179 Name="VCPreBuildEventTool"
180 />
181 <Tool
182 Name="VCCustomBuildTool"
183 />
184 <Tool
185 Name="VCXMLDataGeneratorTool"
186 />
187 <Tool
188 Name="VCWebServiceProxyGeneratorTool"
189 />
190 <Tool
191 Name="VCMIDLTool"
192 TargetEnvironment="2"
193 />
194 <Tool
195 Name="VCCLCompilerTool"
196 Optimization="0"
197 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
198 PreprocessorDefinitions="ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
199 ExceptionHandling="0"
200 RuntimeLibrary="3"
201 BufferSecurityCheck="false"
202 PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
203 AssemblerListingLocation="$(IntDir)\"
204 ObjectFile="$(IntDir)\"
205 ProgramDataBaseFileName="$(OutDir)\"
206 WarningLevel="3"
207 SuppressStartupBanner="true"
208 Detect64BitPortabilityProblems="true"
209 DebugInformationFormat="1"
210 />
211 <Tool
212 Name="VCManagedResourceCompilerTool"
213 />
214 <Tool
215 Name="VCResourceCompilerTool"
216 Culture="1036"
217 />
218 <Tool
219 Name="VCPreLinkEventTool"
220 />
221 <Tool
222 Name="VCLibrarianTool"
223 AdditionalOptions="/MACHINE:IA64 /NODEFAULTLIB"
224 OutputFile="$(OutDir)\zlibstat.lib"
225 SuppressStartupBanner="true"
226 />
227 <Tool
228 Name="VCALinkTool"
229 />
230 <Tool
231 Name="VCXDCMakeTool"
232 />
233 <Tool
234 Name="VCBscMakeTool"
235 />
236 <Tool
237 Name="VCFxCopTool"
238 />
239 <Tool
240 Name="VCPostBuildEventTool"
241 />
242 </Configuration>
243 <Configuration
244 Name="Release|Win32"
245 OutputDirectory="x86\ZlibStat$(ConfigurationName)"
246 IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp"
247 ConfigurationType="4"
248 InheritedPropertySheets="UpgradeFromVC70.vsprops"
249 UseOfMFC="0"
250 ATLMinimizesCRunTimeLibraryUsage="false"
251 >
252 <Tool
253 Name="VCPreBuildEventTool"
254 />
255 <Tool
256 Name="VCCustomBuildTool"
257 />
258 <Tool
259 Name="VCXMLDataGeneratorTool"
260 />
261 <Tool
262 Name="VCWebServiceProxyGeneratorTool"
263 />
264 <Tool
265 Name="VCMIDLTool"
266 />
267 <Tool
268 Name="VCCLCompilerTool"
269 InlineFunctionExpansion="1"
270 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
271 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ASMV;ASMINF"
272 StringPooling="true"
273 ExceptionHandling="0"
274 RuntimeLibrary="0"
275 BufferSecurityCheck="false"
276 EnableFunctionLevelLinking="true"
277 PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
278 AssemblerListingLocation="$(IntDir)\"
279 ObjectFile="$(IntDir)\"
280 ProgramDataBaseFileName="$(OutDir)\"
281 WarningLevel="3"
282 SuppressStartupBanner="true"
283 />
284 <Tool
285 Name="VCManagedResourceCompilerTool"
286 />
287 <Tool
288 Name="VCResourceCompilerTool"
289 Culture="1036"
290 />
291 <Tool
292 Name="VCPreLinkEventTool"
293 />
294 <Tool
295 Name="VCLibrarianTool"
296 AdditionalOptions="/MACHINE:X86 /NODEFAULTLIB"
297 AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj "
298 OutputFile="$(OutDir)\zlibstat.lib"
299 SuppressStartupBanner="true"
300 />
301 <Tool
302 Name="VCALinkTool"
303 />
304 <Tool
305 Name="VCXDCMakeTool"
306 />
307 <Tool
308 Name="VCBscMakeTool"
309 />
310 <Tool
311 Name="VCFxCopTool"
312 />
313 <Tool
314 Name="VCPostBuildEventTool"
315 />
316 </Configuration>
317 <Configuration
318 Name="Release|x64"
319 OutputDirectory="x64\ZlibStat$(ConfigurationName)"
320 IntermediateDirectory="x64\ZlibStat$(ConfigurationName)\Tmp"
321 ConfigurationType="4"
322 InheritedPropertySheets="UpgradeFromVC70.vsprops"
323 UseOfMFC="0"
324 ATLMinimizesCRunTimeLibraryUsage="false"
325 >
326 <Tool
327 Name="VCPreBuildEventTool"
328 />
329 <Tool
330 Name="VCCustomBuildTool"
331 />
332 <Tool
333 Name="VCXMLDataGeneratorTool"
334 />
335 <Tool
336 Name="VCWebServiceProxyGeneratorTool"
337 />
338 <Tool
339 Name="VCMIDLTool"
340 TargetEnvironment="3"
341 />
342 <Tool
343 Name="VCCLCompilerTool"
344 InlineFunctionExpansion="1"
345 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
346 PreprocessorDefinitions="ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ASMV;ASMINF;WIN64"
347 StringPooling="true"
348 ExceptionHandling="0"
349 RuntimeLibrary="2"
350 BufferSecurityCheck="false"
351 EnableFunctionLevelLinking="true"
352 PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
353 AssemblerListingLocation="$(IntDir)\"
354 ObjectFile="$(IntDir)\"
355 ProgramDataBaseFileName="$(OutDir)\"
356 WarningLevel="3"
357 SuppressStartupBanner="true"
358 />
359 <Tool
360 Name="VCManagedResourceCompilerTool"
361 />
362 <Tool
363 Name="VCResourceCompilerTool"
364 Culture="1036"
365 />
366 <Tool
367 Name="VCPreLinkEventTool"
368 />
369 <Tool
370 Name="VCLibrarianTool"
371 AdditionalOptions="/MACHINE:AMD64 /NODEFAULTLIB"
372 AdditionalDependencies="..\..\masmx64\gvmat64.obj ..\..\masmx64\inffasx64.obj "
373 OutputFile="$(OutDir)\zlibstat.lib"
374 SuppressStartupBanner="true"
375 />
376 <Tool
377 Name="VCALinkTool"
378 />
379 <Tool
380 Name="VCXDCMakeTool"
381 />
382 <Tool
383 Name="VCBscMakeTool"
384 />
385 <Tool
386 Name="VCFxCopTool"
387 />
388 <Tool
389 Name="VCPostBuildEventTool"
390 />
391 </Configuration>
392 <Configuration
393 Name="Release|Itanium"
394 OutputDirectory="ia64\ZlibStat$(ConfigurationName)"
395 IntermediateDirectory="ia64\ZlibStat$(ConfigurationName)\Tmp"
396 ConfigurationType="4"
397 InheritedPropertySheets="UpgradeFromVC70.vsprops"
398 UseOfMFC="0"
399 ATLMinimizesCRunTimeLibraryUsage="false"
400 >
401 <Tool
402 Name="VCPreBuildEventTool"
403 />
404 <Tool
405 Name="VCCustomBuildTool"
406 />
407 <Tool
408 Name="VCXMLDataGeneratorTool"
409 />
410 <Tool
411 Name="VCWebServiceProxyGeneratorTool"
412 />
413 <Tool
414 Name="VCMIDLTool"
415 TargetEnvironment="2"
416 />
417 <Tool
418 Name="VCCLCompilerTool"
419 InlineFunctionExpansion="1"
420 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
421 PreprocessorDefinitions="ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
422 StringPooling="true"
423 ExceptionHandling="0"
424 RuntimeLibrary="2"
425 BufferSecurityCheck="false"
426 EnableFunctionLevelLinking="true"
427 PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
428 AssemblerListingLocation="$(IntDir)\"
429 ObjectFile="$(IntDir)\"
430 ProgramDataBaseFileName="$(OutDir)\"
431 WarningLevel="3"
432 SuppressStartupBanner="true"
433 />
434 <Tool
435 Name="VCManagedResourceCompilerTool"
436 />
437 <Tool
438 Name="VCResourceCompilerTool"
439 Culture="1036"
440 />
441 <Tool
442 Name="VCPreLinkEventTool"
443 />
444 <Tool
445 Name="VCLibrarianTool"
446 AdditionalOptions="/MACHINE:IA64 /NODEFAULTLIB"
447 OutputFile="$(OutDir)\zlibstat.lib"
448 SuppressStartupBanner="true"
449 />
450 <Tool
451 Name="VCALinkTool"
452 />
453 <Tool
454 Name="VCXDCMakeTool"
455 />
456 <Tool
457 Name="VCBscMakeTool"
458 />
459 <Tool
460 Name="VCFxCopTool"
461 />
462 <Tool
463 Name="VCPostBuildEventTool"
464 />
465 </Configuration>
466 <Configuration
467 Name="ReleaseWithoutAsm|Win32"
468 OutputDirectory="x86\ZlibStat$(ConfigurationName)"
469 IntermediateDirectory="x86\ZlibStat$(ConfigurationName)\Tmp"
470 ConfigurationType="4"
471 InheritedPropertySheets="UpgradeFromVC70.vsprops"
472 UseOfMFC="0"
473 ATLMinimizesCRunTimeLibraryUsage="false"
474 >
475 <Tool
476 Name="VCPreBuildEventTool"
477 />
478 <Tool
479 Name="VCCustomBuildTool"
480 />
481 <Tool
482 Name="VCXMLDataGeneratorTool"
483 />
484 <Tool
485 Name="VCWebServiceProxyGeneratorTool"
486 />
487 <Tool
488 Name="VCMIDLTool"
489 />
490 <Tool
491 Name="VCCLCompilerTool"
492 InlineFunctionExpansion="1"
493 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
494 PreprocessorDefinitions="WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
495 StringPooling="true"
496 ExceptionHandling="0"
497 RuntimeLibrary="0"
498 BufferSecurityCheck="false"
499 EnableFunctionLevelLinking="true"
500 PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
501 AssemblerListingLocation="$(IntDir)\"
502 ObjectFile="$(IntDir)\"
503 ProgramDataBaseFileName="$(OutDir)\"
504 WarningLevel="3"
505 SuppressStartupBanner="true"
506 />
507 <Tool
508 Name="VCManagedResourceCompilerTool"
509 />
510 <Tool
511 Name="VCResourceCompilerTool"
512 Culture="1036"
513 />
514 <Tool
515 Name="VCPreLinkEventTool"
516 />
517 <Tool
518 Name="VCLibrarianTool"
519 AdditionalOptions="/MACHINE:X86 /NODEFAULTLIB"
520 OutputFile="$(OutDir)\zlibstat.lib"
521 SuppressStartupBanner="true"
522 />
523 <Tool
524 Name="VCALinkTool"
525 />
526 <Tool
527 Name="VCXDCMakeTool"
528 />
529 <Tool
530 Name="VCBscMakeTool"
531 />
532 <Tool
533 Name="VCFxCopTool"
534 />
535 <Tool
536 Name="VCPostBuildEventTool"
537 />
538 </Configuration>
539 <Configuration
540 Name="ReleaseWithoutAsm|x64"
541 OutputDirectory="x64\ZlibStat$(ConfigurationName)"
542 IntermediateDirectory="x64\ZlibStat$(ConfigurationName)\Tmp"
543 ConfigurationType="4"
544 InheritedPropertySheets="UpgradeFromVC70.vsprops"
545 UseOfMFC="0"
546 ATLMinimizesCRunTimeLibraryUsage="false"
547 >
548 <Tool
549 Name="VCPreBuildEventTool"
550 />
551 <Tool
552 Name="VCCustomBuildTool"
553 />
554 <Tool
555 Name="VCXMLDataGeneratorTool"
556 />
557 <Tool
558 Name="VCWebServiceProxyGeneratorTool"
559 />
560 <Tool
561 Name="VCMIDLTool"
562 TargetEnvironment="3"
563 />
564 <Tool
565 Name="VCCLCompilerTool"
566 InlineFunctionExpansion="1"
567 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
568 PreprocessorDefinitions="ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
569 StringPooling="true"
570 ExceptionHandling="0"
571 RuntimeLibrary="2"
572 BufferSecurityCheck="false"
573 EnableFunctionLevelLinking="true"
574 PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
575 AssemblerListingLocation="$(IntDir)\"
576 ObjectFile="$(IntDir)\"
577 ProgramDataBaseFileName="$(OutDir)\"
578 WarningLevel="3"
579 SuppressStartupBanner="true"
580 />
581 <Tool
582 Name="VCManagedResourceCompilerTool"
583 />
584 <Tool
585 Name="VCResourceCompilerTool"
586 Culture="1036"
587 />
588 <Tool
589 Name="VCPreLinkEventTool"
590 />
591 <Tool
592 Name="VCLibrarianTool"
593 AdditionalOptions="/MACHINE:AMD64 /NODEFAULTLIB"
594 OutputFile="$(OutDir)\zlibstat.lib"
595 SuppressStartupBanner="true"
596 />
597 <Tool
598 Name="VCALinkTool"
599 />
600 <Tool
601 Name="VCXDCMakeTool"
602 />
603 <Tool
604 Name="VCBscMakeTool"
605 />
606 <Tool
607 Name="VCFxCopTool"
608 />
609 <Tool
610 Name="VCPostBuildEventTool"
611 />
612 </Configuration>
613 <Configuration
614 Name="ReleaseWithoutAsm|Itanium"
615 OutputDirectory="ia64\ZlibStat$(ConfigurationName)"
616 IntermediateDirectory="ia64\ZlibStat$(ConfigurationName)\Tmp"
617 ConfigurationType="4"
618 InheritedPropertySheets="UpgradeFromVC70.vsprops"
619 UseOfMFC="0"
620 ATLMinimizesCRunTimeLibraryUsage="false"
621 >
622 <Tool
623 Name="VCPreBuildEventTool"
624 />
625 <Tool
626 Name="VCCustomBuildTool"
627 />
628 <Tool
629 Name="VCXMLDataGeneratorTool"
630 />
631 <Tool
632 Name="VCWebServiceProxyGeneratorTool"
633 />
634 <Tool
635 Name="VCMIDLTool"
636 TargetEnvironment="2"
637 />
638 <Tool
639 Name="VCCLCompilerTool"
640 InlineFunctionExpansion="1"
641 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
642 PreprocessorDefinitions="ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;WIN64"
643 StringPooling="true"
644 ExceptionHandling="0"
645 RuntimeLibrary="2"
646 BufferSecurityCheck="false"
647 EnableFunctionLevelLinking="true"
648 PrecompiledHeaderFile="$(IntDir)/zlibstat.pch"
649 AssemblerListingLocation="$(IntDir)\"
650 ObjectFile="$(IntDir)\"
651 ProgramDataBaseFileName="$(OutDir)\"
652 WarningLevel="3"
653 SuppressStartupBanner="true"
654 />
655 <Tool
656 Name="VCManagedResourceCompilerTool"
657 />
658 <Tool
659 Name="VCResourceCompilerTool"
660 Culture="1036"
661 />
662 <Tool
663 Name="VCPreLinkEventTool"
664 />
665 <Tool
666 Name="VCLibrarianTool"
667 AdditionalOptions="/MACHINE:IA64 /NODEFAULTLIB"
668 OutputFile="$(OutDir)\zlibstat.lib"
669 SuppressStartupBanner="true"
670 />
671 <Tool
672 Name="VCALinkTool"
673 />
674 <Tool
675 Name="VCXDCMakeTool"
676 />
677 <Tool
678 Name="VCBscMakeTool"
679 />
680 <Tool
681 Name="VCFxCopTool"
682 />
683 <Tool
684 Name="VCPostBuildEventTool"
685 />
686 </Configuration>
687 </Configurations>
688 <References>
689 </References>
690 <Files>
691 <Filter
692 Name="Source Files"
693 >
694 <File
695 RelativePath="..\..\..\adler32.c"
696 >
697 </File>
698 <File
699 RelativePath="..\..\..\compress.c"
700 >
701 </File>
702 <File
703 RelativePath="..\..\..\crc32.c"
704 >
705 </File>
706 <File
707 RelativePath="..\..\..\deflate.c"
708 >
709 </File>
710 <File
711 RelativePath="..\..\masmx86\gvmat32c.c"
712 >
713 <FileConfiguration
714 Name="Debug|x64"
715 ExcludedFromBuild="true"
716 >
717 <Tool
718 Name="VCCLCompilerTool"
719 />
720 </FileConfiguration>
721 <FileConfiguration
722 Name="Debug|Itanium"
723 ExcludedFromBuild="true"
724 >
725 <Tool
726 Name="VCCLCompilerTool"
727 />
728 </FileConfiguration>
729 <FileConfiguration
730 Name="Release|x64"
731 ExcludedFromBuild="true"
732 >
733 <Tool
734 Name="VCCLCompilerTool"
735 />
736 </FileConfiguration>
737 <FileConfiguration
738 Name="Release|Itanium"
739 ExcludedFromBuild="true"
740 >
741 <Tool
742 Name="VCCLCompilerTool"
743 />
744 </FileConfiguration>
745 <FileConfiguration
746 Name="ReleaseWithoutAsm|x64"
747 ExcludedFromBuild="true"
748 >
749 <Tool
750 Name="VCCLCompilerTool"
751 />
752 </FileConfiguration>
753 <FileConfiguration
754 Name="ReleaseWithoutAsm|Itanium"
755 ExcludedFromBuild="true"
756 >
757 <Tool
758 Name="VCCLCompilerTool"
759 />
760 </FileConfiguration>
761 </File>
762 <File
763 RelativePath="..\..\..\gzio.c"
764 >
765 </File>
766 <File
767 RelativePath="..\..\..\infback.c"
768 >
769 </File>
770 <File
771 RelativePath="..\..\masmx64\inffas8664.c"
772 >
773 <FileConfiguration
774 Name="Debug|Win32"
775 ExcludedFromBuild="true"
776 >
777 <Tool
778 Name="VCCLCompilerTool"
779 />
780 </FileConfiguration>
781 <FileConfiguration
782 Name="Debug|Itanium"
783 ExcludedFromBuild="true"
784 >
785 <Tool
786 Name="VCCLCompilerTool"
787 />
788 </FileConfiguration>
789 <FileConfiguration
790 Name="Release|Win32"
791 ExcludedFromBuild="true"
792 >
793 <Tool
794 Name="VCCLCompilerTool"
795 />
796 </FileConfiguration>
797 <FileConfiguration
798 Name="Release|Itanium"
799 ExcludedFromBuild="true"
800 >
801 <Tool
802 Name="VCCLCompilerTool"
803 />
804 </FileConfiguration>
805 <FileConfiguration
806 Name="ReleaseWithoutAsm|Win32"
807 ExcludedFromBuild="true"
808 >
809 <Tool
810 Name="VCCLCompilerTool"
811 />
812 </FileConfiguration>
813 <FileConfiguration
814 Name="ReleaseWithoutAsm|Itanium"
815 ExcludedFromBuild="true"
816 >
817 <Tool
818 Name="VCCLCompilerTool"
819 />
820 </FileConfiguration>
821 </File>
822 <File
823 RelativePath="..\..\..\inffast.c"
824 >
825 </File>
826 <File
827 RelativePath="..\..\..\inflate.c"
828 >
829 </File>
830 <File
831 RelativePath="..\..\..\inftrees.c"
832 >
833 </File>
834 <File
835 RelativePath="..\..\minizip\ioapi.c"
836 >
837 </File>
838 <File
839 RelativePath="..\..\..\trees.c"
840 >
841 </File>
842 <File
843 RelativePath="..\..\..\uncompr.c"
844 >
845 </File>
846 <File
847 RelativePath="..\..\minizip\unzip.c"
848 >
849 </File>
850 <File
851 RelativePath="..\..\minizip\zip.c"
852 >
853 </File>
854 <File
855 RelativePath=".\zlib.rc"
856 >
857 </File>
858 <File
859 RelativePath=".\zlibvc.def"
860 >
861 </File>
862 <File
863 RelativePath="..\..\..\zutil.c"
864 >
865 </File>
866 </Filter>
867 </Files>
868 <Globals>
869 </Globals>
870</VisualStudioProject>
diff --git a/contrib/vstudio/vc8/zlibvc.def b/contrib/vstudio/vc8/zlibvc.def
new file mode 100644
index 0000000..a40e715
--- /dev/null
+++ b/contrib/vstudio/vc8/zlibvc.def
@@ -0,0 +1,92 @@
1
2VERSION 1.23
3
4HEAPSIZE 1048576,8192
5
6EXPORTS
7 adler32 @1
8 compress @2
9 crc32 @3
10 deflate @4
11 deflateCopy @5
12 deflateEnd @6
13 deflateInit2_ @7
14 deflateInit_ @8
15 deflateParams @9
16 deflateReset @10
17 deflateSetDictionary @11
18 gzclose @12
19 gzdopen @13
20 gzerror @14
21 gzflush @15
22 gzopen @16
23 gzread @17
24 gzwrite @18
25 inflate @19
26 inflateEnd @20
27 inflateInit2_ @21
28 inflateInit_ @22
29 inflateReset @23
30 inflateSetDictionary @24
31 inflateSync @25
32 uncompress @26
33 zlibVersion @27
34 gzprintf @28
35 gzputc @29
36 gzgetc @30
37 gzseek @31
38 gzrewind @32
39 gztell @33
40 gzeof @34
41 gzsetparams @35
42 zError @36
43 inflateSyncPoint @37
44 get_crc_table @38
45 compress2 @39
46 gzputs @40
47 gzgets @41
48 inflateCopy @42
49 inflateBackInit_ @43
50 inflateBack @44
51 inflateBackEnd @45
52 compressBound @46
53 deflateBound @47
54 gzclearerr @48
55 gzungetc @49
56 zlibCompileFlags @50
57 deflatePrime @51
58
59 unzOpen @61
60 unzClose @62
61 unzGetGlobalInfo @63
62 unzGetCurrentFileInfo @64
63 unzGoToFirstFile @65
64 unzGoToNextFile @66
65 unzOpenCurrentFile @67
66 unzReadCurrentFile @68
67 unzOpenCurrentFile3 @69
68 unztell @70
69 unzeof @71
70 unzCloseCurrentFile @72
71 unzGetGlobalComment @73
72 unzStringFileNameCompare @74
73 unzLocateFile @75
74 unzGetLocalExtrafield @76
75 unzOpen2 @77
76 unzOpenCurrentFile2 @78
77 unzOpenCurrentFilePassword @79
78
79 zipOpen @80
80 zipOpenNewFileInZip @81
81 zipWriteInFileInZip @82
82 zipCloseFileInZip @83
83 zipClose @84
84 zipOpenNewFileInZip2 @86
85 zipCloseFileInZipRaw @87
86 zipOpen2 @88
87 zipOpenNewFileInZip3 @89
88
89 unzGetFilePos @100
90 unzGoToFilePos @101
91
92 fill_win32_filefunc @110
diff --git a/contrib/vstudio/vc8/zlibvc.sln b/contrib/vstudio/vc8/zlibvc.sln
new file mode 100644
index 0000000..a815a55
--- /dev/null
+++ b/contrib/vstudio/vc8/zlibvc.sln
@@ -0,0 +1,144 @@
1
2Microsoft Visual Studio Solution File, Format Version 9.00
3# Visual Studio 2005
4Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}"
5EndProject
6Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}"
7EndProject
8Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}"
9EndProject
10Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestZlibDll", "testzlibdll.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694366A}"
11 ProjectSection(ProjectDependencies) = postProject
12 {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D}
13 EndProjectSection
14EndProject
15Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}"
16 ProjectSection(ProjectDependencies) = postProject
17 {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D}
18 EndProjectSection
19EndProject
20Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}"
21 ProjectSection(ProjectDependencies) = postProject
22 {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D}
23 EndProjectSection
24EndProject
25Global
26 GlobalSection(SolutionConfigurationPlatforms) = preSolution
27 Debug|Itanium = Debug|Itanium
28 Debug|Win32 = Debug|Win32
29 Debug|x64 = Debug|x64
30 Release|Itanium = Release|Itanium
31 Release|Win32 = Release|Win32
32 Release|x64 = Release|x64
33 ReleaseWithoutAsm|Itanium = ReleaseWithoutAsm|Itanium
34 ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32
35 ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64
36 EndGlobalSection
37 GlobalSection(ProjectConfigurationPlatforms) = postSolution
38 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.ActiveCfg = Debug|Itanium
39 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.Build.0 = Debug|Itanium
40 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32
41 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32
42 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.ActiveCfg = Debug|x64
43 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.Build.0 = Debug|x64
44 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.ActiveCfg = Release|Itanium
45 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.Build.0 = Release|Itanium
46 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32
47 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32
48 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.ActiveCfg = ReleaseWithoutAsm|x64
49 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.Build.0 = ReleaseWithoutAsm|x64
50 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium
51 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium
52 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32
53 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32
54 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64
55 {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64
56 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.ActiveCfg = Debug|Itanium
57 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.Build.0 = Debug|Itanium
58 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32
59 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32
60 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64
61 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64
62 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.ActiveCfg = Release|Itanium
63 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.Build.0 = Release|Itanium
64 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32
65 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32
66 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64
67 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64
68 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium
69 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium
70 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32
71 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32
72 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64
73 {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64
74 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Itanium
75 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.Build.0 = Debug|Itanium
76 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32
77 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32
78 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64
79 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64
80 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Itanium
81 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.Build.0 = Release|Itanium
82 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32
83 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32
84 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64
85 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64
86 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium
87 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium
88 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32
89 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32
90 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64
91 {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64
92 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.ActiveCfg = Debug|Itanium
93 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.Build.0 = Debug|Itanium
94 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.ActiveCfg = Debug|Win32
95 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.Build.0 = Debug|Win32
96 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.ActiveCfg = Debug|x64
97 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.Build.0 = Debug|x64
98 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.ActiveCfg = Release|Itanium
99 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.Build.0 = Release|Itanium
100 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.ActiveCfg = Release|Win32
101 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.Build.0 = Release|Win32
102 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.ActiveCfg = Release|x64
103 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.Build.0 = Release|x64
104 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium
105 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium
106 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Itanium
107 {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|Itanium
108 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Itanium
109 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.Build.0 = Debug|Itanium
110 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32
111 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32
112 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64
113 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64
114 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Itanium
115 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.Build.0 = Release|Itanium
116 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32
117 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32
118 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64
119 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64
120 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium
121 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium
122 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Itanium
123 {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = Release|Itanium
124 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.ActiveCfg = Debug|Itanium
125 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.Build.0 = Debug|Itanium
126 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.ActiveCfg = Debug|Win32
127 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.Build.0 = Debug|Win32
128 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.ActiveCfg = Debug|x64
129 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.Build.0 = Debug|x64
130 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.ActiveCfg = Release|Itanium
131 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.Build.0 = Release|Itanium
132 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.ActiveCfg = Release|Win32
133 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.Build.0 = Release|Win32
134 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.ActiveCfg = Release|x64
135 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.Build.0 = Release|x64
136 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium
137 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium
138 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Itanium
139 {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|Itanium
140 EndGlobalSection
141 GlobalSection(SolutionProperties) = preSolution
142 HideSolutionNode = FALSE
143 EndGlobalSection
144EndGlobal
diff --git a/contrib/vstudio/vc8/zlibvc.vcproj b/contrib/vstudio/vc8/zlibvc.vcproj
new file mode 100644
index 0000000..e717011
--- /dev/null
+++ b/contrib/vstudio/vc8/zlibvc.vcproj
@@ -0,0 +1,1219 @@
1<?xml version="1.0" encoding="Windows-1252"?>
2<VisualStudioProject
3 ProjectType="Visual C++"
4 Version="8,00"
5 Name="zlibvc"
6 ProjectGUID="{8FD826F8-3739-44E6-8CC8-997122E53B8D}"
7 >
8 <Platforms>
9 <Platform
10 Name="Win32"
11 />
12 <Platform
13 Name="x64"
14 />
15 <Platform
16 Name="Itanium"
17 />
18 </Platforms>
19 <ToolFiles>
20 </ToolFiles>
21 <Configurations>
22 <Configuration
23 Name="Debug|Win32"
24 OutputDirectory="x86\ZlibDll$(ConfigurationName)"
25 IntermediateDirectory="x86\ZlibDll$(ConfigurationName)\Tmp"
26 ConfigurationType="2"
27 InheritedPropertySheets="UpgradeFromVC70.vsprops"
28 UseOfMFC="0"
29 ATLMinimizesCRunTimeLibraryUsage="false"
30 >
31 <Tool
32 Name="VCPreBuildEventTool"
33 />
34 <Tool
35 Name="VCCustomBuildTool"
36 />
37 <Tool
38 Name="VCXMLDataGeneratorTool"
39 />
40 <Tool
41 Name="VCWebServiceProxyGeneratorTool"
42 />
43 <Tool
44 Name="VCMIDLTool"
45 PreprocessorDefinitions="_DEBUG"
46 MkTypLibCompatible="true"
47 SuppressStartupBanner="true"
48 TargetEnvironment="1"
49 TypeLibraryName="$(OutDir)/zlibvc.tlb"
50 />
51 <Tool
52 Name="VCCLCompilerTool"
53 Optimization="0"
54 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
55 PreprocessorDefinitions="WIN32,_CRT_SECURE_NO_DEPRECATE,ZLIB_WINAPI,ASMV,ASMINF"
56 ExceptionHandling="0"
57 RuntimeLibrary="1"
58 BufferSecurityCheck="false"
59 PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
60 AssemblerListingLocation="$(IntDir)\"
61 ObjectFile="$(IntDir)\"
62 ProgramDataBaseFileName="$(OutDir)\"
63 BrowseInformation="0"
64 WarningLevel="3"
65 SuppressStartupBanner="true"
66 DebugInformationFormat="4"
67 />
68 <Tool
69 Name="VCManagedResourceCompilerTool"
70 />
71 <Tool
72 Name="VCResourceCompilerTool"
73 PreprocessorDefinitions="_DEBUG"
74 Culture="1036"
75 />
76 <Tool
77 Name="VCPreLinkEventTool"
78 />
79 <Tool
80 Name="VCLinkerTool"
81 AdditionalOptions="/MACHINE:I386"
82 AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj"
83 OutputFile="$(OutDir)\zlibwapi.dll"
84 LinkIncremental="2"
85 SuppressStartupBanner="true"
86 GenerateManifest="false"
87 ModuleDefinitionFile=".\zlibvc.def"
88 GenerateDebugInformation="true"
89 ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
90 GenerateMapFile="true"
91 MapFileName="$(OutDir)/zlibwapi.map"
92 SubSystem="2"
93 ImportLibrary="$(OutDir)/zlibwapi.lib"
94 />
95 <Tool
96 Name="VCALinkTool"
97 />
98 <Tool
99 Name="VCManifestTool"
100 />
101 <Tool
102 Name="VCXDCMakeTool"
103 />
104 <Tool
105 Name="VCBscMakeTool"
106 />
107 <Tool
108 Name="VCFxCopTool"
109 />
110 <Tool
111 Name="VCAppVerifierTool"
112 />
113 <Tool
114 Name="VCWebDeploymentTool"
115 />
116 <Tool
117 Name="VCPostBuildEventTool"
118 />
119 </Configuration>
120 <Configuration
121 Name="Debug|x64"
122 OutputDirectory="x64\ZlibDll$(ConfigurationName)"
123 IntermediateDirectory="x64\ZlibDll$(ConfigurationName)\Tmp"
124 ConfigurationType="2"
125 InheritedPropertySheets="UpgradeFromVC70.vsprops"
126 UseOfMFC="0"
127 ATLMinimizesCRunTimeLibraryUsage="false"
128 >
129 <Tool
130 Name="VCPreBuildEventTool"
131 />
132 <Tool
133 Name="VCCustomBuildTool"
134 />
135 <Tool
136 Name="VCXMLDataGeneratorTool"
137 />
138 <Tool
139 Name="VCWebServiceProxyGeneratorTool"
140 />
141 <Tool
142 Name="VCMIDLTool"
143 PreprocessorDefinitions="_DEBUG"
144 MkTypLibCompatible="true"
145 SuppressStartupBanner="true"
146 TargetEnvironment="3"
147 TypeLibraryName="$(OutDir)/zlibvc.tlb"
148 />
149 <Tool
150 Name="VCCLCompilerTool"
151 Optimization="0"
152 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
153 PreprocessorDefinitions="WIN32,_CRT_SECURE_NO_DEPRECATE,ZLIB_WINAPI,ASMV,ASMINF;WIN64"
154 ExceptionHandling="0"
155 RuntimeLibrary="3"
156 BufferSecurityCheck="false"
157 PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
158 AssemblerListingLocation="$(IntDir)\"
159 ObjectFile="$(IntDir)\"
160 ProgramDataBaseFileName="$(OutDir)\"
161 BrowseInformation="0"
162 WarningLevel="3"
163 SuppressStartupBanner="true"
164 DebugInformationFormat="3"
165 />
166 <Tool
167 Name="VCManagedResourceCompilerTool"
168 />
169 <Tool
170 Name="VCResourceCompilerTool"
171 PreprocessorDefinitions="_DEBUG"
172 Culture="1036"
173 />
174 <Tool
175 Name="VCPreLinkEventTool"
176 />
177 <Tool
178 Name="VCLinkerTool"
179 AdditionalDependencies="..\..\masmx64\gvmat64.obj ..\..\masmx64\inffasx64.obj "
180 OutputFile="$(OutDir)\zlibwapi.dll"
181 LinkIncremental="2"
182 SuppressStartupBanner="true"
183 GenerateManifest="false"
184 ModuleDefinitionFile=".\zlibvc.def"
185 GenerateDebugInformation="true"
186 ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
187 GenerateMapFile="true"
188 MapFileName="$(OutDir)/zlibwapi.map"
189 SubSystem="2"
190 ImportLibrary="$(OutDir)/zlibwapi.lib"
191 TargetMachine="17"
192 />
193 <Tool
194 Name="VCALinkTool"
195 />
196 <Tool
197 Name="VCManifestTool"
198 />
199 <Tool
200 Name="VCXDCMakeTool"
201 />
202 <Tool
203 Name="VCBscMakeTool"
204 />
205 <Tool
206 Name="VCFxCopTool"
207 />
208 <Tool
209 Name="VCAppVerifierTool"
210 />
211 <Tool
212 Name="VCWebDeploymentTool"
213 />
214 <Tool
215 Name="VCPostBuildEventTool"
216 />
217 </Configuration>
218 <Configuration
219 Name="Debug|Itanium"
220 OutputDirectory="ia64\ZlibDll$(ConfigurationName)"
221 IntermediateDirectory="ia64\ZlibDll$(ConfigurationName)\Tmp"
222 ConfigurationType="2"
223 InheritedPropertySheets="UpgradeFromVC70.vsprops"
224 UseOfMFC="0"
225 ATLMinimizesCRunTimeLibraryUsage="false"
226 >
227 <Tool
228 Name="VCPreBuildEventTool"
229 />
230 <Tool
231 Name="VCCustomBuildTool"
232 />
233 <Tool
234 Name="VCXMLDataGeneratorTool"
235 />
236 <Tool
237 Name="VCWebServiceProxyGeneratorTool"
238 />
239 <Tool
240 Name="VCMIDLTool"
241 PreprocessorDefinitions="_DEBUG"
242 MkTypLibCompatible="true"
243 SuppressStartupBanner="true"
244 TargetEnvironment="2"
245 TypeLibraryName="$(OutDir)/zlibvc.tlb"
246 />
247 <Tool
248 Name="VCCLCompilerTool"
249 Optimization="0"
250 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
251 PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;WIN64"
252 ExceptionHandling="0"
253 RuntimeLibrary="3"
254 BufferSecurityCheck="false"
255 PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
256 AssemblerListingLocation="$(IntDir)\"
257 ObjectFile="$(IntDir)\"
258 ProgramDataBaseFileName="$(OutDir)\"
259 BrowseInformation="0"
260 WarningLevel="3"
261 SuppressStartupBanner="true"
262 DebugInformationFormat="3"
263 />
264 <Tool
265 Name="VCManagedResourceCompilerTool"
266 />
267 <Tool
268 Name="VCResourceCompilerTool"
269 PreprocessorDefinitions="_DEBUG"
270 Culture="1036"
271 />
272 <Tool
273 Name="VCPreLinkEventTool"
274 />
275 <Tool
276 Name="VCLinkerTool"
277 OutputFile="$(OutDir)\zlibwapi.dll"
278 LinkIncremental="2"
279 SuppressStartupBanner="true"
280 GenerateManifest="false"
281 ModuleDefinitionFile=".\zlibvc.def"
282 GenerateDebugInformation="true"
283 ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
284 GenerateMapFile="true"
285 MapFileName="$(OutDir)/zlibwapi.map"
286 SubSystem="2"
287 ImportLibrary="$(OutDir)/zlibwapi.lib"
288 TargetMachine="5"
289 />
290 <Tool
291 Name="VCALinkTool"
292 />
293 <Tool
294 Name="VCManifestTool"
295 />
296 <Tool
297 Name="VCXDCMakeTool"
298 />
299 <Tool
300 Name="VCBscMakeTool"
301 />
302 <Tool
303 Name="VCFxCopTool"
304 />
305 <Tool
306 Name="VCAppVerifierTool"
307 />
308 <Tool
309 Name="VCWebDeploymentTool"
310 />
311 <Tool
312 Name="VCPostBuildEventTool"
313 />
314 </Configuration>
315 <Configuration
316 Name="ReleaseWithoutAsm|Win32"
317 OutputDirectory="x86\ZlibDll$(ConfigurationName)"
318 IntermediateDirectory="x86\ZlibDll$(ConfigurationName)\Tmp"
319 ConfigurationType="2"
320 InheritedPropertySheets="UpgradeFromVC70.vsprops"
321 UseOfMFC="0"
322 ATLMinimizesCRunTimeLibraryUsage="false"
323 WholeProgramOptimization="1"
324 >
325 <Tool
326 Name="VCPreBuildEventTool"
327 />
328 <Tool
329 Name="VCCustomBuildTool"
330 />
331 <Tool
332 Name="VCXMLDataGeneratorTool"
333 />
334 <Tool
335 Name="VCWebServiceProxyGeneratorTool"
336 />
337 <Tool
338 Name="VCMIDLTool"
339 PreprocessorDefinitions="NDEBUG"
340 MkTypLibCompatible="true"
341 SuppressStartupBanner="true"
342 TargetEnvironment="1"
343 TypeLibraryName="$(OutDir)/zlibvc.tlb"
344 />
345 <Tool
346 Name="VCCLCompilerTool"
347 InlineFunctionExpansion="1"
348 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
349 PreprocessorDefinitions="WIN32,_CRT_SECURE_NO_DEPRECATE,ZLIB_WINAPI"
350 StringPooling="true"
351 ExceptionHandling="0"
352 RuntimeLibrary="2"
353 BufferSecurityCheck="false"
354 EnableFunctionLevelLinking="true"
355 PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
356 AssemblerOutput="2"
357 AssemblerListingLocation="$(IntDir)\"
358 ObjectFile="$(IntDir)\"
359 ProgramDataBaseFileName="$(OutDir)\"
360 BrowseInformation="0"
361 WarningLevel="3"
362 SuppressStartupBanner="true"
363 />
364 <Tool
365 Name="VCManagedResourceCompilerTool"
366 />
367 <Tool
368 Name="VCResourceCompilerTool"
369 PreprocessorDefinitions="NDEBUG"
370 Culture="1036"
371 />
372 <Tool
373 Name="VCPreLinkEventTool"
374 />
375 <Tool
376 Name="VCLinkerTool"
377 AdditionalOptions="/MACHINE:I386"
378 OutputFile="$(OutDir)\zlibwapi.dll"
379 LinkIncremental="1"
380 SuppressStartupBanner="true"
381 GenerateManifest="false"
382 IgnoreAllDefaultLibraries="false"
383 ModuleDefinitionFile=".\zlibvc.def"
384 ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
385 GenerateMapFile="true"
386 MapFileName="$(OutDir)/zlibwapi.map"
387 SubSystem="2"
388 OptimizeForWindows98="1"
389 ImportLibrary="$(OutDir)/zlibwapi.lib"
390 />
391 <Tool
392 Name="VCALinkTool"
393 />
394 <Tool
395 Name="VCManifestTool"
396 />
397 <Tool
398 Name="VCXDCMakeTool"
399 />
400 <Tool
401 Name="VCBscMakeTool"
402 />
403 <Tool
404 Name="VCFxCopTool"
405 />
406 <Tool
407 Name="VCAppVerifierTool"
408 />
409 <Tool
410 Name="VCWebDeploymentTool"
411 />
412 <Tool
413 Name="VCPostBuildEventTool"
414 />
415 </Configuration>
416 <Configuration
417 Name="ReleaseWithoutAsm|x64"
418 OutputDirectory="x64\ZlibDll$(ConfigurationName)"
419 IntermediateDirectory="x64\ZlibDll$(ConfigurationName)\Tmp"
420 ConfigurationType="2"
421 InheritedPropertySheets="UpgradeFromVC70.vsprops"
422 UseOfMFC="0"
423 ATLMinimizesCRunTimeLibraryUsage="false"
424 WholeProgramOptimization="1"
425 >
426 <Tool
427 Name="VCPreBuildEventTool"
428 />
429 <Tool
430 Name="VCCustomBuildTool"
431 />
432 <Tool
433 Name="VCXMLDataGeneratorTool"
434 />
435 <Tool
436 Name="VCWebServiceProxyGeneratorTool"
437 />
438 <Tool
439 Name="VCMIDLTool"
440 PreprocessorDefinitions="NDEBUG"
441 MkTypLibCompatible="true"
442 SuppressStartupBanner="true"
443 TargetEnvironment="3"
444 TypeLibraryName="$(OutDir)/zlibvc.tlb"
445 />
446 <Tool
447 Name="VCCLCompilerTool"
448 InlineFunctionExpansion="1"
449 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
450 PreprocessorDefinitions="WIN32,_CRT_SECURE_NO_DEPRECATE,ZLIB_WINAPI;WIN64"
451 StringPooling="true"
452 ExceptionHandling="0"
453 RuntimeLibrary="2"
454 BufferSecurityCheck="false"
455 EnableFunctionLevelLinking="true"
456 PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
457 AssemblerOutput="2"
458 AssemblerListingLocation="$(IntDir)\"
459 ObjectFile="$(IntDir)\"
460 ProgramDataBaseFileName="$(OutDir)\"
461 BrowseInformation="0"
462 WarningLevel="3"
463 SuppressStartupBanner="true"
464 />
465 <Tool
466 Name="VCManagedResourceCompilerTool"
467 />
468 <Tool
469 Name="VCResourceCompilerTool"
470 PreprocessorDefinitions="NDEBUG"
471 Culture="1036"
472 />
473 <Tool
474 Name="VCPreLinkEventTool"
475 />
476 <Tool
477 Name="VCLinkerTool"
478 OutputFile="$(OutDir)\zlibwapi.dll"
479 LinkIncremental="1"
480 SuppressStartupBanner="true"
481 GenerateManifest="false"
482 IgnoreAllDefaultLibraries="false"
483 ModuleDefinitionFile=".\zlibvc.def"
484 ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
485 GenerateMapFile="true"
486 MapFileName="$(OutDir)/zlibwapi.map"
487 SubSystem="2"
488 OptimizeForWindows98="1"
489 ImportLibrary="$(OutDir)/zlibwapi.lib"
490 TargetMachine="17"
491 />
492 <Tool
493 Name="VCALinkTool"
494 />
495 <Tool
496 Name="VCManifestTool"
497 />
498 <Tool
499 Name="VCXDCMakeTool"
500 />
501 <Tool
502 Name="VCBscMakeTool"
503 />
504 <Tool
505 Name="VCFxCopTool"
506 />
507 <Tool
508 Name="VCAppVerifierTool"
509 />
510 <Tool
511 Name="VCWebDeploymentTool"
512 />
513 <Tool
514 Name="VCPostBuildEventTool"
515 />
516 </Configuration>
517 <Configuration
518 Name="ReleaseWithoutAsm|Itanium"
519 OutputDirectory="ia64\ZlibDll$(ConfigurationName)"
520 IntermediateDirectory="ia64\ZlibDll$(ConfigurationName)\Tmp"
521 ConfigurationType="2"
522 InheritedPropertySheets="UpgradeFromVC70.vsprops"
523 UseOfMFC="0"
524 ATLMinimizesCRunTimeLibraryUsage="false"
525 WholeProgramOptimization="1"
526 >
527 <Tool
528 Name="VCPreBuildEventTool"
529 />
530 <Tool
531 Name="VCCustomBuildTool"
532 />
533 <Tool
534 Name="VCXMLDataGeneratorTool"
535 />
536 <Tool
537 Name="VCWebServiceProxyGeneratorTool"
538 />
539 <Tool
540 Name="VCMIDLTool"
541 PreprocessorDefinitions="NDEBUG"
542 MkTypLibCompatible="true"
543 SuppressStartupBanner="true"
544 TargetEnvironment="2"
545 TypeLibraryName="$(OutDir)/zlibvc.tlb"
546 />
547 <Tool
548 Name="VCCLCompilerTool"
549 InlineFunctionExpansion="1"
550 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
551 PreprocessorDefinitions="WIN32,_CRT_SECURE_NO_DEPRECATE,ZLIB_WINAPI;WIN64"
552 StringPooling="true"
553 ExceptionHandling="0"
554 RuntimeLibrary="2"
555 BufferSecurityCheck="false"
556 EnableFunctionLevelLinking="true"
557 PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
558 AssemblerOutput="2"
559 AssemblerListingLocation="$(IntDir)\"
560 ObjectFile="$(IntDir)\"
561 ProgramDataBaseFileName="$(OutDir)\"
562 BrowseInformation="0"
563 WarningLevel="3"
564 SuppressStartupBanner="true"
565 />
566 <Tool
567 Name="VCManagedResourceCompilerTool"
568 />
569 <Tool
570 Name="VCResourceCompilerTool"
571 PreprocessorDefinitions="NDEBUG"
572 Culture="1036"
573 />
574 <Tool
575 Name="VCPreLinkEventTool"
576 />
577 <Tool
578 Name="VCLinkerTool"
579 OutputFile="$(OutDir)\zlibwapi.dll"
580 LinkIncremental="1"
581 SuppressStartupBanner="true"
582 GenerateManifest="false"
583 IgnoreAllDefaultLibraries="false"
584 ModuleDefinitionFile=".\zlibvc.def"
585 ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
586 GenerateMapFile="true"
587 MapFileName="$(OutDir)/zlibwapi.map"
588 SubSystem="2"
589 OptimizeForWindows98="1"
590 ImportLibrary="$(OutDir)/zlibwapi.lib"
591 TargetMachine="5"
592 />
593 <Tool
594 Name="VCALinkTool"
595 />
596 <Tool
597 Name="VCManifestTool"
598 />
599 <Tool
600 Name="VCXDCMakeTool"
601 />
602 <Tool
603 Name="VCBscMakeTool"
604 />
605 <Tool
606 Name="VCFxCopTool"
607 />
608 <Tool
609 Name="VCAppVerifierTool"
610 />
611 <Tool
612 Name="VCWebDeploymentTool"
613 />
614 <Tool
615 Name="VCPostBuildEventTool"
616 />
617 </Configuration>
618 <Configuration
619 Name="Release|Win32"
620 OutputDirectory="x86\ZlibDll$(ConfigurationName)"
621 IntermediateDirectory="x86\ZlibDll$(ConfigurationName)\Tmp"
622 ConfigurationType="2"
623 InheritedPropertySheets="UpgradeFromVC70.vsprops"
624 UseOfMFC="0"
625 ATLMinimizesCRunTimeLibraryUsage="false"
626 WholeProgramOptimization="1"
627 >
628 <Tool
629 Name="VCPreBuildEventTool"
630 />
631 <Tool
632 Name="VCCustomBuildTool"
633 />
634 <Tool
635 Name="VCXMLDataGeneratorTool"
636 />
637 <Tool
638 Name="VCWebServiceProxyGeneratorTool"
639 />
640 <Tool
641 Name="VCMIDLTool"
642 PreprocessorDefinitions="NDEBUG"
643 MkTypLibCompatible="true"
644 SuppressStartupBanner="true"
645 TargetEnvironment="1"
646 TypeLibraryName="$(OutDir)/zlibvc.tlb"
647 />
648 <Tool
649 Name="VCCLCompilerTool"
650 InlineFunctionExpansion="1"
651 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
652 PreprocessorDefinitions="WIN32;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;ASMV;ASMINF"
653 StringPooling="true"
654 ExceptionHandling="0"
655 RuntimeLibrary="2"
656 BufferSecurityCheck="false"
657 EnableFunctionLevelLinking="true"
658 PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
659 AssemblerOutput="2"
660 AssemblerListingLocation="$(IntDir)\"
661 ObjectFile="$(IntDir)\"
662 ProgramDataBaseFileName="$(OutDir)\"
663 BrowseInformation="0"
664 WarningLevel="3"
665 SuppressStartupBanner="true"
666 />
667 <Tool
668 Name="VCManagedResourceCompilerTool"
669 />
670 <Tool
671 Name="VCResourceCompilerTool"
672 PreprocessorDefinitions="NDEBUG"
673 Culture="1036"
674 />
675 <Tool
676 Name="VCPreLinkEventTool"
677 />
678 <Tool
679 Name="VCLinkerTool"
680 AdditionalOptions="/MACHINE:I386"
681 AdditionalDependencies="..\..\masmx86\gvmat32.obj ..\..\masmx86\inffas32.obj "
682 OutputFile="$(OutDir)\zlibwapi.dll"
683 LinkIncremental="1"
684 SuppressStartupBanner="true"
685 GenerateManifest="false"
686 IgnoreAllDefaultLibraries="false"
687 ModuleDefinitionFile=".\zlibvc.def"
688 ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
689 GenerateMapFile="true"
690 MapFileName="$(OutDir)/zlibwapi.map"
691 SubSystem="2"
692 OptimizeForWindows98="1"
693 ImportLibrary="$(OutDir)/zlibwapi.lib"
694 />
695 <Tool
696 Name="VCALinkTool"
697 />
698 <Tool
699 Name="VCManifestTool"
700 />
701 <Tool
702 Name="VCXDCMakeTool"
703 />
704 <Tool
705 Name="VCBscMakeTool"
706 />
707 <Tool
708 Name="VCFxCopTool"
709 />
710 <Tool
711 Name="VCAppVerifierTool"
712 />
713 <Tool
714 Name="VCWebDeploymentTool"
715 />
716 <Tool
717 Name="VCPostBuildEventTool"
718 />
719 </Configuration>
720 <Configuration
721 Name="Release|x64"
722 OutputDirectory="x64\ZlibDll$(ConfigurationName)"
723 IntermediateDirectory="x64\ZlibDll$(ConfigurationName)\Tmp"
724 ConfigurationType="2"
725 InheritedPropertySheets="UpgradeFromVC70.vsprops"
726 UseOfMFC="0"
727 ATLMinimizesCRunTimeLibraryUsage="false"
728 WholeProgramOptimization="1"
729 >
730 <Tool
731 Name="VCPreBuildEventTool"
732 />
733 <Tool
734 Name="VCCustomBuildTool"
735 />
736 <Tool
737 Name="VCXMLDataGeneratorTool"
738 />
739 <Tool
740 Name="VCWebServiceProxyGeneratorTool"
741 />
742 <Tool
743 Name="VCMIDLTool"
744 PreprocessorDefinitions="NDEBUG"
745 MkTypLibCompatible="true"
746 SuppressStartupBanner="true"
747 TargetEnvironment="3"
748 TypeLibraryName="$(OutDir)/zlibvc.tlb"
749 />
750 <Tool
751 Name="VCCLCompilerTool"
752 InlineFunctionExpansion="1"
753 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
754 PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;ASMV;ASMINF;WIN64"
755 StringPooling="true"
756 ExceptionHandling="0"
757 RuntimeLibrary="2"
758 BufferSecurityCheck="false"
759 EnableFunctionLevelLinking="true"
760 PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
761 AssemblerOutput="2"
762 AssemblerListingLocation="$(IntDir)\"
763 ObjectFile="$(IntDir)\"
764 ProgramDataBaseFileName="$(OutDir)\"
765 BrowseInformation="0"
766 WarningLevel="3"
767 SuppressStartupBanner="true"
768 />
769 <Tool
770 Name="VCManagedResourceCompilerTool"
771 />
772 <Tool
773 Name="VCResourceCompilerTool"
774 PreprocessorDefinitions="NDEBUG"
775 Culture="1036"
776 />
777 <Tool
778 Name="VCPreLinkEventTool"
779 />
780 <Tool
781 Name="VCLinkerTool"
782 AdditionalDependencies="..\..\masmx64\gvmat64.obj ..\..\masmx64\inffasx64.obj "
783 OutputFile="$(OutDir)\zlibwapi.dll"
784 LinkIncremental="1"
785 SuppressStartupBanner="true"
786 GenerateManifest="false"
787 IgnoreAllDefaultLibraries="false"
788 ModuleDefinitionFile=".\zlibvc.def"
789 ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
790 GenerateMapFile="true"
791 MapFileName="$(OutDir)/zlibwapi.map"
792 SubSystem="2"
793 OptimizeForWindows98="1"
794 ImportLibrary="$(OutDir)/zlibwapi.lib"
795 TargetMachine="17"
796 />
797 <Tool
798 Name="VCALinkTool"
799 />
800 <Tool
801 Name="VCManifestTool"
802 />
803 <Tool
804 Name="VCXDCMakeTool"
805 />
806 <Tool
807 Name="VCBscMakeTool"
808 />
809 <Tool
810 Name="VCFxCopTool"
811 />
812 <Tool
813 Name="VCAppVerifierTool"
814 />
815 <Tool
816 Name="VCWebDeploymentTool"
817 />
818 <Tool
819 Name="VCPostBuildEventTool"
820 />
821 </Configuration>
822 <Configuration
823 Name="Release|Itanium"
824 OutputDirectory="ia64\ZlibDll$(ConfigurationName)"
825 IntermediateDirectory="ia64\ZlibDll$(ConfigurationName)\Tmp"
826 ConfigurationType="2"
827 InheritedPropertySheets="UpgradeFromVC70.vsprops"
828 UseOfMFC="0"
829 ATLMinimizesCRunTimeLibraryUsage="false"
830 WholeProgramOptimization="1"
831 >
832 <Tool
833 Name="VCPreBuildEventTool"
834 />
835 <Tool
836 Name="VCCustomBuildTool"
837 />
838 <Tool
839 Name="VCXMLDataGeneratorTool"
840 />
841 <Tool
842 Name="VCWebServiceProxyGeneratorTool"
843 />
844 <Tool
845 Name="VCMIDLTool"
846 PreprocessorDefinitions="NDEBUG"
847 MkTypLibCompatible="true"
848 SuppressStartupBanner="true"
849 TargetEnvironment="2"
850 TypeLibraryName="$(OutDir)/zlibvc.tlb"
851 />
852 <Tool
853 Name="VCCLCompilerTool"
854 InlineFunctionExpansion="1"
855 AdditionalIncludeDirectories="..\..\..;..\..\masmx86"
856 PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;WIN64"
857 StringPooling="true"
858 ExceptionHandling="0"
859 RuntimeLibrary="2"
860 BufferSecurityCheck="false"
861 EnableFunctionLevelLinking="true"
862 PrecompiledHeaderFile="$(IntDir)/zlibvc.pch"
863 AssemblerOutput="2"
864 AssemblerListingLocation="$(IntDir)\"
865 ObjectFile="$(IntDir)\"
866 ProgramDataBaseFileName="$(OutDir)\"
867 BrowseInformation="0"
868 WarningLevel="3"
869 SuppressStartupBanner="true"
870 />
871 <Tool
872 Name="VCManagedResourceCompilerTool"
873 />
874 <Tool
875 Name="VCResourceCompilerTool"
876 PreprocessorDefinitions="NDEBUG"
877 Culture="1036"
878 />
879 <Tool
880 Name="VCPreLinkEventTool"
881 />
882 <Tool
883 Name="VCLinkerTool"
884 OutputFile="$(OutDir)\zlibwapi.dll"
885 LinkIncremental="1"
886 SuppressStartupBanner="true"
887 GenerateManifest="false"
888 IgnoreAllDefaultLibraries="false"
889 ModuleDefinitionFile=".\zlibvc.def"
890 ProgramDatabaseFile="$(OutDir)/zlibwapi.pdb"
891 GenerateMapFile="true"
892 MapFileName="$(OutDir)/zlibwapi.map"
893 SubSystem="2"
894 OptimizeForWindows98="1"
895 ImportLibrary="$(OutDir)/zlibwapi.lib"
896 TargetMachine="5"
897 />
898 <Tool
899 Name="VCALinkTool"
900 />
901 <Tool
902 Name="VCManifestTool"
903 />
904 <Tool
905 Name="VCXDCMakeTool"
906 />
907 <Tool
908 Name="VCBscMakeTool"
909 />
910 <Tool
911 Name="VCFxCopTool"
912 />
913 <Tool
914 Name="VCAppVerifierTool"
915 />
916 <Tool
917 Name="VCWebDeploymentTool"
918 />
919 <Tool
920 Name="VCPostBuildEventTool"
921 />
922 </Configuration>
923 </Configurations>
924 <References>
925 </References>
926 <Files>
927 <Filter
928 Name="Source Files"
929 Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
930 >
931 <File
932 RelativePath="..\..\..\adler32.c"
933 >
934 </File>
935 <File
936 RelativePath="..\..\..\compress.c"
937 >
938 </File>
939 <File
940 RelativePath="..\..\..\crc32.c"
941 >
942 </File>
943 <File
944 RelativePath="..\..\..\deflate.c"
945 >
946 </File>
947 <File
948 RelativePath="..\..\masmx86\gvmat32c.c"
949 >
950 <FileConfiguration
951 Name="Debug|x64"
952 ExcludedFromBuild="true"
953 >
954 <Tool
955 Name="VCCLCompilerTool"
956 />
957 </FileConfiguration>
958 <FileConfiguration
959 Name="Debug|Itanium"
960 ExcludedFromBuild="true"
961 >
962 <Tool
963 Name="VCCLCompilerTool"
964 />
965 </FileConfiguration>
966 <FileConfiguration
967 Name="ReleaseWithoutAsm|Win32"
968 ExcludedFromBuild="true"
969 >
970 <Tool
971 Name="VCCLCompilerTool"
972 />
973 </FileConfiguration>
974 <FileConfiguration
975 Name="ReleaseWithoutAsm|x64"
976 ExcludedFromBuild="true"
977 >
978 <Tool
979 Name="VCCLCompilerTool"
980 />
981 </FileConfiguration>
982 <FileConfiguration
983 Name="ReleaseWithoutAsm|Itanium"
984 ExcludedFromBuild="true"
985 >
986 <Tool
987 Name="VCCLCompilerTool"
988 />
989 </FileConfiguration>
990 <FileConfiguration
991 Name="Release|x64"
992 ExcludedFromBuild="true"
993 >
994 <Tool
995 Name="VCCLCompilerTool"
996 />
997 </FileConfiguration>
998 <FileConfiguration
999 Name="Release|Itanium"
1000 ExcludedFromBuild="true"
1001 >
1002 <Tool
1003 Name="VCCLCompilerTool"
1004 />
1005 </FileConfiguration>
1006 </File>
1007 <File
1008 RelativePath="..\..\..\gzio.c"
1009 >
1010 </File>
1011 <File
1012 RelativePath="..\..\..\infback.c"
1013 >
1014 </File>
1015 <File
1016 RelativePath="..\..\masmx64\inffas8664.c"
1017 >
1018 <FileConfiguration
1019 Name="Debug|Win32"
1020 ExcludedFromBuild="true"
1021 >
1022 <Tool
1023 Name="VCCLCompilerTool"
1024 />
1025 </FileConfiguration>
1026 <FileConfiguration
1027 Name="Debug|Itanium"
1028 ExcludedFromBuild="true"
1029 >
1030 <Tool
1031 Name="VCCLCompilerTool"
1032 />
1033 </FileConfiguration>
1034 <FileConfiguration
1035 Name="ReleaseWithoutAsm|Win32"
1036 ExcludedFromBuild="true"
1037 >
1038 <Tool
1039 Name="VCCLCompilerTool"
1040 />
1041 </FileConfiguration>
1042 <FileConfiguration
1043 Name="ReleaseWithoutAsm|Itanium"
1044 ExcludedFromBuild="true"
1045 >
1046 <Tool
1047 Name="VCCLCompilerTool"
1048 />
1049 </FileConfiguration>
1050 <FileConfiguration
1051 Name="Release|Win32"
1052 ExcludedFromBuild="true"
1053 >
1054 <Tool
1055 Name="VCCLCompilerTool"
1056 />
1057 </FileConfiguration>
1058 <FileConfiguration
1059 Name="Release|Itanium"
1060 ExcludedFromBuild="true"
1061 >
1062 <Tool
1063 Name="VCCLCompilerTool"
1064 />
1065 </FileConfiguration>
1066 </File>
1067 <File
1068 RelativePath="..\..\..\inffast.c"
1069 >
1070 </File>
1071 <File
1072 RelativePath="..\..\..\inflate.c"
1073 >
1074 </File>
1075 <File
1076 RelativePath="..\..\..\inftrees.c"
1077 >
1078 </File>
1079 <File
1080 RelativePath="..\..\minizip\ioapi.c"
1081 >
1082 </File>
1083 <File
1084 RelativePath="..\..\minizip\iowin32.c"
1085 >
1086 </File>
1087 <File
1088 RelativePath="..\..\..\trees.c"
1089 >
1090 </File>
1091 <File
1092 RelativePath="..\..\..\uncompr.c"
1093 >
1094 </File>
1095 <File
1096 RelativePath="..\..\minizip\unzip.c"
1097 >
1098 <FileConfiguration
1099 Name="Release|Win32"
1100 >
1101 <Tool
1102 Name="VCCLCompilerTool"
1103 AdditionalIncludeDirectories=""
1104 PreprocessorDefinitions="ZLIB_INTERNAL"
1105 />
1106 </FileConfiguration>
1107 <FileConfiguration
1108 Name="Release|x64"
1109 >
1110 <Tool
1111 Name="VCCLCompilerTool"
1112 AdditionalIncludeDirectories=""
1113 PreprocessorDefinitions="ZLIB_INTERNAL"
1114 />
1115 </FileConfiguration>
1116 <FileConfiguration
1117 Name="Release|Itanium"
1118 >
1119 <Tool
1120 Name="VCCLCompilerTool"
1121 AdditionalIncludeDirectories=""
1122 PreprocessorDefinitions="ZLIB_INTERNAL"
1123 />
1124 </FileConfiguration>
1125 </File>
1126 <File
1127 RelativePath="..\..\minizip\zip.c"
1128 >
1129 <FileConfiguration
1130 Name="Release|Win32"
1131 >
1132 <Tool
1133 Name="VCCLCompilerTool"
1134 AdditionalIncludeDirectories=""
1135 PreprocessorDefinitions="ZLIB_INTERNAL"
1136 />
1137 </FileConfiguration>
1138 <FileConfiguration
1139 Name="Release|x64"
1140 >
1141 <Tool
1142 Name="VCCLCompilerTool"
1143 AdditionalIncludeDirectories=""
1144 PreprocessorDefinitions="ZLIB_INTERNAL"
1145 />
1146 </FileConfiguration>
1147 <FileConfiguration
1148 Name="Release|Itanium"
1149 >
1150 <Tool
1151 Name="VCCLCompilerTool"
1152 AdditionalIncludeDirectories=""
1153 PreprocessorDefinitions="ZLIB_INTERNAL"
1154 />
1155 </FileConfiguration>
1156 </File>
1157 <File
1158 RelativePath=".\zlib.rc"
1159 >
1160 </File>
1161 <File
1162 RelativePath=".\zlibvc.def"
1163 >
1164 </File>
1165 <File
1166 RelativePath="..\..\..\zutil.c"
1167 >
1168 </File>
1169 </Filter>
1170 <Filter
1171 Name="Header Files"
1172 Filter="h;hpp;hxx;hm;inl;fi;fd"
1173 >
1174 <File
1175 RelativePath="..\..\..\deflate.h"
1176 >
1177 </File>
1178 <File
1179 RelativePath="..\..\..\infblock.h"
1180 >
1181 </File>
1182 <File
1183 RelativePath="..\..\..\infcodes.h"
1184 >
1185 </File>
1186 <File
1187 RelativePath="..\..\..\inffast.h"
1188 >
1189 </File>
1190 <File
1191 RelativePath="..\..\..\inftrees.h"
1192 >
1193 </File>
1194 <File
1195 RelativePath="..\..\..\infutil.h"
1196 >
1197 </File>
1198 <File
1199 RelativePath="..\..\..\zconf.h"
1200 >
1201 </File>
1202 <File
1203 RelativePath="..\..\..\zlib.h"
1204 >
1205 </File>
1206 <File
1207 RelativePath="..\..\..\zutil.h"
1208 >
1209 </File>
1210 </Filter>
1211 <Filter
1212 Name="Resource Files"
1213 Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
1214 >
1215 </Filter>
1216 </Files>
1217 <Globals>
1218 </Globals>
1219</VisualStudioProject>
diff --git a/deflate.c b/deflate.c
index 395c40a..29ce1f6 100644
--- a/deflate.c
+++ b/deflate.c
@@ -52,7 +52,7 @@
52#include "deflate.h" 52#include "deflate.h"
53 53
54const char deflate_copyright[] = 54const char deflate_copyright[] =
55 " deflate 1.2.2.4 Copyright 1995-2005 Jean-loup Gailly "; 55 " deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly ";
56/* 56/*
57 If you use the zlib library in a product, an acknowledgment is welcome 57 If you use the zlib library in a product, an acknowledgment is welcome
58 in the documentation of your product. If for some reason you cannot 58 in the documentation of your product. If for some reason you cannot
diff --git a/inftrees.c b/inftrees.c
index 61d52f6..8a9c13f 100644
--- a/inftrees.c
+++ b/inftrees.c
@@ -9,7 +9,7 @@
9#define MAXBITS 15 9#define MAXBITS 15
10 10
11const char inflate_copyright[] = 11const char inflate_copyright[] =
12 " inflate 1.2.2.4 Copyright 1995-2005 Mark Adler "; 12 " inflate 1.2.3 Copyright 1995-2005 Mark Adler ";
13/* 13/*
14 If you use the zlib library in a product, an acknowledgment is welcome 14 If you use the zlib library in a product, an acknowledgment is welcome
15 in the documentation of your product. If for some reason you cannot 15 in the documentation of your product. If for some reason you cannot
@@ -62,7 +62,7 @@ unsigned short FAR *work;
62 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; 62 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
63 static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 63 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
64 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 64 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
65 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 206, 69}; 65 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196};
66 static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 66 static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
67 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 67 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
68 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 68 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
diff --git a/make_vms.com b/make_vms.com
index c3e5b58..c2a1fb5 100644
--- a/make_vms.com
+++ b/make_vms.com
@@ -1,5 +1,5 @@
1$! make libz under VMS written by 1$! make libz under VMS written by
2$! Martin P.J. Zinser 2$! Martin P.J. Zinser
3$! <zinser@zinser.no-ip.info or zinser@sysdev.deutsche-boerse.com> 3$! <zinser@zinser.no-ip.info or zinser@sysdev.deutsche-boerse.com>
4$! 4$!
5$ on error then goto err_exit 5$ on error then goto err_exit
@@ -46,8 +46,8 @@ $ then
46$ ccopt = "/prefix=all" + ccopt 46$ ccopt = "/prefix=all" + ccopt
47$ if f$trnlnm("SYS") .eqs. "" 47$ if f$trnlnm("SYS") .eqs. ""
48$ then 48$ then
49$ if axp 49$ if axp
50$ then 50$ then
51$ define sys sys$library: 51$ define sys sys$library:
52$ else 52$ else
53$ ccopt = "/decc" + ccopt 53$ ccopt = "/decc" + ccopt
@@ -58,7 +58,7 @@ $ endif
58$ if its_vaxc .or. its_gnuc 58$ if its_vaxc .or. its_gnuc
59$ then 59$ then
60$ if f$trnlnm("SYS").eqs."" then define sys sys$library: 60$ if f$trnlnm("SYS").eqs."" then define sys sys$library:
61$ endif 61$ endif
62$! 62$!
63$! Build the thing plain or with mms 63$! Build the thing plain or with mms
64$! 64$!
@@ -101,8 +101,8 @@ $ then
101$ write sys$output "Building minigzip..." 101$ write sys$output "Building minigzip..."
102$ CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" - 102$ CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" -
103 minigzip.c zlib.h zconf.h 103 minigzip.c zlib.h zconf.h
104$ call make minigzip.exe - 104$ call make minigzip.exe -
105 "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" - 105 "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" -
106 minigzip.obj libz.olb 106 minigzip.obj libz.olb
107$ endif 107$ endif
108$ else 108$ else
@@ -118,7 +118,7 @@ $ Then
118$ gosub crea_olist 118$ gosub crea_olist
119$ write sys$output "Creating libzshr.exe" 119$ write sys$output "Creating libzshr.exe"
120$ call anal_obj_axp modules.opt _link.opt 120$ call anal_obj_axp modules.opt _link.opt
121$ if s_case 121$ if s_case
122$ then 122$ then
123$ open/append optf modules.opt 123$ open/append optf modules.opt
124$ write optf "case_sensitive=YES" 124$ write optf "case_sensitive=YES"
@@ -200,41 +200,41 @@ $ if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) -
200 then s_case = true 200 then s_case = true
201$ endif 201$ endif
202$ if cparm .eqs. "LINK" then linkonly = true 202$ if cparm .eqs. "LINK" then linkonly = true
203$ if f$locate("LOPTS=",cparm) .lt. f$length(cparm) 203$ if f$locate("LOPTS=",cparm) .lt. f$length(cparm)
204$ then 204$ then
205$ start = f$locate("=",cparm) + 1 205$ start = f$locate("=",cparm) + 1
206$ len = f$length(cparm) - start 206$ len = f$length(cparm) - start
207$ lopts = lopts + f$extract(start,len,cparm) 207$ lopts = lopts + f$extract(start,len,cparm)
208$ endif 208$ endif
209$ if f$locate("CC=",cparm) .lt. f$length(cparm) 209$ if f$locate("CC=",cparm) .lt. f$length(cparm)
210$ then 210$ then
211$ start = f$locate("=",cparm) + 1 211$ start = f$locate("=",cparm) + 1
212$ len = f$length(cparm) - start 212$ len = f$length(cparm) - start
213$ cc_com = f$extract(start,len,cparm) 213$ cc_com = f$extract(start,len,cparm)
214 if (cc_com .nes. "DECC") .and. - 214 if (cc_com .nes. "DECC") .and. -
215 (cc_com .nes. "VAXC") .and. - 215 (cc_com .nes. "VAXC") .and. -
216 (cc_com .nes. "GNUC") 216 (cc_com .nes. "GNUC")
217$ then 217$ then
218$ write sys$output "Unsupported compiler choice ''cc_com' ignored" 218$ write sys$output "Unsupported compiler choice ''cc_com' ignored"
219$ write sys$output "Use DECC, VAXC, or GNUC instead" 219$ write sys$output "Use DECC, VAXC, or GNUC instead"
220$ else 220$ else
221$ if cc_com .eqs. "DECC" then its_decc = true 221$ if cc_com .eqs. "DECC" then its_decc = true
222$ if cc_com .eqs. "VAXC" then its_vaxc = true 222$ if cc_com .eqs. "VAXC" then its_vaxc = true
223$ if cc_com .eqs. "GNUC" then its_gnuc = true 223$ if cc_com .eqs. "GNUC" then its_gnuc = true
224$ endif 224$ endif
225$ endif 225$ endif
226$ if f$locate("MAKE=",cparm) .lt. f$length(cparm) 226$ if f$locate("MAKE=",cparm) .lt. f$length(cparm)
227$ then 227$ then
228$ start = f$locate("=",cparm) + 1 228$ start = f$locate("=",cparm) + 1
229$ len = f$length(cparm) - start 229$ len = f$length(cparm) - start
230$ mmks = f$extract(start,len,cparm) 230$ mmks = f$extract(start,len,cparm)
231$ if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS") 231$ if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS")
232$ then 232$ then
233$ make = mmks 233$ make = mmks
234$ else 234$ else
235$ write sys$output "Unsupported make choice ''mmks' ignored" 235$ write sys$output "Unsupported make choice ''mmks' ignored"
236$ write sys$output "Use MMK or MMS instead" 236$ write sys$output "Use MMK or MMS instead"
237$ endif 237$ endif
238$ endif 238$ endif
239$ i = i + 1 239$ i = i + 1
240$ goto opt_loop 240$ goto opt_loop
@@ -242,7 +242,7 @@ $ endif
242$ return 242$ return
243$!------------------------------------------------------------------------------ 243$!------------------------------------------------------------------------------
244$! 244$!
245$! Look for the compiler used 245$! Look for the compiler used
246$! 246$!
247$CHECK_COMPILER: 247$CHECK_COMPILER:
248$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc)) 248$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
@@ -254,7 +254,7 @@ $ endif
254$! 254$!
255$! Exit if no compiler available 255$! Exit if no compiler available
256$! 256$!
257$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc)) 257$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
258$ then goto CC_ERR 258$ then goto CC_ERR
259$ else 259$ else
260$ if its_decc then write sys$output "CC compiler check ... Compaq C" 260$ if its_decc then write sys$output "CC compiler check ... Compaq C"
@@ -273,7 +273,7 @@ $ open/append out descrip.mms
273$ copy sys$input: out 273$ copy sys$input: out
274$ deck 274$ deck
275# descrip.mms: MMS description file for building zlib on VMS 275# descrip.mms: MMS description file for building zlib on VMS
276# written by Martin P.J. Zinser 276# written by Martin P.J. Zinser
277# <zinser@zinser.no-ip.info or zinser@sysdev.deutsche-boerse.com> 277# <zinser@zinser.no-ip.info or zinser@sysdev.deutsche-boerse.com>
278 278
279OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj, infback.obj\ 279OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj, infback.obj\
@@ -281,7 +281,7 @@ OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj, infback.obj\
281 inftrees.obj, inffast.obj 281 inftrees.obj, inffast.obj
282 282
283$ eod 283$ eod
284$ write out "CFLAGS=", ccopt 284$ write out "CFLAGS=", ccopt
285$ write out "LOPTS=", lopts 285$ write out "LOPTS=", lopts
286$ copy sys$input: out 286$ copy sys$input: out
287$ deck 287$ deck
@@ -298,7 +298,7 @@ example.exe : example.obj libz.olb
298minigzip.exe : minigzip.obj libz.olb 298minigzip.exe : minigzip.obj libz.olb
299 link $(LOPTS) minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib 299 link $(LOPTS) minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib
300 300
301clean : 301clean :
302 delete *.obj;*,libz.olb;*,*.opt;*,*.exe;* 302 delete *.obj;*,libz.olb;*,*.opt;*,*.exe;*
303 303
304 304
@@ -310,7 +310,7 @@ deflate.obj : deflate.c deflate.h zutil.h zlib.h zconf.h
310example.obj : example.c zlib.h zconf.h 310example.obj : example.c zlib.h zconf.h
311gzio.obj : gzio.c zutil.h zlib.h zconf.h 311gzio.obj : gzio.c zutil.h zlib.h zconf.h
312inffast.obj : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h 312inffast.obj : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h
313inflate.obj : inflate.c zutil.h zlib.h zconf.h 313inflate.obj : inflate.c zutil.h zlib.h zconf.h
314inftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h 314inftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h
315minigzip.obj : minigzip.c zlib.h zconf.h 315minigzip.obj : minigzip.c zlib.h zconf.h
316trees.obj : trees.c deflate.h zutil.h zlib.h zconf.h 316trees.obj : trees.c deflate.h zutil.h zlib.h zconf.h
@@ -332,12 +332,12 @@ $ src_check = "OBJS ="
332$MRLOOP: 332$MRLOOP:
333$ read/end=mrdone min rec 333$ read/end=mrdone min rec
334$ if (f$extract(0,6,rec) .nes. src_check) then goto mrloop 334$ if (f$extract(0,6,rec) .nes. src_check) then goto mrloop
335$ rec = rec - src_check 335$ rec = rec - src_check
336$ gosub extra_filnam 336$ gosub extra_filnam
337$ if (f$element(1,"\",rec) .eqs. "\") then goto mrdone 337$ if (f$element(1,"\",rec) .eqs. "\") then goto mrdone
338$MRSLOOP: 338$MRSLOOP:
339$ read/end=mrdone min rec 339$ read/end=mrdone min rec
340$ gosub extra_filnam 340$ gosub extra_filnam
341$ if (f$element(1,"\",rec) .nes. "\") then goto mrsloop 341$ if (f$element(1,"\",rec) .nes. "\") then goto mrsloop
342$MRDONE: 342$MRDONE:
343$ close min 343$ close min
@@ -356,7 +356,7 @@ $ if (srcfil .nes. " ")
356$ then 356$ then
357$ write mod f$parse(srcfil,,,"NAME"), ".obj" 357$ write mod f$parse(srcfil,,,"NAME"), ".obj"
358$ i = i + 1 358$ i = i + 1
359$ goto feloop 359$ goto feloop
360$ endif 360$ endif
361$ return 361$ return
362$!------------------------------------------------------------------------------ 362$!------------------------------------------------------------------------------
@@ -382,17 +382,17 @@ $ close h_in
382$ return 382$ return
383$!------------------------------------------------------------------------------ 383$!------------------------------------------------------------------------------
384$! 384$!
385$! Analyze Object files for OpenVMS AXP to extract Procedure and Data 385$! Analyze Object files for OpenVMS AXP to extract Procedure and Data
386$! information to build a symbol vector for a shareable image 386$! information to build a symbol vector for a shareable image
387$! All the "brains" of this logic was suggested by Hartmut Becker 387$! All the "brains" of this logic was suggested by Hartmut Becker
388$! (Hartmut.Becker@compaq.com). All the bugs were introduced by me 388$! (Hartmut.Becker@compaq.com). All the bugs were introduced by me
389$! (zinser@decus.de), so if you do have problem reports please do not 389$! (zinser@decus.de), so if you do have problem reports please do not
390$! bother Hartmut/HP, but get in touch with me 390$! bother Hartmut/HP, but get in touch with me
391$! 391$!
392$ ANAL_OBJ_AXP: Subroutine 392$ ANAL_OBJ_AXP: Subroutine
393$ V = 'F$Verify(0) 393$ V = 'F$Verify(0)
394$ SAY := "WRITE_ SYS$OUTPUT" 394$ SAY := "WRITE_ SYS$OUTPUT"
395$ 395$
396$ IF F$SEARCH("''P1'") .EQS. "" 396$ IF F$SEARCH("''P1'") .EQS. ""
397$ THEN 397$ THEN
398$ SAY "ANAL_OBJ_AXP-E-NOSUCHFILE: Error, inputfile ''p1' not available" 398$ SAY "ANAL_OBJ_AXP-E-NOSUCHFILE: Error, inputfile ''p1' not available"
@@ -457,5 +457,5 @@ $ if f$search("x.tmp") .nes. "" -
457$! 457$!
458$ EXIT_AA: 458$ EXIT_AA:
459$ if V then set verify 459$ if V then set verify
460$ endsubroutine 460$ endsubroutine
461$!------------------------------------------------------------------------------ 461$!------------------------------------------------------------------------------
diff --git a/old/Makefile.riscos b/old/Makefile.riscos
index d97f449..57e29d3 100644
--- a/old/Makefile.riscos
+++ b/old/Makefile.riscos
@@ -3,12 +3,12 @@
3# test works out-of-the-box, installs `somewhere' on demand 3# test works out-of-the-box, installs `somewhere' on demand
4 4
5# Toolflags: 5# Toolflags:
6CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fah 6CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fah
7C++flags = -c -depend !Depend -IC: -throwback 7C++flags = -c -depend !Depend -IC: -throwback
8Linkflags = -aif -c++ -o $@ 8Linkflags = -aif -c++ -o $@
9ObjAsmflags = -throwback -NoCache -depend !Depend 9ObjAsmflags = -throwback -NoCache -depend !Depend
10CMHGflags = 10CMHGflags =
11LibFileflags = -c -l -o $@ 11LibFileflags = -c -l -o $@
12Squeezeflags = -o $@ 12Squeezeflags = -o $@
13 13
14# change the line below to where _you_ want the library installed. 14# change the line below to where _you_ want the library installed.
@@ -17,10 +17,10 @@ libdest = lib:zlib
17# Final targets: 17# Final targets:
18@.lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \ 18@.lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \
19 @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \ 19 @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \
20 @.o.uncompr @.o.zutil 20 @.o.uncompr @.o.zutil
21 LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \ 21 LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \
22 @.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \ 22 @.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \
23 @.o.trees @.o.uncompr @.o.zutil 23 @.o.trees @.o.uncompr @.o.zutil
24test: @.minigzip @.example @.lib 24test: @.minigzip @.example @.lib
25 @copy @.lib @.libc A~C~DF~L~N~P~Q~RS~TV 25 @copy @.lib @.libc A~C~DF~L~N~P~Q~RS~TV
26 @echo running tests: hang on. 26 @echo running tests: hang on.
@@ -41,9 +41,9 @@ test: @.minigzip @.example @.lib
41 @/@.example @.fred @.fred 41 @/@.example @.fred @.fred
42 @echo that will have given lots of hello!'s. 42 @echo that will have given lots of hello!'s.
43 43
44@.minigzip: @.o.minigzip @.lib C:o.Stubs 44@.minigzip: @.o.minigzip @.lib C:o.Stubs
45 Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs 45 Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs
46@.example: @.o.example @.lib C:o.Stubs 46@.example: @.o.example @.lib C:o.Stubs
47 Link $(Linkflags) @.o.example @.lib C:o.Stubs 47 Link $(Linkflags) @.o.example @.lib C:o.Stubs
48 48
49install: @.lib 49install: @.lib
diff --git a/qnx/package.qpg b/qnx/package.qpg
index f728ebe..8a4a47c 100644
--- a/qnx/package.qpg
+++ b/qnx/package.qpg
@@ -25,10 +25,10 @@
25 <QPG:Files> 25 <QPG:Files>
26 <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/> 26 <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
27 <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/> 27 <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
28 <QPG:Add file="../libz.so.1.2.2.4" install="/opt/lib/" user="root:bin" permission="644"/> 28 <QPG:Add file="../libz.so.1.2.3" install="/opt/lib/" user="root:bin" permission="644"/>
29 <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.2.4"/> 29 <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.3"/>
30 <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.2.4"/> 30 <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.3"/>
31 <QPG:Add file="../libz.so.1.2.2.4" install="/opt/lib/" component="slib"/> 31 <QPG:Add file="../libz.so.1.2.3" install="/opt/lib/" component="slib"/>
32 </QPG:Files> 32 </QPG:Files>
33 33
34 <QPG:PackageFilter> 34 <QPG:PackageFilter>
@@ -63,7 +63,7 @@
63 </QPM:ProductDescription> 63 </QPM:ProductDescription>
64 64
65 <QPM:ReleaseDescription> 65 <QPM:ReleaseDescription>
66 <QPM:ReleaseVersion>1.2.2.4</QPM:ReleaseVersion> 66 <QPM:ReleaseVersion>1.2.3</QPM:ReleaseVersion>
67 <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency> 67 <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
68 <QPM:ReleaseStability>Stable</QPM:ReleaseStability> 68 <QPM:ReleaseStability>Stable</QPM:ReleaseStability>
69 <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor> 69 <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
@@ -105,7 +105,7 @@
105 </QPM:Script> 105 </QPM:Script>
106 </QPM:ProductInstallationProcedure> 106 </QPM:ProductInstallationProcedure>
107 </QPM:PackageManifest> 107 </QPM:PackageManifest>
108 108
109 <QPM:Launch> 109 <QPM:Launch>
110 </QPM:Launch> 110 </QPM:Launch>
111 </QPG:PackageFilter> 111 </QPG:PackageFilter>
@@ -119,7 +119,7 @@
119 </QPM:OrderDependency> 119 </QPM:OrderDependency>
120 </QPM:ProductInstallationProcedure> 120 </QPM:ProductInstallationProcedure>
121 </QPM:PackageManifest> 121 </QPM:PackageManifest>
122 122
123 <QPM:Launch> 123 <QPM:Launch>
124 </QPM:Launch> 124 </QPM:Launch>
125 </QPG:PackageFilter> 125 </QPG:PackageFilter>
@@ -133,7 +133,7 @@
133 </QPM:OrderDependency> 133 </QPM:OrderDependency>
134 </QPM:ProductInstallationProcedure> 134 </QPM:ProductInstallationProcedure>
135 </QPM:PackageManifest> 135 </QPM:PackageManifest>
136 136
137 <QPM:Launch> 137 <QPM:Launch>
138 </QPM:Launch> 138 </QPM:Launch>
139 </QPG:PackageFilter> 139 </QPG:PackageFilter>
diff --git a/win32/zlib1.rc b/win32/zlib1.rc
index 8cff589..99025c9 100644
--- a/win32/zlib1.rc
+++ b/win32/zlib1.rc
@@ -5,8 +5,8 @@ VS_VERSION_INFO VERSIONINFO
5#else 5#else
6VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 6VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
7#endif 7#endif
8 FILEVERSION 1,2,2,4 8 FILEVERSION 1,2,2,0
9 PRODUCTVERSION 1,2,2,4 9 PRODUCTVERSION 1,2,2,0
10 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 10 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
11#ifdef _DEBUG 11#ifdef _DEBUG
12 FILEFLAGS 1 12 FILEFLAGS 1
@@ -23,12 +23,12 @@ BEGIN
23 //language ID = U.S. English, char set = Windows, Multilingual 23 //language ID = U.S. English, char set = Windows, Multilingual
24 BEGIN 24 BEGIN
25 VALUE "FileDescription", "zlib data compression library\0" 25 VALUE "FileDescription", "zlib data compression library\0"
26 VALUE "FileVersion", "1.2.2.4\0" 26 VALUE "FileVersion", "1.2.3\0"
27 VALUE "InternalName", "zlib1.dll\0" 27 VALUE "InternalName", "zlib1.dll\0"
28 VALUE "LegalCopyright", "(C) 1995-2004 Jean-loup Gailly & Mark Adler\0" 28 VALUE "LegalCopyright", "(C) 1995-2004 Jean-loup Gailly & Mark Adler\0"
29 VALUE "OriginalFilename", "zlib1.dll\0" 29 VALUE "OriginalFilename", "zlib1.dll\0"
30 VALUE "ProductName", "zlib\0" 30 VALUE "ProductName", "zlib\0"
31 VALUE "ProductVersion", "1.2.2.4\0" 31 VALUE "ProductVersion", "1.2.3\0"
32 VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" 32 VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
33 END 33 END
34 END 34 END
diff --git a/zlib.3 b/zlib.3
index b91375e..90b8162 100644
--- a/zlib.3
+++ b/zlib.3
@@ -1,4 +1,4 @@
1.TH ZLIB 3 "11 July 2005" 1.TH ZLIB 3 "18 July 2005"
2.SH NAME 2.SH NAME
3zlib \- compression/decompression library 3zlib \- compression/decompression library
4.SH SYNOPSIS 4.SH SYNOPSIS
@@ -133,7 +133,7 @@ before asking for help.
133Send questions and/or comments to zlib@gzip.org, 133Send questions and/or comments to zlib@gzip.org,
134or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). 134or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
135.SH AUTHORS 135.SH AUTHORS
136Version 1.2.2.4 136Version 1.2.3
137Copyright (C) 1995-2005 Jean-loup Gailly (jloup@gzip.org) 137Copyright (C) 1995-2005 Jean-loup Gailly (jloup@gzip.org)
138and Mark Adler (madler@alumni.caltech.edu). 138and Mark Adler (madler@alumni.caltech.edu).
139.LP 139.LP
diff --git a/zlib.h b/zlib.h
index f7e47a2..0228179 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1,5 +1,5 @@
1/* zlib.h -- interface of the 'zlib' general purpose compression library 1/* zlib.h -- interface of the 'zlib' general purpose compression library
2 version 1.2.2.4, July 11th, 2005 2 version 1.2.3, July 18th, 2005
3 3
4 Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler 4 Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
5 5
@@ -37,8 +37,8 @@
37extern "C" { 37extern "C" {
38#endif 38#endif
39 39
40#define ZLIB_VERSION "1.2.2.4" 40#define ZLIB_VERSION "1.2.3"
41#define ZLIB_VERNUM 0x1224 41#define ZLIB_VERNUM 0x1230
42 42
43/* 43/*
44 The 'zlib' compression library provides in-memory compression and 44 The 'zlib' compression library provides in-memory compression and