summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:22:48 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:22:48 -0700
commitf81ba93d4a7e43fccf4730e5e7404ee765a76e3e (patch)
tree1f130d999e06b2d572bce1f99eaeaadd329a7ae7
parent4b5a43a219d51066c01ff2ab86af18b967f2d0dd (diff)
downloadzlib-1.2.0.6.tar.gz
zlib-1.2.0.6.tar.bz2
zlib-1.2.0.6.zip
zlib 1.2.0.6v1.2.0.6
-rw-r--r--ChangeLog9
-rw-r--r--FAQ3
-rw-r--r--Makefile4
-rw-r--r--Makefile.in4
-rw-r--r--README4
-rw-r--r--contrib/README.contrib1
-rw-r--r--contrib/infback9/infback9.c605
-rw-r--r--contrib/infback9/infback9.diff427
-rw-r--r--contrib/infback9/infback9.h7
-rw-r--r--contrib/infback9/inffix9.h177
-rw-r--r--contrib/infback9/inflate9.h47
-rw-r--r--contrib/infback9/inftree9.c323
-rw-r--r--contrib/infback9/inftree9.h55
-rw-r--r--contrib/minizip/ChangeLogUnzip4
-rw-r--r--contrib/minizip/crypt.h28
-rw-r--r--contrib/minizip/ioapi.c2
-rw-r--r--contrib/minizip/ioapi.h2
-rw-r--r--contrib/minizip/iowin32.c2
-rw-r--r--contrib/minizip/iowin32.h2
-rw-r--r--contrib/minizip/miniunz.c2
-rw-r--r--contrib/minizip/minizip.c2
-rw-r--r--contrib/minizip/unzip.c4
-rw-r--r--contrib/minizip/unzip.h2
-rw-r--r--contrib/minizip/zip.c6
-rw-r--r--contrib/minizip/zip.h2
-rw-r--r--contrib/puff/puff.c2
-rw-r--r--deflate.c2
-rw-r--r--example.c4
-rw-r--r--gzio.c5
-rw-r--r--inffast.c1
-rw-r--r--inftrees.c4
-rw-r--r--qnx/package.qpg10
-rw-r--r--win32/zlib1.rc8
-rw-r--r--zconf.h7
-rw-r--r--zconf.in.h7
-rw-r--r--zlib.34
-rw-r--r--zlib.h8
37 files changed, 1235 insertions, 551 deletions
diff --git a/ChangeLog b/ChangeLog
index ebf063a..0193989 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,15 @@
1 1
2 ChangeLog file for zlib 2 ChangeLog file for zlib
3 3
4Changes in 1.2.0.6 (13 September 2003)
5- Minor FAQ updates
6- Update contrib/minizip to 1.00 [Vollant]
7- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta]
8- Updated POSTINC comment for 68060 [Nikl]
9- Added contrib/infback9 with deflate64 decoding (unsupported)
10- For MVS define NO_vsnprintf and undefine FAR [van Burik]
11- Add pragma for fdopen on MVS [van Burik]
12
4Changes in 1.2.0.5 (8 September 2003) 13Changes in 1.2.0.5 (8 September 2003)
5- Add infback9 diffs to contrib 14- Add infback9 diffs to contrib
6- Add OF to inflateBackEnd() declaration in zlib.h 15- Add OF to inflateBackEnd() declaration in zlib.h
diff --git a/FAQ b/FAQ
index e82dff1..7115ec3 100644
--- a/FAQ
+++ b/FAQ
@@ -73,8 +73,7 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
73 73
7410. I need a Delphi interface to zlib. 7410. I need a Delphi interface to zlib.
75 75
76 See the directories contrib/delphi and contrib/delphi2 in the zlib 76 See the contrib/delphi directory in the zlib distribution.
77 distribution.
78 77
7911. Can zlib handle .zip archives? 7811. Can zlib handle .zip archives?
80 79
diff --git a/Makefile b/Makefile
index ac69ed9..ccf0a56 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,7 @@ LDFLAGS=libz.a
28LDSHARED=$(CC) 28LDSHARED=$(CC)
29CPP=$(CC) -E 29CPP=$(CC) -E
30 30
31VER=1.2.0.5 31VER=1.2.0.6
32LIBS=libz.a 32LIBS=libz.a
33SHAREDLIB=libz.so 33SHAREDLIB=libz.so
34 34
@@ -137,7 +137,7 @@ uninstall:
137mostlyclean: clean 137mostlyclean: clean
138clean: 138clean:
139 rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \ 139 rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \
140 _match.s maketree 140 _match.s maketree contrib/infback9/*.o
141 141
142maintainer-clean: distclean 142maintainer-clean: distclean
143distclean: clean 143distclean: clean
diff --git a/Makefile.in b/Makefile.in
index ac69ed9..ccf0a56 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -28,7 +28,7 @@ LDFLAGS=libz.a
28LDSHARED=$(CC) 28LDSHARED=$(CC)
29CPP=$(CC) -E 29CPP=$(CC) -E
30 30
31VER=1.2.0.5 31VER=1.2.0.6
32LIBS=libz.a 32LIBS=libz.a
33SHAREDLIB=libz.so 33SHAREDLIB=libz.so
34 34
@@ -137,7 +137,7 @@ uninstall:
137mostlyclean: clean 137mostlyclean: clean
138clean: 138clean:
139 rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \ 139 rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \
140 _match.s maketree 140 _match.s maketree contrib/infback9/*.o
141 141
142maintainer-clean: distclean 142maintainer-clean: distclean
143distclean: clean 143distclean: clean
diff --git a/README b/README
index c95b0d2..db5ce3c 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
1ZLIB DATA COMPRESSION LIBRARY 1ZLIB DATA COMPRESSION LIBRARY
2 2
3zlib 1.2.0.5 is a general purpose data compression library. All the code is 3zlib 1.2.0.6 is a general purpose data compression library. All the code is
4thread safe. The data format used by the zlib library is described by RFCs 4thread safe. The data format used by the zlib library is described by RFCs
5(Request for Comments) 1950 to 1952 in the files 5(Request for Comments) 1950 to 1952 in the files
6http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) 6http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
@@ -34,7 +34,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
34issue of Dr. Dobb's Journal; a copy of the article is available in 34issue of Dr. Dobb's Journal; a copy of the article is available in
35http://dogma.net/markn/articles/zlibtool/zlibtool.htm 35http://dogma.net/markn/articles/zlibtool/zlibtool.htm
36 36
37The changes made in version 1.2.0.5 are documented in the file ChangeLog. 37The changes made in version 1.2.0.6 are documented in the file ChangeLog.
38 38
39Unsupported third party contributions are provided in directory "contrib". 39Unsupported third party contributions are provided in directory "contrib".
40 40
diff --git a/contrib/README.contrib b/contrib/README.contrib
index b1de0d1..96f2c43 100644
--- a/contrib/README.contrib
+++ b/contrib/README.contrib
@@ -20,7 +20,6 @@ delphi/ by Cosmin Truta <cosmint@cs.ubbcluj.ro>
20 20
21infback9/ by Mark Adler <madler@alumni.caltech.edu> 21infback9/ by Mark Adler <madler@alumni.caltech.edu>
22 Unsupported diffs to infback to decode the deflate64 format 22 Unsupported diffs to infback to decode the deflate64 format
23 (Worse than that, it's not even tested)
24 23
25inflate86/ by Chris Anderson <christop@charm.net> 24inflate86/ by Chris Anderson <christop@charm.net>
26 Tuned x86 gcc asm code to replace inflate_fast() 25 Tuned x86 gcc asm code to replace inflate_fast()
diff --git a/contrib/infback9/infback9.c b/contrib/infback9/infback9.c
new file mode 100644
index 0000000..fb6acb4
--- /dev/null
+++ b/contrib/infback9/infback9.c
@@ -0,0 +1,605 @@
1/* infback9.c -- inflate deflate64 data using a call-back interface
2 * Copyright (C) 1995-2003 Mark Adler
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
6#include "zutil.h"
7#include "infback9.h"
8#include "inftree9.h"
9#include "inflate9.h"
10
11#define WSIZE 65536UL
12
13/*
14 strm provides memory allocation functions in zalloc and zfree, or
15 Z_NULL to use the library memory allocation functions.
16
17 window is a user-supplied window and output buffer that is 64K bytes.
18 */
19int ZEXPORT inflateBack9Init_(strm, window, version, stream_size)
20z_stream FAR *strm;
21unsigned char FAR *window;
22const char *version;
23int stream_size;
24{
25 struct inflate_state FAR *state;
26
27 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
28 stream_size != (int)(sizeof(z_stream)))
29 return Z_VERSION_ERROR;
30 if (strm == Z_NULL || window == Z_NULL)
31 return Z_STREAM_ERROR;
32 strm->msg = Z_NULL; /* in case we return an error */
33 if (strm->zalloc == (alloc_func)0) {
34 strm->zalloc = zcalloc;
35 strm->opaque = (voidpf)0;
36 }
37 if (strm->zfree == (free_func)0) strm->zfree = zcfree;
38 state = (struct inflate_state FAR *)ZALLOC(strm, 1,
39 sizeof(struct inflate_state));
40 if (state == Z_NULL) return Z_MEM_ERROR;
41 Tracev((stderr, "inflate: allocated\n"));
42 strm->state = (voidpf)state;
43 state->window = window;
44 return Z_OK;
45}
46
47/*
48 Build and output length and distance decoding tables for fixed code
49 decoding.
50 */
51#ifdef MAKEFIXED
52#include <stdio.h>
53
54void makefixed9(void)
55{
56 unsigned sym, bits, low, size;
57 code *next, *lenfix, *distfix;
58 struct inflate_state state;
59 code fixed[544];
60
61 /* literal/length table */
62 sym = 0;
63 while (sym < 144) state.lens[sym++] = 8;
64 while (sym < 256) state.lens[sym++] = 9;
65 while (sym < 280) state.lens[sym++] = 7;
66 while (sym < 288) state.lens[sym++] = 8;
67 next = fixed;
68 lenfix = next;
69 bits = 9;
70 inflate_table9(LENS, state.lens, 288, &(next), &(bits), state.work);
71
72 /* distance table */
73 sym = 0;
74 while (sym < 32) state.lens[sym++] = 5;
75 distfix = next;
76 bits = 5;
77 inflate_table9(DISTS, state.lens, 32, &(next), &(bits), state.work);
78
79 /* write tables */
80 puts(" /* inffix9.h -- table for decoding deflate64 fixed codes");
81 puts(" * Generated automatically by makefixed9().");
82 puts(" */");
83 puts("");
84 puts(" /* WARNING: this file should *not* be used by applications.");
85 puts(" It is part of the implementation of this library and is");
86 puts(" subject to change. Applications should only use zlib.h.");
87 puts(" */");
88 puts("");
89 size = 1U << 9;
90 printf(" static const code lenfix[%u] = {", size);
91 low = 0;
92 for (;;) {
93 if ((low % 6) == 0) printf("\n ");
94 printf("{%u,%u,%d}", lenfix[low].op, lenfix[low].bits,
95 lenfix[low].val);
96 if (++low == size) break;
97 putchar(',');
98 }
99 puts("\n };");
100 size = 1U << 5;
101 printf("\n static const code distfix[%u] = {", size);
102 low = 0;
103 for (;;) {
104 if ((low % 5) == 0) printf("\n ");
105 printf("{%u,%u,%d}", distfix[low].op, distfix[low].bits,
106 distfix[low].val);
107 if (++low == size) break;
108 putchar(',');
109 }
110 puts("\n };");
111}
112#endif /* MAKEFIXED */
113
114/* Macros for inflateBack(): */
115
116/* Clear the input bit accumulator */
117#define INITBITS() \
118 do { \
119 hold = 0; \
120 bits = 0; \
121 } while (0)
122
123/* Assure that some input is available. If input is requested, but denied,
124 then return a Z_BUF_ERROR from inflateBack(). */
125#define PULL() \
126 do { \
127 if (have == 0) { \
128 have = in(in_desc, &next); \
129 if (have == 0) { \
130 next = Z_NULL; \
131 ret = Z_BUF_ERROR; \
132 goto inf_leave; \
133 } \
134 } \
135 } while (0)
136
137/* Get a byte of input into the bit accumulator, or return from inflateBack()
138 with an error if there is no input available. */
139#define PULLBYTE() \
140 do { \
141 PULL(); \
142 have--; \
143 hold += (unsigned long)(*next++) << bits; \
144 bits += 8; \
145 } while (0)
146
147/* Assure that there are at least n bits in the bit accumulator. If there is
148 not enough available input to do that, then return from inflateBack() with
149 an error. */
150#define NEEDBITS(n) \
151 do { \
152 while (bits < (unsigned)(n)) \
153 PULLBYTE(); \
154 } while (0)
155
156/* Return the low n bits of the bit accumulator (n <= 16) */
157#define BITS(n) \
158 ((unsigned)hold & ((1U << (n)) - 1))
159
160/* Remove n bits from the bit accumulator */
161#define DROPBITS(n) \
162 do { \
163 hold >>= (n); \
164 bits -= (unsigned)(n); \
165 } while (0)
166
167/* Remove zero to seven bits as needed to go to a byte boundary */
168#define BYTEBITS() \
169 do { \
170 hold >>= bits & 7; \
171 bits -= bits & 7; \
172 } while (0)
173
174/* Assure that some output space is available, by writing out the window
175 if it's full. If the write fails, return from inflateBack() with a
176 Z_BUF_ERROR. */
177#define ROOM() \
178 do { \
179 if (left == 0) { \
180 put = window; \
181 left = WSIZE; \
182 wrap = 1; \
183 if (out(out_desc, put, (unsigned)left)) { \
184 ret = Z_BUF_ERROR; \
185 goto inf_leave; \
186 } \
187 } \
188 } while (0)
189
190/*
191 strm provides the memory allocation functions and window buffer on input,
192 and provides information on the unused input on return. For Z_DATA_ERROR
193 returns, strm will also provide an error message.
194
195 in() and out() are the call-back input and output functions. When
196 inflateBack() needs more input, it calls in(). When inflateBack() has
197 filled the window with output, or when it completes with data in the
198 window, it calls out() to write out the data. The application must not
199 change the provided input until in() is called again or inflateBack()
200 returns. The application must not change the window/output buffer until
201 inflateBack() returns.
202
203 in() and out() are called with a descriptor parameter provided in the
204 inflateBack() call. This parameter can be a structure that provides the
205 information required to do the read or write, as well as accumulated
206 information on the input and output such as totals and check values.
207
208 in() should return zero on failure. out() should return non-zero on
209 failure. If either in() or out() fails, than inflateBack() returns a
210 Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
211 was in() or out() that caused in the error. Otherwise, inflateBack()
212 returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
213 error, or Z_MEM_ERROR if it could not allocate memory for the state.
214 inflateBack() can also return Z_STREAM_ERROR if the input parameters
215 are not correct, i.e. strm is Z_NULL or the state was not initialized.
216 */
217int ZEXPORT inflateBack9(strm, in, in_desc, out, out_desc)
218z_stream FAR *strm;
219in_func in;
220void FAR *in_desc;
221out_func out;
222void FAR *out_desc;
223{
224 struct inflate_state FAR *state;
225 unsigned char FAR *next; /* next input */
226 unsigned char FAR *put; /* next output */
227 unsigned have; /* available input */
228 unsigned long left; /* available output */
229 inflate_mode mode; /* current inflate mode */
230 int lastblock; /* true if processing last block */
231 int wrap; /* true if the window has wrapped */
232 unsigned long write; /* window write index */
233 unsigned char FAR *window; /* allocated sliding window, if needed */
234 unsigned long hold; /* bit buffer */
235 unsigned bits; /* bits in bit buffer */
236 unsigned extra; /* extra bits needed */
237 unsigned long length; /* literal or length of data to copy */
238 unsigned long offset; /* distance back to copy string from */
239 unsigned long copy; /* number of stored or match bytes to copy */
240 unsigned char FAR *from; /* where to copy match bytes from */
241 code const FAR *lencode; /* starting table for length/literal codes */
242 code const FAR *distcode; /* starting table for distance codes */
243 unsigned lenbits; /* index bits for lencode */
244 unsigned distbits; /* index bits for distcode */
245 code this; /* current decoding table entry */
246 code last; /* parent table entry */
247 unsigned len; /* length to copy for repeats, bits to drop */
248 int ret; /* return code */
249 static const unsigned short order[19] = /* permutation of code lengths */
250 {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
251#include "inffix9.h"
252
253 /* Check that the strm exists and that the state was initialized */
254 if (strm == Z_NULL || strm->state == Z_NULL)
255 return Z_STREAM_ERROR;
256 state = (struct inflate_state FAR *)strm->state;
257
258 /* Reset the state */
259 strm->msg = Z_NULL;
260 mode = TYPE;
261 lastblock = 0;
262 write = 0;
263 wrap = 0;
264 window = state->window;
265 next = strm->next_in;
266 have = next != Z_NULL ? strm->avail_in : 0;
267 hold = 0;
268 bits = 0;
269 put = window;
270 left = WSIZE;
271 lencode = Z_NULL;
272 distcode = Z_NULL;
273
274 /* Inflate until end of block marked as last */
275 for (;;)
276 switch (mode) {
277 case TYPE:
278 /* determine and dispatch block type */
279 if (lastblock) {
280 BYTEBITS();
281 mode = DONE;
282 break;
283 }
284 NEEDBITS(3);
285 lastblock = BITS(1);
286 DROPBITS(1);
287 switch (BITS(2)) {
288 case 0: /* stored block */
289 Tracev((stderr, "inflate: stored block%s\n",
290 lastblock ? " (last)" : ""));
291 mode = STORED;
292 break;
293 case 1: /* fixed block */
294 lencode = lenfix;
295 lenbits = 9;
296 distcode = distfix;
297 distbits = 5;
298 Tracev((stderr, "inflate: fixed codes block%s\n",
299 lastblock ? " (last)" : ""));
300 mode = LEN; /* decode codes */
301 break;
302 case 2: /* dynamic block */
303 Tracev((stderr, "inflate: dynamic codes block%s\n",
304 lastblock ? " (last)" : ""));
305 mode = TABLE;
306 break;
307 case 3:
308 strm->msg = (char *)"invalid block type";
309 mode = BAD;
310 }
311 DROPBITS(2);
312 break;
313
314 case STORED:
315 /* get and verify stored block length */
316 BYTEBITS(); /* go to byte boundary */
317 NEEDBITS(32);
318 if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
319 strm->msg = (char *)"invalid stored block lengths";
320 mode = BAD;
321 break;
322 }
323 length = (unsigned)hold & 0xffff;
324 Tracev((stderr, "inflate: stored length %u\n",
325 length));
326 INITBITS();
327
328 /* copy stored block from input to output */
329 while (length != 0) {
330 copy = length;
331 PULL();
332 ROOM();
333 if (copy > have) copy = have;
334 if (copy > left) copy = left;
335 zmemcpy(put, next, copy);
336 have -= copy;
337 next += copy;
338 left -= copy;
339 put += copy;
340 length -= copy;
341 }
342 Tracev((stderr, "inflate: stored end\n"));
343 mode = TYPE;
344 break;
345
346 case TABLE:
347 /* get dynamic table entries descriptor */
348 NEEDBITS(14);
349 state->nlen = BITS(5) + 257;
350 DROPBITS(5);
351 state->ndist = BITS(5) + 1;
352 DROPBITS(5);
353 state->ncode = BITS(4) + 4;
354 DROPBITS(4);
355 if (state->nlen > 286) {
356 strm->msg = (char *)"too many length symbols";
357 mode = BAD;
358 break;
359 }
360 Tracev((stderr, "inflate: table sizes ok\n"));
361
362 /* get code length code lengths (not a typo) */
363 state->have = 0;
364 while (state->have < state->ncode) {
365 NEEDBITS(3);
366 state->lens[order[state->have++]] = (unsigned short)BITS(3);
367 DROPBITS(3);
368 }
369 while (state->have < 19)
370 state->lens[order[state->have++]] = 0;
371 state->next = state->codes;
372 lencode = (code const FAR *)(state->next);
373 lenbits = 7;
374 ret = inflate_table9(CODES, state->lens, 19, &(state->next),
375 &(lenbits), state->work);
376 if (ret) {
377 strm->msg = (char *)"invalid code lengths set";
378 mode = BAD;
379 break;
380 }
381 Tracev((stderr, "inflate: code lengths ok\n"));
382
383 /* get length and distance code code lengths */
384 state->have = 0;
385 while (state->have < state->nlen + state->ndist) {
386 for (;;) {
387 this = lencode[BITS(lenbits)];
388 if ((unsigned)(this.bits) <= bits) break;
389 PULLBYTE();
390 }
391 if (this.val < 16) {
392 NEEDBITS(this.bits);
393 DROPBITS(this.bits);
394 state->lens[state->have++] = this.val;
395 }
396 else {
397 if (this.val == 16) {
398 NEEDBITS(this.bits + 2);
399 DROPBITS(this.bits);
400 if (state->have == 0) {
401 strm->msg = (char *)"invalid bit length repeat";
402 mode = BAD;
403 break;
404 }
405 len = (unsigned)(state->lens[state->have - 1]);
406 copy = 3 + BITS(2);
407 DROPBITS(2);
408 }
409 else if (this.val == 17) {
410 NEEDBITS(this.bits + 3);
411 DROPBITS(this.bits);
412 len = 0;
413 copy = 3 + BITS(3);
414 DROPBITS(3);
415 }
416 else {
417 NEEDBITS(this.bits + 7);
418 DROPBITS(this.bits);
419 len = 0;
420 copy = 11 + BITS(7);
421 DROPBITS(7);
422 }
423 if (state->have + copy > state->nlen + state->ndist) {
424 strm->msg = (char *)"invalid bit length repeat";
425 mode = BAD;
426 break;
427 }
428 while (copy--)
429 state->lens[state->have++] = (unsigned short)len;
430 }
431 }
432
433 /* build code tables */
434 state->next = state->codes;
435 lencode = (code const FAR *)(state->next);
436 lenbits = 9;
437 ret = inflate_table9(LENS, state->lens, state->nlen,
438 &(state->next), &(lenbits), state->work);
439 if (ret) {
440 strm->msg = (char *)"invalid literal/lengths set";
441 mode = BAD;
442 break;
443 }
444 distcode = (code const FAR *)(state->next);
445 distbits = 6;
446 ret = inflate_table9(DISTS, state->lens + state->nlen,
447 state->ndist, &(state->next), &(distbits),
448 state->work);
449 if (ret) {
450 strm->msg = (char *)"invalid distances set";
451 mode = BAD;
452 break;
453 }
454 Tracev((stderr, "inflate: codes ok\n"));
455 mode = LEN;
456
457 case LEN:
458 /* get a literal, length, or end-of-block code */
459 for (;;) {
460 this = lencode[BITS(lenbits)];
461 if ((unsigned)(this.bits) <= bits) break;
462 PULLBYTE();
463 }
464 if (this.op && (this.op & 0xf0) == 0) {
465 last = this;
466 for (;;) {
467 this = lencode[last.val +
468 (BITS(last.bits + last.op) >> last.bits)];
469 if ((unsigned)(last.bits + this.bits) <= bits) break;
470 PULLBYTE();
471 }
472 DROPBITS(last.bits);
473 }
474 DROPBITS(this.bits);
475 length = (unsigned)this.val;
476
477 /* process literal */
478 if (this.op == 0) {
479 Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
480 "inflate: literal '%c'\n" :
481 "inflate: literal 0x%02x\n", this.val));
482 ROOM();
483 *put++ = (unsigned char)(length);
484 left--;
485 mode = LEN;
486 break;
487 }
488
489 /* process end of block */
490 if (this.op & 32) {
491 Tracevv((stderr, "inflate: end of block\n"));
492 mode = TYPE;
493 break;
494 }
495
496 /* invalid code */
497 if (this.op & 64) {
498 strm->msg = (char *)"invalid literal/length code";
499 mode = BAD;
500 break;
501 }
502
503 /* length code -- get extra bits, if any */
504 extra = (unsigned)(this.op) & 31;
505 if (extra != 0) {
506 NEEDBITS(extra);
507 length += BITS(extra);
508 DROPBITS(extra);
509 }
510 Tracevv((stderr, "inflate: length %u\n", length));
511
512 /* get distance code */
513 for (;;) {
514 this = distcode[BITS(distbits)];
515 if ((unsigned)(this.bits) <= bits) break;
516 PULLBYTE();
517 }
518 if ((this.op & 0xf0) == 0) {
519 last = this;
520 for (;;) {
521 this = distcode[last.val +
522 (BITS(last.bits + last.op) >> last.bits)];
523 if ((unsigned)(last.bits + this.bits) <= bits) break;
524 PULLBYTE();
525 }
526 DROPBITS(last.bits);
527 }
528 DROPBITS(this.bits);
529 if (this.op & 64) {
530 strm->msg = (char *)"invalid distance code";
531 mode = BAD;
532 break;
533 }
534 offset = (unsigned)this.val;
535
536 /* get distance extra bits, if any */
537 extra = (unsigned)(this.op) & 15;
538 if (extra != 0) {
539 NEEDBITS(extra);
540 offset += BITS(extra);
541 DROPBITS(extra);
542 }
543 if (offset > WSIZE - (wrap ? 0: left)) {
544 strm->msg = (char *)"invalid distance too far back";
545 mode = BAD;
546 break;
547 }
548 Tracevv((stderr, "inflate: distance %u\n", offset));
549
550 /* copy match from window to output */
551 do {
552 ROOM();
553 copy = WSIZE - offset;
554 if (copy < left) {
555 from = put + copy;
556 copy = left - copy;
557 }
558 else {
559 from = put - offset;
560 copy = left;
561 }
562 if (copy > length) copy = length;
563 length -= copy;
564 left -= copy;
565 do {
566 *put++ = *from++;
567 } while (--copy);
568 } while (length != 0);
569 break;
570
571 case DONE:
572 /* inflate stream terminated properly -- write leftover output */
573 ret = Z_STREAM_END;
574 if (left < WSIZE) {
575 if (out(out_desc, window, (unsigned)(WSIZE - left)))
576 ret = Z_BUF_ERROR;
577 }
578 goto inf_leave;
579
580 case BAD:
581 ret = Z_DATA_ERROR;
582 goto inf_leave;
583
584 default: /* can't happen, but makes compilers happy */
585 ret = Z_STREAM_ERROR;
586 goto inf_leave;
587 }
588
589 /* Return unused input */
590 inf_leave:
591 strm->next_in = next;
592 strm->avail_in = have;
593 return ret;
594}
595
596int ZEXPORT inflateBack9End(strm)
597z_stream FAR *strm;
598{
599 if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
600 return Z_STREAM_ERROR;
601 ZFREE(strm, strm->state);
602 strm->state = Z_NULL;
603 Tracev((stderr, "inflate: end\n"));
604 return Z_OK;
605}
diff --git a/contrib/infback9/infback9.diff b/contrib/infback9/infback9.diff
deleted file mode 100644
index cbe2e49..0000000
--- a/contrib/infback9/infback9.diff
+++ /dev/null
@@ -1,427 +0,0 @@
1*** infback.c Mon Aug 11 16:48:06 2003
2--- infback9.c Mon Sep 8 21:22:46 2003
3***************
4*** 1,19 ****
5! /* infback.c -- inflate using a call-back interface
6 * Copyright (C) 1995-2003 Mark Adler
7 * For conditions of distribution and use, see copyright notice in zlib.h
8 */
9
10- /*
11- This code is largely copied from inflate.c. Normally either infback.o or
12- inflate.o would be linked into an application--not both. The interface
13- with inffast.c is retained so that optimized assembler-coded versions of
14- inflate_fast() can be used with either inflate.c or infback.c.
15- */
16-
17 #include "zutil.h"
18! #include "inftrees.h"
19 #include "inflate.h"
20- #include "inffast.h"
21
22 /* function prototypes */
23 local void fixedtables OF((struct inflate_state FAR *state));
24--- 1,12 ----
25! /* infback9.c -- inflate deflate64 data using a call-back interface
26 * Copyright (C) 1995-2003 Mark Adler
27 * For conditions of distribution and use, see copyright notice in zlib.h
28 */
29
30 #include "zutil.h"
31! #include "infback9.h"
32! #include "inftree9.h"
33 #include "inflate.h"
34
35 /* function prototypes */
36 local void fixedtables OF((struct inflate_state FAR *state));
37***************
38*** 22,33 ****
39 strm provides memory allocation functions in zalloc and zfree, or
40 Z_NULL to use the library memory allocation functions.
41
42! windowBits is in the range 8..15, and window is a user-supplied
43! window and output buffer that is 2**windowBits bytes.
44 */
45! int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
46 z_stream FAR *strm;
47- int windowBits;
48 unsigned char FAR *window;
49 const char *version;
50 int stream_size;
51--- 15,24 ----
52 strm provides memory allocation functions in zalloc and zfree, or
53 Z_NULL to use the library memory allocation functions.
54
55! window is a user-supplied window and output buffer that is 64K bytes.
56 */
57! int ZEXPORT inflateBack9Init_(strm, window, version, stream_size)
58 z_stream FAR *strm;
59 unsigned char FAR *window;
60 const char *version;
61 int stream_size;
62***************
63*** 37,44 ****
64 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
65 stream_size != (int)(sizeof(z_stream)))
66 return Z_VERSION_ERROR;
67! if (strm == Z_NULL || window == Z_NULL ||
68! windowBits < 8 || windowBits > 15)
69 return Z_STREAM_ERROR;
70 strm->msg = Z_NULL; /* in case we return an error */
71 if (strm->zalloc == (alloc_func)0) {
72--- 28,34 ----
73 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
74 stream_size != (int)(sizeof(z_stream)))
75 return Z_VERSION_ERROR;
76! if (strm == Z_NULL || window == Z_NULL)
77 return Z_STREAM_ERROR;
78 strm->msg = Z_NULL; /* in case we return an error */
79 if (strm->zalloc == (alloc_func)0) {
80***************
81*** 51,58 ****
82 if (state == Z_NULL) return Z_MEM_ERROR;
83 Tracev((stderr, "inflate: allocated\n"));
84 strm->state = (voidpf)state;
85! state->wbits = windowBits;
86! state->wsize = 1U << windowBits;
87 state->window = window;
88 state->write = 0;
89 state->whave = 0;
90--- 41,48 ----
91 if (state == Z_NULL) return Z_MEM_ERROR;
92 Tracev((stderr, "inflate: allocated\n"));
93 strm->state = (voidpf)state;
94! state->wbits = 16;
95! state->wsize = 1U << 16;
96 state->window = window;
97 state->write = 0;
98 state->whave = 0;
99***************
100*** 91,110 ****
101 next = fixed;
102 lenfix = next;
103 bits = 9;
104! inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
105
106 /* distance table */
107 sym = 0;
108 while (sym < 32) state->lens[sym++] = 5;
109 distfix = next;
110 bits = 5;
111! inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
112
113 /* do this just once */
114 virgin = 0;
115 }
116 #else /* !BUILDFIXED */
117! # include "inffixed.h"
118 #endif /* BUILDFIXED */
119 state->lencode = lenfix;
120 state->lenbits = 9;
121--- 81,100 ----
122 next = fixed;
123 lenfix = next;
124 bits = 9;
125! inflate_table9(LENS, state->lens, 288, &(next), &(bits), state->work);
126
127 /* distance table */
128 sym = 0;
129 while (sym < 32) state->lens[sym++] = 5;
130 distfix = next;
131 bits = 5;
132! inflate_table9(DISTS, state->lens, 32, &(next), &(bits), state->work);
133
134 /* do this just once */
135 virgin = 0;
136 }
137 #else /* !BUILDFIXED */
138! # include "inffix9.h"
139 #endif /* BUILDFIXED */
140 state->lencode = lenfix;
141 state->lenbits = 9;
142***************
143*** 114,141 ****
144
145 /* Macros for inflateBack(): */
146
147- /* Load returned state from inflate_fast() */
148- #define LOAD() \
149- do { \
150- put = strm->next_out; \
151- left = strm->avail_out; \
152- next = strm->next_in; \
153- have = strm->avail_in; \
154- hold = state->hold; \
155- bits = state->bits; \
156- } while (0)
157-
158- /* Set state from registers for inflate_fast() */
159- #define RESTORE() \
160- do { \
161- strm->next_out = put; \
162- strm->avail_out = left; \
163- strm->next_in = next; \
164- strm->avail_in = have; \
165- state->hold = hold; \
166- state->bits = bits; \
167- } while (0)
168-
169 /* Clear the input bit accumulator */
170 #define INITBITS() \
171 do { \
172--- 104,109 ----
173***************
174*** 237,243 ****
175 inflateBack() can also return Z_STREAM_ERROR if the input parameters
176 are not correct, i.e. strm is Z_NULL or the state was not initialized.
177 */
178! int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
179 z_stream FAR *strm;
180 in_func in;
181 void FAR *in_desc;
182--- 205,211 ----
183 inflateBack() can also return Z_STREAM_ERROR if the input parameters
184 are not correct, i.e. strm is Z_NULL or the state was not initialized.
185 */
186! int ZEXPORT inflateBack9(strm, in, in_desc, out, out_desc)
187 z_stream FAR *strm;
188 in_func in;
189 void FAR *in_desc;
190***************
191*** 354,366 ****
192 DROPBITS(5);
193 state->ncode = BITS(4) + 4;
194 DROPBITS(4);
195! #ifndef PKZIP_BUG_WORKAROUND
196! if (state->nlen > 286 || state->ndist > 30) {
197! strm->msg = (char *)"too many length or distance symbols";
198 state->mode = BAD;
199 break;
200 }
201- #endif
202 Tracev((stderr, "inflate: table sizes ok\n"));
203
204 /* get code length code lengths (not a typo) */
205--- 322,332 ----
206 DROPBITS(5);
207 state->ncode = BITS(4) + 4;
208 DROPBITS(4);
209! if (state->nlen > 286) {
210! strm->msg = (char *)"too many length symbols";
211 state->mode = BAD;
212 break;
213 }
214 Tracev((stderr, "inflate: table sizes ok\n"));
215
216 /* get code length code lengths (not a typo) */
217***************
218*** 375,381 ****
219 state->next = state->codes;
220 state->lencode = (code const FAR *)(state->next);
221 state->lenbits = 7;
222! ret = inflate_table(CODES, state->lens, 19, &(state->next),
223 &(state->lenbits), state->work);
224 if (ret) {
225 strm->msg = (char *)"invalid code lengths set";
226--- 341,347 ----
227 state->next = state->codes;
228 state->lencode = (code const FAR *)(state->next);
229 state->lenbits = 7;
230! ret = inflate_table9(CODES, state->lens, 19, &(state->next),
231 &(state->lenbits), state->work);
232 if (ret) {
233 strm->msg = (char *)"invalid code lengths set";
234***************
235*** 438,445 ****
236 state->next = state->codes;
237 state->lencode = (code const FAR *)(state->next);
238 state->lenbits = 9;
239! ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
240! &(state->lenbits), state->work);
241 if (ret) {
242 strm->msg = (char *)"invalid literal/lengths set";
243 state->mode = BAD;
244--- 404,411 ----
245 state->next = state->codes;
246 state->lencode = (code const FAR *)(state->next);
247 state->lenbits = 9;
248! ret = inflate_table9(LENS, state->lens, state->nlen,
249! &(state->next), &(state->lenbits), state->work);
250 if (ret) {
251 strm->msg = (char *)"invalid literal/lengths set";
252 state->mode = BAD;
253***************
254*** 447,454 ****
255 }
256 state->distcode = (code const FAR *)(state->next);
257 state->distbits = 6;
258! ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
259! &(state->next), &(state->distbits), state->work);
260 if (ret) {
261 strm->msg = (char *)"invalid distances set";
262 state->mode = BAD;
263--- 413,421 ----
264 }
265 state->distcode = (code const FAR *)(state->next);
266 state->distbits = 6;
267! ret = inflate_table9(DISTS, state->lens + state->nlen,
268! state->ndist, &(state->next), &(state->distbits),
269! state->work);
270 if (ret) {
271 strm->msg = (char *)"invalid distances set";
272 state->mode = BAD;
273***************
274*** 458,473 ****
275 state->mode = LEN;
276
277 case LEN:
278- /* use inflate_fast() if we have enough input and output */
279- if (have >= 6 && left >= 258) {
280- RESTORE();
281- if (state->whave < state->wsize)
282- state->whave = state->wsize - left;
283- inflate_fast(strm, state->wsize);
284- LOAD();
285- break;
286- }
287-
288 /* get a literal, length, or end-of-block code */
289 for (;;) {
290 this = state->lencode[BITS(state->lenbits)];
291--- 425,430 ----
292***************
293*** 607,613 ****
294 return ret;
295 }
296
297! int ZEXPORT inflateBackEnd(strm)
298 z_stream FAR *strm;
299 {
300 if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
301--- 564,570 ----
302 return ret;
303 }
304
305! int ZEXPORT inflateBack9End(strm)
306 z_stream FAR *strm;
307 {
308 if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
309*** inftrees.c Sun Sep 7 10:59:10 2003
310--- inftree9.c Mon Sep 8 20:54:36 2003
311***************
312*** 1,15 ****
313! /* inftrees.c -- generate Huffman trees for efficient decoding
314 * Copyright (C) 1995-2003 Mark Adler
315 * For conditions of distribution and use, see copyright notice in zlib.h
316 */
317
318 #include "zutil.h"
319! #include "inftrees.h"
320
321 #define MAXBITS 15
322
323! const char inflate_copyright[] =
324! " inflate 1.2.0.5 Copyright 1995-2003 Mark Adler ";
325 /*
326 If you use the zlib library in a product, an acknowledgment is welcome
327 in the documentation of your product. If for some reason you cannot
328--- 1,15 ----
329! /* inftree9.c -- generate Huffman trees for efficient decoding
330 * Copyright (C) 1995-2003 Mark Adler
331 * For conditions of distribution and use, see copyright notice in zlib.h
332 */
333
334 #include "zutil.h"
335! #include "inftree9.h"
336
337 #define MAXBITS 15
338
339! const char inflate9_copyright[] =
340! " inflate9 1.2.0.5 Copyright 1995-2003 Mark Adler ";
341 /*
342 If you use the zlib library in a product, an acknowledgment is welcome
343 in the documentation of your product. If for some reason you cannot
344***************
345*** 29,35 ****
346 table index bits. It will differ if the request is greater than the
347 longest code or if it is less than the shortest code.
348 */
349! int inflate_table(type, lens, codes, table, bits, work)
350 codetype type;
351 unsigned short FAR *lens;
352 unsigned codes;
353--- 29,35 ----
354 table index bits. It will differ if the request is greater than the
355 longest code or if it is less than the shortest code.
356 */
357! int inflate_table9(type, lens, codes, table, bits, work)
358 codetype type;
359 unsigned short FAR *lens;
360 unsigned codes;
361***************
362*** 59,76 ****
363 unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
364 static const unsigned short lbase[31] = { /* Length codes 257..285 base */
365 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
366! 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
367 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
368 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
369! 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 192, 78};
370! static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
371 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
372 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
373! 8193, 12289, 16385, 24577, 0, 0};
374! static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
375 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
376 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
377! 28, 28, 29, 29, 64, 64};
378
379 /*
380 Process a set of code lengths to create a canonical Huffman code. The
381--- 59,76 ----
382 unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
383 static const unsigned short lbase[31] = { /* Length codes 257..285 base */
384 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
385! 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 3, 0, 0};
386 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
387 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
388! 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 32, 192, 78};
389! static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
390 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
391 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
392! 8193, 12289, 16385, 24577, 32769, 49153};
393! static const unsigned short dext[32] = { /* Distance codes 0..31 extra */
394 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
395 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
396! 28, 28, 29, 29, 30, 30};
397
398 /*
399 Process a set of code lengths to create a canonical Huffman code. The
400*** inftrees.h Sun Aug 10 15:15:50 2003
401--- inftree9.h Mon Sep 8 20:54:51 2003
402***************
403*** 1,4 ****
404! /* inftrees.h -- header to use inftrees.c
405 * Copyright (C) 1995-2003 Mark Adler
406 * For conditions of distribution and use, see copyright notice in zlib.h
407 */
408--- 1,4 ----
409! /* inftree9.h -- header to use inftree9.c
410 * Copyright (C) 1995-2003 Mark Adler
411 * For conditions of distribution and use, see copyright notice in zlib.h
412 */
413***************
414*** 50,55 ****
415 DISTS
416 } codetype;
417
418! extern int inflate_table OF((codetype type, unsigned short FAR *lens,
419 unsigned codes, code FAR * FAR *table,
420 unsigned FAR *bits, unsigned short FAR *work));
421--- 50,55 ----
422 DISTS
423 } codetype;
424
425! extern int inflate_table9 OF((codetype type, unsigned short FAR *lens,
426 unsigned codes, code FAR * FAR *table,
427 unsigned FAR *bits, unsigned short FAR *work));
diff --git a/contrib/infback9/infback9.h b/contrib/infback9/infback9.h
index fb7c73e..10bf58c 100644
--- a/contrib/infback9/infback9.h
+++ b/contrib/infback9/infback9.h
@@ -7,10 +7,13 @@
7 * This header file and associated patches provide a decoder for PKWare's 7 * This header file and associated patches provide a decoder for PKWare's
8 * undocumented deflate64 compression method (method 9). Use with infback9.c, 8 * undocumented deflate64 compression method (method 9). Use with infback9.c,
9 * inftree9.h, inftree9.c, and inffix9.h. These patches are not supported. 9 * inftree9.h, inftree9.c, and inffix9.h. These patches are not supported.
10 * This code will almost certainly not work on 16-bit architectures. See the 10 * This should be compiled with zlib, since it uses zutil.h and zutil.o.
11 * This code has not yet been tested on 16-bit architectures. See the
11 * comments in zlib.h for inflateBack() usage. These functions are used 12 * comments in zlib.h for inflateBack() usage. These functions are used
12 * identically, except that there is no windowBits parameter, and a 64K 13 * identically, except that there is no windowBits parameter, and a 64K
13 * window must be provided. zlib.h must be included before this header file. 14 * window must be provided. Also if int's are 16 bits, then a zero for
15 * the third parameter of the "out" function actually means 65536UL.
16 * zlib.h must be included before this header file.
14 */ 17 */
15 18
16ZEXTERN int ZEXPORT inflateBack9 OF((z_stream FAR *strm, 19ZEXTERN int ZEXPORT inflateBack9 OF((z_stream FAR *strm,
diff --git a/contrib/infback9/inffix9.h b/contrib/infback9/inffix9.h
index 8476588..ee5671d 100644
--- a/contrib/infback9/inffix9.h
+++ b/contrib/infback9/inffix9.h
@@ -1,5 +1,5 @@
1 /* inffix9.h -- table for decoding fixed codes 1 /* inffix9.h -- table for decoding deflate64 fixed codes
2 * Generated automatically by makefixed(). 2 * Generated automatically by makefixed9().
3 */ 3 */
4 4
5 /* WARNING: this file should *not* be used by applications. 5 /* WARNING: this file should *not* be used by applications.
@@ -8,87 +8,100 @@
8 */ 8 */
9 9
10 static const code lenfix[512] = { 10 static const code lenfix[512] = {
11 {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, 11 {96,7,0},{0,8,80},{0,8,16},{132,8,115},{130,7,31},{0,8,112},
12 {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, 12 {0,8,48},{0,9,192},{128,7,10},{0,8,96},{0,8,32},{0,9,160},
13 {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, 13 {0,8,0},{0,8,128},{0,8,64},{0,9,224},{128,7,6},{0,8,88},
14 {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, 14 {0,8,24},{0,9,144},{131,7,59},{0,8,120},{0,8,56},{0,9,208},
15 {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, 15 {129,7,17},{0,8,104},{0,8,40},{0,9,176},{0,8,8},{0,8,136},
16 {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, 16 {0,8,72},{0,9,240},{128,7,4},{0,8,84},{0,8,20},{133,8,227},
17 {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, 17 {131,7,43},{0,8,116},{0,8,52},{0,9,200},{129,7,13},{0,8,100},
18 {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, 18 {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},
19 {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, 19 {128,7,8},{0,8,92},{0,8,28},{0,9,152},{132,7,83},{0,8,124},
20 {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, 20 {0,8,60},{0,9,216},{130,7,23},{0,8,108},{0,8,44},{0,9,184},
21 {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, 21 {0,8,12},{0,8,140},{0,8,76},{0,9,248},{128,7,3},{0,8,82},
22 {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, 22 {0,8,18},{133,8,163},{131,7,35},{0,8,114},{0,8,50},{0,9,196},
23 {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, 23 {129,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},{0,8,130},
24 {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, 24 {0,8,66},{0,9,228},{128,7,7},{0,8,90},{0,8,26},{0,9,148},
25 {0,8,22},{192,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, 25 {132,7,67},{0,8,122},{0,8,58},{0,9,212},{130,7,19},{0,8,106},
26 {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, 26 {0,8,42},{0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},
27 {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, 27 {128,7,5},{0,8,86},{0,8,22},{65,8,0},{131,7,51},{0,8,118},
28 {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, 28 {0,8,54},{0,9,204},{129,7,15},{0,8,102},{0,8,38},{0,9,172},
29 {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, 29 {0,8,6},{0,8,134},{0,8,70},{0,9,236},{128,7,9},{0,8,94},
30 {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, 30 {0,8,30},{0,9,156},{132,7,99},{0,8,126},{0,8,62},{0,9,220},
31 {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, 31 {130,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
32 {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, 32 {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{133,8,131},
33 {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, 33 {130,7,31},{0,8,113},{0,8,49},{0,9,194},{128,7,10},{0,8,97},
34 {0,8,85},{0,8,21},{32,8,3},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, 34 {0,8,33},{0,9,162},{0,8,1},{0,8,129},{0,8,65},{0,9,226},
35 {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, 35 {128,7,6},{0,8,89},{0,8,25},{0,9,146},{131,7,59},{0,8,121},
36 {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, 36 {0,8,57},{0,9,210},{129,7,17},{0,8,105},{0,8,41},{0,9,178},
37 {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, 37 {0,8,9},{0,8,137},{0,8,73},{0,9,242},{128,7,4},{0,8,85},
38 {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, 38 {0,8,21},{144,8,3},{131,7,43},{0,8,117},{0,8,53},{0,9,202},
39 {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, 39 {129,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},
40 {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, 40 {0,8,69},{0,9,234},{128,7,8},{0,8,93},{0,8,29},{0,9,154},
41 {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, 41 {132,7,83},{0,8,125},{0,8,61},{0,9,218},{130,7,23},{0,8,109},
42 {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, 42 {0,8,45},{0,9,186},{0,8,13},{0,8,141},{0,8,77},{0,9,250},
43 {16,7,5},{0,8,87},{0,8,23},{78,8,0},{19,7,51},{0,8,119},{0,8,55}, 43 {128,7,3},{0,8,83},{0,8,19},{133,8,195},{131,7,35},{0,8,115},
44 {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, 44 {0,8,51},{0,9,198},{129,7,11},{0,8,99},{0,8,35},{0,9,166},
45 {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, 45 {0,8,3},{0,8,131},{0,8,67},{0,9,230},{128,7,7},{0,8,91},
46 {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, 46 {0,8,27},{0,9,150},{132,7,67},{0,8,123},{0,8,59},{0,9,214},
47 {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, 47 {130,7,19},{0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},
48 {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, 48 {0,8,75},{0,9,246},{128,7,5},{0,8,87},{0,8,23},{77,8,0},
49 {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, 49 {131,7,51},{0,8,119},{0,8,55},{0,9,206},{129,7,15},{0,8,103},
50 {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, 50 {0,8,39},{0,9,174},{0,8,7},{0,8,135},{0,8,71},{0,9,238},
51 {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, 51 {128,7,9},{0,8,95},{0,8,31},{0,9,158},{132,7,99},{0,8,127},
52 {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, 52 {0,8,63},{0,9,222},{130,7,27},{0,8,111},{0,8,47},{0,9,190},
53 {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, 53 {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},
54 {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, 54 {0,8,16},{132,8,115},{130,7,31},{0,8,112},{0,8,48},{0,9,193},
55 {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, 55 {128,7,10},{0,8,96},{0,8,32},{0,9,161},{0,8,0},{0,8,128},
56 {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, 56 {0,8,64},{0,9,225},{128,7,6},{0,8,88},{0,8,24},{0,9,145},
57 {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, 57 {131,7,59},{0,8,120},{0,8,56},{0,9,209},{129,7,17},{0,8,104},
58 {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, 58 {0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},{0,9,241},
59 {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, 59 {128,7,4},{0,8,84},{0,8,20},{133,8,227},{131,7,43},{0,8,116},
60 {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, 60 {0,8,52},{0,9,201},{129,7,13},{0,8,100},{0,8,36},{0,9,169},
61 {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{192,8,0},{19,7,51}, 61 {0,8,4},{0,8,132},{0,8,68},{0,9,233},{128,7,8},{0,8,92},
62 {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, 62 {0,8,28},{0,9,153},{132,7,83},{0,8,124},{0,8,60},{0,9,217},
63 {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, 63 {130,7,23},{0,8,108},{0,8,44},{0,9,185},{0,8,12},{0,8,140},
64 {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, 64 {0,8,76},{0,9,249},{128,7,3},{0,8,82},{0,8,18},{133,8,163},
65 {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, 65 {131,7,35},{0,8,114},{0,8,50},{0,9,197},{129,7,11},{0,8,98},
66 {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, 66 {0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
67 {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, 67 {128,7,7},{0,8,90},{0,8,26},{0,9,149},{132,7,67},{0,8,122},
68 {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, 68 {0,8,58},{0,9,213},{130,7,19},{0,8,106},{0,8,42},{0,9,181},
69 {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, 69 {0,8,10},{0,8,138},{0,8,74},{0,9,245},{128,7,5},{0,8,86},
70 {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{32,8,3}, 70 {0,8,22},{65,8,0},{131,7,51},{0,8,118},{0,8,54},{0,9,205},
71 {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, 71 {129,7,15},{0,8,102},{0,8,38},{0,9,173},{0,8,6},{0,8,134},
72 {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, 72 {0,8,70},{0,9,237},{128,7,9},{0,8,94},{0,8,30},{0,9,157},
73 {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, 73 {132,7,99},{0,8,126},{0,8,62},{0,9,221},{130,7,27},{0,8,110},
74 {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, 74 {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},
75 {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, 75 {96,7,0},{0,8,81},{0,8,17},{133,8,131},{130,7,31},{0,8,113},
76 {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, 76 {0,8,49},{0,9,195},{128,7,10},{0,8,97},{0,8,33},{0,9,163},
77 {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, 77 {0,8,1},{0,8,129},{0,8,65},{0,9,227},{128,7,6},{0,8,89},
78 {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, 78 {0,8,25},{0,9,147},{131,7,59},{0,8,121},{0,8,57},{0,9,211},
79 {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, 79 {129,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},{0,8,137},
80 {78,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, 80 {0,8,73},{0,9,243},{128,7,4},{0,8,85},{0,8,21},{144,8,3},
81 {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, 81 {131,7,43},{0,8,117},{0,8,53},{0,9,203},{129,7,13},{0,8,101},
82 {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, 82 {0,8,37},{0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},
83 {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, 83 {128,7,8},{0,8,93},{0,8,29},{0,9,155},{132,7,83},{0,8,125},
84 {0,9,255} 84 {0,8,61},{0,9,219},{130,7,23},{0,8,109},{0,8,45},{0,9,187},
85 {0,8,13},{0,8,141},{0,8,77},{0,9,251},{128,7,3},{0,8,83},
86 {0,8,19},{133,8,195},{131,7,35},{0,8,115},{0,8,51},{0,9,199},
87 {129,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
88 {0,8,67},{0,9,231},{128,7,7},{0,8,91},{0,8,27},{0,9,151},
89 {132,7,67},{0,8,123},{0,8,59},{0,9,215},{130,7,19},{0,8,107},
90 {0,8,43},{0,9,183},{0,8,11},{0,8,139},{0,8,75},{0,9,247},
91 {128,7,5},{0,8,87},{0,8,23},{77,8,0},{131,7,51},{0,8,119},
92 {0,8,55},{0,9,207},{129,7,15},{0,8,103},{0,8,39},{0,9,175},
93 {0,8,7},{0,8,135},{0,8,71},{0,9,239},{128,7,9},{0,8,95},
94 {0,8,31},{0,9,159},{132,7,99},{0,8,127},{0,8,63},{0,9,223},
95 {130,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},
96 {0,8,79},{0,9,255}
85 }; 97 };
86 98
87 static const code distfix[32] = { 99 static const code distfix[32] = {
88 {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, 100 {128,5,1},{135,5,257},{131,5,17},{139,5,4097},{129,5,5},
89 {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, 101 {137,5,1025},{133,5,65},{141,5,16385},{128,5,3},{136,5,513},
90 {18,5,9},{26,5,2049},{22,5,129},{30,5,32769},{16,5,2},{23,5,385}, 102 {132,5,33},{140,5,8193},{130,5,9},{138,5,2049},{134,5,129},
91 {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, 103 {142,5,32769},{128,5,2},{135,5,385},{131,5,25},{139,5,6145},
92 {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, 104 {129,5,7},{137,5,1537},{133,5,97},{141,5,24577},{128,5,4},
93 {22,5,193},{30,5,49153} 105 {136,5,769},{132,5,49},{140,5,12289},{130,5,13},{138,5,3073},
106 {134,5,193},{142,5,49153}
94 }; 107 };
diff --git a/contrib/infback9/inflate9.h b/contrib/infback9/inflate9.h
new file mode 100644
index 0000000..ee9a793
--- /dev/null
+++ b/contrib/infback9/inflate9.h
@@ -0,0 +1,47 @@
1/* inflate9.h -- internal inflate state definition
2 * Copyright (C) 1995-2003 Mark Adler
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
6/* WARNING: this file should *not* be used by applications. It is
7 part of the implementation of the compression library and is
8 subject to change. Applications should only use zlib.h.
9 */
10
11/* Possible inflate modes between inflate() calls */
12typedef enum {
13 TYPE, /* i: waiting for type bits, including last-flag bit */
14 STORED, /* i: waiting for stored size (length and complement) */
15 TABLE, /* i: waiting for dynamic block table lengths */
16 LEN, /* i: waiting for length/lit code */
17 DONE, /* finished check, done -- remain here until reset */
18 BAD /* got a data error -- remain here until reset */
19} inflate_mode;
20
21/*
22 State transitions between above modes -
23
24 (most modes can go to the BAD mode -- not shown for clarity)
25
26 Read deflate blocks:
27 TYPE -> STORED or TABLE or LEN or DONE
28 STORED -> TYPE
29 TABLE -> LENLENS -> CODELENS -> LEN
30 Read deflate codes:
31 LEN -> LEN or TYPE
32 */
33
34/* state maintained between inflate() calls. Approximately 7K bytes. */
35struct inflate_state {
36 /* sliding window */
37 unsigned char FAR *window; /* allocated sliding window, if needed */
38 /* dynamic table building */
39 unsigned ncode; /* number of code length code lengths */
40 unsigned nlen; /* number of length code lengths */
41 unsigned ndist; /* number of distance code lengths */
42 unsigned have; /* number of code lengths in lens[] */
43 code FAR *next; /* next available space in codes[] */
44 unsigned short lens[320]; /* temporary storage for code lengths */
45 unsigned short work[288]; /* work area for code table building */
46 code codes[ENOUGH]; /* space for code tables */
47};
diff --git a/contrib/infback9/inftree9.c b/contrib/infback9/inftree9.c
new file mode 100644
index 0000000..0c544cf
--- /dev/null
+++ b/contrib/infback9/inftree9.c
@@ -0,0 +1,323 @@
1/* inftree9.c -- generate Huffman trees for efficient decoding
2 * Copyright (C) 1995-2003 Mark Adler
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
6#include "zutil.h"
7#include "inftree9.h"
8
9#define MAXBITS 15
10
11const char inflate9_copyright[] =
12 " inflate9 1.2.0.6 Copyright 1995-2003 Mark Adler ";
13/*
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
16 include such an acknowledgment, I would appreciate that you keep this
17 copyright string in the executable of your product.
18 */
19
20/*
21 Build a set of tables to decode the provided canonical Huffman code.
22 The code lengths are lens[0..codes-1]. The result starts at *table,
23 whose indices are 0..2^bits-1. work is a writable array of at least
24 lens shorts, which is used as a work area. type is the type of code
25 to be generated, CODES, LENS, or DISTS. On return, zero is success,
26 -1 is an invalid code, and +1 means that ENOUGH isn't enough. table
27 on return points to the next available entry's address. bits is the
28 requested root table index bits, and on return it is the actual root
29 table index bits. It will differ if the request is greater than the
30 longest code or if it is less than the shortest code.
31 */
32int inflate_table9(type, lens, codes, table, bits, work)
33codetype type;
34unsigned short FAR *lens;
35unsigned codes;
36code FAR * FAR *table;
37unsigned FAR *bits;
38unsigned short FAR *work;
39{
40 unsigned len; /* a code's length in bits */
41 unsigned sym; /* index of code symbols */
42 unsigned min, max; /* minimum and maximum code lengths */
43 unsigned root; /* number of index bits for root table */
44 unsigned curr; /* number of index bits for current table */
45 unsigned drop; /* code bits to drop for sub-table */
46 int left; /* number of prefix codes available */
47 unsigned used; /* code entries in table used */
48 unsigned huff; /* Huffman code */
49 unsigned incr; /* for incrementing code, index */
50 unsigned fill; /* index for replicating entries */
51 unsigned low; /* low bits for current root entry */
52 unsigned mask; /* mask for low root bits */
53 code this; /* table entry for duplication */
54 code FAR *next; /* next available space in table */
55 const unsigned short FAR *base; /* base value table to use */
56 const unsigned short FAR *extra; /* extra bits table to use */
57 int end; /* use base and extra for symbol > end */
58 unsigned short count[MAXBITS+1]; /* number of codes of each length */
59 unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
60 static const unsigned short lbase[31] = { /* Length codes 257..285 base */
61 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17,
62 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115,
63 131, 163, 195, 227, 3, 0, 0};
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,
66 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
67 133, 133, 133, 133, 144, 65, 77};
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,
70 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
71 4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153};
72 static const unsigned short dext[32] = { /* Distance codes 0..31 extra */
73 128, 128, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132,
74 133, 133, 134, 134, 135, 135, 136, 136, 137, 137, 138, 138,
75 139, 139, 140, 140, 141, 141, 142, 142};
76
77 /*
78 Process a set of code lengths to create a canonical Huffman code. The
79 code lengths are lens[0..codes-1]. Each length corresponds to the
80 symbols 0..codes-1. The Huffman code is generated by first sorting the
81 symbols by length from short to long, and retaining the symbol order
82 for codes with equal lengths. Then the code starts with all zero bits
83 for the first code of the shortest length, and the codes are integer
84 increments for the same length, and zeros are appended as the length
85 increases. For the deflate format, these bits are stored backwards
86 from their more natural integer increment ordering, and so when the
87 decoding tables are built in the large loop below, the integer codes
88 are incremented backwards.
89
90 This routine assumes, but does not check, that all of the entries in
91 lens[] are in the range 0..MAXBITS. The caller must assure this.
92 1..MAXBITS is interpreted as that code length. zero means that that
93 symbol does not occur in this code.
94
95 The codes are sorted by computing a count of codes for each length,
96 creating from that a table of starting indices for each length in the
97 sorted table, and then entering the symbols in order in the sorted
98 table. The sorted table is work[], with that space being provided by
99 the caller.
100
101 The length counts are used for other purposes as well, i.e. finding
102 the minimum and maximum length codes, determining if there are any
103 codes at all, checking for a valid set of lengths, and looking ahead
104 at length counts to determine sub-table sizes when building the
105 decoding tables.
106 */
107
108 /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
109 for (len = 0; len <= MAXBITS; len++)
110 count[len] = 0;
111 for (sym = 0; sym < codes; sym++)
112 count[lens[sym]]++;
113
114 /* bound code lengths, force root to be within code lengths */
115 root = *bits;
116 for (max = MAXBITS; max >= 1; max--)
117 if (count[max] != 0) break;
118 if (root > max) root = max;
119 if (max == 0) return -1; /* no codes! */
120 for (min = 1; min <= MAXBITS; min++)
121 if (count[min] != 0) break;
122 if (root < min) root = min;
123
124 /* check for an over-subscribed or incomplete set of lengths */
125 left = 1;
126 for (len = 1; len <= MAXBITS; len++) {
127 left <<= 1;
128 left -= count[len];
129 if (left < 0) return -1; /* over-subscribed */
130 }
131 if (left > 0 && (type == CODES || (codes - count[0] != 1)))
132 return -1; /* incomplete set */
133
134 /* generate offsets into symbol table for each length for sorting */
135 offs[1] = 0;
136 for (len = 1; len < MAXBITS; len++)
137 offs[len + 1] = offs[len] + count[len];
138
139 /* sort symbols by length, by symbol order within each length */
140 for (sym = 0; sym < codes; sym++)
141 if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
142
143 /*
144 Create and fill in decoding tables. In this loop, the table being
145 filled is at next and has curr index bits. The code being used is huff
146 with length len. That code is converted to an index by dropping drop
147 bits off of the bottom. For codes where len is less than drop + curr,
148 those top drop + curr - len bits are incremented through all values to
149 fill the table with replicated entries.
150
151 root is the number of index bits for the root table. When len exceeds
152 root, sub-tables are created pointed to by the root entry with an index
153 of the low root bits of huff. This is saved in low to check for when a
154 new sub-table should be started. drop is zero when the root table is
155 being filled, and drop is root when sub-tables are being filled.
156
157 When a new sub-table is needed, it is necessary to look ahead in the
158 code lengths to determine what size sub-table is needed. The length
159 counts are used for this, and so count[] is decremented as codes are
160 entered in the tables.
161
162 used keeps track of how many table entries have been allocated from the
163 provided *table space. It is checked when a LENS table is being made
164 against the space in *table, ENOUGH, minus the maximum space needed by
165 the worst case distance code, MAXD. This should never happen, but the
166 sufficiency of ENOUGH has not been proven exhaustively, hence the check.
167 This assumes that when type == LENS, bits == 9.
168
169 sym increments through all symbols, and the loop terminates when
170 all codes of length max, i.e. all codes, have been processed. This
171 routine permits incomplete codes, so another loop after this one fills
172 in the rest of the decoding tables with invalid code markers.
173 */
174
175 /* set up for code type */
176 switch (type) {
177 case CODES:
178 base = extra = work; /* dummy value--not used */
179 end = 19;
180 break;
181 case LENS:
182 base = lbase;
183 base -= 257;
184 extra = lext;
185 extra -= 257;
186 end = 256;
187 break;
188 default: /* DISTS */
189 base = dbase;
190 extra = dext;
191 end = -1;
192 }
193
194 /* initialize state for loop */
195 huff = 0; /* starting code */
196 sym = 0; /* starting code symbol */
197 len = min; /* starting code length */
198 next = *table; /* current table to fill in */
199 curr = root; /* current table index bits */
200 drop = 0; /* current bits to drop from code for index */
201 low = (unsigned)(-1); /* trigger new sub-table when len > root */
202 used = 1U << root; /* use root table entries */
203 mask = used - 1; /* mask for comparing low */
204
205 /* check available table space */
206 if (type == LENS && used >= ENOUGH - MAXD)
207 return 1;
208
209 /* process all codes and make table entries */
210 for (;;) {
211 /* create table entry */
212 this.bits = (unsigned char)(len - drop);
213 if ((int)(work[sym]) < end) {
214 this.op = (unsigned char)0;
215 this.val = work[sym];
216 }
217 else if ((int)(work[sym]) > end) {
218 this.op = (unsigned char)(extra[work[sym]]);
219 this.val = base[work[sym]];
220 }
221 else {
222 this.op = (unsigned char)(32 + 64); /* end of block */
223 this.val = 0;
224 }
225
226 /* replicate for those indices with low len bits equal to huff */
227 incr = 1U << (len - drop);
228 fill = 1U << curr;
229 do {
230 fill -= incr;
231 next[(huff >> drop) + fill] = this;
232 } while (fill != 0);
233
234 /* backwards increment the len-bit code huff */
235 incr = 1U << (len - 1);
236 while (huff & incr)
237 incr >>= 1;
238 if (incr != 0) {
239 huff &= incr - 1;
240 huff += incr;
241 }
242 else
243 huff = 0;
244
245 /* go to next symbol, update count, len */
246 sym++;
247 if (--(count[len]) == 0) {
248 if (len == max) break;
249 len = lens[work[sym]];
250 }
251
252 /* create new sub-table if needed */
253 if (len > root && (huff & mask) != low) {
254 /* if first time, transition to sub-tables */
255 if (drop == 0)
256 drop = root;
257
258 /* increment past last table */
259 next += 1U << curr;
260
261 /* determine length of next table */
262 curr = len - drop;
263 left = (int)(1 << curr);
264 while (curr + drop < max) {
265 left -= count[curr + drop];
266 if (left <= 0) break;
267 curr++;
268 left <<= 1;
269 }
270
271 /* check for enough space */
272 used += 1U << curr;
273 if (type == LENS && used >= ENOUGH - MAXD)
274 return 1;
275
276 /* point entry in root table to sub-table */
277 low = huff & mask;
278 (*table)[low].op = (unsigned char)curr;
279 (*table)[low].bits = (unsigned char)root;
280 (*table)[low].val = (unsigned short)(next - *table);
281 }
282 }
283
284 /*
285 Fill in rest of table for incomplete codes. This loop is similar to the
286 loop above in incrementing huff for table indices. It is assumed that
287 len is equal to curr + drop, so there is no loop needed to increment
288 through high index bits. When the current sub-table is filled, the loop
289 drops back to the root table to fill in any remaining entries there.
290 */
291 this.op = (unsigned char)64; /* invalid code marker */
292 this.bits = (unsigned char)(len - drop);
293 this.val = (unsigned short)0;
294 while (huff != 0) {
295 /* when done with sub-table, drop back to root table */
296 if (drop != 0 && (huff & mask) != low) {
297 drop = 0;
298 len = root;
299 next = *table;
300 curr = root;
301 this.bits = (unsigned char)len;
302 }
303
304 /* put invalid code marker in table */
305 next[huff >> drop] = this;
306
307 /* backwards increment the len-bit code huff */
308 incr = 1U << (len - 1);
309 while (huff & incr)
310 incr >>= 1;
311 if (incr != 0) {
312 huff &= incr - 1;
313 huff += incr;
314 }
315 else
316 huff = 0;
317 }
318
319 /* set return parameters */
320 *table += used;
321 *bits = root;
322 return 0;
323}
diff --git a/contrib/infback9/inftree9.h b/contrib/infback9/inftree9.h
new file mode 100644
index 0000000..6a699a7
--- /dev/null
+++ b/contrib/infback9/inftree9.h
@@ -0,0 +1,55 @@
1/* inftree9.h -- header to use inftree9.c
2 * Copyright (C) 1995-2003 Mark Adler
3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */
5
6/* WARNING: this file should *not* be used by applications. It is
7 part of the implementation of the compression library and is
8 subject to change. Applications should only use zlib.h.
9 */
10
11/* Structure for decoding tables. Each entry provides either the
12 information needed to do the operation requested by the code that
13 indexed that table entry, or it provides a pointer to another
14 table that indexes more bits of the code. op indicates whether
15 the entry is a pointer to another table, a literal, a length or
16 distance, an end-of-block, or an invalid code. For a table
17 pointer, the low four bits of op is the number of index bits of
18 that table. For a length or distance, the low four bits of op
19 is the number of extra bits to get after the code. bits is
20 the number of bits in this code or part of the code to drop off
21 of the bit buffer. val is the actual byte to output in the case
22 of a literal, the base length or distance, or the offset from
23 the current table to the next table. Each entry is four bytes. */
24typedef struct {
25 unsigned char op; /* operation, extra bits, table bits */
26 unsigned char bits; /* bits in this part of the code */
27 unsigned short val; /* offset in table or code value */
28} code;
29
30/* op values as set by inflate_table():
31 00000000 - literal
32 0000tttt - table link, tttt != 0 is the number of table index bits
33 100eeeee - length or distance, eeee is the number of extra bits
34 01100000 - end of block
35 01000000 - invalid code
36 */
37
38/* Maximum size of dynamic tree. The maximum found in a long but non-
39 exhaustive search was 1004 code structures (850 for length/literals
40 and 154 for distances, the latter actually the result of an
41 exhaustive search). The true maximum is not known, but the value
42 below is more than safe. */
43#define ENOUGH 1440
44#define MAXD 154
45
46/* Type of code to build for inftable() */
47typedef enum {
48 CODES,
49 LENS,
50 DISTS
51} codetype;
52
53extern int inflate_table9 OF((codetype type, unsigned short FAR *lens,
54 unsigned codes, code FAR * FAR *table,
55 unsigned FAR *bits, unsigned short FAR *work));
diff --git a/contrib/minizip/ChangeLogUnzip b/contrib/minizip/ChangeLogUnzip
index cfabd61..d7d4b6b 100644
--- a/contrib/minizip/ChangeLogUnzip
+++ b/contrib/minizip/ChangeLogUnzip
@@ -1,3 +1,7 @@
1Change in 1.00: (10 sept 03)
2- rename to 1.00
3- cosmetic code change
4
1Change in 0.22: (19 May 03) 5Change in 0.22: (19 May 03)
2- crypting support (unless you define NOCRYPT) 6- crypting support (unless you define NOCRYPT)
3- append file in existing zipfile 7- append file in existing zipfile
diff --git a/contrib/minizip/crypt.h b/contrib/minizip/crypt.h
index a02bf0b..9c7a89c 100644
--- a/contrib/minizip/crypt.h
+++ b/contrib/minizip/crypt.h
@@ -1,3 +1,31 @@
1/* crypt.h -- base code for crypt/uncrypt ZIPfile
2
3
4 Version 1.00, September 10th, 2003
5
6 Copyright (C) 1998-2003 Gilles Vollant
7
8 This code is a modified version of crypting code in Infozip distribution
9
10 The encryption/decryption parts of this source code (as opposed to the
11 non-echoing password parts) were originally written in Europe. The
12 whole source package can be freely distributed, including from the USA.
13 (Prior to January 2000, re-export from the US was a violation of US law.)
14
15 This encryption code is a direct transcription of the algorithm from
16 Roger Schlafly, described by Phil Katz in the file appnote.txt. This
17 file (appnote.txt) is distributed with the PKZIP program (even in the
18 version without encryption capabilities).
19
20 If you don't need crypting in your application, just define symbols
21 NOCRYPT and NOUNCRYPT.
22
23 This code support the "Traditional PKWARE Encryption".
24
25 The new AES encryption added on Zip format by Winzip (see the page
26 http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
27 Encryption is not supported.
28*/
1 29
2#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) 30#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
3 31
diff --git a/contrib/minizip/ioapi.c b/contrib/minizip/ioapi.c
index ea9ee30..80443b7 100644
--- a/contrib/minizip/ioapi.c
+++ b/contrib/minizip/ioapi.c
@@ -1,7 +1,7 @@
1/* ioapi.c -- IO base function header for compress/uncompress .zip 1/* ioapi.c -- IO base function header for compress/uncompress .zip
2 files using zlib + zip or unzip API 2 files using zlib + zip or unzip API
3 3
4 Version 0.22, May 19th, 2003 4 Version 1.00, September 10th, 2003
5 5
6 Copyright (C) 1998-2003 Gilles Vollant 6 Copyright (C) 1998-2003 Gilles Vollant
7*/ 7*/
diff --git a/contrib/minizip/ioapi.h b/contrib/minizip/ioapi.h
index 13f4f21..6bc2a2c 100644
--- a/contrib/minizip/ioapi.h
+++ b/contrib/minizip/ioapi.h
@@ -1,7 +1,7 @@
1/* ioapi.h -- IO base function header for compress/uncompress .zip 1/* ioapi.h -- IO base function header for compress/uncompress .zip
2 files using zlib + zip or unzip API 2 files using zlib + zip or unzip API
3 3
4 Version 0.22, May 19th, 2003 4 Version 1.00, September 10th, 2003
5 5
6 Copyright (C) 1998-2003 Gilles Vollant 6 Copyright (C) 1998-2003 Gilles Vollant
7*/ 7*/
diff --git a/contrib/minizip/iowin32.c b/contrib/minizip/iowin32.c
index 8e6d43d..02b27cb 100644
--- a/contrib/minizip/iowin32.c
+++ b/contrib/minizip/iowin32.c
@@ -2,7 +2,7 @@
2 files using zlib + zip or unzip API 2 files using zlib + zip or unzip API
3 This IO API version uses the Win32 API (for Microsoft Windows) 3 This IO API version uses the Win32 API (for Microsoft Windows)
4 4
5 Version 0.22, May 19th, 2003 5 Version 1.00, September 10th, 2003
6 6
7 Copyright (C) 1998-2003 Gilles Vollant 7 Copyright (C) 1998-2003 Gilles Vollant
8*/ 8*/
diff --git a/contrib/minizip/iowin32.h b/contrib/minizip/iowin32.h
index 94aa1aa..c0ebd50 100644
--- a/contrib/minizip/iowin32.h
+++ b/contrib/minizip/iowin32.h
@@ -2,7 +2,7 @@
2 files using zlib + zip or unzip API 2 files using zlib + zip or unzip API
3 This IO API version uses the Win32 API (for Microsoft Windows) 3 This IO API version uses the Win32 API (for Microsoft Windows)
4 4
5 Version 0.22, May 19th, 2003 5 Version 1.00, September 10th, 2003
6 6
7 Copyright (C) 1998-2003 Gilles Vollant 7 Copyright (C) 1998-2003 Gilles Vollant
8*/ 8*/
diff --git a/contrib/minizip/miniunz.c b/contrib/minizip/miniunz.c
index 57601e1..c8cf81e 100644
--- a/contrib/minizip/miniunz.c
+++ b/contrib/minizip/miniunz.c
@@ -140,7 +140,7 @@ int makedir (newdir)
140 140
141void do_banner() 141void do_banner()
142{ 142{
143 printf("MiniUnz 0.22, demo of zLib + Unz package written by Gilles Vollant\n"); 143 printf("MiniUnz 1.00, demo of zLib + Unz package written by Gilles Vollant\n");
144 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); 144 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
145} 145}
146 146
diff --git a/contrib/minizip/minizip.c b/contrib/minizip/minizip.c
index 7e2ce36..5746f5c 100644
--- a/contrib/minizip/minizip.c
+++ b/contrib/minizip/minizip.c
@@ -120,7 +120,7 @@ int check_exist_file(filename)
120 120
121void do_banner() 121void do_banner()
122{ 122{
123 printf("MiniZip 0.22, demo of zLib + Zip package written by Gilles Vollant\n"); 123 printf("MiniZip 1.00, demo of zLib + Zip package written by Gilles Vollant\n");
124 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); 124 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
125} 125}
126 126
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c
index 81c8c28..f08f624 100644
--- a/contrib/minizip/unzip.c
+++ b/contrib/minizip/unzip.c
@@ -1,5 +1,5 @@
1/* unzip.c -- IO for uncompress .zip files using zlib 1/* unzip.c -- IO for uncompress .zip files using zlib
2 Version 0.22, May 19th, 2003 2 Version 1.00, September 10th, 2003
3 3
4 Copyright (C) 1998-2003 Gilles Vollant 4 Copyright (C) 1998-2003 Gilles Vollant
5 5
@@ -88,7 +88,7 @@ woven in by Terry Thorsen 1/2003.
88 88
89 89
90const char unz_copyright[] = 90const char unz_copyright[] =
91 " unzip 0.22 Copyright 1998-2003 Gilles Vollant - http://www.winimage.com/zLibDll"; 91 " unzip 1.00 Copyright 1998-2003 Gilles Vollant - http://www.winimage.com/zLibDll";
92 92
93/* unz_file_info_interntal contain internal info about a file in zipfile*/ 93/* unz_file_info_interntal contain internal info about a file in zipfile*/
94typedef struct unz_file_info_internal_s 94typedef struct unz_file_info_internal_s
diff --git a/contrib/minizip/unzip.h b/contrib/minizip/unzip.h
index 4c2f5e1..4e50979 100644
--- a/contrib/minizip/unzip.h
+++ b/contrib/minizip/unzip.h
@@ -1,5 +1,5 @@
1/* unzip.h -- IO for uncompress .zip files using zlib 1/* unzip.h -- IO for uncompress .zip files using zlib
2 Version 0.22, May 19th, 2003 2 Version 1.00, September 10th, 2003
3 3
4 Copyright (C) 1998-2003 Gilles Vollant 4 Copyright (C) 1998-2003 Gilles Vollant
5 5
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c
index 193c539..1a713e5 100644
--- a/contrib/minizip/zip.c
+++ b/contrib/minizip/zip.c
@@ -1,5 +1,7 @@
1/* zip.c -- IO on .zip files using zlib 1/* zip.c -- IO on .zip files using zlib
2 Version 0.22, May 19th, 2003 2 Version 1.00, September 10th, 2003
3
4 Copyright (C) 1998-2003 Gilles Vollant
3 5
4 Read zip.h for more info 6 Read zip.h for more info
5*/ 7*/
@@ -75,7 +77,7 @@
75#endif 77#endif
76#endif 78#endif
77const char zip_copyright[] = 79const char zip_copyright[] =
78 " zip 0.22 Copyright 1998-2003 Gilles Vollant - http://www.winimage.com/zLibDll"; 80 " zip 1.00 Copyright 1998-2003 Gilles Vollant - http://www.winimage.com/zLibDll";
79 81
80 82
81#define SIZEDATA_INDATABLOCK (4096-(4*4)) 83#define SIZEDATA_INDATABLOCK (4096-(4*4))
diff --git a/contrib/minizip/zip.h b/contrib/minizip/zip.h
index 5a75fc6..c37ea21 100644
--- a/contrib/minizip/zip.h
+++ b/contrib/minizip/zip.h
@@ -1,5 +1,5 @@
1/* zip.h -- IO for compress .zip files using zlib 1/* zip.h -- IO for compress .zip files using zlib
2 Version 0.22, May 19th, 2003 2 Version 1.00, September 10th, 2003
3 3
4 Copyright (C) 1998-2003 Gilles Vollant 4 Copyright (C) 1998-2003 Gilles Vollant
5 5
diff --git a/contrib/puff/puff.c b/contrib/puff/puff.c
index a30fb17..7a8116b 100644
--- a/contrib/puff/puff.c
+++ b/contrib/puff/puff.c
@@ -58,7 +58,7 @@
58 * - Add FIXLCODES #define 58 * - Add FIXLCODES #define
59 * 1.5 6 Apr 2002 - Minor comment fixes 59 * 1.5 6 Apr 2002 - Minor comment fixes
60 * 1.6 7 Aug 2002 - Minor format changes 60 * 1.6 7 Aug 2002 - Minor format changes
61 * 1.7 3 Mar 2002 - Added test code for distribution 61 * 1.7 3 Mar 2003 - Added test code for distribution
62 * - Added zlib-like license 62 * - Added zlib-like license
63 */ 63 */
64 64
diff --git a/deflate.c b/deflate.c
index 5f9b5c0..ac083ae 100644
--- a/deflate.c
+++ b/deflate.c
@@ -52,7 +52,7 @@
52#include "deflate.h" 52#include "deflate.h"
53 53
54const char deflate_copyright[] = 54const char deflate_copyright[] =
55 " deflate 1.2.0.5 Copyright 1995-2003 Jean-loup Gailly "; 55 " deflate 1.2.0.6 Copyright 1995-2003 Jean-loup Gailly ";
56/* 56/*
57 If you use the zlib library in a product, an acknowledgment is welcome 57 If you use the zlib library in a product, an acknowledgment is welcome
58 in the documentation of your product. If for some reason you cannot 58 in the documentation of your product. If for some reason you cannot
diff --git a/example.c b/example.c
index 2acc099..c2361f9 100644
--- a/example.c
+++ b/example.c
@@ -89,6 +89,9 @@ void test_gzio(fname, uncompr, uncomprLen)
89 Byte *uncompr; 89 Byte *uncompr;
90 uLong uncomprLen; 90 uLong uncomprLen;
91{ 91{
92#ifdef NO_GZCOMPRESS
93 fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n");
94#else
92 int err; 95 int err;
93 int len = (int)strlen(hello)+1; 96 int len = (int)strlen(hello)+1;
94 gzFile file; 97 gzFile file;
@@ -159,6 +162,7 @@ void test_gzio(fname, uncompr, uncomprLen)
159 } 162 }
160 163
161 gzclose(file); 164 gzclose(file);
165#endif
162} 166}
163 167
164/* =========================================================================== 168/* ===========================================================================
diff --git a/gzio.c b/gzio.c
index fc5eb50..441560e 100644
--- a/gzio.c
+++ b/gzio.c
@@ -30,6 +30,11 @@ struct internal_state {int dummy;}; /* for buggy compilers */
30# define Z_PRINTF_BUFSIZE 4096 30# define Z_PRINTF_BUFSIZE 4096
31#endif 31#endif
32 32
33#ifdef __MVS__
34# pragma map (fdopen , "\174\174FDOPEN")
35 FILE *fdopen(int, const char *);
36#endif
37
33#ifndef STDC 38#ifndef STDC
34extern voidp malloc OF((uInt size)); 39extern voidp malloc OF((uInt size));
35extern void free OF((voidpf ptr)); 40extern void free OF((voidpf ptr));
diff --git a/inffast.c b/inffast.c
index 513b1af..c716440 100644
--- a/inffast.c
+++ b/inffast.c
@@ -19,6 +19,7 @@
19 - none 19 - none
20 No measurable difference: 20 No measurable difference:
21 - Pentium III (Anderson) 21 - Pentium III (Anderson)
22 - 68060 (Nikl)
22 */ 23 */
23#ifdef POSTINC 24#ifdef POSTINC
24# define OFF 0 25# define OFF 0
diff --git a/inftrees.c b/inftrees.c
index d339ad5..204afe6 100644
--- a/inftrees.c
+++ b/inftrees.c
@@ -9,7 +9,7 @@
9#define MAXBITS 15 9#define MAXBITS 15
10 10
11const char inflate_copyright[] = 11const char inflate_copyright[] =
12 " inflate 1.2.0.5 Copyright 1995-2003 Mark Adler "; 12 " inflate 1.2.0.6 Copyright 1995-2003 Mark Adler ";
13/* 13/*
14 If you use the zlib library in a product, an acknowledgment is welcome 14 If you use the zlib library in a product, an acknowledgment is welcome
15 in the documentation of your product. If for some reason you cannot 15 in the documentation of your product. If for some reason you cannot
@@ -62,7 +62,7 @@ unsigned short FAR *work;
62 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; 62 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
63 static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 63 static const unsigned short lext[31] = { /* Length codes 257..285 extra */
64 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 64 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
65 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 192, 78}; 65 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 65, 77};
66 static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 66 static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
67 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 67 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
68 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 68 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
diff --git a/qnx/package.qpg b/qnx/package.qpg
index 26c42c3..f07311f 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.0.5" install="/opt/lib/" user="root:bin" permission="644"/> 28 <QPG:Add file="../libz.so.1.2.0.6" 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.0.5"/> 29 <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.0.6"/>
30 <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.0.5"/> 30 <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.0.6"/>
31 <QPG:Add file="../libz.so.1.2.0.5" install="/opt/lib/" component="slib"/> 31 <QPG:Add file="../libz.so.1.2.0.6" 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.0.5</QPM:ReleaseVersion> 66 <QPM:ReleaseVersion>1.2.0.6</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>
diff --git a/win32/zlib1.rc b/win32/zlib1.rc
index 138d30c..f5f2a1f 100644
--- a/win32/zlib1.rc
+++ b/win32/zlib1.rc
@@ -5,8 +5,8 @@ VS_VERSION_INFO VERSIONINFO
5#else 5#else
6VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 6VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
7#endif 7#endif
8 FILEVERSION 1,2,0,5 8 FILEVERSION 1,2,0,6
9 PRODUCTVERSION 1,2,0,5 9 PRODUCTVERSION 1,2,0,6
10 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 10 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
11#ifdef _DEBUG 11#ifdef _DEBUG
12 FILEFLAGS 1 12 FILEFLAGS 1
@@ -23,12 +23,12 @@ BEGIN
23 //language ID = U.S. English, char set = Windows, Multilingual 23 //language ID = U.S. English, char set = Windows, Multilingual
24 BEGIN 24 BEGIN
25 VALUE "FileDescription", "zlib data compression library\0" 25 VALUE "FileDescription", "zlib data compression library\0"
26 VALUE "FileVersion", "1.2.0.5\0" 26 VALUE "FileVersion", "1.2.0.6\0"
27 VALUE "InternalName", "zlib1.dll\0" 27 VALUE "InternalName", "zlib1.dll\0"
28 VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0" 28 VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0"
29 VALUE "OriginalFilename", "zlib1.dll\0" 29 VALUE "OriginalFilename", "zlib1.dll\0"
30 VALUE "ProductName", "zlib\0" 30 VALUE "ProductName", "zlib\0"
31 VALUE "ProductVersion", "1.2.0.5\0" 31 VALUE "ProductVersion", "1.2.0.6\0"
32 VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" 32 VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
33 END 33 END
34 END 34 END
diff --git a/zconf.h b/zconf.h
index 7ef861c..4301375 100644
--- a/zconf.h
+++ b/zconf.h
@@ -287,6 +287,13 @@ typedef uLong FAR uLongf;
287# define z_off_t long 287# define z_off_t long
288#endif 288#endif
289 289
290#if defined(__MVS__)
291#define NO_vsnprintf
292#ifdef FAR
293#undef FAR
294#endif
295#endif
296
290/* MVS linker does not support external names larger than 8 bytes */ 297/* MVS linker does not support external names larger than 8 bytes */
291#if defined(__MVS__) 298#if defined(__MVS__)
292# pragma map(deflateInit_,"DEIN") 299# pragma map(deflateInit_,"DEIN")
diff --git a/zconf.in.h b/zconf.in.h
index 7ef861c..4301375 100644
--- a/zconf.in.h
+++ b/zconf.in.h
@@ -287,6 +287,13 @@ typedef uLong FAR uLongf;
287# define z_off_t long 287# define z_off_t long
288#endif 288#endif
289 289
290#if defined(__MVS__)
291#define NO_vsnprintf
292#ifdef FAR
293#undef FAR
294#endif
295#endif
296
290/* MVS linker does not support external names larger than 8 bytes */ 297/* MVS linker does not support external names larger than 8 bytes */
291#if defined(__MVS__) 298#if defined(__MVS__)
292# pragma map(deflateInit_,"DEIN") 299# pragma map(deflateInit_,"DEIN")
diff --git a/zlib.3 b/zlib.3
index 2601aea..92a436a 100644
--- a/zlib.3
+++ b/zlib.3
@@ -1,4 +1,4 @@
1.TH ZLIB 3 "8 September 2003" 1.TH ZLIB 3 "13 September 2003"
2.SH NAME 2.SH NAME
3zlib \- compression/decompression library 3zlib \- compression/decompression library
4.SH SYNOPSIS 4.SH SYNOPSIS
@@ -133,7 +133,7 @@ before asking for help.
133Send questions and/or comments to zlib@gzip.org, 133Send questions and/or comments to zlib@gzip.org,
134or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). 134or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
135.SH AUTHORS 135.SH AUTHORS
136Version 1.2.0.5 136Version 1.2.0.6
137Copyright (C) 1995-2003 Jean-loup Gailly (jloup@gzip.org) 137Copyright (C) 1995-2003 Jean-loup Gailly (jloup@gzip.org)
138and Mark Adler (madler@alumni.caltech.edu). 138and Mark Adler (madler@alumni.caltech.edu).
139.LP 139.LP
diff --git a/zlib.h b/zlib.h
index 45f1bef..61a69a2 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1,5 +1,5 @@
1/* zlib.h -- interface of the 'zlib' general purpose compression library 1/* zlib.h -- interface of the 'zlib' general purpose compression library
2 version 1.2.0.5, September 8th, 2003 2 version 1.2.0.6, September 13th, 2003
3 3
4 Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler 4 Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler
5 5
@@ -37,8 +37,8 @@
37extern "C" { 37extern "C" {
38#endif 38#endif
39 39
40#define ZLIB_VERSION "1.2.0.5" 40#define ZLIB_VERSION "1.2.0.6"
41#define ZLIB_VERNUM 0x1205 41#define ZLIB_VERNUM 0x1206
42 42
43/* 43/*
44 The 'zlib' compression library provides in-memory compression and 44 The 'zlib' compression library provides in-memory compression and
@@ -777,7 +777,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm,
777 777
778 The in_desc and out_desc parameters of inflateBack() is passed as the 778 The in_desc and out_desc parameters of inflateBack() is passed as the
779 first parameter of in() and out() respectively when they are called. These 779 first parameter of in() and out() respectively when they are called. These
780 descriptors can be optinally used to pass any information that the caller- 780 descriptors can be optionally used to pass any information that the caller-
781 supplied in() and out() functions need to do their job. 781 supplied in() and out() functions need to do their job.
782 782
783 On return, inflateBack() will set strm->next_in and strm->avail_in to 783 On return, inflateBack() will set strm->next_in and strm->avail_in to