diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:26:29 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-09-09 23:26:29 -0700 |
commit | 639be997883d9016baaf46017a2802b2ce1698bd (patch) | |
tree | db90fc577d10564b335980824111e8d11c5527e2 | |
parent | d6231142d2b883a8c3b253fa34992b5cdb4ac2fe (diff) | |
download | zlib-639be997883d9016baaf46017a2802b2ce1698bd.tar.gz zlib-639be997883d9016baaf46017a2802b2ce1698bd.tar.bz2 zlib-639be997883d9016baaf46017a2802b2ce1698bd.zip |
zlib 1.2.3.3v1.2.3.3
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | Makefile | 41 | ||||
-rw-r--r-- | Makefile.in | 41 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | adler32.c | 44 | ||||
-rw-r--r-- | as400/zlib.inc | 6 | ||||
-rwxr-xr-x | configure | 49 | ||||
-rw-r--r-- | contrib/infback9/infback9.c | 80 | ||||
-rw-r--r-- | contrib/infback9/inftree9.c | 4 | ||||
-rw-r--r-- | contrib/vstudio/vc7/zlib.rc | 6 | ||||
-rw-r--r-- | crc32.c | 41 | ||||
-rw-r--r-- | deflate.c | 2 | ||||
-rw-r--r-- | gzio.c | 121 | ||||
-rw-r--r-- | infback.c | 80 | ||||
-rw-r--r-- | inffast.c | 57 | ||||
-rw-r--r-- | inflate.c | 123 | ||||
-rw-r--r-- | inflate.h | 1 | ||||
-rw-r--r-- | inftrees.c | 42 | ||||
-rw-r--r-- | qnx/package.qpg | 10 | ||||
-rw-r--r-- | zlib.3 | 6 | ||||
-rw-r--r-- | zlib.h | 45 | ||||
-rw-r--r-- | zutil.h | 6 |
22 files changed, 583 insertions, 240 deletions
@@ -1,6 +1,20 @@ | |||
1 | 1 | ||
2 | ChangeLog file for zlib | 2 | ChangeLog file for zlib |
3 | 3 | ||
4 | Changes in 1.2.3.3 (2 October 2006) | ||
5 | - Make --shared the default for configure, add a --static option | ||
6 | - Add compile option to permit invalid distance-too-far streams | ||
7 | - Add inflateUndermine() function which is required to enable above | ||
8 | - Remove use of "this" variable name for C++ compatibility [Marquess] | ||
9 | - Add testing of shared library in make test, if shared library built | ||
10 | - Use ftello() and fseeko() if available instead of ftell() and fseek() | ||
11 | - Provide two versions of all functions that use the z_off_t type for | ||
12 | binary compatibility -- a normal version and a 64-bit offset version, | ||
13 | per the Large File Support Extension when _LARGEFILE64_SUPPORT is | ||
14 | defined; use the 64-bit versions by default when _FILE_OFFSET_BITS | ||
15 | is defined to be 64 | ||
16 | - Add a --uname= option to configure to perhaps help with cross-compiling | ||
17 | |||
4 | Changes in 1.2.3.2 (3 September 2006) | 18 | Changes in 1.2.3.2 (3 September 2006) |
5 | - Turn off silly Borland warnings [Hay] | 19 | - Turn off silly Borland warnings [Hay] |
6 | - Use off64_t and define _LARGEFILE64_SOURCE when present | 20 | - Use off64_t and define _LARGEFILE64_SOURCE when present |
@@ -32,7 +32,7 @@ CPP=$(CC) -E | |||
32 | 32 | ||
33 | LIBS=libz.a | 33 | LIBS=libz.a |
34 | SHAREDLIB=libz.so | 34 | SHAREDLIB=libz.so |
35 | SHAREDLIBV=libz.so.1.2.3.2 | 35 | SHAREDLIBV=libz.so.1.2.3.3 |
36 | SHAREDLIBM=libz.so.1 | 36 | SHAREDLIBM=libz.so.1 |
37 | 37 | ||
38 | AR=ar | 38 | AR=ar |
@@ -61,12 +61,14 @@ PIC_OBJS = $(OBJS:%.o=%.lo) | |||
61 | 61 | ||
62 | TEST_OBJS = example.o minigzip.o | 62 | TEST_OBJS = example.o minigzip.o |
63 | 63 | ||
64 | all: example$(EXE) minigzip$(EXE) | 64 | allstatic: example$(EXE) minigzip$(EXE) |
65 | 65 | ||
66 | check: test | 66 | allshared: examplesh$(EXE) minigzipsh$(EXE) |
67 | test: all | 67 | |
68 | @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ | 68 | all: allstatic allshared |
69 | echo hello world | ./minigzip | ./minigzip -d || \ | 69 | |
70 | teststatic: allstatic | ||
71 | @echo hello world | ./minigzip | ./minigzip -d || \ | ||
70 | echo ' *** minigzip test FAILED ***' ; \ | 72 | echo ' *** minigzip test FAILED ***' ; \ |
71 | if ./example; then \ | 73 | if ./example; then \ |
72 | echo ' *** zlib test OK ***'; \ | 74 | echo ' *** zlib test OK ***'; \ |
@@ -74,6 +76,22 @@ test: all | |||
74 | echo ' *** zlib test FAILED ***'; \ | 76 | echo ' *** zlib test FAILED ***'; \ |
75 | fi | 77 | fi |
76 | 78 | ||
79 | testshared: allshared | ||
80 | @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ | ||
81 | DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ | ||
82 | SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ | ||
83 | echo hello world | ./minigzipsh | ./minigzipsh -d || \ | ||
84 | echo ' *** minigzip shared test FAILED ***' ; \ | ||
85 | if ./examplesh; then \ | ||
86 | echo ' *** zlib shared test OK ***'; \ | ||
87 | else \ | ||
88 | echo ' *** zlib shared test FAILED ***'; \ | ||
89 | fi | ||
90 | |||
91 | test: teststatic testshared | ||
92 | |||
93 | check: test | ||
94 | |||
77 | libz.a: $(OBJS) | 95 | libz.a: $(OBJS) |
78 | $(AR) $@ $(OBJS) | 96 | $(AR) $@ $(OBJS) |
79 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 | 97 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 |
@@ -105,6 +123,12 @@ example$(EXE): example.o $(LIBS) | |||
105 | minigzip$(EXE): minigzip.o $(LIBS) | 123 | minigzip$(EXE): minigzip.o $(LIBS) |
106 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) | 124 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) |
107 | 125 | ||
126 | examplesh$(EXE): example.o $(LIBS) | ||
127 | $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIB) | ||
128 | |||
129 | minigzipsh$(EXE): minigzip.o $(LIBS) | ||
130 | $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIB) | ||
131 | |||
108 | install-libs: $(LIBS) | 132 | install-libs: $(LIBS) |
109 | -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi | 133 | -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi |
110 | -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi | 134 | -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi |
@@ -142,7 +166,8 @@ uninstall: | |||
142 | 166 | ||
143 | mostlyclean: clean | 167 | mostlyclean: clean |
144 | clean: | 168 | clean: |
145 | rm -f *.o *.lo *~ example$(EXE) minigzip$(EXE) \ | 169 | rm -f *.o *.lo *~ \ |
170 | example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ | ||
146 | libz.* foo.gz so_locations \ | 171 | libz.* foo.gz so_locations \ |
147 | _match.s maketree contrib/infback9/*.o | 172 | _match.s maketree contrib/infback9/*.o |
148 | 173 | ||
@@ -180,13 +205,11 @@ adler32.lo: zlib.h zconf.h zlibdefs.h | |||
180 | compress.lo: zlib.h zconf.h zlibdefs.h | 205 | compress.lo: zlib.h zconf.h zlibdefs.h |
181 | crc32.lo: crc32.h zlib.h zconf.h zlibdefs.h | 206 | crc32.lo: crc32.h zlib.h zconf.h zlibdefs.h |
182 | deflate.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h | 207 | deflate.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h |
183 | example.lo: zlib.h zconf.h zlibdefs.h | ||
184 | gzio.lo: zutil.h zlib.h zconf.h zlibdefs.h | 208 | gzio.lo: zutil.h zlib.h zconf.h zlibdefs.h |
185 | inffast.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h | 209 | inffast.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h |
186 | inflate.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h | 210 | inflate.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h |
187 | infback.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h | 211 | infback.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h |
188 | inftrees.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h | 212 | inftrees.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h |
189 | minigzip.lo: zlib.h zconf.h zlibdefs.h | ||
190 | trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h | 213 | trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h |
191 | uncompr.lo: zlib.h zconf.h zlibdefs.h | 214 | uncompr.lo: zlib.h zconf.h zlibdefs.h |
192 | zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h | 215 | zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h |
diff --git a/Makefile.in b/Makefile.in index 8c77268..2fa2e25 100644 --- a/Makefile.in +++ b/Makefile.in | |||
@@ -32,7 +32,7 @@ CPP=$(CC) -E | |||
32 | 32 | ||
33 | LIBS=libz.a | 33 | LIBS=libz.a |
34 | SHAREDLIB=libz.so | 34 | SHAREDLIB=libz.so |
35 | SHAREDLIBV=libz.so.1.2.3.2 | 35 | SHAREDLIBV=libz.so.1.2.3.3 |
36 | SHAREDLIBM=libz.so.1 | 36 | SHAREDLIBM=libz.so.1 |
37 | 37 | ||
38 | AR=ar | 38 | AR=ar |
@@ -61,12 +61,14 @@ PIC_OBJS = $(OBJS:%.o=%.lo) | |||
61 | 61 | ||
62 | TEST_OBJS = example.o minigzip.o | 62 | TEST_OBJS = example.o minigzip.o |
63 | 63 | ||
64 | all: example$(EXE) minigzip$(EXE) | 64 | allstatic: example$(EXE) minigzip$(EXE) |
65 | 65 | ||
66 | check: test | 66 | allshared: examplesh$(EXE) minigzipsh$(EXE) |
67 | test: all | 67 | |
68 | @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ | 68 | all: allstatic allshared |
69 | echo hello world | ./minigzip | ./minigzip -d || \ | 69 | |
70 | teststatic: allstatic | ||
71 | @echo hello world | ./minigzip | ./minigzip -d || \ | ||
70 | echo ' *** minigzip test FAILED ***' ; \ | 72 | echo ' *** minigzip test FAILED ***' ; \ |
71 | if ./example; then \ | 73 | if ./example; then \ |
72 | echo ' *** zlib test OK ***'; \ | 74 | echo ' *** zlib test OK ***'; \ |
@@ -74,6 +76,22 @@ test: all | |||
74 | echo ' *** zlib test FAILED ***'; \ | 76 | echo ' *** zlib test FAILED ***'; \ |
75 | fi | 77 | fi |
76 | 78 | ||
79 | testshared: allshared | ||
80 | @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ | ||
81 | DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \ | ||
82 | SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \ | ||
83 | echo hello world | ./minigzipsh | ./minigzipsh -d || \ | ||
84 | echo ' *** minigzip shared test FAILED ***' ; \ | ||
85 | if ./examplesh; then \ | ||
86 | echo ' *** zlib shared test OK ***'; \ | ||
87 | else \ | ||
88 | echo ' *** zlib shared test FAILED ***'; \ | ||
89 | fi | ||
90 | |||
91 | test: teststatic testshared | ||
92 | |||
93 | check: test | ||
94 | |||
77 | libz.a: $(OBJS) | 95 | libz.a: $(OBJS) |
78 | $(AR) $@ $(OBJS) | 96 | $(AR) $@ $(OBJS) |
79 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 | 97 | -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 |
@@ -105,6 +123,12 @@ example$(EXE): example.o $(LIBS) | |||
105 | minigzip$(EXE): minigzip.o $(LIBS) | 123 | minigzip$(EXE): minigzip.o $(LIBS) |
106 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) | 124 | $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) |
107 | 125 | ||
126 | examplesh$(EXE): example.o $(LIBS) | ||
127 | $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIB) | ||
128 | |||
129 | minigzipsh$(EXE): minigzip.o $(LIBS) | ||
130 | $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIB) | ||
131 | |||
108 | install-libs: $(LIBS) | 132 | install-libs: $(LIBS) |
109 | -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi | 133 | -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi |
110 | -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi | 134 | -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi |
@@ -142,7 +166,8 @@ uninstall: | |||
142 | 166 | ||
143 | mostlyclean: clean | 167 | mostlyclean: clean |
144 | clean: | 168 | clean: |
145 | rm -f *.o *.lo *~ example$(EXE) minigzip$(EXE) \ | 169 | rm -f *.o *.lo *~ \ |
170 | example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ | ||
146 | libz.* foo.gz so_locations \ | 171 | libz.* foo.gz so_locations \ |
147 | _match.s maketree contrib/infback9/*.o | 172 | _match.s maketree contrib/infback9/*.o |
148 | 173 | ||
@@ -180,13 +205,11 @@ adler32.lo: zlib.h zconf.h zlibdefs.h | |||
180 | compress.lo: zlib.h zconf.h zlibdefs.h | 205 | compress.lo: zlib.h zconf.h zlibdefs.h |
181 | crc32.lo: crc32.h zlib.h zconf.h zlibdefs.h | 206 | crc32.lo: crc32.h zlib.h zconf.h zlibdefs.h |
182 | deflate.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h | 207 | deflate.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h |
183 | example.lo: zlib.h zconf.h zlibdefs.h | ||
184 | gzio.lo: zutil.h zlib.h zconf.h zlibdefs.h | 208 | gzio.lo: zutil.h zlib.h zconf.h zlibdefs.h |
185 | inffast.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h | 209 | inffast.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h |
186 | inflate.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h | 210 | inflate.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h |
187 | infback.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h | 211 | infback.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h |
188 | inftrees.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h | 212 | inftrees.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h |
189 | minigzip.lo: zlib.h zconf.h zlibdefs.h | ||
190 | trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h | 213 | trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h |
191 | uncompr.lo: zlib.h zconf.h zlibdefs.h | 214 | uncompr.lo: zlib.h zconf.h zlibdefs.h |
192 | zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h | 215 | zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h |
@@ -1,6 +1,6 @@ | |||
1 | ZLIB DATA COMPRESSION LIBRARY | 1 | ZLIB DATA COMPRESSION LIBRARY |
2 | 2 | ||
3 | zlib 1.2.3.2 is a general purpose data compression library. All the code is | 3 | zlib 1.2.3.3 is a general purpose data compression library. All the code is |
4 | thread safe. The data format used by the zlib library is described by RFCs | 4 | thread 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 |
6 | http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) | 6 | http://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 | |||
33 | issue of Dr. Dobb's Journal; a copy of the article is available in | 33 | issue of Dr. Dobb's Journal; a copy of the article is available in |
34 | http://dogma.net/markn/articles/zlibtool/zlibtool.htm | 34 | http://dogma.net/markn/articles/zlibtool/zlibtool.htm |
35 | 35 | ||
36 | The changes made in version 1.2.3.2 are documented in the file ChangeLog. | 36 | The changes made in version 1.2.3.3 are documented in the file ChangeLog. |
37 | 37 | ||
38 | Unsupported third party contributions are provided in directory "contrib". | 38 | Unsupported third party contributions are provided in directory "contrib". |
39 | 39 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* adler32.c -- compute the Adler-32 checksum of a data stream | 1 | /* adler32.c -- compute the Adler-32 checksum of a data stream |
2 | * Copyright (C) 1995-2004 Mark Adler | 2 | * Copyright (C) 1995-2006 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -8,6 +8,15 @@ | |||
8 | #define ZLIB_INTERNAL | 8 | #define ZLIB_INTERNAL |
9 | #include "zlib.h" | 9 | #include "zlib.h" |
10 | 10 | ||
11 | #define local static | ||
12 | |||
13 | #ifdef _LARGEFILE64_SOURCE | ||
14 | local uLong adler32_combine_(uLong adler1, uLong adler2, off64_t len2); | ||
15 | #else | ||
16 | local uLong adler32_combine_(uLong adler1, uLong adler2, z_off_t len2); | ||
17 | #endif | ||
18 | |||
19 | |||
11 | #define BASE 65521UL /* largest prime smaller than 65536 */ | 20 | #define BASE 65521UL /* largest prime smaller than 65536 */ |
12 | #define NMAX 5552 | 21 | #define NMAX 5552 |
13 | /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ | 22 | /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ |
@@ -125,10 +134,14 @@ uLong ZEXPORT adler32(adler, buf, len) | |||
125 | } | 134 | } |
126 | 135 | ||
127 | /* ========================================================================= */ | 136 | /* ========================================================================= */ |
128 | uLong ZEXPORT adler32_combine(adler1, adler2, len2) | 137 | local uLong adler32_combine_(adler1, adler2, len2) |
129 | uLong adler1; | 138 | uLong adler1; |
130 | uLong adler2; | 139 | uLong adler2; |
140 | #ifdef _LARGEFILE64_SOURCE | ||
141 | off64_t len2; | ||
142 | #else | ||
131 | z_off_t len2; | 143 | z_off_t len2; |
144 | #endif | ||
132 | { | 145 | { |
133 | unsigned long sum1; | 146 | unsigned long sum1; |
134 | unsigned long sum2; | 147 | unsigned long sum2; |
@@ -147,3 +160,30 @@ uLong ZEXPORT adler32_combine(adler1, adler2, len2) | |||
147 | if (sum2 > BASE) sum2 -= BASE; | 160 | if (sum2 > BASE) sum2 -= BASE; |
148 | return sum1 | (sum2 << 16); | 161 | return sum1 | (sum2 << 16); |
149 | } | 162 | } |
163 | |||
164 | /* ========================================================================= */ | ||
165 | uLong ZEXPORT adler32_combine(adler1, adler2, len2) | ||
166 | uLong adler1; | ||
167 | uLong adler2; | ||
168 | z_off_t len2; | ||
169 | { | ||
170 | return adler32_combine_(adler1, adler2, len2); | ||
171 | } | ||
172 | |||
173 | #ifdef _LARGEFILE64_SOURCE | ||
174 | uLong ZEXPORT adler32_combine64(adler1, adler2, len2) | ||
175 | uLong adler1; | ||
176 | uLong adler2; | ||
177 | off64_t len2; | ||
178 | { | ||
179 | return adler32_combine_(adler1, adler2, len2); | ||
180 | } | ||
181 | #else | ||
182 | uLong ZEXPORT adler32_combine64(adler1, adler2, len2) | ||
183 | uLong adler1; | ||
184 | uLong adler2; | ||
185 | z_off_t len2; | ||
186 | { | ||
187 | return adler32_combine_(adler1, adler2, len2); | ||
188 | } | ||
189 | #endif | ||
diff --git a/as400/zlib.inc b/as400/zlib.inc index fcf1791..4436477 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.3.2 | 4 | * Version 1.2.3.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.3.2' | 25 | D ZLIB_VERSION C '1.2.3.3' |
26 | D ZLIB_VERNUM C X'1232' | 26 | D ZLIB_VERNUM C X'1233' |
27 | * | 27 | * |
28 | * Other equates. | 28 | * Other equates. |
29 | * | 29 | * |
@@ -32,7 +32,7 @@ libdir=${libdir-'${exec_prefix}/lib'} | |||
32 | includedir=${includedir-'${prefix}/include'} | 32 | includedir=${includedir-'${prefix}/include'} |
33 | mandir=${mandir-'${prefix}/share/man'} | 33 | mandir=${mandir-'${prefix}/share/man'} |
34 | shared_ext='.so' | 34 | shared_ext='.so' |
35 | shared=0 | 35 | shared=1 |
36 | zprefix=0 | 36 | zprefix=0 |
37 | gcc=0 | 37 | gcc=0 |
38 | old_cc="$CC" | 38 | old_cc="$CC" |
@@ -50,11 +50,13 @@ case "$1" in | |||
50 | -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; | 50 | -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; |
51 | -l*=* | --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; | 51 | -l*=* | --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; |
52 | -i*=* | --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;; | 52 | -i*=* | --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;; |
53 | -u*=* | --uname=*) uname=`echo $1 | sed 's/[-a-z_]*=//'`;shift;; | ||
53 | -p* | --prefix) prefix="$2"; shift; shift;; | 54 | -p* | --prefix) prefix="$2"; shift; shift;; |
54 | -e* | --eprefix) exec_prefix="$2"; shift; shift;; | 55 | -e* | --eprefix) exec_prefix="$2"; shift; shift;; |
55 | -l* | --libdir) libdir="$2"; shift; shift;; | 56 | -l* | --libdir) libdir="$2"; shift; shift;; |
56 | -i* | --includedir) includedir="$2"; shift; shift;; | 57 | -i* | --includedir) includedir="$2"; shift; shift;; |
57 | -s* | --shared | --enable-shared) shared=1; shift;; | 58 | -s* | --shared | --enable-shared) shared=1; shift;; |
59 | -t | --static) shared=0; shift;; | ||
58 | -z* | --zprefix) zprefix=1; shift;; | 60 | -z* | --zprefix) zprefix=1; shift;; |
59 | --sysconfdir=*) echo "ignored option: --sysconfdir"; shift;; | 61 | --sysconfdir=*) echo "ignored option: --sysconfdir"; shift;; |
60 | --localstatedir=*) echo "ignored option: --localstatedir"; shift;; | 62 | --localstatedir=*) echo "ignored option: --localstatedir"; shift;; |
@@ -80,7 +82,10 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then | |||
80 | CC="$cc" | 82 | CC="$cc" |
81 | SFLAGS="${CFLAGS-"-O3"} -fPIC" | 83 | SFLAGS="${CFLAGS-"-O3"} -fPIC" |
82 | CFLAGS="${CFLAGS-"-O3"}" | 84 | CFLAGS="${CFLAGS-"-O3"}" |
83 | case `(uname -s || echo unknown) 2>/dev/null` in | 85 | if test -z $uname; then |
86 | uname=`(uname -s || echo unknown) 2>/dev/null` | ||
87 | fi | ||
88 | case "$uname" in | ||
84 | Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"};; | 89 | Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"};; |
85 | CYGWIN* | Cygwin* | cygwin* | OS/2* ) | 90 | CYGWIN* | Cygwin* | cygwin* | OS/2* ) |
86 | EXE='.exe';; | 91 | EXE='.exe';; |
@@ -107,7 +112,10 @@ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then | |||
107 | else | 112 | else |
108 | # find system name and corresponding cc options | 113 | # find system name and corresponding cc options |
109 | CC=${CC-cc} | 114 | CC=${CC-cc} |
110 | case `(uname -sr || echo unknown) 2>/dev/null` in | 115 | if test -z $uname; then |
116 | uname=`(uname -sr || echo unknown) 2>/dev/null` | ||
117 | fi | ||
118 | case "$uname" in | ||
111 | HP-UX*) SFLAGS=${CFLAGS-"-O +z"} | 119 | HP-UX*) SFLAGS=${CFLAGS-"-O +z"} |
112 | CFLAGS=${CFLAGS-"-O"} | 120 | CFLAGS=${CFLAGS-"-O"} |
113 | # LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"} | 121 | # LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"} |
@@ -200,7 +208,12 @@ if test $shared -eq 1; then | |||
200 | fi | 208 | fi |
201 | if test $shared -eq 0; then | 209 | if test $shared -eq 0; then |
202 | LDSHARED="$CC" | 210 | LDSHARED="$CC" |
211 | ALL="allstatic" | ||
212 | TEST="teststatic" | ||
203 | echo Building static library $LIBS version $VER with $CC. | 213 | echo Building static library $LIBS version $VER with $CC. |
214 | else | ||
215 | ALL="allstatic allshared" | ||
216 | TEST="teststatic testshared" | ||
204 | fi | 217 | fi |
205 | 218 | ||
206 | cat > zlibdefs.h << EOF | 219 | cat > zlibdefs.h << EOF |
@@ -215,15 +228,27 @@ cat > $test.c <<EOF | |||
215 | #include <sys/types.h> | 228 | #include <sys/types.h> |
216 | off64_t dummy = 0; | 229 | off64_t dummy = 0; |
217 | EOF | 230 | EOF |
218 | if test "`($CC -c $CFLAGS -D_LARGEFILE64_SOURCE $test.c) 2>&1`" = ""; then | 231 | if test "`($CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c) 2>&1`" = ""; then |
219 | cat >> zlibdefs.h <<EOF | 232 | CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1" |
220 | #define z_off_t off64_t | 233 | SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1" |
221 | EOF | ||
222 | CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE" | ||
223 | SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE" | ||
224 | echo "Checking for off64_t... Yes." | 234 | echo "Checking for off64_t... Yes." |
235 | echo "Checking for fseeko... Yes." | ||
225 | else | 236 | else |
226 | echo "Checking for off64_t... No." | 237 | echo "Checking for off64_t... No." |
238 | cat > $test.c <<EOF | ||
239 | #include <stdio.h> | ||
240 | int main(void) { | ||
241 | fseeko(NULL, 0, 0); | ||
242 | return 0; | ||
243 | } | ||
244 | EOF | ||
245 | if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then | ||
246 | echo "Checking for fseeko... Yes." | ||
247 | else | ||
248 | CFLAGS="${CFLAGS} -DNO_FSEEKO" | ||
249 | SFLAGS="${SFLAGS} -DNO_FSEEKO" | ||
250 | echo "Checking for fseeko... No." | ||
251 | fi | ||
227 | fi | 252 | fi |
228 | 253 | ||
229 | cat > $test.c <<EOF | 254 | cat > $test.c <<EOF |
@@ -491,8 +516,9 @@ sed < Makefile.in " | |||
491 | /^CC *=/s#=.*#=$CC# | 516 | /^CC *=/s#=.*#=$CC# |
492 | /^CFLAGS *=/s#=.*#=$CFLAGS# | 517 | /^CFLAGS *=/s#=.*#=$CFLAGS# |
493 | /^SFLAGS *=/s#=.*#=$SFLAGS# | 518 | /^SFLAGS *=/s#=.*#=$SFLAGS# |
494 | /^CPP *=/s#=.*#=$CPP# | 519 | /^LDFLAGS *=/s#=.*#=$LDFLAGS# |
495 | /^LDSHARED *=/s#=.*#=$LDSHARED# | 520 | /^LDSHARED *=/s#=.*#=$LDSHARED# |
521 | /^CPP *=/s#=.*#=$CPP# | ||
496 | /^LIBS *=/s#=.*#=$LIBS# | 522 | /^LIBS *=/s#=.*#=$LIBS# |
497 | /^SHAREDLIB *=/s#=.*#=$SHAREDLIB# | 523 | /^SHAREDLIB *=/s#=.*#=$SHAREDLIB# |
498 | /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# | 524 | /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# |
@@ -505,7 +531,8 @@ sed < Makefile.in " | |||
505 | /^libdir *=/s#=.*#=$libdir# | 531 | /^libdir *=/s#=.*#=$libdir# |
506 | /^includedir *=/s#=.*#=$includedir# | 532 | /^includedir *=/s#=.*#=$includedir# |
507 | /^mandir *=/s#=.*#=$mandir# | 533 | /^mandir *=/s#=.*#=$mandir# |
508 | /^LDFLAGS *=/s#=.*#=$LDFLAGS# | 534 | /^all: */s#:.*#: $ALL# |
535 | /^test: */s#:.*#: $TEST# | ||
509 | " > Makefile | 536 | " > Makefile |
510 | 537 | ||
511 | sed < zlib.pc.in " | 538 | sed < zlib.pc.in " |
diff --git a/contrib/infback9/infback9.c b/contrib/infback9/infback9.c index f5ddde6..c5547ae 100644 --- a/contrib/infback9/infback9.c +++ b/contrib/infback9/infback9.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* infback9.c -- inflate deflate64 data using a call-back interface | 1 | /* infback9.c -- inflate deflate64 data using a call-back interface |
2 | * Copyright (C) 1995-2003 Mark Adler | 2 | * Copyright (C) 1995-2006 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -242,7 +242,7 @@ void FAR *out_desc; | |||
242 | code const FAR *distcode; /* starting table for distance codes */ | 242 | code const FAR *distcode; /* starting table for distance codes */ |
243 | unsigned lenbits; /* index bits for lencode */ | 243 | unsigned lenbits; /* index bits for lencode */ |
244 | unsigned distbits; /* index bits for distcode */ | 244 | unsigned distbits; /* index bits for distcode */ |
245 | code this; /* current decoding table entry */ | 245 | code here; /* current decoding table entry */ |
246 | code last; /* parent table entry */ | 246 | code last; /* parent table entry */ |
247 | unsigned len; /* length to copy for repeats, bits to drop */ | 247 | unsigned len; /* length to copy for repeats, bits to drop */ |
248 | int ret; /* return code */ | 248 | int ret; /* return code */ |
@@ -384,19 +384,19 @@ void FAR *out_desc; | |||
384 | state->have = 0; | 384 | state->have = 0; |
385 | while (state->have < state->nlen + state->ndist) { | 385 | while (state->have < state->nlen + state->ndist) { |
386 | for (;;) { | 386 | for (;;) { |
387 | this = lencode[BITS(lenbits)]; | 387 | here = lencode[BITS(lenbits)]; |
388 | if ((unsigned)(this.bits) <= bits) break; | 388 | if ((unsigned)(here.bits) <= bits) break; |
389 | PULLBYTE(); | 389 | PULLBYTE(); |
390 | } | 390 | } |
391 | if (this.val < 16) { | 391 | if (here.val < 16) { |
392 | NEEDBITS(this.bits); | 392 | NEEDBITS(here.bits); |
393 | DROPBITS(this.bits); | 393 | DROPBITS(here.bits); |
394 | state->lens[state->have++] = this.val; | 394 | state->lens[state->have++] = here.val; |
395 | } | 395 | } |
396 | else { | 396 | else { |
397 | if (this.val == 16) { | 397 | if (here.val == 16) { |
398 | NEEDBITS(this.bits + 2); | 398 | NEEDBITS(here.bits + 2); |
399 | DROPBITS(this.bits); | 399 | DROPBITS(here.bits); |
400 | if (state->have == 0) { | 400 | if (state->have == 0) { |
401 | strm->msg = (char *)"invalid bit length repeat"; | 401 | strm->msg = (char *)"invalid bit length repeat"; |
402 | mode = BAD; | 402 | mode = BAD; |
@@ -406,16 +406,16 @@ void FAR *out_desc; | |||
406 | copy = 3 + BITS(2); | 406 | copy = 3 + BITS(2); |
407 | DROPBITS(2); | 407 | DROPBITS(2); |
408 | } | 408 | } |
409 | else if (this.val == 17) { | 409 | else if (here.val == 17) { |
410 | NEEDBITS(this.bits + 3); | 410 | NEEDBITS(here.bits + 3); |
411 | DROPBITS(this.bits); | 411 | DROPBITS(here.bits); |
412 | len = 0; | 412 | len = 0; |
413 | copy = 3 + BITS(3); | 413 | copy = 3 + BITS(3); |
414 | DROPBITS(3); | 414 | DROPBITS(3); |
415 | } | 415 | } |
416 | else { | 416 | else { |
417 | NEEDBITS(this.bits + 7); | 417 | NEEDBITS(here.bits + 7); |
418 | DROPBITS(this.bits); | 418 | DROPBITS(here.bits); |
419 | len = 0; | 419 | len = 0; |
420 | copy = 11 + BITS(7); | 420 | copy = 11 + BITS(7); |
421 | DROPBITS(7); | 421 | DROPBITS(7); |
@@ -460,28 +460,28 @@ void FAR *out_desc; | |||
460 | case LEN: | 460 | case LEN: |
461 | /* get a literal, length, or end-of-block code */ | 461 | /* get a literal, length, or end-of-block code */ |
462 | for (;;) { | 462 | for (;;) { |
463 | this = lencode[BITS(lenbits)]; | 463 | here = lencode[BITS(lenbits)]; |
464 | if ((unsigned)(this.bits) <= bits) break; | 464 | if ((unsigned)(here.bits) <= bits) break; |
465 | PULLBYTE(); | 465 | PULLBYTE(); |
466 | } | 466 | } |
467 | if (this.op && (this.op & 0xf0) == 0) { | 467 | if (here.op && (here.op & 0xf0) == 0) { |
468 | last = this; | 468 | last = here; |
469 | for (;;) { | 469 | for (;;) { |
470 | this = lencode[last.val + | 470 | here = lencode[last.val + |
471 | (BITS(last.bits + last.op) >> last.bits)]; | 471 | (BITS(last.bits + last.op) >> last.bits)]; |
472 | if ((unsigned)(last.bits + this.bits) <= bits) break; | 472 | if ((unsigned)(last.bits + here.bits) <= bits) break; |
473 | PULLBYTE(); | 473 | PULLBYTE(); |
474 | } | 474 | } |
475 | DROPBITS(last.bits); | 475 | DROPBITS(last.bits); |
476 | } | 476 | } |
477 | DROPBITS(this.bits); | 477 | DROPBITS(here.bits); |
478 | length = (unsigned)this.val; | 478 | length = (unsigned)here.val; |
479 | 479 | ||
480 | /* process literal */ | 480 | /* process literal */ |
481 | if (this.op == 0) { | 481 | if (here.op == 0) { |
482 | Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? | 482 | Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? |
483 | "inflate: literal '%c'\n" : | 483 | "inflate: literal '%c'\n" : |
484 | "inflate: literal 0x%02x\n", this.val)); | 484 | "inflate: literal 0x%02x\n", here.val)); |
485 | ROOM(); | 485 | ROOM(); |
486 | *put++ = (unsigned char)(length); | 486 | *put++ = (unsigned char)(length); |
487 | left--; | 487 | left--; |
@@ -490,21 +490,21 @@ void FAR *out_desc; | |||
490 | } | 490 | } |
491 | 491 | ||
492 | /* process end of block */ | 492 | /* process end of block */ |
493 | if (this.op & 32) { | 493 | if (here.op & 32) { |
494 | Tracevv((stderr, "inflate: end of block\n")); | 494 | Tracevv((stderr, "inflate: end of block\n")); |
495 | mode = TYPE; | 495 | mode = TYPE; |
496 | break; | 496 | break; |
497 | } | 497 | } |
498 | 498 | ||
499 | /* invalid code */ | 499 | /* invalid code */ |
500 | if (this.op & 64) { | 500 | if (here.op & 64) { |
501 | strm->msg = (char *)"invalid literal/length code"; | 501 | strm->msg = (char *)"invalid literal/length code"; |
502 | mode = BAD; | 502 | mode = BAD; |
503 | break; | 503 | break; |
504 | } | 504 | } |
505 | 505 | ||
506 | /* length code -- get extra bits, if any */ | 506 | /* length code -- get extra bits, if any */ |
507 | extra = (unsigned)(this.op) & 31; | 507 | extra = (unsigned)(here.op) & 31; |
508 | if (extra != 0) { | 508 | if (extra != 0) { |
509 | NEEDBITS(extra); | 509 | NEEDBITS(extra); |
510 | length += BITS(extra); | 510 | length += BITS(extra); |
@@ -514,30 +514,30 @@ void FAR *out_desc; | |||
514 | 514 | ||
515 | /* get distance code */ | 515 | /* get distance code */ |
516 | for (;;) { | 516 | for (;;) { |
517 | this = distcode[BITS(distbits)]; | 517 | here = distcode[BITS(distbits)]; |
518 | if ((unsigned)(this.bits) <= bits) break; | 518 | if ((unsigned)(here.bits) <= bits) break; |
519 | PULLBYTE(); | 519 | PULLBYTE(); |
520 | } | 520 | } |
521 | if ((this.op & 0xf0) == 0) { | 521 | if ((here.op & 0xf0) == 0) { |
522 | last = this; | 522 | last = here; |
523 | for (;;) { | 523 | for (;;) { |
524 | this = distcode[last.val + | 524 | here = distcode[last.val + |
525 | (BITS(last.bits + last.op) >> last.bits)]; | 525 | (BITS(last.bits + last.op) >> last.bits)]; |
526 | if ((unsigned)(last.bits + this.bits) <= bits) break; | 526 | if ((unsigned)(last.bits + here.bits) <= bits) break; |
527 | PULLBYTE(); | 527 | PULLBYTE(); |
528 | } | 528 | } |
529 | DROPBITS(last.bits); | 529 | DROPBITS(last.bits); |
530 | } | 530 | } |
531 | DROPBITS(this.bits); | 531 | DROPBITS(here.bits); |
532 | if (this.op & 64) { | 532 | if (here.op & 64) { |
533 | strm->msg = (char *)"invalid distance code"; | 533 | strm->msg = (char *)"invalid distance code"; |
534 | mode = BAD; | 534 | mode = BAD; |
535 | break; | 535 | break; |
536 | } | 536 | } |
537 | offset = (unsigned)this.val; | 537 | offset = (unsigned)here.val; |
538 | 538 | ||
539 | /* get distance extra bits, if any */ | 539 | /* get distance extra bits, if any */ |
540 | extra = (unsigned)(this.op) & 15; | 540 | extra = (unsigned)(here.op) & 15; |
541 | if (extra != 0) { | 541 | if (extra != 0) { |
542 | NEEDBITS(extra); | 542 | NEEDBITS(extra); |
543 | offset += BITS(extra); | 543 | offset += BITS(extra); |
diff --git a/contrib/infback9/inftree9.c b/contrib/infback9/inftree9.c index dede93b..c24302b 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 | ||
11 | const char inflate9_copyright[] = | 11 | const char inflate9_copyright[] = |
12 | " inflate9 1.2.3.2 Copyright 1995-2006 Mark Adler "; | 12 | " inflate9 1.2.3.3 Copyright 1995-2006 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, 192, 204}; | 67 | 133, 133, 133, 133, 144, 201, 203}; |
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, |
diff --git a/contrib/vstudio/vc7/zlib.rc b/contrib/vstudio/vc7/zlib.rc index 71d827b..39eca7e 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 |
4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE | 4 | IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE |
5 | FILEVERSION 1,2,3,2 | 5 | FILEVERSION 1,2,3,3 |
6 | PRODUCTVERSION 1,2,3,2 | 6 | PRODUCTVERSION 1,2,3,3 |
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.3.2\0" | 20 | VALUE "FileVersion", "1.2.3.3\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" |
@@ -1,5 +1,5 @@ | |||
1 | /* crc32.c -- compute the CRC-32 of a data stream | 1 | /* crc32.c -- compute the CRC-32 of a data stream |
2 | * Copyright (C) 1995-2005 Mark Adler | 2 | * Copyright (C) 1995-2006 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | * | 4 | * |
5 | * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster | 5 | * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster |
@@ -68,6 +68,12 @@ | |||
68 | local unsigned long gf2_matrix_times OF((unsigned long *mat, | 68 | local unsigned long gf2_matrix_times OF((unsigned long *mat, |
69 | unsigned long vec)); | 69 | unsigned long vec)); |
70 | local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); | 70 | local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); |
71 | #ifdef _LARGEFILE64_SOURCE | ||
72 | local uLong crc32_combine_(uLong crc1, uLong crc2, off64_t len2); | ||
73 | #else | ||
74 | local uLong crc32_combine_(uLong crc1, uLong crc2, z_off_t len2); | ||
75 | #endif | ||
76 | |||
71 | 77 | ||
72 | #ifdef DYNAMIC_CRC_TABLE | 78 | #ifdef DYNAMIC_CRC_TABLE |
73 | 79 | ||
@@ -367,10 +373,14 @@ local void gf2_matrix_square(square, mat) | |||
367 | } | 373 | } |
368 | 374 | ||
369 | /* ========================================================================= */ | 375 | /* ========================================================================= */ |
370 | uLong ZEXPORT crc32_combine(crc1, crc2, len2) | 376 | local uLong crc32_combine_(crc1, crc2, len2) |
371 | uLong crc1; | 377 | uLong crc1; |
372 | uLong crc2; | 378 | uLong crc2; |
379 | #ifdef _LARGEFILE64_SOURCE | ||
380 | off64_t len2; | ||
381 | #else | ||
373 | z_off_t len2; | 382 | z_off_t len2; |
383 | #endif | ||
374 | { | 384 | { |
375 | int n; | 385 | int n; |
376 | unsigned long row; | 386 | unsigned long row; |
@@ -421,3 +431,30 @@ uLong ZEXPORT crc32_combine(crc1, crc2, len2) | |||
421 | crc1 ^= crc2; | 431 | crc1 ^= crc2; |
422 | return crc1; | 432 | return crc1; |
423 | } | 433 | } |
434 | |||
435 | /* ========================================================================= */ | ||
436 | uLong ZEXPORT crc32_combine(crc1, crc2, len2) | ||
437 | uLong crc1; | ||
438 | uLong crc2; | ||
439 | z_off_t len2; | ||
440 | { | ||
441 | return crc32_combine_(crc1, crc2, len2); | ||
442 | } | ||
443 | |||
444 | #ifdef _LARGEFILE64_SOURCE | ||
445 | uLong ZEXPORT crc32_combine64(crc1, crc2, len2) | ||
446 | uLong crc1; | ||
447 | uLong crc2; | ||
448 | off64_t len2; | ||
449 | { | ||
450 | return crc32_combine_(crc1, crc2, len2); | ||
451 | } | ||
452 | #else | ||
453 | uLong ZEXPORT crc32_combine64(crc1, crc2, len2) | ||
454 | uLong crc1; | ||
455 | uLong crc2; | ||
456 | z_off_t len2; | ||
457 | { | ||
458 | return crc32_combine_(crc1, crc2, len2); | ||
459 | } | ||
460 | #endif | ||
@@ -52,7 +52,7 @@ | |||
52 | #include "deflate.h" | 52 | #include "deflate.h" |
53 | 53 | ||
54 | const char deflate_copyright[] = | 54 | const char deflate_copyright[] = |
55 | " deflate 1.2.3.2 Copyright 1995-2006 Jean-loup Gailly "; | 55 | " deflate 1.2.3.3 Copyright 1995-2006 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 |
@@ -7,6 +7,15 @@ | |||
7 | 7 | ||
8 | /* @(#) $Id$ */ | 8 | /* @(#) $Id$ */ |
9 | 9 | ||
10 | #ifdef _LARGEFILE64_SOURCE | ||
11 | # ifndef _LARGEFILE_SOURCE | ||
12 | # define _LARGEFILE_SOURCE | ||
13 | # endif | ||
14 | # ifdef _FILE_OFFSET_BITS | ||
15 | # undef _FILE_OFFSET_BITS | ||
16 | # endif | ||
17 | #endif | ||
18 | |||
10 | #include "zutil.h" | 19 | #include "zutil.h" |
11 | #include <stdio.h> | 20 | #include <stdio.h> |
12 | 21 | ||
@@ -39,6 +48,14 @@ extern voidp malloc OF((uInt size)); | |||
39 | extern void free OF((voidpf ptr)); | 48 | extern void free OF((voidpf ptr)); |
40 | #endif | 49 | #endif |
41 | 50 | ||
51 | #ifdef NO_FSEEKO | ||
52 | # define FSEEK fseek | ||
53 | # define FTELL ftell | ||
54 | #else | ||
55 | # define FSEEK fseeko | ||
56 | # define FTELL ftello | ||
57 | #endif | ||
58 | |||
42 | #define ALLOC(size) malloc(size) | 59 | #define ALLOC(size) malloc(size) |
43 | #define TRYFREE(p) {if (p) free(p);} | 60 | #define TRYFREE(p) {if (p) free(p);} |
44 | 61 | ||
@@ -64,15 +81,27 @@ typedef struct gz_stream { | |||
64 | char *path; /* path name for debugging only */ | 81 | char *path; /* path name for debugging only */ |
65 | int transparent; /* 1 if input file is not a .gz file */ | 82 | int transparent; /* 1 if input file is not a .gz file */ |
66 | char mode; /* 'w' or 'r' */ | 83 | char mode; /* 'w' or 'r' */ |
84 | #ifdef _LARGEFILE64_SOURCE | ||
85 | off64_t start; /* start of compressed data in file (header skipped) */ | ||
86 | off64_t in; /* bytes into deflate or inflate */ | ||
87 | off64_t out; /* bytes out of deflate or inflate */ | ||
88 | #else | ||
67 | z_off_t start; /* start of compressed data in file (header skipped) */ | 89 | z_off_t start; /* start of compressed data in file (header skipped) */ |
68 | z_off_t in; /* bytes into deflate or inflate */ | 90 | z_off_t in; /* bytes into deflate or inflate */ |
69 | z_off_t out; /* bytes out of deflate or inflate */ | 91 | z_off_t out; /* bytes out of deflate or inflate */ |
92 | #endif | ||
70 | int back; /* one character push-back */ | 93 | int back; /* one character push-back */ |
71 | int last; /* true if push-back is last character */ | 94 | int last; /* true if push-back is last character */ |
72 | } gz_stream; | 95 | } gz_stream; |
73 | 96 | ||
74 | 97 | ||
75 | local gzFile gz_open OF((const char *path, const char *mode, int fd)); | 98 | local gzFile gz_open OF((const char *path, const char *mode, int fd, |
99 | int use64)); | ||
100 | #ifdef _LARGEFILE64_SOURCE | ||
101 | local off64_t gz_seek OF((gzFile file, off64_t offset, int whence, int use64)); | ||
102 | #else | ||
103 | local z_off_t gz_seek OF((gzFile file, z_off_t offset, int whence, int use64)); | ||
104 | #endif | ||
76 | local int do_flush OF((gzFile file, int flush)); | 105 | local int do_flush OF((gzFile file, int flush)); |
77 | local int get_byte OF((gz_stream *s)); | 106 | local int get_byte OF((gz_stream *s)); |
78 | local void check_header OF((gz_stream *s)); | 107 | local void check_header OF((gz_stream *s)); |
@@ -89,10 +118,11 @@ local uLong getLong OF((gz_stream *s)); | |||
89 | can be checked to distinguish the two cases (if errno is zero, the | 118 | can be checked to distinguish the two cases (if errno is zero, the |
90 | zlib error is Z_MEM_ERROR). | 119 | zlib error is Z_MEM_ERROR). |
91 | */ | 120 | */ |
92 | local gzFile gz_open (path, mode, fd) | 121 | local gzFile gz_open (path, mode, fd, use64) |
93 | const char *path; | 122 | const char *path; |
94 | const char *mode; | 123 | const char *mode; |
95 | int fd; | 124 | int fd; |
125 | int use64; | ||
96 | { | 126 | { |
97 | int err; | 127 | int err; |
98 | int level = Z_DEFAULT_COMPRESSION; /* compression level */ | 128 | int level = Z_DEFAULT_COMPRESSION; /* compression level */ |
@@ -164,12 +194,7 @@ local gzFile gz_open (path, mode, fd) | |||
164 | s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); | 194 | s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); |
165 | 195 | ||
166 | err = inflateInit2(&(s->stream), -MAX_WBITS); | 196 | err = inflateInit2(&(s->stream), -MAX_WBITS); |
167 | /* windowBits is passed < 0 to tell that there is no zlib header. | 197 | /* windowBits is passed < 0 to tell that there is no zlib header */ |
168 | * Note that in this case inflate *requires* an extra "dummy" byte | ||
169 | * after the compressed stream in order to complete decompression and | ||
170 | * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are | ||
171 | * present after the compressed stream. | ||
172 | */ | ||
173 | if (err != Z_OK || s->inbuf == Z_NULL) { | 198 | if (err != Z_OK || s->inbuf == Z_NULL) { |
174 | return destroy(s), (gzFile)Z_NULL; | 199 | return destroy(s), (gzFile)Z_NULL; |
175 | } | 200 | } |
@@ -177,7 +202,8 @@ local gzFile gz_open (path, mode, fd) | |||
177 | s->stream.avail_out = Z_BUFSIZE; | 202 | s->stream.avail_out = Z_BUFSIZE; |
178 | 203 | ||
179 | errno = 0; | 204 | errno = 0; |
180 | s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode); | 205 | s->file = fd < 0 ? (use64 ? F_OPEN64(path, fmode) : F_OPEN(path, fmode)) : |
206 | (FILE*)fdopen(fd, fmode); | ||
181 | 207 | ||
182 | if (s->file == NULL) { | 208 | if (s->file == NULL) { |
183 | return destroy(s), (gzFile)Z_NULL; | 209 | return destroy(s), (gzFile)Z_NULL; |
@@ -198,7 +224,7 @@ local gzFile gz_open (path, mode, fd) | |||
198 | */ | 224 | */ |
199 | } else { | 225 | } else { |
200 | check_header(s); /* skip the .gz header */ | 226 | check_header(s); /* skip the .gz header */ |
201 | s->start = ftell(s->file) - s->stream.avail_in; | 227 | s->start = FTELL(s->file) - s->stream.avail_in; |
202 | } | 228 | } |
203 | 229 | ||
204 | return (gzFile)s; | 230 | return (gzFile)s; |
@@ -211,7 +237,17 @@ gzFile ZEXPORT gzopen (path, mode) | |||
211 | const char *path; | 237 | const char *path; |
212 | const char *mode; | 238 | const char *mode; |
213 | { | 239 | { |
214 | return gz_open (path, mode, -1); | 240 | return gz_open (path, mode, -1, 0); |
241 | } | ||
242 | |||
243 | /* =========================================================================== | ||
244 | Opens a gzip (.gz) file for reading or writing for 64-bit offsets | ||
245 | */ | ||
246 | gzFile ZEXPORT gzopen64 (path, mode) | ||
247 | const char *path; | ||
248 | const char *mode; | ||
249 | { | ||
250 | return gz_open (path, mode, -1, 1); | ||
215 | } | 251 | } |
216 | 252 | ||
217 | /* =========================================================================== | 253 | /* =========================================================================== |
@@ -227,7 +263,7 @@ gzFile ZEXPORT gzdopen (fd, mode) | |||
227 | if (fd < 0) return (gzFile)Z_NULL; | 263 | if (fd < 0) return (gzFile)Z_NULL; |
228 | sprintf(name, "<fd:%d>", fd); /* for debugging */ | 264 | sprintf(name, "<fd:%d>", fd); /* for debugging */ |
229 | 265 | ||
230 | return gz_open (name, mode, fd); | 266 | return gz_open (name, mode, fd, 0); |
231 | } | 267 | } |
232 | 268 | ||
233 | /* =========================================================================== | 269 | /* =========================================================================== |
@@ -767,10 +803,17 @@ int ZEXPORT gzflush (file, flush) | |||
767 | SEEK_END is not implemented, returns error. | 803 | SEEK_END is not implemented, returns error. |
768 | In this version of the library, gzseek can be extremely slow. | 804 | In this version of the library, gzseek can be extremely slow. |
769 | */ | 805 | */ |
770 | z_off_t ZEXPORT gzseek (file, offset, whence) | 806 | #ifdef _LARGEFILE64_SOURCE |
807 | local off64_t gz_seek (file, offset, whence, use64) | ||
808 | gzFile file; | ||
809 | off64_t offset; | ||
810 | #else | ||
811 | local z_off_t gz_seek (file, offset, whence, use64) | ||
771 | gzFile file; | 812 | gzFile file; |
772 | z_off_t offset; | 813 | z_off_t offset; |
814 | #endif | ||
773 | int whence; | 815 | int whence; |
816 | int use64; | ||
774 | { | 817 | { |
775 | gz_stream *s = (gz_stream*)file; | 818 | gz_stream *s = (gz_stream*)file; |
776 | 819 | ||
@@ -819,7 +862,13 @@ z_off_t ZEXPORT gzseek (file, offset, whence) | |||
819 | s->back = EOF; | 862 | s->back = EOF; |
820 | s->stream.avail_in = 0; | 863 | s->stream.avail_in = 0; |
821 | s->stream.next_in = s->inbuf; | 864 | s->stream.next_in = s->inbuf; |
822 | if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; | 865 | #ifdef _LARGEFILE64_SOURCE |
866 | if ((use64 ? fseeko64(s->file, offset, SEEK_SET) : | ||
867 | FSEEK(s->file, offset, SEEK_SET)) < 0) | ||
868 | return -1L; | ||
869 | #else | ||
870 | if (FSEEK(s->file, offset, SEEK_SET) < 0) return -1L; | ||
871 | #endif | ||
823 | 872 | ||
824 | s->in = s->out = offset; | 873 | s->in = s->out = offset; |
825 | return offset; | 874 | return offset; |
@@ -855,6 +904,35 @@ z_off_t ZEXPORT gzseek (file, offset, whence) | |||
855 | } | 904 | } |
856 | 905 | ||
857 | /* =========================================================================== | 906 | /* =========================================================================== |
907 | Define external functions gzseek() and gzseek64() using local gz_seek(). | ||
908 | */ | ||
909 | z_off_t ZEXPORT gzseek (file, offset, whence) | ||
910 | gzFile file; | ||
911 | z_off_t offset; | ||
912 | int whence; | ||
913 | { | ||
914 | return (z_off_t)gz_seek(file, offset, whence, 0); | ||
915 | } | ||
916 | |||
917 | #ifdef _LARGEFILE64_SOURCE | ||
918 | off64_t ZEXPORT gzseek64 (file, offset, whence) | ||
919 | gzFile file; | ||
920 | off64_t offset; | ||
921 | int whence; | ||
922 | { | ||
923 | return gz_seek(file, offset, whence, 1); | ||
924 | } | ||
925 | #else | ||
926 | z_off_t ZEXPORT gzseek64 (file, offset, whence) | ||
927 | gzFile file; | ||
928 | z_off_t offset; | ||
929 | int whence; | ||
930 | { | ||
931 | return gz_seek(file, offset, whence, 0); | ||
932 | } | ||
933 | #endif | ||
934 | |||
935 | /* =========================================================================== | ||
858 | Rewinds input file. | 936 | Rewinds input file. |
859 | */ | 937 | */ |
860 | int ZEXPORT gzrewind (file) | 938 | int ZEXPORT gzrewind (file) |
@@ -873,7 +951,7 @@ int ZEXPORT gzrewind (file) | |||
873 | if (!s->transparent) (void)inflateReset(&s->stream); | 951 | if (!s->transparent) (void)inflateReset(&s->stream); |
874 | s->in = 0; | 952 | s->in = 0; |
875 | s->out = 0; | 953 | s->out = 0; |
876 | return fseek(s->file, s->start, SEEK_SET); | 954 | return FSEEK(s->file, s->start, SEEK_SET); |
877 | } | 955 | } |
878 | 956 | ||
879 | /* =========================================================================== | 957 | /* =========================================================================== |
@@ -888,6 +966,19 @@ z_off_t ZEXPORT gztell (file) | |||
888 | } | 966 | } |
889 | 967 | ||
890 | /* =========================================================================== | 968 | /* =========================================================================== |
969 | 64-bit version | ||
970 | */ | ||
971 | #ifdef _LARGEFILE64_SOURCE | ||
972 | off64_t ZEXPORT gztell64 (file) | ||
973 | #else | ||
974 | z_off_t ZEXPORT gztell64 (file) | ||
975 | #endif | ||
976 | gzFile file; | ||
977 | { | ||
978 | return gzseek64(file, 0L, SEEK_CUR); | ||
979 | } | ||
980 | |||
981 | /* =========================================================================== | ||
891 | Returns 1 when EOF has previously been detected reading the given | 982 | Returns 1 when EOF has previously been detected reading the given |
892 | input stream, otherwise zero. | 983 | input stream, otherwise zero. |
893 | */ | 984 | */ |
@@ -1,5 +1,5 @@ | |||
1 | /* infback.c -- inflate using a call-back interface | 1 | /* infback.c -- inflate using a call-back interface |
2 | * Copyright (C) 1995-2005 Mark Adler | 2 | * Copyright (C) 1995-2006 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -253,7 +253,7 @@ void FAR *out_desc; | |||
253 | unsigned bits; /* bits in bit buffer */ | 253 | unsigned bits; /* bits in bit buffer */ |
254 | unsigned copy; /* number of stored or match bytes to copy */ | 254 | unsigned copy; /* number of stored or match bytes to copy */ |
255 | unsigned char FAR *from; /* where to copy match bytes from */ | 255 | unsigned char FAR *from; /* where to copy match bytes from */ |
256 | code this; /* current decoding table entry */ | 256 | code here; /* current decoding table entry */ |
257 | code last; /* parent table entry */ | 257 | code last; /* parent table entry */ |
258 | unsigned len; /* length to copy for repeats, bits to drop */ | 258 | unsigned len; /* length to copy for repeats, bits to drop */ |
259 | int ret; /* return code */ | 259 | int ret; /* return code */ |
@@ -389,19 +389,19 @@ void FAR *out_desc; | |||
389 | state->have = 0; | 389 | state->have = 0; |
390 | while (state->have < state->nlen + state->ndist) { | 390 | while (state->have < state->nlen + state->ndist) { |
391 | for (;;) { | 391 | for (;;) { |
392 | this = state->lencode[BITS(state->lenbits)]; | 392 | here = state->lencode[BITS(state->lenbits)]; |
393 | if ((unsigned)(this.bits) <= bits) break; | 393 | if ((unsigned)(here.bits) <= bits) break; |
394 | PULLBYTE(); | 394 | PULLBYTE(); |
395 | } | 395 | } |
396 | if (this.val < 16) { | 396 | if (here.val < 16) { |
397 | NEEDBITS(this.bits); | 397 | NEEDBITS(here.bits); |
398 | DROPBITS(this.bits); | 398 | DROPBITS(here.bits); |
399 | state->lens[state->have++] = this.val; | 399 | state->lens[state->have++] = here.val; |
400 | } | 400 | } |
401 | else { | 401 | else { |
402 | if (this.val == 16) { | 402 | if (here.val == 16) { |
403 | NEEDBITS(this.bits + 2); | 403 | NEEDBITS(here.bits + 2); |
404 | DROPBITS(this.bits); | 404 | DROPBITS(here.bits); |
405 | if (state->have == 0) { | 405 | if (state->have == 0) { |
406 | strm->msg = (char *)"invalid bit length repeat"; | 406 | strm->msg = (char *)"invalid bit length repeat"; |
407 | state->mode = BAD; | 407 | state->mode = BAD; |
@@ -411,16 +411,16 @@ void FAR *out_desc; | |||
411 | copy = 3 + BITS(2); | 411 | copy = 3 + BITS(2); |
412 | DROPBITS(2); | 412 | DROPBITS(2); |
413 | } | 413 | } |
414 | else if (this.val == 17) { | 414 | else if (here.val == 17) { |
415 | NEEDBITS(this.bits + 3); | 415 | NEEDBITS(here.bits + 3); |
416 | DROPBITS(this.bits); | 416 | DROPBITS(here.bits); |
417 | len = 0; | 417 | len = 0; |
418 | copy = 3 + BITS(3); | 418 | copy = 3 + BITS(3); |
419 | DROPBITS(3); | 419 | DROPBITS(3); |
420 | } | 420 | } |
421 | else { | 421 | else { |
422 | NEEDBITS(this.bits + 7); | 422 | NEEDBITS(here.bits + 7); |
423 | DROPBITS(this.bits); | 423 | DROPBITS(here.bits); |
424 | len = 0; | 424 | len = 0; |
425 | copy = 11 + BITS(7); | 425 | copy = 11 + BITS(7); |
426 | DROPBITS(7); | 426 | DROPBITS(7); |
@@ -474,28 +474,28 @@ void FAR *out_desc; | |||
474 | 474 | ||
475 | /* get a literal, length, or end-of-block code */ | 475 | /* get a literal, length, or end-of-block code */ |
476 | for (;;) { | 476 | for (;;) { |
477 | this = state->lencode[BITS(state->lenbits)]; | 477 | here = state->lencode[BITS(state->lenbits)]; |
478 | if ((unsigned)(this.bits) <= bits) break; | 478 | if ((unsigned)(here.bits) <= bits) break; |
479 | PULLBYTE(); | 479 | PULLBYTE(); |
480 | } | 480 | } |
481 | if (this.op && (this.op & 0xf0) == 0) { | 481 | if (here.op && (here.op & 0xf0) == 0) { |
482 | last = this; | 482 | last = here; |
483 | for (;;) { | 483 | for (;;) { |
484 | this = state->lencode[last.val + | 484 | here = state->lencode[last.val + |
485 | (BITS(last.bits + last.op) >> last.bits)]; | 485 | (BITS(last.bits + last.op) >> last.bits)]; |
486 | if ((unsigned)(last.bits + this.bits) <= bits) break; | 486 | if ((unsigned)(last.bits + here.bits) <= bits) break; |
487 | PULLBYTE(); | 487 | PULLBYTE(); |
488 | } | 488 | } |
489 | DROPBITS(last.bits); | 489 | DROPBITS(last.bits); |
490 | } | 490 | } |
491 | DROPBITS(this.bits); | 491 | DROPBITS(here.bits); |
492 | state->length = (unsigned)this.val; | 492 | state->length = (unsigned)here.val; |
493 | 493 | ||
494 | /* process literal */ | 494 | /* process literal */ |
495 | if (this.op == 0) { | 495 | if (here.op == 0) { |
496 | Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? | 496 | Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? |
497 | "inflate: literal '%c'\n" : | 497 | "inflate: literal '%c'\n" : |
498 | "inflate: literal 0x%02x\n", this.val)); | 498 | "inflate: literal 0x%02x\n", here.val)); |
499 | ROOM(); | 499 | ROOM(); |
500 | *put++ = (unsigned char)(state->length); | 500 | *put++ = (unsigned char)(state->length); |
501 | left--; | 501 | left--; |
@@ -504,21 +504,21 @@ void FAR *out_desc; | |||
504 | } | 504 | } |
505 | 505 | ||
506 | /* process end of block */ | 506 | /* process end of block */ |
507 | if (this.op & 32) { | 507 | if (here.op & 32) { |
508 | Tracevv((stderr, "inflate: end of block\n")); | 508 | Tracevv((stderr, "inflate: end of block\n")); |
509 | state->mode = TYPE; | 509 | state->mode = TYPE; |
510 | break; | 510 | break; |
511 | } | 511 | } |
512 | 512 | ||
513 | /* invalid code */ | 513 | /* invalid code */ |
514 | if (this.op & 64) { | 514 | if (here.op & 64) { |
515 | strm->msg = (char *)"invalid literal/length code"; | 515 | strm->msg = (char *)"invalid literal/length code"; |
516 | state->mode = BAD; | 516 | state->mode = BAD; |
517 | break; | 517 | break; |
518 | } | 518 | } |
519 | 519 | ||
520 | /* length code -- get extra bits, if any */ | 520 | /* length code -- get extra bits, if any */ |
521 | state->extra = (unsigned)(this.op) & 15; | 521 | state->extra = (unsigned)(here.op) & 15; |
522 | if (state->extra != 0) { | 522 | if (state->extra != 0) { |
523 | NEEDBITS(state->extra); | 523 | NEEDBITS(state->extra); |
524 | state->length += BITS(state->extra); | 524 | state->length += BITS(state->extra); |
@@ -528,30 +528,30 @@ void FAR *out_desc; | |||
528 | 528 | ||
529 | /* get distance code */ | 529 | /* get distance code */ |
530 | for (;;) { | 530 | for (;;) { |
531 | this = state->distcode[BITS(state->distbits)]; | 531 | here = state->distcode[BITS(state->distbits)]; |
532 | if ((unsigned)(this.bits) <= bits) break; | 532 | if ((unsigned)(here.bits) <= bits) break; |
533 | PULLBYTE(); | 533 | PULLBYTE(); |
534 | } | 534 | } |
535 | if ((this.op & 0xf0) == 0) { | 535 | if ((here.op & 0xf0) == 0) { |
536 | last = this; | 536 | last = here; |
537 | for (;;) { | 537 | for (;;) { |
538 | this = state->distcode[last.val + | 538 | here = state->distcode[last.val + |
539 | (BITS(last.bits + last.op) >> last.bits)]; | 539 | (BITS(last.bits + last.op) >> last.bits)]; |
540 | if ((unsigned)(last.bits + this.bits) <= bits) break; | 540 | if ((unsigned)(last.bits + here.bits) <= bits) break; |
541 | PULLBYTE(); | 541 | PULLBYTE(); |
542 | } | 542 | } |
543 | DROPBITS(last.bits); | 543 | DROPBITS(last.bits); |
544 | } | 544 | } |
545 | DROPBITS(this.bits); | 545 | DROPBITS(here.bits); |
546 | if (this.op & 64) { | 546 | if (here.op & 64) { |
547 | strm->msg = (char *)"invalid distance code"; | 547 | strm->msg = (char *)"invalid distance code"; |
548 | state->mode = BAD; | 548 | state->mode = BAD; |
549 | break; | 549 | break; |
550 | } | 550 | } |
551 | state->offset = (unsigned)this.val; | 551 | state->offset = (unsigned)here.val; |
552 | 552 | ||
553 | /* get distance extra bits, if any */ | 553 | /* get distance extra bits, if any */ |
554 | state->extra = (unsigned)(this.op) & 15; | 554 | state->extra = (unsigned)(here.op) & 15; |
555 | if (state->extra != 0) { | 555 | if (state->extra != 0) { |
556 | NEEDBITS(state->extra); | 556 | NEEDBITS(state->extra); |
557 | state->offset += BITS(state->extra); | 557 | state->offset += BITS(state->extra); |
@@ -1,5 +1,5 @@ | |||
1 | /* inffast.c -- fast decoding | 1 | /* inffast.c -- fast decoding |
2 | * Copyright (C) 1995-2004 Mark Adler | 2 | * Copyright (C) 1995-2006 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -87,7 +87,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ | |||
87 | code const FAR *dcode; /* local strm->distcode */ | 87 | code const FAR *dcode; /* local strm->distcode */ |
88 | unsigned lmask; /* mask for first level of length codes */ | 88 | unsigned lmask; /* mask for first level of length codes */ |
89 | unsigned dmask; /* mask for first level of distance codes */ | 89 | unsigned dmask; /* mask for first level of distance codes */ |
90 | code this; /* retrieved table entry */ | 90 | code here; /* retrieved table entry */ |
91 | unsigned op; /* code bits, operation, extra bits, or */ | 91 | unsigned op; /* code bits, operation, extra bits, or */ |
92 | /* window position, window bytes to copy */ | 92 | /* window position, window bytes to copy */ |
93 | unsigned len; /* match length, unused bytes */ | 93 | unsigned len; /* match length, unused bytes */ |
@@ -124,20 +124,20 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ | |||
124 | hold += (unsigned long)(PUP(in)) << bits; | 124 | hold += (unsigned long)(PUP(in)) << bits; |
125 | bits += 8; | 125 | bits += 8; |
126 | } | 126 | } |
127 | this = lcode[hold & lmask]; | 127 | here = lcode[hold & lmask]; |
128 | dolen: | 128 | dolen: |
129 | op = (unsigned)(this.bits); | 129 | op = (unsigned)(here.bits); |
130 | hold >>= op; | 130 | hold >>= op; |
131 | bits -= op; | 131 | bits -= op; |
132 | op = (unsigned)(this.op); | 132 | op = (unsigned)(here.op); |
133 | if (op == 0) { /* literal */ | 133 | if (op == 0) { /* literal */ |
134 | Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? | 134 | Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? |
135 | "inflate: literal '%c'\n" : | 135 | "inflate: literal '%c'\n" : |
136 | "inflate: literal 0x%02x\n", this.val)); | 136 | "inflate: literal 0x%02x\n", here.val)); |
137 | PUP(out) = (unsigned char)(this.val); | 137 | PUP(out) = (unsigned char)(here.val); |
138 | } | 138 | } |
139 | else if (op & 16) { /* length base */ | 139 | else if (op & 16) { /* length base */ |
140 | len = (unsigned)(this.val); | 140 | len = (unsigned)(here.val); |
141 | op &= 15; /* number of extra bits */ | 141 | op &= 15; /* number of extra bits */ |
142 | if (op) { | 142 | if (op) { |
143 | if (bits < op) { | 143 | if (bits < op) { |
@@ -155,14 +155,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ | |||
155 | hold += (unsigned long)(PUP(in)) << bits; | 155 | hold += (unsigned long)(PUP(in)) << bits; |
156 | bits += 8; | 156 | bits += 8; |
157 | } | 157 | } |
158 | this = dcode[hold & dmask]; | 158 | here = dcode[hold & dmask]; |
159 | dodist: | 159 | dodist: |
160 | op = (unsigned)(this.bits); | 160 | op = (unsigned)(here.bits); |
161 | hold >>= op; | 161 | hold >>= op; |
162 | bits -= op; | 162 | bits -= op; |
163 | op = (unsigned)(this.op); | 163 | op = (unsigned)(here.op); |
164 | if (op & 16) { /* distance base */ | 164 | if (op & 16) { /* distance base */ |
165 | dist = (unsigned)(this.val); | 165 | dist = (unsigned)(here.val); |
166 | op &= 15; /* number of extra bits */ | 166 | op &= 15; /* number of extra bits */ |
167 | if (bits < op) { | 167 | if (bits < op) { |
168 | hold += (unsigned long)(PUP(in)) << bits; | 168 | hold += (unsigned long)(PUP(in)) << bits; |
@@ -187,9 +187,30 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ | |||
187 | if (dist > op) { /* see if copy from window */ | 187 | if (dist > op) { /* see if copy from window */ |
188 | op = dist - op; /* distance back in window */ | 188 | op = dist - op; /* distance back in window */ |
189 | if (op > whave) { | 189 | if (op > whave) { |
190 | strm->msg = (char *)"invalid distance too far back"; | 190 | if (state->sane) { |
191 | state->mode = BAD; | 191 | strm->msg = (char *)"invalid distance too far back"; |
192 | break; | 192 | state->mode = BAD; |
193 | break; | ||
194 | } | ||
195 | #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR | ||
196 | if (len <= op - whave) { | ||
197 | do { | ||
198 | PUP(out) = 0; | ||
199 | } while (--len); | ||
200 | continue; | ||
201 | } | ||
202 | len -= op - whave; | ||
203 | do { | ||
204 | PUP(out) = 0; | ||
205 | } while (--op > whave); | ||
206 | if (op == 0) { | ||
207 | from = out - dist; | ||
208 | do { | ||
209 | PUP(out) = PUP(from); | ||
210 | } while (--len); | ||
211 | continue; | ||
212 | } | ||
213 | #endif | ||
193 | } | 214 | } |
194 | from = window - OFF; | 215 | from = window - OFF; |
195 | if (write == 0) { /* very common case */ | 216 | if (write == 0) { /* very common case */ |
@@ -259,7 +280,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ | |||
259 | } | 280 | } |
260 | } | 281 | } |
261 | else if ((op & 64) == 0) { /* 2nd level distance code */ | 282 | else if ((op & 64) == 0) { /* 2nd level distance code */ |
262 | this = dcode[this.val + (hold & ((1U << op) - 1))]; | 283 | here = dcode[here.val + (hold & ((1U << op) - 1))]; |
263 | goto dodist; | 284 | goto dodist; |
264 | } | 285 | } |
265 | else { | 286 | else { |
@@ -269,7 +290,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */ | |||
269 | } | 290 | } |
270 | } | 291 | } |
271 | else if ((op & 64) == 0) { /* 2nd level length code */ | 292 | else if ((op & 64) == 0) { /* 2nd level length code */ |
272 | this = lcode[this.val + (hold & ((1U << op) - 1))]; | 293 | here = lcode[here.val + (hold & ((1U << op) - 1))]; |
273 | goto dolen; | 294 | goto dolen; |
274 | } | 295 | } |
275 | else if (op & 32) { /* end-of-block */ | 296 | else if (op & 32) { /* end-of-block */ |
@@ -1,5 +1,5 @@ | |||
1 | /* inflate.c -- zlib decompression | 1 | /* inflate.c -- zlib decompression |
2 | * Copyright (C) 1995-2005 Mark Adler | 2 | * Copyright (C) 1995-2006 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -121,6 +121,7 @@ z_streamp strm; | |||
121 | state->hold = 0; | 121 | state->hold = 0; |
122 | state->bits = 0; | 122 | state->bits = 0; |
123 | state->lencode = state->distcode = state->next = state->codes; | 123 | state->lencode = state->distcode = state->next = state->codes; |
124 | state->sane = 1; | ||
124 | Tracev((stderr, "inflate: reset\n")); | 125 | Tracev((stderr, "inflate: reset\n")); |
125 | return Z_OK; | 126 | return Z_OK; |
126 | } | 127 | } |
@@ -564,7 +565,7 @@ int flush; | |||
564 | unsigned in, out; /* save starting available input and output */ | 565 | unsigned in, out; /* save starting available input and output */ |
565 | unsigned copy; /* number of stored or match bytes to copy */ | 566 | unsigned copy; /* number of stored or match bytes to copy */ |
566 | unsigned char FAR *from; /* where to copy match bytes from */ | 567 | unsigned char FAR *from; /* where to copy match bytes from */ |
567 | code this; /* current decoding table entry */ | 568 | code here; /* current decoding table entry */ |
568 | code last; /* parent table entry */ | 569 | code last; /* parent table entry */ |
569 | unsigned len; /* length to copy for repeats, bits to drop */ | 570 | unsigned len; /* length to copy for repeats, bits to drop */ |
570 | int ret; /* return code */ | 571 | int ret; /* return code */ |
@@ -876,19 +877,19 @@ int flush; | |||
876 | case CODELENS: | 877 | case CODELENS: |
877 | while (state->have < state->nlen + state->ndist) { | 878 | while (state->have < state->nlen + state->ndist) { |
878 | for (;;) { | 879 | for (;;) { |
879 | this = state->lencode[BITS(state->lenbits)]; | 880 | here = state->lencode[BITS(state->lenbits)]; |
880 | if ((unsigned)(this.bits) <= bits) break; | 881 | if ((unsigned)(here.bits) <= bits) break; |
881 | PULLBYTE(); | 882 | PULLBYTE(); |
882 | } | 883 | } |
883 | if (this.val < 16) { | 884 | if (here.val < 16) { |
884 | NEEDBITS(this.bits); | 885 | NEEDBITS(here.bits); |
885 | DROPBITS(this.bits); | 886 | DROPBITS(here.bits); |
886 | state->lens[state->have++] = this.val; | 887 | state->lens[state->have++] = here.val; |
887 | } | 888 | } |
888 | else { | 889 | else { |
889 | if (this.val == 16) { | 890 | if (here.val == 16) { |
890 | NEEDBITS(this.bits + 2); | 891 | NEEDBITS(here.bits + 2); |
891 | DROPBITS(this.bits); | 892 | DROPBITS(here.bits); |
892 | if (state->have == 0) { | 893 | if (state->have == 0) { |
893 | strm->msg = (char *)"invalid bit length repeat"; | 894 | strm->msg = (char *)"invalid bit length repeat"; |
894 | state->mode = BAD; | 895 | state->mode = BAD; |
@@ -898,16 +899,16 @@ int flush; | |||
898 | copy = 3 + BITS(2); | 899 | copy = 3 + BITS(2); |
899 | DROPBITS(2); | 900 | DROPBITS(2); |
900 | } | 901 | } |
901 | else if (this.val == 17) { | 902 | else if (here.val == 17) { |
902 | NEEDBITS(this.bits + 3); | 903 | NEEDBITS(here.bits + 3); |
903 | DROPBITS(this.bits); | 904 | DROPBITS(here.bits); |
904 | len = 0; | 905 | len = 0; |
905 | copy = 3 + BITS(3); | 906 | copy = 3 + BITS(3); |
906 | DROPBITS(3); | 907 | DROPBITS(3); |
907 | } | 908 | } |
908 | else { | 909 | else { |
909 | NEEDBITS(this.bits + 7); | 910 | NEEDBITS(here.bits + 7); |
910 | DROPBITS(this.bits); | 911 | DROPBITS(here.bits); |
911 | len = 0; | 912 | len = 0; |
912 | copy = 11 + BITS(7); | 913 | copy = 11 + BITS(7); |
913 | DROPBITS(7); | 914 | DROPBITS(7); |
@@ -955,40 +956,40 @@ int flush; | |||
955 | break; | 956 | break; |
956 | } | 957 | } |
957 | for (;;) { | 958 | for (;;) { |
958 | this = state->lencode[BITS(state->lenbits)]; | 959 | here = state->lencode[BITS(state->lenbits)]; |
959 | if ((unsigned)(this.bits) <= bits) break; | 960 | if ((unsigned)(here.bits) <= bits) break; |
960 | PULLBYTE(); | 961 | PULLBYTE(); |
961 | } | 962 | } |
962 | if (this.op && (this.op & 0xf0) == 0) { | 963 | if (here.op && (here.op & 0xf0) == 0) { |
963 | last = this; | 964 | last = here; |
964 | for (;;) { | 965 | for (;;) { |
965 | this = state->lencode[last.val + | 966 | here = state->lencode[last.val + |
966 | (BITS(last.bits + last.op) >> last.bits)]; | 967 | (BITS(last.bits + last.op) >> last.bits)]; |
967 | if ((unsigned)(last.bits + this.bits) <= bits) break; | 968 | if ((unsigned)(last.bits + here.bits) <= bits) break; |
968 | PULLBYTE(); | 969 | PULLBYTE(); |
969 | } | 970 | } |
970 | DROPBITS(last.bits); | 971 | DROPBITS(last.bits); |
971 | } | 972 | } |
972 | DROPBITS(this.bits); | 973 | DROPBITS(here.bits); |
973 | state->length = (unsigned)this.val; | 974 | state->length = (unsigned)here.val; |
974 | if ((int)(this.op) == 0) { | 975 | if ((int)(here.op) == 0) { |
975 | Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? | 976 | Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? |
976 | "inflate: literal '%c'\n" : | 977 | "inflate: literal '%c'\n" : |
977 | "inflate: literal 0x%02x\n", this.val)); | 978 | "inflate: literal 0x%02x\n", here.val)); |
978 | state->mode = LIT; | 979 | state->mode = LIT; |
979 | break; | 980 | break; |
980 | } | 981 | } |
981 | if (this.op & 32) { | 982 | if (here.op & 32) { |
982 | Tracevv((stderr, "inflate: end of block\n")); | 983 | Tracevv((stderr, "inflate: end of block\n")); |
983 | state->mode = TYPE; | 984 | state->mode = TYPE; |
984 | break; | 985 | break; |
985 | } | 986 | } |
986 | if (this.op & 64) { | 987 | if (here.op & 64) { |
987 | strm->msg = (char *)"invalid literal/length code"; | 988 | strm->msg = (char *)"invalid literal/length code"; |
988 | state->mode = BAD; | 989 | state->mode = BAD; |
989 | break; | 990 | break; |
990 | } | 991 | } |
991 | state->extra = (unsigned)(this.op) & 15; | 992 | state->extra = (unsigned)(here.op) & 15; |
992 | state->mode = LENEXT; | 993 | state->mode = LENEXT; |
993 | case LENEXT: | 994 | case LENEXT: |
994 | if (state->extra) { | 995 | if (state->extra) { |
@@ -1000,28 +1001,28 @@ int flush; | |||
1000 | state->mode = DIST; | 1001 | state->mode = DIST; |
1001 | case DIST: | 1002 | case DIST: |
1002 | for (;;) { | 1003 | for (;;) { |
1003 | this = state->distcode[BITS(state->distbits)]; | 1004 | here = state->distcode[BITS(state->distbits)]; |
1004 | if ((unsigned)(this.bits) <= bits) break; | 1005 | if ((unsigned)(here.bits) <= bits) break; |
1005 | PULLBYTE(); | 1006 | PULLBYTE(); |
1006 | } | 1007 | } |
1007 | if ((this.op & 0xf0) == 0) { | 1008 | if ((here.op & 0xf0) == 0) { |
1008 | last = this; | 1009 | last = here; |
1009 | for (;;) { | 1010 | for (;;) { |
1010 | this = state->distcode[last.val + | 1011 | here = state->distcode[last.val + |
1011 | (BITS(last.bits + last.op) >> last.bits)]; | 1012 | (BITS(last.bits + last.op) >> last.bits)]; |
1012 | if ((unsigned)(last.bits + this.bits) <= bits) break; | 1013 | if ((unsigned)(last.bits + here.bits) <= bits) break; |
1013 | PULLBYTE(); | 1014 | PULLBYTE(); |
1014 | } | 1015 | } |
1015 | DROPBITS(last.bits); | 1016 | DROPBITS(last.bits); |
1016 | } | 1017 | } |
1017 | DROPBITS(this.bits); | 1018 | DROPBITS(here.bits); |
1018 | if (this.op & 64) { | 1019 | if (here.op & 64) { |
1019 | strm->msg = (char *)"invalid distance code"; | 1020 | strm->msg = (char *)"invalid distance code"; |
1020 | state->mode = BAD; | 1021 | state->mode = BAD; |
1021 | break; | 1022 | break; |
1022 | } | 1023 | } |
1023 | state->offset = (unsigned)this.val; | 1024 | state->offset = (unsigned)here.val; |
1024 | state->extra = (unsigned)(this.op) & 15; | 1025 | state->extra = (unsigned)(here.op) & 15; |
1025 | state->mode = DISTEXT; | 1026 | state->mode = DISTEXT; |
1026 | case DISTEXT: | 1027 | case DISTEXT: |
1027 | if (state->extra) { | 1028 | if (state->extra) { |
@@ -1036,11 +1037,6 @@ int flush; | |||
1036 | break; | 1037 | break; |
1037 | } | 1038 | } |
1038 | #endif | 1039 | #endif |
1039 | if (state->offset > state->whave + out - left) { | ||
1040 | strm->msg = (char *)"invalid distance too far back"; | ||
1041 | state->mode = BAD; | ||
1042 | break; | ||
1043 | } | ||
1044 | Tracevv((stderr, "inflate: distance %u\n", state->offset)); | 1040 | Tracevv((stderr, "inflate: distance %u\n", state->offset)); |
1045 | state->mode = MATCH; | 1041 | state->mode = MATCH; |
1046 | case MATCH: | 1042 | case MATCH: |
@@ -1048,6 +1044,26 @@ int flush; | |||
1048 | copy = out - left; | 1044 | copy = out - left; |
1049 | if (state->offset > copy) { /* copy from window */ | 1045 | if (state->offset > copy) { /* copy from window */ |
1050 | copy = state->offset - copy; | 1046 | copy = state->offset - copy; |
1047 | if (copy > state->whave) { | ||
1048 | if (state->sane) { | ||
1049 | strm->msg = (char *)"invalid distance too far back"; | ||
1050 | state->mode = BAD; | ||
1051 | break; | ||
1052 | } | ||
1053 | #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR | ||
1054 | Trace((stderr, "inflate.c too far\n")); | ||
1055 | copy -= state->whave; | ||
1056 | if (copy > state->length) copy = state->length; | ||
1057 | if (copy > left) copy = left; | ||
1058 | left -= copy; | ||
1059 | state->length -= copy; | ||
1060 | do { | ||
1061 | *put++ = 0; | ||
1062 | } while (--copy); | ||
1063 | if (state->length == 0) state->mode = LEN; | ||
1064 | break; | ||
1065 | #endif | ||
1066 | } | ||
1051 | if (copy > state->write) { | 1067 | if (copy > state->write) { |
1052 | copy -= state->write; | 1068 | copy -= state->write; |
1053 | from = state->window + (state->wsize - copy); | 1069 | from = state->window + (state->wsize - copy); |
@@ -1366,3 +1382,20 @@ z_streamp source; | |||
1366 | dest->state = (struct internal_state FAR *)copy; | 1382 | dest->state = (struct internal_state FAR *)copy; |
1367 | return Z_OK; | 1383 | return Z_OK; |
1368 | } | 1384 | } |
1385 | |||
1386 | int ZEXPORT inflateUndermine(strm, subvert) | ||
1387 | z_streamp strm; | ||
1388 | int subvert; | ||
1389 | { | ||
1390 | struct inflate_state FAR *state; | ||
1391 | |||
1392 | if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | ||
1393 | state = (struct inflate_state FAR *)strm->state; | ||
1394 | #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR | ||
1395 | state->sane = !subvert; | ||
1396 | return Z_OK; | ||
1397 | #else | ||
1398 | state->sane = 1; | ||
1399 | return Z_DATA_ERROR; | ||
1400 | #endif | ||
1401 | } | ||
@@ -112,4 +112,5 @@ struct inflate_state { | |||
112 | unsigned short lens[320]; /* temporary storage for code lengths */ | 112 | unsigned short lens[320]; /* temporary storage for code lengths */ |
113 | unsigned short work[288]; /* work area for code table building */ | 113 | unsigned short work[288]; /* work area for code table building */ |
114 | code codes[ENOUGH]; /* space for code tables */ | 114 | code codes[ENOUGH]; /* space for code tables */ |
115 | int sane; /* if false, allow invalid distance too far */ | ||
115 | }; | 116 | }; |
@@ -9,7 +9,7 @@ | |||
9 | #define MAXBITS 15 | 9 | #define MAXBITS 15 |
10 | 10 | ||
11 | const char inflate_copyright[] = | 11 | const char inflate_copyright[] = |
12 | " inflate 1.2.3.2 Copyright 1995-2006 Mark Adler "; | 12 | " inflate 1.2.3.3 Copyright 1995-2006 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 |
@@ -50,7 +50,7 @@ unsigned short FAR *work; | |||
50 | unsigned fill; /* index for replicating entries */ | 50 | unsigned fill; /* index for replicating entries */ |
51 | unsigned low; /* low bits for current root entry */ | 51 | unsigned low; /* low bits for current root entry */ |
52 | unsigned mask; /* mask for low root bits */ | 52 | unsigned mask; /* mask for low root bits */ |
53 | code this; /* table entry for duplication */ | 53 | code here; /* table entry for duplication */ |
54 | code FAR *next; /* next available space in table */ | 54 | code FAR *next; /* next available space in table */ |
55 | const unsigned short FAR *base; /* base value table to use */ | 55 | const unsigned short FAR *base; /* base value table to use */ |
56 | const unsigned short FAR *extra; /* extra bits table to use */ | 56 | const unsigned short FAR *extra; /* extra bits table to use */ |
@@ -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, 192, 204}; | 65 | 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 203}; |
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, |
@@ -115,11 +115,11 @@ unsigned short FAR *work; | |||
115 | if (count[max] != 0) break; | 115 | if (count[max] != 0) break; |
116 | if (root > max) root = max; | 116 | if (root > max) root = max; |
117 | if (max == 0) { /* no symbols to code at all */ | 117 | if (max == 0) { /* no symbols to code at all */ |
118 | this.op = (unsigned char)64; /* invalid code marker */ | 118 | here.op = (unsigned char)64; /* invalid code marker */ |
119 | this.bits = (unsigned char)1; | 119 | here.bits = (unsigned char)1; |
120 | this.val = (unsigned short)0; | 120 | here.val = (unsigned short)0; |
121 | *(*table)++ = this; /* make a table to force an error */ | 121 | *(*table)++ = here; /* make a table to force an error */ |
122 | *(*table)++ = this; | 122 | *(*table)++ = here; |
123 | *bits = 1; | 123 | *bits = 1; |
124 | return 0; /* no symbols, but wait for decoding to report error */ | 124 | return 0; /* no symbols, but wait for decoding to report error */ |
125 | } | 125 | } |
@@ -215,18 +215,18 @@ unsigned short FAR *work; | |||
215 | /* process all codes and make table entries */ | 215 | /* process all codes and make table entries */ |
216 | for (;;) { | 216 | for (;;) { |
217 | /* create table entry */ | 217 | /* create table entry */ |
218 | this.bits = (unsigned char)(len - drop); | 218 | here.bits = (unsigned char)(len - drop); |
219 | if ((int)(work[sym]) < end) { | 219 | if ((int)(work[sym]) < end) { |
220 | this.op = (unsigned char)0; | 220 | here.op = (unsigned char)0; |
221 | this.val = work[sym]; | 221 | here.val = work[sym]; |
222 | } | 222 | } |
223 | else if ((int)(work[sym]) > end) { | 223 | else if ((int)(work[sym]) > end) { |
224 | this.op = (unsigned char)(extra[work[sym]]); | 224 | here.op = (unsigned char)(extra[work[sym]]); |
225 | this.val = base[work[sym]]; | 225 | here.val = base[work[sym]]; |
226 | } | 226 | } |
227 | else { | 227 | else { |
228 | this.op = (unsigned char)(32 + 64); /* end of block */ | 228 | here.op = (unsigned char)(32 + 64); /* end of block */ |
229 | this.val = 0; | 229 | here.val = 0; |
230 | } | 230 | } |
231 | 231 | ||
232 | /* replicate for those indices with low len bits equal to huff */ | 232 | /* replicate for those indices with low len bits equal to huff */ |
@@ -235,7 +235,7 @@ unsigned short FAR *work; | |||
235 | min = fill; /* save offset to next table */ | 235 | min = fill; /* save offset to next table */ |
236 | do { | 236 | do { |
237 | fill -= incr; | 237 | fill -= incr; |
238 | next[(huff >> drop) + fill] = this; | 238 | next[(huff >> drop) + fill] = here; |
239 | } while (fill != 0); | 239 | } while (fill != 0); |
240 | 240 | ||
241 | /* backwards increment the len-bit code huff */ | 241 | /* backwards increment the len-bit code huff */ |
@@ -295,20 +295,20 @@ unsigned short FAR *work; | |||
295 | through high index bits. When the current sub-table is filled, the loop | 295 | through high index bits. When the current sub-table is filled, the loop |
296 | drops back to the root table to fill in any remaining entries there. | 296 | drops back to the root table to fill in any remaining entries there. |
297 | */ | 297 | */ |
298 | this.op = (unsigned char)64; /* invalid code marker */ | 298 | here.op = (unsigned char)64; /* invalid code marker */ |
299 | this.bits = (unsigned char)(len - drop); | 299 | here.bits = (unsigned char)(len - drop); |
300 | this.val = (unsigned short)0; | 300 | here.val = (unsigned short)0; |
301 | while (huff != 0) { | 301 | while (huff != 0) { |
302 | /* when done with sub-table, drop back to root table */ | 302 | /* when done with sub-table, drop back to root table */ |
303 | if (drop != 0 && (huff & mask) != low) { | 303 | if (drop != 0 && (huff & mask) != low) { |
304 | drop = 0; | 304 | drop = 0; |
305 | len = root; | 305 | len = root; |
306 | next = *table; | 306 | next = *table; |
307 | this.bits = (unsigned char)len; | 307 | here.bits = (unsigned char)len; |
308 | } | 308 | } |
309 | 309 | ||
310 | /* put invalid code marker in table */ | 310 | /* put invalid code marker in table */ |
311 | next[huff >> drop] = this; | 311 | next[huff >> drop] = here; |
312 | 312 | ||
313 | /* backwards increment the len-bit code huff */ | 313 | /* backwards increment the len-bit code huff */ |
314 | incr = 1U << (len - 1); | 314 | incr = 1U << (len - 1); |
diff --git a/qnx/package.qpg b/qnx/package.qpg index b7e8bf7..be5d5c1 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.3.2" install="/opt/lib/" user="root:bin" permission="644"/> | 28 | <QPG:Add file="../libz.so.1.2.3.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.3.2"/> | 29 | <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.3.3"/> |
30 | <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.3.2"/> | 30 | <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.3.3"/> |
31 | <QPG:Add file="../libz.so.1.2.3.2" install="/opt/lib/" component="slib"/> | 31 | <QPG:Add file="../libz.so.1.2.3.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.3.2</QPM:ReleaseVersion> | 66 | <QPM:ReleaseVersion>1.2.3.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> |
@@ -1,4 +1,4 @@ | |||
1 | .TH ZLIB 3 "xx August 2006" | 1 | .TH ZLIB 3 "2 October 2006" |
2 | .SH NAME | 2 | .SH NAME |
3 | zlib \- compression/decompression library | 3 | zlib \- compression/decompression library |
4 | .SH SYNOPSIS | 4 | .SH SYNOPSIS |
@@ -133,8 +133,8 @@ before asking for help. | |||
133 | Send questions and/or comments to zlib@gzip.org, | 133 | Send questions and/or comments to zlib@gzip.org, |
134 | or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). | 134 | or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). |
135 | .SH AUTHORS | 135 | .SH AUTHORS |
136 | Version 1.2.3.2 | 136 | Version 1.2.3.3 |
137 | Copyright (C) 1995-2005 Jean-loup Gailly (jloup@gzip.org) | 137 | Copyright (C) 1995-2006 Jean-loup Gailly (jloup@gzip.org) |
138 | and Mark Adler (madler@alumni.caltech.edu). | 138 | and Mark Adler (madler@alumni.caltech.edu). |
139 | .LP | 139 | .LP |
140 | This software is provided "as-is," | 140 | This software is provided "as-is," |
@@ -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.3.2, September 3rd, 2006 | 2 | version 1.2.3.3, October 2nd, 2006 |
3 | 3 | ||
4 | Copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler | 4 | Copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler |
5 | 5 | ||
@@ -37,8 +37,8 @@ | |||
37 | extern "C" { | 37 | extern "C" { |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #define ZLIB_VERSION "1.2.3.2" | 40 | #define ZLIB_VERSION "1.2.3.3" |
41 | #define ZLIB_VERNUM 0x1232 | 41 | #define ZLIB_VERNUM 0x1233 |
42 | #define ZLIB_VER_MAJOR 1 | 42 | #define ZLIB_VER_MAJOR 1 |
43 | #define ZLIB_VER_MINOR 2 | 43 | #define ZLIB_VER_MINOR 2 |
44 | #define ZLIB_VER_REVISION 3 | 44 | #define ZLIB_VER_REVISION 3 |
@@ -1077,8 +1077,9 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, | |||
1077 | 1077 | ||
1078 | typedef voidp gzFile; | 1078 | typedef voidp gzFile; |
1079 | 1079 | ||
1080 | ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); | ||
1081 | /* | 1080 | /* |
1081 | ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); | ||
1082 | |||
1082 | Opens a gzip (.gz) file for reading or writing. The mode parameter | 1083 | Opens a gzip (.gz) file for reading or writing. The mode parameter |
1083 | is as in fopen ("rb" or "wb") but can also include a compression level | 1084 | is as in fopen ("rb" or "wb") but can also include a compression level |
1084 | ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for | 1085 | ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for |
@@ -1192,9 +1193,10 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); | |||
1192 | degrade compression. | 1193 | degrade compression. |
1193 | */ | 1194 | */ |
1194 | 1195 | ||
1196 | /* | ||
1195 | ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, | 1197 | ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, |
1196 | z_off_t offset, int whence)); | 1198 | z_off_t offset, int whence)); |
1197 | /* | 1199 | |
1198 | Sets the starting position for the next gzread or gzwrite on the | 1200 | Sets the starting position for the next gzread or gzwrite on the |
1199 | given compressed file. The offset represents a number of bytes in the | 1201 | given compressed file. The offset represents a number of bytes in the |
1200 | uncompressed data stream. The whence parameter is defined as in lseek(2); | 1202 | uncompressed data stream. The whence parameter is defined as in lseek(2); |
@@ -1217,8 +1219,9 @@ ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); | |||
1217 | gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) | 1219 | gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) |
1218 | */ | 1220 | */ |
1219 | 1221 | ||
1220 | ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); | ||
1221 | /* | 1222 | /* |
1223 | ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); | ||
1224 | |||
1222 | Returns the starting position for the next gzread or gzwrite on the | 1225 | Returns the starting position for the next gzread or gzwrite on the |
1223 | given compressed file. This position represents a number of bytes in the | 1226 | given compressed file. This position represents a number of bytes in the |
1224 | uncompressed data stream. | 1227 | uncompressed data stream. |
@@ -1289,9 +1292,10 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); | |||
1289 | if (adler != original_adler) error(); | 1292 | if (adler != original_adler) error(); |
1290 | */ | 1293 | */ |
1291 | 1294 | ||
1295 | /* | ||
1292 | ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, | 1296 | ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, |
1293 | z_off_t len2)); | 1297 | z_off_t len2)); |
1294 | /* | 1298 | |
1295 | Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 | 1299 | Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 |
1296 | and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for | 1300 | and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for |
1297 | each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of | 1301 | each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of |
@@ -1314,9 +1318,9 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); | |||
1314 | if (crc != original_crc) error(); | 1318 | if (crc != original_crc) error(); |
1315 | */ | 1319 | */ |
1316 | 1320 | ||
1321 | /* | ||
1317 | ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); | 1322 | ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); |
1318 | 1323 | ||
1319 | /* | ||
1320 | Combine two CRC-32 check values into one. For two sequences of bytes, | 1324 | Combine two CRC-32 check values into one. For two sequences of bytes, |
1321 | seq1 and seq2 with lengths len1 and len2, CRC-32 check values were | 1325 | seq1 and seq2 with lengths len1 and len2, CRC-32 check values were |
1322 | calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 | 1326 | calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 |
@@ -1357,13 +1361,36 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, | |||
1357 | inflateBackInit_((strm), (windowBits), (window), \ | 1361 | inflateBackInit_((strm), (windowBits), (window), \ |
1358 | ZLIB_VERSION, sizeof(z_stream)) | 1362 | ZLIB_VERSION, sizeof(z_stream)) |
1359 | 1363 | ||
1364 | #ifdef _LARGEFILE64_SOURCE | ||
1365 | ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); | ||
1366 | ZEXTERN off64_t ZEXPORT gzseek64 OF((gzFile, off64_t, int)); | ||
1367 | ZEXTERN off64_t ZEXPORT gztell64 OF((gzFile)); | ||
1368 | ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off64_t)); | ||
1369 | ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off64_t)); | ||
1370 | #endif | ||
1371 | |||
1372 | #if _FILE_OFFSET_BITS == 64 | ||
1373 | # define gzopen gzopen64 | ||
1374 | # define gzseek gzseek64 | ||
1375 | # define gztell gztell64 | ||
1376 | # define adler32_combine adler32_combine64 | ||
1377 | # define crc32_combine crc32_combine64 | ||
1378 | #else | ||
1379 | ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); | ||
1380 | ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); | ||
1381 | ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); | ||
1382 | ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); | ||
1383 | ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); | ||
1384 | #endif | ||
1385 | |||
1360 | #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) | 1386 | #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) |
1361 | struct internal_state {int dummy;}; /* hack for buggy compilers */ | 1387 | struct internal_state {int dummy;}; /* hack for buggy compilers */ |
1362 | #endif | 1388 | #endif |
1363 | 1389 | ||
1364 | ZEXTERN const char * ZEXPORT zError OF((int)); | 1390 | ZEXTERN const char * ZEXPORT zError OF((int)); |
1365 | ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); | 1391 | ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); |
1366 | ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); | 1392 | ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); |
1393 | ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); | ||
1367 | 1394 | ||
1368 | #ifdef __cplusplus | 1395 | #ifdef __cplusplus |
1369 | } | 1396 | } |
@@ -177,6 +177,12 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ | |||
177 | # define F_OPEN(name, mode) fopen((name), (mode)) | 177 | # define F_OPEN(name, mode) fopen((name), (mode)) |
178 | #endif | 178 | #endif |
179 | 179 | ||
180 | #ifdef _LARGEFILE64_SOURCE | ||
181 | # define F_OPEN64(name, mode) fopen64((name), (mode)) | ||
182 | #else | ||
183 | # define F_OPEN64(name, mode) fopen((name), (mode)) | ||
184 | #endif | ||
185 | |||
180 | /* functions */ | 186 | /* functions */ |
181 | 187 | ||
182 | #if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) | 188 | #if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) |