zlib 1.2.0.6
This commit is contained in:
parent
4b5a43a219
commit
f81ba93d4a
@ -1,6 +1,15 @@
|
||||
|
||||
ChangeLog file for zlib
|
||||
|
||||
Changes in 1.2.0.6 (13 September 2003)
|
||||
- Minor FAQ updates
|
||||
- Update contrib/minizip to 1.00 [Vollant]
|
||||
- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta]
|
||||
- Updated POSTINC comment for 68060 [Nikl]
|
||||
- Added contrib/infback9 with deflate64 decoding (unsupported)
|
||||
- For MVS define NO_vsnprintf and undefine FAR [van Burik]
|
||||
- Add pragma for fdopen on MVS [van Burik]
|
||||
|
||||
Changes in 1.2.0.5 (8 September 2003)
|
||||
- Add infback9 diffs to contrib
|
||||
- Add OF to inflateBackEnd() declaration in zlib.h
|
||||
|
3
FAQ
3
FAQ
@ -73,8 +73,7 @@ The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
|
||||
|
||||
10. I need a Delphi interface to zlib.
|
||||
|
||||
See the directories contrib/delphi and contrib/delphi2 in the zlib
|
||||
distribution.
|
||||
See the contrib/delphi directory in the zlib distribution.
|
||||
|
||||
11. Can zlib handle .zip archives?
|
||||
|
||||
|
4
Makefile
4
Makefile
@ -28,7 +28,7 @@ LDFLAGS=libz.a
|
||||
LDSHARED=$(CC)
|
||||
CPP=$(CC) -E
|
||||
|
||||
VER=1.2.0.5
|
||||
VER=1.2.0.6
|
||||
LIBS=libz.a
|
||||
SHAREDLIB=libz.so
|
||||
|
||||
@ -137,7 +137,7 @@ uninstall:
|
||||
mostlyclean: clean
|
||||
clean:
|
||||
rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \
|
||||
_match.s maketree
|
||||
_match.s maketree contrib/infback9/*.o
|
||||
|
||||
maintainer-clean: distclean
|
||||
distclean: clean
|
||||
|
@ -28,7 +28,7 @@ LDFLAGS=libz.a
|
||||
LDSHARED=$(CC)
|
||||
CPP=$(CC) -E
|
||||
|
||||
VER=1.2.0.5
|
||||
VER=1.2.0.6
|
||||
LIBS=libz.a
|
||||
SHAREDLIB=libz.so
|
||||
|
||||
@ -137,7 +137,7 @@ uninstall:
|
||||
mostlyclean: clean
|
||||
clean:
|
||||
rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \
|
||||
_match.s maketree
|
||||
_match.s maketree contrib/infback9/*.o
|
||||
|
||||
maintainer-clean: distclean
|
||||
distclean: clean
|
||||
|
4
README
4
README
@ -1,6 +1,6 @@
|
||||
ZLIB DATA COMPRESSION LIBRARY
|
||||
|
||||
zlib 1.2.0.5 is a general purpose data compression library. All the code is
|
||||
zlib 1.2.0.6 is a general purpose data compression library. All the code is
|
||||
thread safe. The data format used by the zlib library is described by RFCs
|
||||
(Request for Comments) 1950 to 1952 in the files
|
||||
http://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
|
||||
issue of Dr. Dobb's Journal; a copy of the article is available in
|
||||
http://dogma.net/markn/articles/zlibtool/zlibtool.htm
|
||||
|
||||
The changes made in version 1.2.0.5 are documented in the file ChangeLog.
|
||||
The changes made in version 1.2.0.6 are documented in the file ChangeLog.
|
||||
|
||||
Unsupported third party contributions are provided in directory "contrib".
|
||||
|
||||
|
@ -20,7 +20,6 @@ delphi/ by Cosmin Truta <cosmint@cs.ubbcluj.ro>
|
||||
|
||||
infback9/ by Mark Adler <madler@alumni.caltech.edu>
|
||||
Unsupported diffs to infback to decode the deflate64 format
|
||||
(Worse than that, it's not even tested)
|
||||
|
||||
inflate86/ by Chris Anderson <christop@charm.net>
|
||||
Tuned x86 gcc asm code to replace inflate_fast()
|
||||
|
605
contrib/infback9/infback9.c
Normal file
605
contrib/infback9/infback9.c
Normal file
@ -0,0 +1,605 @@
|
||||
/* infback9.c -- inflate deflate64 data using a call-back interface
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
#include "zutil.h"
|
||||
#include "infback9.h"
|
||||
#include "inftree9.h"
|
||||
#include "inflate9.h"
|
||||
|
||||
#define WSIZE 65536UL
|
||||
|
||||
/*
|
||||
strm provides memory allocation functions in zalloc and zfree, or
|
||||
Z_NULL to use the library memory allocation functions.
|
||||
|
||||
window is a user-supplied window and output buffer that is 64K bytes.
|
||||
*/
|
||||
int ZEXPORT inflateBack9Init_(strm, window, version, stream_size)
|
||||
z_stream FAR *strm;
|
||||
unsigned char FAR *window;
|
||||
const char *version;
|
||||
int stream_size;
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
|
||||
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
|
||||
stream_size != (int)(sizeof(z_stream)))
|
||||
return Z_VERSION_ERROR;
|
||||
if (strm == Z_NULL || window == Z_NULL)
|
||||
return Z_STREAM_ERROR;
|
||||
strm->msg = Z_NULL; /* in case we return an error */
|
||||
if (strm->zalloc == (alloc_func)0) {
|
||||
strm->zalloc = zcalloc;
|
||||
strm->opaque = (voidpf)0;
|
||||
}
|
||||
if (strm->zfree == (free_func)0) strm->zfree = zcfree;
|
||||
state = (struct inflate_state FAR *)ZALLOC(strm, 1,
|
||||
sizeof(struct inflate_state));
|
||||
if (state == Z_NULL) return Z_MEM_ERROR;
|
||||
Tracev((stderr, "inflate: allocated\n"));
|
||||
strm->state = (voidpf)state;
|
||||
state->window = window;
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
Build and output length and distance decoding tables for fixed code
|
||||
decoding.
|
||||
*/
|
||||
#ifdef MAKEFIXED
|
||||
#include <stdio.h>
|
||||
|
||||
void makefixed9(void)
|
||||
{
|
||||
unsigned sym, bits, low, size;
|
||||
code *next, *lenfix, *distfix;
|
||||
struct inflate_state state;
|
||||
code fixed[544];
|
||||
|
||||
/* literal/length table */
|
||||
sym = 0;
|
||||
while (sym < 144) state.lens[sym++] = 8;
|
||||
while (sym < 256) state.lens[sym++] = 9;
|
||||
while (sym < 280) state.lens[sym++] = 7;
|
||||
while (sym < 288) state.lens[sym++] = 8;
|
||||
next = fixed;
|
||||
lenfix = next;
|
||||
bits = 9;
|
||||
inflate_table9(LENS, state.lens, 288, &(next), &(bits), state.work);
|
||||
|
||||
/* distance table */
|
||||
sym = 0;
|
||||
while (sym < 32) state.lens[sym++] = 5;
|
||||
distfix = next;
|
||||
bits = 5;
|
||||
inflate_table9(DISTS, state.lens, 32, &(next), &(bits), state.work);
|
||||
|
||||
/* write tables */
|
||||
puts(" /* inffix9.h -- table for decoding deflate64 fixed codes");
|
||||
puts(" * Generated automatically by makefixed9().");
|
||||
puts(" */");
|
||||
puts("");
|
||||
puts(" /* WARNING: this file should *not* be used by applications.");
|
||||
puts(" It is part of the implementation of this library and is");
|
||||
puts(" subject to change. Applications should only use zlib.h.");
|
||||
puts(" */");
|
||||
puts("");
|
||||
size = 1U << 9;
|
||||
printf(" static const code lenfix[%u] = {", size);
|
||||
low = 0;
|
||||
for (;;) {
|
||||
if ((low % 6) == 0) printf("\n ");
|
||||
printf("{%u,%u,%d}", lenfix[low].op, lenfix[low].bits,
|
||||
lenfix[low].val);
|
||||
if (++low == size) break;
|
||||
putchar(',');
|
||||
}
|
||||
puts("\n };");
|
||||
size = 1U << 5;
|
||||
printf("\n static const code distfix[%u] = {", size);
|
||||
low = 0;
|
||||
for (;;) {
|
||||
if ((low % 5) == 0) printf("\n ");
|
||||
printf("{%u,%u,%d}", distfix[low].op, distfix[low].bits,
|
||||
distfix[low].val);
|
||||
if (++low == size) break;
|
||||
putchar(',');
|
||||
}
|
||||
puts("\n };");
|
||||
}
|
||||
#endif /* MAKEFIXED */
|
||||
|
||||
/* Macros for inflateBack(): */
|
||||
|
||||
/* Clear the input bit accumulator */
|
||||
#define INITBITS() \
|
||||
do { \
|
||||
hold = 0; \
|
||||
bits = 0; \
|
||||
} while (0)
|
||||
|
||||
/* Assure that some input is available. If input is requested, but denied,
|
||||
then return a Z_BUF_ERROR from inflateBack(). */
|
||||
#define PULL() \
|
||||
do { \
|
||||
if (have == 0) { \
|
||||
have = in(in_desc, &next); \
|
||||
if (have == 0) { \
|
||||
next = Z_NULL; \
|
||||
ret = Z_BUF_ERROR; \
|
||||
goto inf_leave; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Get a byte of input into the bit accumulator, or return from inflateBack()
|
||||
with an error if there is no input available. */
|
||||
#define PULLBYTE() \
|
||||
do { \
|
||||
PULL(); \
|
||||
have--; \
|
||||
hold += (unsigned long)(*next++) << bits; \
|
||||
bits += 8; \
|
||||
} while (0)
|
||||
|
||||
/* Assure that there are at least n bits in the bit accumulator. If there is
|
||||
not enough available input to do that, then return from inflateBack() with
|
||||
an error. */
|
||||
#define NEEDBITS(n) \
|
||||
do { \
|
||||
while (bits < (unsigned)(n)) \
|
||||
PULLBYTE(); \
|
||||
} while (0)
|
||||
|
||||
/* Return the low n bits of the bit accumulator (n <= 16) */
|
||||
#define BITS(n) \
|
||||
((unsigned)hold & ((1U << (n)) - 1))
|
||||
|
||||
/* Remove n bits from the bit accumulator */
|
||||
#define DROPBITS(n) \
|
||||
do { \
|
||||
hold >>= (n); \
|
||||
bits -= (unsigned)(n); \
|
||||
} while (0)
|
||||
|
||||
/* Remove zero to seven bits as needed to go to a byte boundary */
|
||||
#define BYTEBITS() \
|
||||
do { \
|
||||
hold >>= bits & 7; \
|
||||
bits -= bits & 7; \
|
||||
} while (0)
|
||||
|
||||
/* Assure that some output space is available, by writing out the window
|
||||
if it's full. If the write fails, return from inflateBack() with a
|
||||
Z_BUF_ERROR. */
|
||||
#define ROOM() \
|
||||
do { \
|
||||
if (left == 0) { \
|
||||
put = window; \
|
||||
left = WSIZE; \
|
||||
wrap = 1; \
|
||||
if (out(out_desc, put, (unsigned)left)) { \
|
||||
ret = Z_BUF_ERROR; \
|
||||
goto inf_leave; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
strm provides the memory allocation functions and window buffer on input,
|
||||
and provides information on the unused input on return. For Z_DATA_ERROR
|
||||
returns, strm will also provide an error message.
|
||||
|
||||
in() and out() are the call-back input and output functions. When
|
||||
inflateBack() needs more input, it calls in(). When inflateBack() has
|
||||
filled the window with output, or when it completes with data in the
|
||||
window, it calls out() to write out the data. The application must not
|
||||
change the provided input until in() is called again or inflateBack()
|
||||
returns. The application must not change the window/output buffer until
|
||||
inflateBack() returns.
|
||||
|
||||
in() and out() are called with a descriptor parameter provided in the
|
||||
inflateBack() call. This parameter can be a structure that provides the
|
||||
information required to do the read or write, as well as accumulated
|
||||
information on the input and output such as totals and check values.
|
||||
|
||||
in() should return zero on failure. out() should return non-zero on
|
||||
failure. If either in() or out() fails, than inflateBack() returns a
|
||||
Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
|
||||
was in() or out() that caused in the error. Otherwise, inflateBack()
|
||||
returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
|
||||
error, or Z_MEM_ERROR if it could not allocate memory for the state.
|
||||
inflateBack() can also return Z_STREAM_ERROR if the input parameters
|
||||
are not correct, i.e. strm is Z_NULL or the state was not initialized.
|
||||
*/
|
||||
int ZEXPORT inflateBack9(strm, in, in_desc, out, out_desc)
|
||||
z_stream FAR *strm;
|
||||
in_func in;
|
||||
void FAR *in_desc;
|
||||
out_func out;
|
||||
void FAR *out_desc;
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
unsigned char FAR *next; /* next input */
|
||||
unsigned char FAR *put; /* next output */
|
||||
unsigned have; /* available input */
|
||||
unsigned long left; /* available output */
|
||||
inflate_mode mode; /* current inflate mode */
|
||||
int lastblock; /* true if processing last block */
|
||||
int wrap; /* true if the window has wrapped */
|
||||
unsigned long write; /* window write index */
|
||||
unsigned char FAR *window; /* allocated sliding window, if needed */
|
||||
unsigned long hold; /* bit buffer */
|
||||
unsigned bits; /* bits in bit buffer */
|
||||
unsigned extra; /* extra bits needed */
|
||||
unsigned long length; /* literal or length of data to copy */
|
||||
unsigned long offset; /* distance back to copy string from */
|
||||
unsigned long copy; /* number of stored or match bytes to copy */
|
||||
unsigned char FAR *from; /* where to copy match bytes from */
|
||||
code const FAR *lencode; /* starting table for length/literal codes */
|
||||
code const FAR *distcode; /* starting table for distance codes */
|
||||
unsigned lenbits; /* index bits for lencode */
|
||||
unsigned distbits; /* index bits for distcode */
|
||||
code this; /* current decoding table entry */
|
||||
code last; /* parent table entry */
|
||||
unsigned len; /* length to copy for repeats, bits to drop */
|
||||
int ret; /* return code */
|
||||
static const unsigned short order[19] = /* permutation of code lengths */
|
||||
{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
|
||||
#include "inffix9.h"
|
||||
|
||||
/* Check that the strm exists and that the state was initialized */
|
||||
if (strm == Z_NULL || strm->state == Z_NULL)
|
||||
return Z_STREAM_ERROR;
|
||||
state = (struct inflate_state FAR *)strm->state;
|
||||
|
||||
/* Reset the state */
|
||||
strm->msg = Z_NULL;
|
||||
mode = TYPE;
|
||||
lastblock = 0;
|
||||
write = 0;
|
||||
wrap = 0;
|
||||
window = state->window;
|
||||
next = strm->next_in;
|
||||
have = next != Z_NULL ? strm->avail_in : 0;
|
||||
hold = 0;
|
||||
bits = 0;
|
||||
put = window;
|
||||
left = WSIZE;
|
||||
lencode = Z_NULL;
|
||||
distcode = Z_NULL;
|
||||
|
||||
/* Inflate until end of block marked as last */
|
||||
for (;;)
|
||||
switch (mode) {
|
||||
case TYPE:
|
||||
/* determine and dispatch block type */
|
||||
if (lastblock) {
|
||||
BYTEBITS();
|
||||
mode = DONE;
|
||||
break;
|
||||
}
|
||||
NEEDBITS(3);
|
||||
lastblock = BITS(1);
|
||||
DROPBITS(1);
|
||||
switch (BITS(2)) {
|
||||
case 0: /* stored block */
|
||||
Tracev((stderr, "inflate: stored block%s\n",
|
||||
lastblock ? " (last)" : ""));
|
||||
mode = STORED;
|
||||
break;
|
||||
case 1: /* fixed block */
|
||||
lencode = lenfix;
|
||||
lenbits = 9;
|
||||
distcode = distfix;
|
||||
distbits = 5;
|
||||
Tracev((stderr, "inflate: fixed codes block%s\n",
|
||||
lastblock ? " (last)" : ""));
|
||||
mode = LEN; /* decode codes */
|
||||
break;
|
||||
case 2: /* dynamic block */
|
||||
Tracev((stderr, "inflate: dynamic codes block%s\n",
|
||||
lastblock ? " (last)" : ""));
|
||||
mode = TABLE;
|
||||
break;
|
||||
case 3:
|
||||
strm->msg = (char *)"invalid block type";
|
||||
mode = BAD;
|
||||
}
|
||||
DROPBITS(2);
|
||||
break;
|
||||
|
||||
case STORED:
|
||||
/* get and verify stored block length */
|
||||
BYTEBITS(); /* go to byte boundary */
|
||||
NEEDBITS(32);
|
||||
if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
|
||||
strm->msg = (char *)"invalid stored block lengths";
|
||||
mode = BAD;
|
||||
break;
|
||||
}
|
||||
length = (unsigned)hold & 0xffff;
|
||||
Tracev((stderr, "inflate: stored length %u\n",
|
||||
length));
|
||||
INITBITS();
|
||||
|
||||
/* copy stored block from input to output */
|
||||
while (length != 0) {
|
||||
copy = length;
|
||||
PULL();
|
||||
ROOM();
|
||||
if (copy > have) copy = have;
|
||||
if (copy > left) copy = left;
|
||||
zmemcpy(put, next, copy);
|
||||
have -= copy;
|
||||
next += copy;
|
||||
left -= copy;
|
||||
put += copy;
|
||||
length -= copy;
|
||||
}
|
||||
Tracev((stderr, "inflate: stored end\n"));
|
||||
mode = TYPE;
|
||||
break;
|
||||
|
||||
case TABLE:
|
||||
/* get dynamic table entries descriptor */
|
||||
NEEDBITS(14);
|
||||
state->nlen = BITS(5) + 257;
|
||||
DROPBITS(5);
|
||||
state->ndist = BITS(5) + 1;
|
||||
DROPBITS(5);
|
||||
state->ncode = BITS(4) + 4;
|
||||
DROPBITS(4);
|
||||
if (state->nlen > 286) {
|
||||
strm->msg = (char *)"too many length symbols";
|
||||
mode = BAD;
|
||||
break;
|
||||
}
|
||||
Tracev((stderr, "inflate: table sizes ok\n"));
|
||||
|
||||
/* get code length code lengths (not a typo) */
|
||||
state->have = 0;
|
||||
while (state->have < state->ncode) {
|
||||
NEEDBITS(3);
|
||||
state->lens[order[state->have++]] = (unsigned short)BITS(3);
|
||||
DROPBITS(3);
|
||||
}
|
||||
while (state->have < 19)
|
||||
state->lens[order[state->have++]] = 0;
|
||||
state->next = state->codes;
|
||||
lencode = (code const FAR *)(state->next);
|
||||
lenbits = 7;
|
||||
ret = inflate_table9(CODES, state->lens, 19, &(state->next),
|
||||
&(lenbits), state->work);
|
||||
if (ret) {
|
||||
strm->msg = (char *)"invalid code lengths set";
|
||||
mode = BAD;
|
||||
break;
|
||||
}
|
||||
Tracev((stderr, "inflate: code lengths ok\n"));
|
||||
|
||||
/* get length and distance code code lengths */
|
||||
state->have = 0;
|
||||
while (state->have < state->nlen + state->ndist) {
|
||||
for (;;) {
|
||||
this = lencode[BITS(lenbits)];
|
||||
if ((unsigned)(this.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
if (this.val < 16) {
|
||||
NEEDBITS(this.bits);
|
||||
DROPBITS(this.bits);
|
||||
state->lens[state->have++] = this.val;
|
||||
}
|
||||
else {
|
||||
if (this.val == 16) {
|
||||
NEEDBITS(this.bits + 2);
|
||||
DROPBITS(this.bits);
|
||||
if (state->have == 0) {
|
||||
strm->msg = (char *)"invalid bit length repeat";
|
||||
mode = BAD;
|
||||
break;
|
||||
}
|
||||
len = (unsigned)(state->lens[state->have - 1]);
|
||||
copy = 3 + BITS(2);
|
||||
DROPBITS(2);
|
||||
}
|
||||
else if (this.val == 17) {
|
||||
NEEDBITS(this.bits + 3);
|
||||
DROPBITS(this.bits);
|
||||
len = 0;
|
||||
copy = 3 + BITS(3);
|
||||
DROPBITS(3);
|
||||
}
|
||||
else {
|
||||
NEEDBITS(this.bits + 7);
|
||||
DROPBITS(this.bits);
|
||||
len = 0;
|
||||
copy = 11 + BITS(7);
|
||||
DROPBITS(7);
|
||||
}
|
||||
if (state->have + copy > state->nlen + state->ndist) {
|
||||
strm->msg = (char *)"invalid bit length repeat";
|
||||
mode = BAD;
|
||||
break;
|
||||
}
|
||||
while (copy--)
|
||||
state->lens[state->have++] = (unsigned short)len;
|
||||
}
|
||||
}
|
||||
|
||||
/* build code tables */
|
||||
state->next = state->codes;
|
||||
lencode = (code const FAR *)(state->next);
|
||||
lenbits = 9;
|
||||
ret = inflate_table9(LENS, state->lens, state->nlen,
|
||||
&(state->next), &(lenbits), state->work);
|
||||
if (ret) {
|
||||
strm->msg = (char *)"invalid literal/lengths set";
|
||||
mode = BAD;
|
||||
break;
|
||||
}
|
||||
distcode = (code const FAR *)(state->next);
|
||||
distbits = 6;
|
||||
ret = inflate_table9(DISTS, state->lens + state->nlen,
|
||||
state->ndist, &(state->next), &(distbits),
|
||||
state->work);
|
||||
if (ret) {
|
||||
strm->msg = (char *)"invalid distances set";
|
||||
mode = BAD;
|
||||
break;
|
||||
}
|
||||
Tracev((stderr, "inflate: codes ok\n"));
|
||||
mode = LEN;
|
||||
|
||||
case LEN:
|
||||
/* get a literal, length, or end-of-block code */
|
||||
for (;;) {
|
||||
this = lencode[BITS(lenbits)];
|
||||
if ((unsigned)(this.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
if (this.op && (this.op & 0xf0) == 0) {
|
||||
last = this;
|
||||
for (;;) {
|
||||
this = lencode[last.val +
|
||||
(BITS(last.bits + last.op) >> last.bits)];
|
||||
if ((unsigned)(last.bits + this.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
DROPBITS(last.bits);
|
||||
}
|
||||
DROPBITS(this.bits);
|
||||
length = (unsigned)this.val;
|
||||
|
||||
/* process literal */
|
||||
if (this.op == 0) {
|
||||
Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
|
||||
"inflate: literal '%c'\n" :
|
||||
"inflate: literal 0x%02x\n", this.val));
|
||||
ROOM();
|
||||
*put++ = (unsigned char)(length);
|
||||
left--;
|
||||
mode = LEN;
|
||||
break;
|
||||
}
|
||||
|
||||
/* process end of block */
|
||||
if (this.op & 32) {
|
||||
Tracevv((stderr, "inflate: end of block\n"));
|
||||
mode = TYPE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* invalid code */
|
||||
if (this.op & 64) {
|
||||
strm->msg = (char *)"invalid literal/length code";
|
||||
mode = BAD;
|
||||
break;
|
||||
}
|
||||
|
||||
/* length code -- get extra bits, if any */
|
||||
extra = (unsigned)(this.op) & 31;
|
||||
if (extra != 0) {
|
||||
NEEDBITS(extra);
|
||||
length += BITS(extra);
|
||||
DROPBITS(extra);
|
||||
}
|
||||
Tracevv((stderr, "inflate: length %u\n", length));
|
||||
|
||||
/* get distance code */
|
||||
for (;;) {
|
||||
this = distcode[BITS(distbits)];
|
||||
if ((unsigned)(this.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
if ((this.op & 0xf0) == 0) {
|
||||
last = this;
|
||||
for (;;) {
|
||||
this = distcode[last.val +
|
||||
(BITS(last.bits + last.op) >> last.bits)];
|
||||
if ((unsigned)(last.bits + this.bits) <= bits) break;
|
||||
PULLBYTE();
|
||||
}
|
||||
DROPBITS(last.bits);
|
||||
}
|
||||
DROPBITS(this.bits);
|
||||
if (this.op & 64) {
|
||||
strm->msg = (char *)"invalid distance code";
|
||||
mode = BAD;
|
||||
break;
|
||||
}
|
||||
offset = (unsigned)this.val;
|
||||
|
||||
/* get distance extra bits, if any */
|
||||
extra = (unsigned)(this.op) & 15;
|
||||
if (extra != 0) {
|
||||
NEEDBITS(extra);
|
||||
offset += BITS(extra);
|
||||
DROPBITS(extra);
|
||||
}
|
||||
if (offset > WSIZE - (wrap ? 0: left)) {
|
||||
strm->msg = (char *)"invalid distance too far back";
|
||||
mode = BAD;
|
||||
break;
|
||||
}
|
||||
Tracevv((stderr, "inflate: distance %u\n", offset));
|
||||
|
||||
/* copy match from window to output */
|
||||
do {
|
||||
ROOM();
|
||||
copy = WSIZE - offset;
|
||||
if (copy < left) {
|
||||
from = put + copy;
|
||||
copy = left - copy;
|
||||
}
|
||||
else {
|
||||
from = put - offset;
|
||||
copy = left;
|
||||
}
|
||||
if (copy > length) copy = length;
|
||||
length -= copy;
|
||||
left -= copy;
|
||||
do {
|
||||
*put++ = *from++;
|
||||
} while (--copy);
|
||||
} while (length != 0);
|
||||
break;
|
||||
|
||||
case DONE:
|
||||
/* inflate stream terminated properly -- write leftover output */
|
||||
ret = Z_STREAM_END;
|
||||
if (left < WSIZE) {
|
||||
if (out(out_desc, window, (unsigned)(WSIZE - left)))
|
||||
ret = Z_BUF_ERROR;
|
||||
}
|
||||
goto inf_leave;
|
||||
|
||||
case BAD:
|
||||
ret = Z_DATA_ERROR;
|
||||
goto inf_leave;
|
||||
|
||||
default: /* can't happen, but makes compilers happy */
|
||||
ret = Z_STREAM_ERROR;
|
||||
goto inf_leave;
|
||||
}
|
||||
|
||||
/* Return unused input */
|
||||
inf_leave:
|
||||
strm->next_in = next;
|
||||
strm->avail_in = have;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ZEXPORT inflateBack9End(strm)
|
||||
z_stream FAR *strm;
|
||||
{
|
||||
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
|
||||
return Z_STREAM_ERROR;
|
||||
ZFREE(strm, strm->state);
|
||||
strm->state = Z_NULL;
|
||||
Tracev((stderr, "inflate: end\n"));
|
||||
return Z_OK;
|
||||
}
|
@ -1,427 +0,0 @@
|
||||
*** infback.c Mon Aug 11 16:48:06 2003
|
||||
--- infback9.c Mon Sep 8 21:22:46 2003
|
||||
***************
|
||||
*** 1,19 ****
|
||||
! /* infback.c -- inflate using a call-back interface
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
- /*
|
||||
- This code is largely copied from inflate.c. Normally either infback.o or
|
||||
- inflate.o would be linked into an application--not both. The interface
|
||||
- with inffast.c is retained so that optimized assembler-coded versions of
|
||||
- inflate_fast() can be used with either inflate.c or infback.c.
|
||||
- */
|
||||
-
|
||||
#include "zutil.h"
|
||||
! #include "inftrees.h"
|
||||
#include "inflate.h"
|
||||
- #include "inffast.h"
|
||||
|
||||
/* function prototypes */
|
||||
local void fixedtables OF((struct inflate_state FAR *state));
|
||||
--- 1,12 ----
|
||||
! /* infback9.c -- inflate deflate64 data using a call-back interface
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
#include "zutil.h"
|
||||
! #include "infback9.h"
|
||||
! #include "inftree9.h"
|
||||
#include "inflate.h"
|
||||
|
||||
/* function prototypes */
|
||||
local void fixedtables OF((struct inflate_state FAR *state));
|
||||
***************
|
||||
*** 22,33 ****
|
||||
strm provides memory allocation functions in zalloc and zfree, or
|
||||
Z_NULL to use the library memory allocation functions.
|
||||
|
||||
! windowBits is in the range 8..15, and window is a user-supplied
|
||||
! window and output buffer that is 2**windowBits bytes.
|
||||
*/
|
||||
! int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
|
||||
z_stream FAR *strm;
|
||||
- int windowBits;
|
||||
unsigned char FAR *window;
|
||||
const char *version;
|
||||
int stream_size;
|
||||
--- 15,24 ----
|
||||
strm provides memory allocation functions in zalloc and zfree, or
|
||||
Z_NULL to use the library memory allocation functions.
|
||||
|
||||
! window is a user-supplied window and output buffer that is 64K bytes.
|
||||
*/
|
||||
! int ZEXPORT inflateBack9Init_(strm, window, version, stream_size)
|
||||
z_stream FAR *strm;
|
||||
unsigned char FAR *window;
|
||||
const char *version;
|
||||
int stream_size;
|
||||
***************
|
||||
*** 37,44 ****
|
||||
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
|
||||
stream_size != (int)(sizeof(z_stream)))
|
||||
return Z_VERSION_ERROR;
|
||||
! if (strm == Z_NULL || window == Z_NULL ||
|
||||
! windowBits < 8 || windowBits > 15)
|
||||
return Z_STREAM_ERROR;
|
||||
strm->msg = Z_NULL; /* in case we return an error */
|
||||
if (strm->zalloc == (alloc_func)0) {
|
||||
--- 28,34 ----
|
||||
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
|
||||
stream_size != (int)(sizeof(z_stream)))
|
||||
return Z_VERSION_ERROR;
|
||||
! if (strm == Z_NULL || window == Z_NULL)
|
||||
return Z_STREAM_ERROR;
|
||||
strm->msg = Z_NULL; /* in case we return an error */
|
||||
if (strm->zalloc == (alloc_func)0) {
|
||||
***************
|
||||
*** 51,58 ****
|
||||
if (state == Z_NULL) return Z_MEM_ERROR;
|
||||
Tracev((stderr, "inflate: allocated\n"));
|
||||
strm->state = (voidpf)state;
|
||||
! state->wbits = windowBits;
|
||||
! state->wsize = 1U << windowBits;
|
||||
state->window = window;
|
||||
state->write = 0;
|
||||
state->whave = 0;
|
||||
--- 41,48 ----
|
||||
if (state == Z_NULL) return Z_MEM_ERROR;
|
||||
Tracev((stderr, "inflate: allocated\n"));
|
||||
strm->state = (voidpf)state;
|
||||
! state->wbits = 16;
|
||||
! state->wsize = 1U << 16;
|
||||
state->window = window;
|
||||
state->write = 0;
|
||||
state->whave = 0;
|
||||
***************
|
||||
*** 91,110 ****
|
||||
next = fixed;
|
||||
lenfix = next;
|
||||
bits = 9;
|
||||
! inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
|
||||
|
||||
/* distance table */
|
||||
sym = 0;
|
||||
while (sym < 32) state->lens[sym++] = 5;
|
||||
distfix = next;
|
||||
bits = 5;
|
||||
! inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
|
||||
|
||||
/* do this just once */
|
||||
virgin = 0;
|
||||
}
|
||||
#else /* !BUILDFIXED */
|
||||
! # include "inffixed.h"
|
||||
#endif /* BUILDFIXED */
|
||||
state->lencode = lenfix;
|
||||
state->lenbits = 9;
|
||||
--- 81,100 ----
|
||||
next = fixed;
|
||||
lenfix = next;
|
||||
bits = 9;
|
||||
! inflate_table9(LENS, state->lens, 288, &(next), &(bits), state->work);
|
||||
|
||||
/* distance table */
|
||||
sym = 0;
|
||||
while (sym < 32) state->lens[sym++] = 5;
|
||||
distfix = next;
|
||||
bits = 5;
|
||||
! inflate_table9(DISTS, state->lens, 32, &(next), &(bits), state->work);
|
||||
|
||||
/* do this just once */
|
||||
virgin = 0;
|
||||
}
|
||||
#else /* !BUILDFIXED */
|
||||
! # include "inffix9.h"
|
||||
#endif /* BUILDFIXED */
|
||||
state->lencode = lenfix;
|
||||
state->lenbits = 9;
|
||||
***************
|
||||
*** 114,141 ****
|
||||
|
||||
/* Macros for inflateBack(): */
|
||||
|
||||
- /* Load returned state from inflate_fast() */
|
||||
- #define LOAD() \
|
||||
- do { \
|
||||
- put = strm->next_out; \
|
||||
- left = strm->avail_out; \
|
||||
- next = strm->next_in; \
|
||||
- have = strm->avail_in; \
|
||||
- hold = state->hold; \
|
||||
- bits = state->bits; \
|
||||
- } while (0)
|
||||
-
|
||||
- /* Set state from registers for inflate_fast() */
|
||||
- #define RESTORE() \
|
||||
- do { \
|
||||
- strm->next_out = put; \
|
||||
- strm->avail_out = left; \
|
||||
- strm->next_in = next; \
|
||||
- strm->avail_in = have; \
|
||||
- state->hold = hold; \
|
||||
- state->bits = bits; \
|
||||
- } while (0)
|
||||
-
|
||||
/* Clear the input bit accumulator */
|
||||
#define INITBITS() \
|
||||
do { \
|
||||
--- 104,109 ----
|
||||
***************
|
||||
*** 237,243 ****
|
||||
inflateBack() can also return Z_STREAM_ERROR if the input parameters
|
||||
are not correct, i.e. strm is Z_NULL or the state was not initialized.
|
||||
*/
|
||||
! int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
|
||||
z_stream FAR *strm;
|
||||
in_func in;
|
||||
void FAR *in_desc;
|
||||
--- 205,211 ----
|
||||
inflateBack() can also return Z_STREAM_ERROR if the input parameters
|
||||
are not correct, i.e. strm is Z_NULL or the state was not initialized.
|
||||
*/
|
||||
! int ZEXPORT inflateBack9(strm, in, in_desc, out, out_desc)
|
||||
z_stream FAR *strm;
|
||||
in_func in;
|
||||
void FAR *in_desc;
|
||||
***************
|
||||
*** 354,366 ****
|
||||
DROPBITS(5);
|
||||
state->ncode = BITS(4) + 4;
|
||||
DROPBITS(4);
|
||||
! #ifndef PKZIP_BUG_WORKAROUND
|
||||
! if (state->nlen > 286 || state->ndist > 30) {
|
||||
! strm->msg = (char *)"too many length or distance symbols";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
- #endif
|
||||
Tracev((stderr, "inflate: table sizes ok\n"));
|
||||
|
||||
/* get code length code lengths (not a typo) */
|
||||
--- 322,332 ----
|
||||
DROPBITS(5);
|
||||
state->ncode = BITS(4) + 4;
|
||||
DROPBITS(4);
|
||||
! if (state->nlen > 286) {
|
||||
! strm->msg = (char *)"too many length symbols";
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
Tracev((stderr, "inflate: table sizes ok\n"));
|
||||
|
||||
/* get code length code lengths (not a typo) */
|
||||
***************
|
||||
*** 375,381 ****
|
||||
state->next = state->codes;
|
||||
state->lencode = (code const FAR *)(state->next);
|
||||
state->lenbits = 7;
|
||||
! ret = inflate_table(CODES, state->lens, 19, &(state->next),
|
||||
&(state->lenbits), state->work);
|
||||
if (ret) {
|
||||
strm->msg = (char *)"invalid code lengths set";
|
||||
--- 341,347 ----
|
||||
state->next = state->codes;
|
||||
state->lencode = (code const FAR *)(state->next);
|
||||
state->lenbits = 7;
|
||||
! ret = inflate_table9(CODES, state->lens, 19, &(state->next),
|
||||
&(state->lenbits), state->work);
|
||||
if (ret) {
|
||||
strm->msg = (char *)"invalid code lengths set";
|
||||
***************
|
||||
*** 438,445 ****
|
||||
state->next = state->codes;
|
||||
state->lencode = (code const FAR *)(state->next);
|
||||
state->lenbits = 9;
|
||||
! ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
|
||||
! &(state->lenbits), state->work);
|
||||
if (ret) {
|
||||
strm->msg = (char *)"invalid literal/lengths set";
|
||||
state->mode = BAD;
|
||||
--- 404,411 ----
|
||||
state->next = state->codes;
|
||||
state->lencode = (code const FAR *)(state->next);
|
||||
state->lenbits = 9;
|
||||
! ret = inflate_table9(LENS, state->lens, state->nlen,
|
||||
! &(state->next), &(state->lenbits), state->work);
|
||||
if (ret) {
|
||||
strm->msg = (char *)"invalid literal/lengths set";
|
||||
state->mode = BAD;
|
||||
***************
|
||||
*** 447,454 ****
|
||||
}
|
||||
state->distcode = (code const FAR *)(state->next);
|
||||
state->distbits = 6;
|
||||
! ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
|
||||
! &(state->next), &(state->distbits), state->work);
|
||||
if (ret) {
|
||||
strm->msg = (char *)"invalid distances set";
|
||||
state->mode = BAD;
|
||||
--- 413,421 ----
|
||||
}
|
||||
state->distcode = (code const FAR *)(state->next);
|
||||
state->distbits = 6;
|
||||
! ret = inflate_table9(DISTS, state->lens + state->nlen,
|
||||
! state->ndist, &(state->next), &(state->distbits),
|
||||
! state->work);
|
||||
if (ret) {
|
||||
strm->msg = (char *)"invalid distances set";
|
||||
state->mode = BAD;
|
||||
***************
|
||||
*** 458,473 ****
|
||||
state->mode = LEN;
|
||||
|
||||
case LEN:
|
||||
- /* use inflate_fast() if we have enough input and output */
|
||||
- if (have >= 6 && left >= 258) {
|
||||
- RESTORE();
|
||||
- if (state->whave < state->wsize)
|
||||
- state->whave = state->wsize - left;
|
||||
- inflate_fast(strm, state->wsize);
|
||||
- LOAD();
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
/* get a literal, length, or end-of-block code */
|
||||
for (;;) {
|
||||
this = state->lencode[BITS(state->lenbits)];
|
||||
--- 425,430 ----
|
||||
***************
|
||||
*** 607,613 ****
|
||||
return ret;
|
||||
}
|
||||
|
||||
! int ZEXPORT inflateBackEnd(strm)
|
||||
z_stream FAR *strm;
|
||||
{
|
||||
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
|
||||
--- 564,570 ----
|
||||
return ret;
|
||||
}
|
||||
|
||||
! int ZEXPORT inflateBack9End(strm)
|
||||
z_stream FAR *strm;
|
||||
{
|
||||
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
|
||||
*** inftrees.c Sun Sep 7 10:59:10 2003
|
||||
--- inftree9.c Mon Sep 8 20:54:36 2003
|
||||
***************
|
||||
*** 1,15 ****
|
||||
! /* inftrees.c -- generate Huffman trees for efficient decoding
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
#include "zutil.h"
|
||||
! #include "inftrees.h"
|
||||
|
||||
#define MAXBITS 15
|
||||
|
||||
! const char inflate_copyright[] =
|
||||
! " inflate 1.2.0.5 Copyright 1995-2003 Mark Adler ";
|
||||
/*
|
||||
If you use the zlib library in a product, an acknowledgment is welcome
|
||||
in the documentation of your product. If for some reason you cannot
|
||||
--- 1,15 ----
|
||||
! /* inftree9.c -- generate Huffman trees for efficient decoding
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
#include "zutil.h"
|
||||
! #include "inftree9.h"
|
||||
|
||||
#define MAXBITS 15
|
||||
|
||||
! const char inflate9_copyright[] =
|
||||
! " inflate9 1.2.0.5 Copyright 1995-2003 Mark Adler ";
|
||||
/*
|
||||
If you use the zlib library in a product, an acknowledgment is welcome
|
||||
in the documentation of your product. If for some reason you cannot
|
||||
***************
|
||||
*** 29,35 ****
|
||||
table index bits. It will differ if the request is greater than the
|
||||
longest code or if it is less than the shortest code.
|
||||
*/
|
||||
! int inflate_table(type, lens, codes, table, bits, work)
|
||||
codetype type;
|
||||
unsigned short FAR *lens;
|
||||
unsigned codes;
|
||||
--- 29,35 ----
|
||||
table index bits. It will differ if the request is greater than the
|
||||
longest code or if it is less than the shortest code.
|
||||
*/
|
||||
! int inflate_table9(type, lens, codes, table, bits, work)
|
||||
codetype type;
|
||||
unsigned short FAR *lens;
|
||||
unsigned codes;
|
||||
***************
|
||||
*** 59,76 ****
|
||||
unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
|
||||
static const unsigned short lbase[31] = { /* Length codes 257..285 base */
|
||||
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
|
||||
! 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
|
||||
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
||||
! 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 192, 78};
|
||||
! static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
||||
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
||||
! 8193, 12289, 16385, 24577, 0, 0};
|
||||
! static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
|
||||
16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
|
||||
23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
|
||||
! 28, 28, 29, 29, 64, 64};
|
||||
|
||||
/*
|
||||
Process a set of code lengths to create a canonical Huffman code. The
|
||||
--- 59,76 ----
|
||||
unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
|
||||
static const unsigned short lbase[31] = { /* Length codes 257..285 base */
|
||||
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
|
||||
! 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 3, 0, 0};
|
||||
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
||||
! 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 32, 192, 78};
|
||||
! static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
||||
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
||||
! 8193, 12289, 16385, 24577, 32769, 49153};
|
||||
! static const unsigned short dext[32] = { /* Distance codes 0..31 extra */
|
||||
16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
|
||||
23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
|
||||
! 28, 28, 29, 29, 30, 30};
|
||||
|
||||
/*
|
||||
Process a set of code lengths to create a canonical Huffman code. The
|
||||
*** inftrees.h Sun Aug 10 15:15:50 2003
|
||||
--- inftree9.h Mon Sep 8 20:54:51 2003
|
||||
***************
|
||||
*** 1,4 ****
|
||||
! /* inftrees.h -- header to use inftrees.c
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
--- 1,4 ----
|
||||
! /* inftree9.h -- header to use inftree9.c
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
***************
|
||||
*** 50,55 ****
|
||||
DISTS
|
||||
} codetype;
|
||||
|
||||
! extern int inflate_table OF((codetype type, unsigned short FAR *lens,
|
||||
unsigned codes, code FAR * FAR *table,
|
||||
unsigned FAR *bits, unsigned short FAR *work));
|
||||
--- 50,55 ----
|
||||
DISTS
|
||||
} codetype;
|
||||
|
||||
! extern int inflate_table9 OF((codetype type, unsigned short FAR *lens,
|
||||
unsigned codes, code FAR * FAR *table,
|
||||
unsigned FAR *bits, unsigned short FAR *work));
|
@ -7,10 +7,13 @@
|
||||
* This header file and associated patches provide a decoder for PKWare's
|
||||
* undocumented deflate64 compression method (method 9). Use with infback9.c,
|
||||
* inftree9.h, inftree9.c, and inffix9.h. These patches are not supported.
|
||||
* This code will almost certainly not work on 16-bit architectures. See the
|
||||
* This should be compiled with zlib, since it uses zutil.h and zutil.o.
|
||||
* This code has not yet been tested on 16-bit architectures. See the
|
||||
* comments in zlib.h for inflateBack() usage. These functions are used
|
||||
* identically, except that there is no windowBits parameter, and a 64K
|
||||
* window must be provided. zlib.h must be included before this header file.
|
||||
* window must be provided. Also if int's are 16 bits, then a zero for
|
||||
* the third parameter of the "out" function actually means 65536UL.
|
||||
* zlib.h must be included before this header file.
|
||||
*/
|
||||
|
||||
ZEXTERN int ZEXPORT inflateBack9 OF((z_stream FAR *strm,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* inffix9.h -- table for decoding fixed codes
|
||||
* Generated automatically by makefixed().
|
||||
/* inffix9.h -- table for decoding deflate64 fixed codes
|
||||
* Generated automatically by makefixed9().
|
||||
*/
|
||||
|
||||
/* WARNING: this file should *not* be used by applications.
|
||||
@ -8,87 +8,100 @@
|
||||
*/
|
||||
|
||||
static const code lenfix[512] = {
|
||||
{96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
|
||||
{0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
|
||||
{0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
|
||||
{0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
|
||||
{0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
|
||||
{21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
|
||||
{0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
|
||||
{0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
|
||||
{18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
|
||||
{0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
|
||||
{0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
|
||||
{0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
|
||||
{20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
|
||||
{0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
|
||||
{0,8,22},{192,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
|
||||
{0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
|
||||
{16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
|
||||
{0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
|
||||
{0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
|
||||
{0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
|
||||
{0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
|
||||
{0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
|
||||
{0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
|
||||
{0,8,85},{0,8,21},{32,8,3},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
|
||||
{17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
|
||||
{0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
|
||||
{0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
|
||||
{0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
|
||||
{19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
|
||||
{0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
|
||||
{0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
|
||||
{0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
|
||||
{16,7,5},{0,8,87},{0,8,23},{78,8,0},{19,7,51},{0,8,119},{0,8,55},
|
||||
{0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
|
||||
{0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
|
||||
{0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
|
||||
{0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
|
||||
{20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
|
||||
{0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
|
||||
{0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
|
||||
{17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
|
||||
{0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
|
||||
{0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
|
||||
{0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
|
||||
{20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
|
||||
{0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
|
||||
{0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
|
||||
{0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
|
||||
{16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
|
||||
{0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
|
||||
{0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{192,8,0},{19,7,51},
|
||||
{0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
|
||||
{0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
|
||||
{0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
|
||||
{0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
|
||||
{0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
|
||||
{16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
|
||||
{0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
|
||||
{0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
|
||||
{0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{32,8,3},
|
||||
{19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
|
||||
{0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
|
||||
{0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
|
||||
{0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
|
||||
{16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
|
||||
{0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
|
||||
{0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
|
||||
{0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
|
||||
{0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
|
||||
{78,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
|
||||
{0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
|
||||
{0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
|
||||
{18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
|
||||
{0,9,255}
|
||||
{96,7,0},{0,8,80},{0,8,16},{132,8,115},{130,7,31},{0,8,112},
|
||||
{0,8,48},{0,9,192},{128,7,10},{0,8,96},{0,8,32},{0,9,160},
|
||||
{0,8,0},{0,8,128},{0,8,64},{0,9,224},{128,7,6},{0,8,88},
|
||||
{0,8,24},{0,9,144},{131,7,59},{0,8,120},{0,8,56},{0,9,208},
|
||||
{129,7,17},{0,8,104},{0,8,40},{0,9,176},{0,8,8},{0,8,136},
|
||||
{0,8,72},{0,9,240},{128,7,4},{0,8,84},{0,8,20},{133,8,227},
|
||||
{131,7,43},{0,8,116},{0,8,52},{0,9,200},{129,7,13},{0,8,100},
|
||||
{0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},
|
||||
{128,7,8},{0,8,92},{0,8,28},{0,9,152},{132,7,83},{0,8,124},
|
||||
{0,8,60},{0,9,216},{130,7,23},{0,8,108},{0,8,44},{0,9,184},
|
||||
{0,8,12},{0,8,140},{0,8,76},{0,9,248},{128,7,3},{0,8,82},
|
||||
{0,8,18},{133,8,163},{131,7,35},{0,8,114},{0,8,50},{0,9,196},
|
||||
{129,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},{0,8,130},
|
||||
{0,8,66},{0,9,228},{128,7,7},{0,8,90},{0,8,26},{0,9,148},
|
||||
{132,7,67},{0,8,122},{0,8,58},{0,9,212},{130,7,19},{0,8,106},
|
||||
{0,8,42},{0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},
|
||||
{128,7,5},{0,8,86},{0,8,22},{65,8,0},{131,7,51},{0,8,118},
|
||||
{0,8,54},{0,9,204},{129,7,15},{0,8,102},{0,8,38},{0,9,172},
|
||||
{0,8,6},{0,8,134},{0,8,70},{0,9,236},{128,7,9},{0,8,94},
|
||||
{0,8,30},{0,9,156},{132,7,99},{0,8,126},{0,8,62},{0,9,220},
|
||||
{130,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
|
||||
{0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{133,8,131},
|
||||
{130,7,31},{0,8,113},{0,8,49},{0,9,194},{128,7,10},{0,8,97},
|
||||
{0,8,33},{0,9,162},{0,8,1},{0,8,129},{0,8,65},{0,9,226},
|
||||
{128,7,6},{0,8,89},{0,8,25},{0,9,146},{131,7,59},{0,8,121},
|
||||
{0,8,57},{0,9,210},{129,7,17},{0,8,105},{0,8,41},{0,9,178},
|
||||
{0,8,9},{0,8,137},{0,8,73},{0,9,242},{128,7,4},{0,8,85},
|
||||
{0,8,21},{144,8,3},{131,7,43},{0,8,117},{0,8,53},{0,9,202},
|
||||
{129,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},
|
||||
{0,8,69},{0,9,234},{128,7,8},{0,8,93},{0,8,29},{0,9,154},
|
||||
{132,7,83},{0,8,125},{0,8,61},{0,9,218},{130,7,23},{0,8,109},
|
||||
{0,8,45},{0,9,186},{0,8,13},{0,8,141},{0,8,77},{0,9,250},
|
||||
{128,7,3},{0,8,83},{0,8,19},{133,8,195},{131,7,35},{0,8,115},
|
||||
{0,8,51},{0,9,198},{129,7,11},{0,8,99},{0,8,35},{0,9,166},
|
||||
{0,8,3},{0,8,131},{0,8,67},{0,9,230},{128,7,7},{0,8,91},
|
||||
{0,8,27},{0,9,150},{132,7,67},{0,8,123},{0,8,59},{0,9,214},
|
||||
{130,7,19},{0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},
|
||||
{0,8,75},{0,9,246},{128,7,5},{0,8,87},{0,8,23},{77,8,0},
|
||||
{131,7,51},{0,8,119},{0,8,55},{0,9,206},{129,7,15},{0,8,103},
|
||||
{0,8,39},{0,9,174},{0,8,7},{0,8,135},{0,8,71},{0,9,238},
|
||||
{128,7,9},{0,8,95},{0,8,31},{0,9,158},{132,7,99},{0,8,127},
|
||||
{0,8,63},{0,9,222},{130,7,27},{0,8,111},{0,8,47},{0,9,190},
|
||||
{0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},
|
||||
{0,8,16},{132,8,115},{130,7,31},{0,8,112},{0,8,48},{0,9,193},
|
||||
{128,7,10},{0,8,96},{0,8,32},{0,9,161},{0,8,0},{0,8,128},
|
||||
{0,8,64},{0,9,225},{128,7,6},{0,8,88},{0,8,24},{0,9,145},
|
||||
{131,7,59},{0,8,120},{0,8,56},{0,9,209},{129,7,17},{0,8,104},
|
||||
{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},{0,9,241},
|
||||
{128,7,4},{0,8,84},{0,8,20},{133,8,227},{131,7,43},{0,8,116},
|
||||
{0,8,52},{0,9,201},{129,7,13},{0,8,100},{0,8,36},{0,9,169},
|
||||
{0,8,4},{0,8,132},{0,8,68},{0,9,233},{128,7,8},{0,8,92},
|
||||
{0,8,28},{0,9,153},{132,7,83},{0,8,124},{0,8,60},{0,9,217},
|
||||
{130,7,23},{0,8,108},{0,8,44},{0,9,185},{0,8,12},{0,8,140},
|
||||
{0,8,76},{0,9,249},{128,7,3},{0,8,82},{0,8,18},{133,8,163},
|
||||
{131,7,35},{0,8,114},{0,8,50},{0,9,197},{129,7,11},{0,8,98},
|
||||
{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
|
||||
{128,7,7},{0,8,90},{0,8,26},{0,9,149},{132,7,67},{0,8,122},
|
||||
{0,8,58},{0,9,213},{130,7,19},{0,8,106},{0,8,42},{0,9,181},
|
||||
{0,8,10},{0,8,138},{0,8,74},{0,9,245},{128,7,5},{0,8,86},
|
||||
{0,8,22},{65,8,0},{131,7,51},{0,8,118},{0,8,54},{0,9,205},
|
||||
{129,7,15},{0,8,102},{0,8,38},{0,9,173},{0,8,6},{0,8,134},
|
||||
{0,8,70},{0,9,237},{128,7,9},{0,8,94},{0,8,30},{0,9,157},
|
||||
{132,7,99},{0,8,126},{0,8,62},{0,9,221},{130,7,27},{0,8,110},
|
||||
{0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},
|
||||
{96,7,0},{0,8,81},{0,8,17},{133,8,131},{130,7,31},{0,8,113},
|
||||
{0,8,49},{0,9,195},{128,7,10},{0,8,97},{0,8,33},{0,9,163},
|
||||
{0,8,1},{0,8,129},{0,8,65},{0,9,227},{128,7,6},{0,8,89},
|
||||
{0,8,25},{0,9,147},{131,7,59},{0,8,121},{0,8,57},{0,9,211},
|
||||
{129,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},{0,8,137},
|
||||
{0,8,73},{0,9,243},{128,7,4},{0,8,85},{0,8,21},{144,8,3},
|
||||
{131,7,43},{0,8,117},{0,8,53},{0,9,203},{129,7,13},{0,8,101},
|
||||
{0,8,37},{0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},
|
||||
{128,7,8},{0,8,93},{0,8,29},{0,9,155},{132,7,83},{0,8,125},
|
||||
{0,8,61},{0,9,219},{130,7,23},{0,8,109},{0,8,45},{0,9,187},
|
||||
{0,8,13},{0,8,141},{0,8,77},{0,9,251},{128,7,3},{0,8,83},
|
||||
{0,8,19},{133,8,195},{131,7,35},{0,8,115},{0,8,51},{0,9,199},
|
||||
{129,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
|
||||
{0,8,67},{0,9,231},{128,7,7},{0,8,91},{0,8,27},{0,9,151},
|
||||
{132,7,67},{0,8,123},{0,8,59},{0,9,215},{130,7,19},{0,8,107},
|
||||
{0,8,43},{0,9,183},{0,8,11},{0,8,139},{0,8,75},{0,9,247},
|
||||
{128,7,5},{0,8,87},{0,8,23},{77,8,0},{131,7,51},{0,8,119},
|
||||
{0,8,55},{0,9,207},{129,7,15},{0,8,103},{0,8,39},{0,9,175},
|
||||
{0,8,7},{0,8,135},{0,8,71},{0,9,239},{128,7,9},{0,8,95},
|
||||
{0,8,31},{0,9,159},{132,7,99},{0,8,127},{0,8,63},{0,9,223},
|
||||
{130,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},
|
||||
{0,8,79},{0,9,255}
|
||||
};
|
||||
|
||||
static const code distfix[32] = {
|
||||
{16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
|
||||
{21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
|
||||
{18,5,9},{26,5,2049},{22,5,129},{30,5,32769},{16,5,2},{23,5,385},
|
||||
{19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
|
||||
{16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
|
||||
{22,5,193},{30,5,49153}
|
||||
{128,5,1},{135,5,257},{131,5,17},{139,5,4097},{129,5,5},
|
||||
{137,5,1025},{133,5,65},{141,5,16385},{128,5,3},{136,5,513},
|
||||
{132,5,33},{140,5,8193},{130,5,9},{138,5,2049},{134,5,129},
|
||||
{142,5,32769},{128,5,2},{135,5,385},{131,5,25},{139,5,6145},
|
||||
{129,5,7},{137,5,1537},{133,5,97},{141,5,24577},{128,5,4},
|
||||
{136,5,769},{132,5,49},{140,5,12289},{130,5,13},{138,5,3073},
|
||||
{134,5,193},{142,5,49153}
|
||||
};
|
||||
|
47
contrib/infback9/inflate9.h
Normal file
47
contrib/infback9/inflate9.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* inflate9.h -- internal inflate state definition
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
/* Possible inflate modes between inflate() calls */
|
||||
typedef enum {
|
||||
TYPE, /* i: waiting for type bits, including last-flag bit */
|
||||
STORED, /* i: waiting for stored size (length and complement) */
|
||||
TABLE, /* i: waiting for dynamic block table lengths */
|
||||
LEN, /* i: waiting for length/lit code */
|
||||
DONE, /* finished check, done -- remain here until reset */
|
||||
BAD /* got a data error -- remain here until reset */
|
||||
} inflate_mode;
|
||||
|
||||
/*
|
||||
State transitions between above modes -
|
||||
|
||||
(most modes can go to the BAD mode -- not shown for clarity)
|
||||
|
||||
Read deflate blocks:
|
||||
TYPE -> STORED or TABLE or LEN or DONE
|
||||
STORED -> TYPE
|
||||
TABLE -> LENLENS -> CODELENS -> LEN
|
||||
Read deflate codes:
|
||||
LEN -> LEN or TYPE
|
||||
*/
|
||||
|
||||
/* state maintained between inflate() calls. Approximately 7K bytes. */
|
||||
struct inflate_state {
|
||||
/* sliding window */
|
||||
unsigned char FAR *window; /* allocated sliding window, if needed */
|
||||
/* dynamic table building */
|
||||
unsigned ncode; /* number of code length code lengths */
|
||||
unsigned nlen; /* number of length code lengths */
|
||||
unsigned ndist; /* number of distance code lengths */
|
||||
unsigned have; /* number of code lengths in lens[] */
|
||||
code FAR *next; /* next available space in codes[] */
|
||||
unsigned short lens[320]; /* temporary storage for code lengths */
|
||||
unsigned short work[288]; /* work area for code table building */
|
||||
code codes[ENOUGH]; /* space for code tables */
|
||||
};
|
323
contrib/infback9/inftree9.c
Normal file
323
contrib/infback9/inftree9.c
Normal file
@ -0,0 +1,323 @@
|
||||
/* inftree9.c -- generate Huffman trees for efficient decoding
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
#include "zutil.h"
|
||||
#include "inftree9.h"
|
||||
|
||||
#define MAXBITS 15
|
||||
|
||||
const char inflate9_copyright[] =
|
||||
" inflate9 1.2.0.6 Copyright 1995-2003 Mark Adler ";
|
||||
/*
|
||||
If you use the zlib library in a product, an acknowledgment is welcome
|
||||
in the documentation of your product. If for some reason you cannot
|
||||
include such an acknowledgment, I would appreciate that you keep this
|
||||
copyright string in the executable of your product.
|
||||
*/
|
||||
|
||||
/*
|
||||
Build a set of tables to decode the provided canonical Huffman code.
|
||||
The code lengths are lens[0..codes-1]. The result starts at *table,
|
||||
whose indices are 0..2^bits-1. work is a writable array of at least
|
||||
lens shorts, which is used as a work area. type is the type of code
|
||||
to be generated, CODES, LENS, or DISTS. On return, zero is success,
|
||||
-1 is an invalid code, and +1 means that ENOUGH isn't enough. table
|
||||
on return points to the next available entry's address. bits is the
|
||||
requested root table index bits, and on return it is the actual root
|
||||
table index bits. It will differ if the request is greater than the
|
||||
longest code or if it is less than the shortest code.
|
||||
*/
|
||||
int inflate_table9(type, lens, codes, table, bits, work)
|
||||
codetype type;
|
||||
unsigned short FAR *lens;
|
||||
unsigned codes;
|
||||
code FAR * FAR *table;
|
||||
unsigned FAR *bits;
|
||||
unsigned short FAR *work;
|
||||
{
|
||||
unsigned len; /* a code's length in bits */
|
||||
unsigned sym; /* index of code symbols */
|
||||
unsigned min, max; /* minimum and maximum code lengths */
|
||||
unsigned root; /* number of index bits for root table */
|
||||
unsigned curr; /* number of index bits for current table */
|
||||
unsigned drop; /* code bits to drop for sub-table */
|
||||
int left; /* number of prefix codes available */
|
||||
unsigned used; /* code entries in table used */
|
||||
unsigned huff; /* Huffman code */
|
||||
unsigned incr; /* for incrementing code, index */
|
||||
unsigned fill; /* index for replicating entries */
|
||||
unsigned low; /* low bits for current root entry */
|
||||
unsigned mask; /* mask for low root bits */
|
||||
code this; /* table entry for duplication */
|
||||
code FAR *next; /* next available space in table */
|
||||
const unsigned short FAR *base; /* base value table to use */
|
||||
const unsigned short FAR *extra; /* extra bits table to use */
|
||||
int end; /* use base and extra for symbol > end */
|
||||
unsigned short count[MAXBITS+1]; /* number of codes of each length */
|
||||
unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
|
||||
static const unsigned short lbase[31] = { /* Length codes 257..285 base */
|
||||
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17,
|
||||
19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115,
|
||||
131, 163, 195, 227, 3, 0, 0};
|
||||
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
||||
128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
|
||||
130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
|
||||
133, 133, 133, 133, 144, 65, 77};
|
||||
static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
|
||||
65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
|
||||
4097, 6145, 8193, 12289, 16385, 24577, 32769, 49153};
|
||||
static const unsigned short dext[32] = { /* Distance codes 0..31 extra */
|
||||
128, 128, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132,
|
||||
133, 133, 134, 134, 135, 135, 136, 136, 137, 137, 138, 138,
|
||||
139, 139, 140, 140, 141, 141, 142, 142};
|
||||
|
||||
/*
|
||||
Process a set of code lengths to create a canonical Huffman code. The
|
||||
code lengths are lens[0..codes-1]. Each length corresponds to the
|
||||
symbols 0..codes-1. The Huffman code is generated by first sorting the
|
||||
symbols by length from short to long, and retaining the symbol order
|
||||
for codes with equal lengths. Then the code starts with all zero bits
|
||||
for the first code of the shortest length, and the codes are integer
|
||||
increments for the same length, and zeros are appended as the length
|
||||
increases. For the deflate format, these bits are stored backwards
|
||||
from their more natural integer increment ordering, and so when the
|
||||
decoding tables are built in the large loop below, the integer codes
|
||||
are incremented backwards.
|
||||
|
||||
This routine assumes, but does not check, that all of the entries in
|
||||
lens[] are in the range 0..MAXBITS. The caller must assure this.
|
||||
1..MAXBITS is interpreted as that code length. zero means that that
|
||||
symbol does not occur in this code.
|
||||
|
||||
The codes are sorted by computing a count of codes for each length,
|
||||
creating from that a table of starting indices for each length in the
|
||||
sorted table, and then entering the symbols in order in the sorted
|
||||
table. The sorted table is work[], with that space being provided by
|
||||
the caller.
|
||||
|
||||
The length counts are used for other purposes as well, i.e. finding
|
||||
the minimum and maximum length codes, determining if there are any
|
||||
codes at all, checking for a valid set of lengths, and looking ahead
|
||||
at length counts to determine sub-table sizes when building the
|
||||
decoding tables.
|
||||
*/
|
||||
|
||||
/* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
|
||||
for (len = 0; len <= MAXBITS; len++)
|
||||
count[len] = 0;
|
||||
for (sym = 0; sym < codes; sym++)
|
||||
count[lens[sym]]++;
|
||||
|
||||
/* bound code lengths, force root to be within code lengths */
|
||||
root = *bits;
|
||||
for (max = MAXBITS; max >= 1; max--)
|
||||
if (count[max] != 0) break;
|
||||
if (root > max) root = max;
|
||||
if (max == 0) return -1; /* no codes! */
|
||||
for (min = 1; min <= MAXBITS; min++)
|
||||
if (count[min] != 0) break;
|
||||
if (root < min) root = min;
|
||||
|
||||
/* check for an over-subscribed or incomplete set of lengths */
|
||||
left = 1;
|
||||
for (len = 1; len <= MAXBITS; len++) {
|
||||
left <<= 1;
|
||||
left -= count[len];
|
||||
if (left < 0) return -1; /* over-subscribed */
|
||||
}
|
||||
if (left > 0 && (type == CODES || (codes - count[0] != 1)))
|
||||
return -1; /* incomplete set */
|
||||
|
||||
/* generate offsets into symbol table for each length for sorting */
|
||||
offs[1] = 0;
|
||||
for (len = 1; len < MAXBITS; len++)
|
||||
offs[len + 1] = offs[len] + count[len];
|
||||
|
||||
/* sort symbols by length, by symbol order within each length */
|
||||
for (sym = 0; sym < codes; sym++)
|
||||
if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
|
||||
|
||||
/*
|
||||
Create and fill in decoding tables. In this loop, the table being
|
||||
filled is at next and has curr index bits. The code being used is huff
|
||||
with length len. That code is converted to an index by dropping drop
|
||||
bits off of the bottom. For codes where len is less than drop + curr,
|
||||
those top drop + curr - len bits are incremented through all values to
|
||||
fill the table with replicated entries.
|
||||
|
||||
root is the number of index bits for the root table. When len exceeds
|
||||
root, sub-tables are created pointed to by the root entry with an index
|
||||
of the low root bits of huff. This is saved in low to check for when a
|
||||
new sub-table should be started. drop is zero when the root table is
|
||||
being filled, and drop is root when sub-tables are being filled.
|
||||
|
||||
When a new sub-table is needed, it is necessary to look ahead in the
|
||||
code lengths to determine what size sub-table is needed. The length
|
||||
counts are used for this, and so count[] is decremented as codes are
|
||||
entered in the tables.
|
||||
|
||||
used keeps track of how many table entries have been allocated from the
|
||||
provided *table space. It is checked when a LENS table is being made
|
||||
against the space in *table, ENOUGH, minus the maximum space needed by
|
||||
the worst case distance code, MAXD. This should never happen, but the
|
||||
sufficiency of ENOUGH has not been proven exhaustively, hence the check.
|
||||
This assumes that when type == LENS, bits == 9.
|
||||
|
||||
sym increments through all symbols, and the loop terminates when
|
||||
all codes of length max, i.e. all codes, have been processed. This
|
||||
routine permits incomplete codes, so another loop after this one fills
|
||||
in the rest of the decoding tables with invalid code markers.
|
||||
*/
|
||||
|
||||
/* set up for code type */
|
||||
switch (type) {
|
||||
case CODES:
|
||||
base = extra = work; /* dummy value--not used */
|
||||
end = 19;
|
||||
break;
|
||||
case LENS:
|
||||
base = lbase;
|
||||
base -= 257;
|
||||
extra = lext;
|
||||
extra -= 257;
|
||||
end = 256;
|
||||
break;
|
||||
default: /* DISTS */
|
||||
base = dbase;
|
||||
extra = dext;
|
||||
end = -1;
|
||||
}
|
||||
|
||||
/* initialize state for loop */
|
||||
huff = 0; /* starting code */
|
||||
sym = 0; /* starting code symbol */
|
||||
len = min; /* starting code length */
|
||||
next = *table; /* current table to fill in */
|
||||
curr = root; /* current table index bits */
|
||||
drop = 0; /* current bits to drop from code for index */
|
||||
low = (unsigned)(-1); /* trigger new sub-table when len > root */
|
||||
used = 1U << root; /* use root table entries */
|
||||
mask = used - 1; /* mask for comparing low */
|
||||
|
||||
/* check available table space */
|
||||
if (type == LENS && used >= ENOUGH - MAXD)
|
||||
return 1;
|
||||
|
||||
/* process all codes and make table entries */
|
||||
for (;;) {
|
||||
/* create table entry */
|
||||
this.bits = (unsigned char)(len - drop);
|
||||
if ((int)(work[sym]) < end) {
|
||||
this.op = (unsigned char)0;
|
||||
this.val = work[sym];
|
||||
}
|
||||
else if ((int)(work[sym]) > end) {
|
||||
this.op = (unsigned char)(extra[work[sym]]);
|
||||
this.val = base[work[sym]];
|
||||
}
|
||||
else {
|
||||
this.op = (unsigned char)(32 + 64); /* end of block */
|
||||
this.val = 0;
|
||||
}
|
||||
|
||||
/* replicate for those indices with low len bits equal to huff */
|
||||
incr = 1U << (len - drop);
|
||||
fill = 1U << curr;
|
||||
do {
|
||||
fill -= incr;
|
||||
next[(huff >> drop) + fill] = this;
|
||||
} while (fill != 0);
|
||||
|
||||
/* backwards increment the len-bit code huff */
|
||||
incr = 1U << (len - 1);
|
||||
while (huff & incr)
|
||||
incr >>= 1;
|
||||
if (incr != 0) {
|
||||
huff &= incr - 1;
|
||||
huff += incr;
|
||||
}
|
||||
else
|
||||
huff = 0;
|
||||
|
||||
/* go to next symbol, update count, len */
|
||||
sym++;
|
||||
if (--(count[len]) == 0) {
|
||||
if (len == max) break;
|
||||
len = lens[work[sym]];
|
||||
}
|
||||
|
||||
/* create new sub-table if needed */
|
||||
if (len > root && (huff & mask) != low) {
|
||||
/* if first time, transition to sub-tables */
|
||||
if (drop == 0)
|
||||
drop = root;
|
||||
|
||||
/* increment past last table */
|
||||
next += 1U << curr;
|
||||
|
||||
/* determine length of next table */
|
||||
curr = len - drop;
|
||||
left = (int)(1 << curr);
|
||||
while (curr + drop < max) {
|
||||
left -= count[curr + drop];
|
||||
if (left <= 0) break;
|
||||
curr++;
|
||||
left <<= 1;
|
||||
}
|
||||
|
||||
/* check for enough space */
|
||||
used += 1U << curr;
|
||||
if (type == LENS && used >= ENOUGH - MAXD)
|
||||
return 1;
|
||||
|
||||
/* point entry in root table to sub-table */
|
||||
low = huff & mask;
|
||||
(*table)[low].op = (unsigned char)curr;
|
||||
(*table)[low].bits = (unsigned char)root;
|
||||
(*table)[low].val = (unsigned short)(next - *table);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Fill in rest of table for incomplete codes. This loop is similar to the
|
||||
loop above in incrementing huff for table indices. It is assumed that
|
||||
len is equal to curr + drop, so there is no loop needed to increment
|
||||
through high index bits. When the current sub-table is filled, the loop
|
||||
drops back to the root table to fill in any remaining entries there.
|
||||
*/
|
||||
this.op = (unsigned char)64; /* invalid code marker */
|
||||
this.bits = (unsigned char)(len - drop);
|
||||
this.val = (unsigned short)0;
|
||||
while (huff != 0) {
|
||||
/* when done with sub-table, drop back to root table */
|
||||
if (drop != 0 && (huff & mask) != low) {
|
||||
drop = 0;
|
||||
len = root;
|
||||
next = *table;
|
||||
curr = root;
|
||||
this.bits = (unsigned char)len;
|
||||
}
|
||||
|
||||
/* put invalid code marker in table */
|
||||
next[huff >> drop] = this;
|
||||
|
||||
/* backwards increment the len-bit code huff */
|
||||
incr = 1U << (len - 1);
|
||||
while (huff & incr)
|
||||
incr >>= 1;
|
||||
if (incr != 0) {
|
||||
huff &= incr - 1;
|
||||
huff += incr;
|
||||
}
|
||||
else
|
||||
huff = 0;
|
||||
}
|
||||
|
||||
/* set return parameters */
|
||||
*table += used;
|
||||
*bits = root;
|
||||
return 0;
|
||||
}
|
55
contrib/infback9/inftree9.h
Normal file
55
contrib/infback9/inftree9.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* inftree9.h -- header to use inftree9.c
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
/* Structure for decoding tables. Each entry provides either the
|
||||
information needed to do the operation requested by the code that
|
||||
indexed that table entry, or it provides a pointer to another
|
||||
table that indexes more bits of the code. op indicates whether
|
||||
the entry is a pointer to another table, a literal, a length or
|
||||
distance, an end-of-block, or an invalid code. For a table
|
||||
pointer, the low four bits of op is the number of index bits of
|
||||
that table. For a length or distance, the low four bits of op
|
||||
is the number of extra bits to get after the code. bits is
|
||||
the number of bits in this code or part of the code to drop off
|
||||
of the bit buffer. val is the actual byte to output in the case
|
||||
of a literal, the base length or distance, or the offset from
|
||||
the current table to the next table. Each entry is four bytes. */
|
||||
typedef struct {
|
||||
unsigned char op; /* operation, extra bits, table bits */
|
||||
unsigned char bits; /* bits in this part of the code */
|
||||
unsigned short val; /* offset in table or code value */
|
||||
} code;
|
||||
|
||||
/* op values as set by inflate_table():
|
||||
00000000 - literal
|
||||
0000tttt - table link, tttt != 0 is the number of table index bits
|
||||
100eeeee - length or distance, eeee is the number of extra bits
|
||||
01100000 - end of block
|
||||
01000000 - invalid code
|
||||
*/
|
||||
|
||||
/* Maximum size of dynamic tree. The maximum found in a long but non-
|
||||
exhaustive search was 1004 code structures (850 for length/literals
|
||||
and 154 for distances, the latter actually the result of an
|
||||
exhaustive search). The true maximum is not known, but the value
|
||||
below is more than safe. */
|
||||
#define ENOUGH 1440
|
||||
#define MAXD 154
|
||||
|
||||
/* Type of code to build for inftable() */
|
||||
typedef enum {
|
||||
CODES,
|
||||
LENS,
|
||||
DISTS
|
||||
} codetype;
|
||||
|
||||
extern int inflate_table9 OF((codetype type, unsigned short FAR *lens,
|
||||
unsigned codes, code FAR * FAR *table,
|
||||
unsigned FAR *bits, unsigned short FAR *work));
|
@ -1,3 +1,7 @@
|
||||
Change in 1.00: (10 sept 03)
|
||||
- rename to 1.00
|
||||
- cosmetic code change
|
||||
|
||||
Change in 0.22: (19 May 03)
|
||||
- crypting support (unless you define NOCRYPT)
|
||||
- append file in existing zipfile
|
||||
|
@ -1,3 +1,31 @@
|
||||
/* crypt.h -- base code for crypt/uncrypt ZIPfile
|
||||
|
||||
|
||||
Version 1.00, September 10th, 2003
|
||||
|
||||
Copyright (C) 1998-2003 Gilles Vollant
|
||||
|
||||
This code is a modified version of crypting code in Infozip distribution
|
||||
|
||||
The encryption/decryption parts of this source code (as opposed to the
|
||||
non-echoing password parts) were originally written in Europe. The
|
||||
whole source package can be freely distributed, including from the USA.
|
||||
(Prior to January 2000, re-export from the US was a violation of US law.)
|
||||
|
||||
This encryption code is a direct transcription of the algorithm from
|
||||
Roger Schlafly, described by Phil Katz in the file appnote.txt. This
|
||||
file (appnote.txt) is distributed with the PKZIP program (even in the
|
||||
version without encryption capabilities).
|
||||
|
||||
If you don't need crypting in your application, just define symbols
|
||||
NOCRYPT and NOUNCRYPT.
|
||||
|
||||
This code support the "Traditional PKWARE Encryption".
|
||||
|
||||
The new AES encryption added on Zip format by Winzip (see the page
|
||||
http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
|
||||
Encryption is not supported.
|
||||
*/
|
||||
|
||||
#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ioapi.c -- IO base function header for compress/uncompress .zip
|
||||
files using zlib + zip or unzip API
|
||||
|
||||
Version 0.22, May 19th, 2003
|
||||
Version 1.00, September 10th, 2003
|
||||
|
||||
Copyright (C) 1998-2003 Gilles Vollant
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* ioapi.h -- IO base function header for compress/uncompress .zip
|
||||
files using zlib + zip or unzip API
|
||||
|
||||
Version 0.22, May 19th, 2003
|
||||
Version 1.00, September 10th, 2003
|
||||
|
||||
Copyright (C) 1998-2003 Gilles Vollant
|
||||
*/
|
||||
|
@ -2,7 +2,7 @@
|
||||
files using zlib + zip or unzip API
|
||||
This IO API version uses the Win32 API (for Microsoft Windows)
|
||||
|
||||
Version 0.22, May 19th, 2003
|
||||
Version 1.00, September 10th, 2003
|
||||
|
||||
Copyright (C) 1998-2003 Gilles Vollant
|
||||
*/
|
||||
|
@ -2,7 +2,7 @@
|
||||
files using zlib + zip or unzip API
|
||||
This IO API version uses the Win32 API (for Microsoft Windows)
|
||||
|
||||
Version 0.22, May 19th, 2003
|
||||
Version 1.00, September 10th, 2003
|
||||
|
||||
Copyright (C) 1998-2003 Gilles Vollant
|
||||
*/
|
||||
|
@ -140,7 +140,7 @@ int makedir (newdir)
|
||||
|
||||
void do_banner()
|
||||
{
|
||||
printf("MiniUnz 0.22, demo of zLib + Unz package written by Gilles Vollant\n");
|
||||
printf("MiniUnz 1.00, demo of zLib + Unz package written by Gilles Vollant\n");
|
||||
printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ int check_exist_file(filename)
|
||||
|
||||
void do_banner()
|
||||
{
|
||||
printf("MiniZip 0.22, demo of zLib + Zip package written by Gilles Vollant\n");
|
||||
printf("MiniZip 1.00, demo of zLib + Zip package written by Gilles Vollant\n");
|
||||
printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* unzip.c -- IO for uncompress .zip files using zlib
|
||||
Version 0.22, May 19th, 2003
|
||||
Version 1.00, September 10th, 2003
|
||||
|
||||
Copyright (C) 1998-2003 Gilles Vollant
|
||||
|
||||
@ -88,7 +88,7 @@ woven in by Terry Thorsen 1/2003.
|
||||
|
||||
|
||||
const char unz_copyright[] =
|
||||
" unzip 0.22 Copyright 1998-2003 Gilles Vollant - http://www.winimage.com/zLibDll";
|
||||
" unzip 1.00 Copyright 1998-2003 Gilles Vollant - http://www.winimage.com/zLibDll";
|
||||
|
||||
/* unz_file_info_interntal contain internal info about a file in zipfile*/
|
||||
typedef struct unz_file_info_internal_s
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* unzip.h -- IO for uncompress .zip files using zlib
|
||||
Version 0.22, May 19th, 2003
|
||||
Version 1.00, September 10th, 2003
|
||||
|
||||
Copyright (C) 1998-2003 Gilles Vollant
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* zip.c -- IO on .zip files using zlib
|
||||
Version 0.22, May 19th, 2003
|
||||
Version 1.00, September 10th, 2003
|
||||
|
||||
Copyright (C) 1998-2003 Gilles Vollant
|
||||
|
||||
Read zip.h for more info
|
||||
*/
|
||||
@ -75,7 +77,7 @@
|
||||
#endif
|
||||
#endif
|
||||
const char zip_copyright[] =
|
||||
" zip 0.22 Copyright 1998-2003 Gilles Vollant - http://www.winimage.com/zLibDll";
|
||||
" zip 1.00 Copyright 1998-2003 Gilles Vollant - http://www.winimage.com/zLibDll";
|
||||
|
||||
|
||||
#define SIZEDATA_INDATABLOCK (4096-(4*4))
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* zip.h -- IO for compress .zip files using zlib
|
||||
Version 0.22, May 19th, 2003
|
||||
Version 1.00, September 10th, 2003
|
||||
|
||||
Copyright (C) 1998-2003 Gilles Vollant
|
||||
|
||||
|
@ -58,7 +58,7 @@
|
||||
* - Add FIXLCODES #define
|
||||
* 1.5 6 Apr 2002 - Minor comment fixes
|
||||
* 1.6 7 Aug 2002 - Minor format changes
|
||||
* 1.7 3 Mar 2002 - Added test code for distribution
|
||||
* 1.7 3 Mar 2003 - Added test code for distribution
|
||||
* - Added zlib-like license
|
||||
*/
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include "deflate.h"
|
||||
|
||||
const char deflate_copyright[] =
|
||||
" deflate 1.2.0.5 Copyright 1995-2003 Jean-loup Gailly ";
|
||||
" deflate 1.2.0.6 Copyright 1995-2003 Jean-loup Gailly ";
|
||||
/*
|
||||
If you use the zlib library in a product, an acknowledgment is welcome
|
||||
in the documentation of your product. If for some reason you cannot
|
||||
|
@ -89,6 +89,9 @@ void test_gzio(fname, uncompr, uncomprLen)
|
||||
Byte *uncompr;
|
||||
uLong uncomprLen;
|
||||
{
|
||||
#ifdef NO_GZCOMPRESS
|
||||
fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n");
|
||||
#else
|
||||
int err;
|
||||
int len = (int)strlen(hello)+1;
|
||||
gzFile file;
|
||||
@ -159,6 +162,7 @@ void test_gzio(fname, uncompr, uncomprLen)
|
||||
}
|
||||
|
||||
gzclose(file);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
|
5
gzio.c
5
gzio.c
@ -30,6 +30,11 @@ struct internal_state {int dummy;}; /* for buggy compilers */
|
||||
# define Z_PRINTF_BUFSIZE 4096
|
||||
#endif
|
||||
|
||||
#ifdef __MVS__
|
||||
# pragma map (fdopen , "\174\174FDOPEN")
|
||||
FILE *fdopen(int, const char *);
|
||||
#endif
|
||||
|
||||
#ifndef STDC
|
||||
extern voidp malloc OF((uInt size));
|
||||
extern void free OF((voidpf ptr));
|
||||
|
@ -19,6 +19,7 @@
|
||||
- none
|
||||
No measurable difference:
|
||||
- Pentium III (Anderson)
|
||||
- 68060 (Nikl)
|
||||
*/
|
||||
#ifdef POSTINC
|
||||
# define OFF 0
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define MAXBITS 15
|
||||
|
||||
const char inflate_copyright[] =
|
||||
" inflate 1.2.0.5 Copyright 1995-2003 Mark Adler ";
|
||||
" inflate 1.2.0.6 Copyright 1995-2003 Mark Adler ";
|
||||
/*
|
||||
If you use the zlib library in a product, an acknowledgment is welcome
|
||||
in the documentation of your product. If for some reason you cannot
|
||||
@ -62,7 +62,7 @@ unsigned short FAR *work;
|
||||
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
|
||||
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
||||
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 192, 78};
|
||||
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 65, 77};
|
||||
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
||||
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
||||
|
@ -25,10 +25,10 @@
|
||||
<QPG:Files>
|
||||
<QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
|
||||
<QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
|
||||
<QPG:Add file="../libz.so.1.2.0.5" install="/opt/lib/" user="root:bin" permission="644"/>
|
||||
<QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.0.5"/>
|
||||
<QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.0.5"/>
|
||||
<QPG:Add file="../libz.so.1.2.0.5" install="/opt/lib/" component="slib"/>
|
||||
<QPG:Add file="../libz.so.1.2.0.6" install="/opt/lib/" user="root:bin" permission="644"/>
|
||||
<QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.0.6"/>
|
||||
<QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.0.6"/>
|
||||
<QPG:Add file="../libz.so.1.2.0.6" install="/opt/lib/" component="slib"/>
|
||||
</QPG:Files>
|
||||
|
||||
<QPG:PackageFilter>
|
||||
@ -63,7 +63,7 @@
|
||||
</QPM:ProductDescription>
|
||||
|
||||
<QPM:ReleaseDescription>
|
||||
<QPM:ReleaseVersion>1.2.0.5</QPM:ReleaseVersion>
|
||||
<QPM:ReleaseVersion>1.2.0.6</QPM:ReleaseVersion>
|
||||
<QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
|
||||
<QPM:ReleaseStability>Stable</QPM:ReleaseStability>
|
||||
<QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
|
||||
|
@ -5,8 +5,8 @@ VS_VERSION_INFO VERSIONINFO
|
||||
#else
|
||||
VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
||||
#endif
|
||||
FILEVERSION 1,2,0,5
|
||||
PRODUCTVERSION 1,2,0,5
|
||||
FILEVERSION 1,2,0,6
|
||||
PRODUCTVERSION 1,2,0,6
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 1
|
||||
@ -23,12 +23,12 @@ BEGIN
|
||||
//language ID = U.S. English, char set = Windows, Multilingual
|
||||
BEGIN
|
||||
VALUE "FileDescription", "zlib data compression library\0"
|
||||
VALUE "FileVersion", "1.2.0.5\0"
|
||||
VALUE "FileVersion", "1.2.0.6\0"
|
||||
VALUE "InternalName", "zlib1.dll\0"
|
||||
VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0"
|
||||
VALUE "OriginalFilename", "zlib1.dll\0"
|
||||
VALUE "ProductName", "zlib\0"
|
||||
VALUE "ProductVersion", "1.2.0.5\0"
|
||||
VALUE "ProductVersion", "1.2.0.6\0"
|
||||
VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"
|
||||
END
|
||||
END
|
||||
|
7
zconf.h
7
zconf.h
@ -287,6 +287,13 @@ typedef uLong FAR uLongf;
|
||||
# define z_off_t long
|
||||
#endif
|
||||
|
||||
#if defined(__MVS__)
|
||||
#define NO_vsnprintf
|
||||
#ifdef FAR
|
||||
#undef FAR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* MVS linker does not support external names larger than 8 bytes */
|
||||
#if defined(__MVS__)
|
||||
# pragma map(deflateInit_,"DEIN")
|
||||
|
@ -287,6 +287,13 @@ typedef uLong FAR uLongf;
|
||||
# define z_off_t long
|
||||
#endif
|
||||
|
||||
#if defined(__MVS__)
|
||||
#define NO_vsnprintf
|
||||
#ifdef FAR
|
||||
#undef FAR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* MVS linker does not support external names larger than 8 bytes */
|
||||
#if defined(__MVS__)
|
||||
# pragma map(deflateInit_,"DEIN")
|
||||
|
4
zlib.3
4
zlib.3
@ -1,4 +1,4 @@
|
||||
.TH ZLIB 3 "8 September 2003"
|
||||
.TH ZLIB 3 "13 September 2003"
|
||||
.SH NAME
|
||||
zlib \- compression/decompression library
|
||||
.SH SYNOPSIS
|
||||
@ -133,7 +133,7 @@ before asking for help.
|
||||
Send questions and/or comments to zlib@gzip.org,
|
||||
or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
|
||||
.SH AUTHORS
|
||||
Version 1.2.0.5
|
||||
Version 1.2.0.6
|
||||
Copyright (C) 1995-2003 Jean-loup Gailly (jloup@gzip.org)
|
||||
and Mark Adler (madler@alumni.caltech.edu).
|
||||
.LP
|
||||
|
8
zlib.h
8
zlib.h
@ -1,5 +1,5 @@
|
||||
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
||||
version 1.2.0.5, September 8th, 2003
|
||||
version 1.2.0.6, September 13th, 2003
|
||||
|
||||
Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler
|
||||
|
||||
@ -37,8 +37,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ZLIB_VERSION "1.2.0.5"
|
||||
#define ZLIB_VERNUM 0x1205
|
||||
#define ZLIB_VERSION "1.2.0.6"
|
||||
#define ZLIB_VERNUM 0x1206
|
||||
|
||||
/*
|
||||
The 'zlib' compression library provides in-memory compression and
|
||||
@ -777,7 +777,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm,
|
||||
|
||||
The in_desc and out_desc parameters of inflateBack() is passed as the
|
||||
first parameter of in() and out() respectively when they are called. These
|
||||
descriptors can be optinally used to pass any information that the caller-
|
||||
descriptors can be optionally used to pass any information that the caller-
|
||||
supplied in() and out() functions need to do their job.
|
||||
|
||||
On return, inflateBack() will set strm->next_in and strm->avail_in to
|
||||
|
Loading…
Reference in New Issue
Block a user