updated to 1.1.4

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15258 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2002-04-25 09:06:49 +00:00
parent 5b98eb2fa6
commit a4019ec280
26 changed files with 363 additions and 312 deletions

View File

@@ -1,5 +1,5 @@
/* adler32.c -- compute the Adler-32 checksum of a data stream /* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */

View File

@@ -1,5 +1,5 @@
/* compress.c -- compress a memory buffer /* compress.c -- compress a memory buffer
* Copyright (C) 1995-1998 Jean-loup Gailly. * Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */

View File

@@ -1,5 +1,5 @@
/* crc32.c -- compute the CRC-32 of a data stream /* crc32.c -- compute the CRC-32 of a data stream
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */

View File

@@ -1,5 +1,5 @@
/* deflate.c -- compress data using the deflation algorithm /* deflate.c -- compress data using the deflation algorithm
* Copyright (C) 1995-1998 Jean-loup Gailly. * Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -52,7 +52,7 @@
#include "deflate.h" #include "deflate.h"
const char deflate_copyright[] = const char deflate_copyright[] =
" deflate 1.1.2 Copyright 1995-1998 Jean-loup Gailly "; " deflate 1.1.4 Copyright 1995-2002 Jean-loup Gailly ";
/* /*
If you use the zlib library in a product, an acknowledgment is welcome 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 in the documentation of your product. If for some reason you cannot
@@ -251,7 +251,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
windowBits = -windowBits; windowBits = -windowBits;
} }
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || windowBits < 9 || windowBits > 15 || level < 0 || level > 9 ||
strategy < 0 || strategy > Z_HUFFMAN_ONLY) { strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
} }
@@ -649,11 +649,13 @@ int ZEXPORT deflateCopy (dest, source)
deflate_state *ss; deflate_state *ss;
ushf *overlay; ushf *overlay;
ss = source->state;
if (source == Z_NULL || dest == Z_NULL || ss == Z_NULL) { if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
} }
ss = source->state;
*dest = *source; *dest = *source;
ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));

View File

@@ -1,5 +1,5 @@
/* deflate.h -- internal compression state /* deflate.h -- internal compression state
* Copyright (C) 1995-1998 Jean-loup Gailly * Copyright (C) 1995-2002 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -230,12 +230,12 @@ typedef struct internal_state {
ulg opt_len; /* bit length of current block with optimal trees */ ulg opt_len; /* bit length of current block with optimal trees */
ulg static_len; /* bit length of current block with static trees */ ulg static_len; /* bit length of current block with static trees */
ulg compressed_len; /* total bit length of compressed file */
uInt matches; /* number of string matches in current block */ uInt matches; /* number of string matches in current block */
int last_eob_len; /* bit length of EOB code for last block */ int last_eob_len; /* bit length of EOB code for last block */
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
ulg bits_sent; /* bit length of the compressed data */ ulg compressed_len; /* total bit length of compressed file mod 2^32 */
ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
#endif #endif
ush bi_buf; ush bi_buf;
@@ -268,7 +268,7 @@ typedef struct internal_state {
/* in trees.c */ /* in trees.c */
void _tr_init OF((deflate_state *s)); void _tr_init OF((deflate_state *s));
int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
ulg _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
int eof)); int eof));
void _tr_align OF((deflate_state *s)); void _tr_align OF((deflate_state *s));
void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,

View File

@@ -15,6 +15,12 @@
extern void exit OF((int)); extern void exit OF((int));
#endif #endif
#if defined(VMS) || defined(RISCOS)
# define TESTFILE "foo-gz"
#else
# define TESTFILE "foo.gz"
#endif
#define CHECK_ERR(err, msg) { \ #define CHECK_ERR(err, msg) { \
if (err != Z_OK) { \ if (err != Z_OK) { \
fprintf(stderr, "%s error: %d\n", msg, err); \ fprintf(stderr, "%s error: %d\n", msg, err); \
@@ -79,8 +85,8 @@ void test_compress(compr, comprLen, uncompr, uncomprLen)
* Test read/write of .gz files * Test read/write of .gz files
*/ */
void test_gzio(out, in, uncompr, uncomprLen) void test_gzio(out, in, uncompr, uncomprLen)
const char *out; /* output file */ const char *out; /* compressed output file */
const char *in; /* input file */ const char *in; /* compressed input file */
Byte *uncompr; Byte *uncompr;
int uncomprLen; int uncomprLen;
{ {
@@ -528,8 +534,8 @@ int main(argc, argv)
} }
test_compress(compr, comprLen, uncompr, uncomprLen); test_compress(compr, comprLen, uncompr, uncomprLen);
test_gzio((argc > 1 ? argv[1] : "foo.gz"), test_gzio((argc > 1 ? argv[1] : TESTFILE),
(argc > 2 ? argv[2] : "foo.gz"), (argc > 2 ? argv[2] : TESTFILE),
uncompr, (int)uncomprLen); uncompr, (int)uncomprLen);
test_deflate(compr, comprLen); test_deflate(compr, comprLen);

View File

@@ -1,5 +1,5 @@
/* gzio.c -- IO on .gz files /* gzio.c -- IO on .gz files
* Copyright (C) 1995-1998 Jean-loup Gailly. * Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
* *
* Compile this file with -DNO_DEFLATE to avoid the compression code. * Compile this file with -DNO_DEFLATE to avoid the compression code.
@@ -446,10 +446,14 @@ int ZEXPORT gzread (file, buf, len)
s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
start = s->stream.next_out; start = s->stream.next_out;
if (getLong(s) != s->crc || getLong(s) != s->stream.total_out) { if (getLong(s) != s->crc) {
s->z_err = Z_DATA_ERROR; s->z_err = Z_DATA_ERROR;
} else { } else {
/* Check for concatenated .gz files: */ (void)getLong(s);
/* The uncompressed length returned by above getlong() may
* be different from s->stream.total_out) in case of
* concatenated .gz files. Check for such files:
*/
check_header(s); check_header(s);
if (s->z_err == Z_OK) { if (s->z_err == Z_OK) {
uLong total_in = s->stream.total_in; uLong total_in = s->stream.total_in;
@@ -740,7 +744,7 @@ z_off_t ZEXPORT gzseek (file, offset, whence)
return -1L; return -1L;
#else #else
if (whence == SEEK_SET) { if (whence == SEEK_SET) {
offset -= s->stream.total_out; offset -= s->stream.total_in;
} }
if (offset < 0) return -1L; if (offset < 0) return -1L;
@@ -819,6 +823,7 @@ int ZEXPORT gzrewind (file)
s->z_eof = 0; s->z_eof = 0;
s->stream.avail_in = 0; s->stream.avail_in = 0;
s->stream.next_in = s->inbuf; s->stream.next_in = s->inbuf;
s->crc = crc32(0L, Z_NULL, 0);
if (s->startpos == 0) { /* not a compressed file */ if (s->startpos == 0) { /* not a compressed file */
rewind(s->file); rewind(s->file);
@@ -879,7 +884,8 @@ local void putLong (file, x)
} }
/* =========================================================================== /* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets Reads a long in LSB order from the given gz_stream. Sets z_err in case
of error.
*/ */
#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ #if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */
local uLong getLong (gz_stream* s) local uLong getLong (gz_stream* s)

View File

@@ -1,5 +1,5 @@
/* infblock.c -- interpret and process block types to last block /* infblock.c -- interpret and process block types to last block
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -259,10 +259,12 @@ int r;
&s->sub.trees.tb, s->hufts, z); &s->sub.trees.tb, s->hufts, z);
if (t != Z_OK) if (t != Z_OK)
{ {
ZFREE(z, s->sub.trees.blens);
r = t; r = t;
if (r == Z_DATA_ERROR) if (r == Z_DATA_ERROR)
{
ZFREE(z, s->sub.trees.blens);
s->mode = BAD; s->mode = BAD;
}
LEAVE LEAVE
} }
s->sub.trees.index = 0; s->sub.trees.index = 0;
@@ -323,11 +325,13 @@ int r;
t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f), t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
s->sub.trees.blens, &bl, &bd, &tl, &td, s->sub.trees.blens, &bl, &bd, &tl, &td,
s->hufts, z); s->hufts, z);
ZFREE(z, s->sub.trees.blens);
if (t != Z_OK) if (t != Z_OK)
{ {
if (t == (uInt)Z_DATA_ERROR) if (t == (uInt)Z_DATA_ERROR)
{
ZFREE(z, s->sub.trees.blens);
s->mode = BAD; s->mode = BAD;
}
r = t; r = t;
LEAVE LEAVE
} }
@@ -339,6 +343,7 @@ int r;
} }
s->sub.decode.codes = c; s->sub.decode.codes = c;
} }
ZFREE(z, s->sub.trees.blens);
s->mode = CODES; s->mode = CODES;
case CODES: case CODES:
UPDATE UPDATE
@@ -355,13 +360,6 @@ int r;
s->mode = TYPE; s->mode = TYPE;
break; break;
} }
if (k > 7) /* return unused byte, if any */
{
Assert(k < 16, "inflate_codes grabbed too many bytes")
k -= 8;
n++;
p--; /* can always return one */
}
s->mode = DRY; s->mode = DRY;
case DRY: case DRY:
FLUSH FLUSH

View File

@@ -1,5 +1,5 @@
/* infblock.h -- header to use infblock.c /* infblock.h -- header to use infblock.c
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */

View File

@@ -1,5 +1,5 @@
/* infcodes.c -- process literals and length/distance pairs /* infcodes.c -- process literals and length/distance pairs
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -202,15 +202,9 @@ int r;
Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist)); Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));
c->mode = COPY; c->mode = COPY;
case COPY: /* o: copying bytes in window, waiting for space */ case COPY: /* o: copying bytes in window, waiting for space */
#ifndef __TURBOC__ /* Turbo C bug for following expression */
f = (uInt)(q - s->window) < c->sub.copy.dist ?
s->end - (c->sub.copy.dist - (q - s->window)) :
q - c->sub.copy.dist;
#else
f = q - c->sub.copy.dist; f = q - c->sub.copy.dist;
if ((uInt)(q - s->window) < c->sub.copy.dist) while (f < s->window) /* modulo window size-"while" instead */
f = s->end - (c->sub.copy.dist - (uInt)(q - s->window)); f += s->end - s->window; /* of "if" handles invalid distances */
#endif
while (c->len) while (c->len)
{ {
NEEDOUT NEEDOUT
@@ -227,6 +221,13 @@ int r;
c->mode = START; c->mode = START;
break; break;
case WASH: /* o: got eob, possibly more output */ case WASH: /* o: got eob, possibly more output */
if (k > 7) /* return unused byte, if any */
{
Assert(k < 16, "inflate_codes grabbed too many bytes")
k -= 8;
n++;
p--; /* can always return one */
}
FLUSH FLUSH
if (s->read != s->write) if (s->read != s->write)
LEAVE LEAVE

View File

@@ -1,5 +1,5 @@
/* infcodes.h -- header to use infcodes.c /* infcodes.h -- header to use infcodes.c
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */

View File

@@ -1,5 +1,5 @@
/* inffast.c -- process literals and length/distance pairs fast /* inffast.c -- process literals and length/distance pairs fast
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -97,28 +97,41 @@ z_streamp z;
/* do the copy */ /* do the copy */
m -= c; m -= c;
if ((uInt)(q - s->window) >= d) /* offset before dest */
{ /* just copy */
r = q - d; r = q - d;
*q++ = *r++; c--; /* minimum count is three, */ if (r < s->window) /* wrap if needed */
*q++ = *r++; c--; /* so unroll loop a little */
}
else /* else offset after destination */
{ {
e = d - (uInt)(q - s->window); /* bytes from offset to end */ do {
r = s->end - e; /* pointer to offset */ r += s->end - s->window; /* force pointer in window */
if (c > e) /* if source crosses, */ } while (r < s->window); /* covers invalid distances */
e = s->end - r;
if (c > e)
{ {
c -= e; /* copy to end of window */ c -= e; /* wrapped copy */
do { do {
*q++ = *r++; *q++ = *r++;
} while (--e); } while (--e);
r = s->window; /* copy rest from start of window */ r = s->window;
do {
*q++ = *r++;
} while (--c);
}
else /* normal copy */
{
*q++ = *r++; c--;
*q++ = *r++; c--;
do {
*q++ = *r++;
} while (--c);
} }
} }
do { /* copy all or what's left */ else /* normal copy */
{
*q++ = *r++; c--;
*q++ = *r++; c--;
do {
*q++ = *r++; *q++ = *r++;
} while (--c); } while (--c);
}
break; break;
} }
else if ((e & 64) == 0) else if ((e & 64) == 0)

View File

@@ -1,5 +1,5 @@
/* inffast.h -- header to use inffast.c /* inffast.h -- header to use inffast.c
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */

View File

@@ -10,116 +10,142 @@
local uInt fixed_bl = 9; local uInt fixed_bl = 9;
local uInt fixed_bd = 5; local uInt fixed_bd = 5;
local inflate_huft fixed_tl[] = { local inflate_huft fixed_tl[] = {
{{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115}, {{{82,7}},31}, {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
{{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192}, {{{80,7}},10}, {{{0,8}},96}, {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192},
{{{0,8}},32}, {{{0,9}},160}, {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160},
{{{0,9}},224}, {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144}, {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224},
{{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208}, {{{81,7}},17}, {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144},
{{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176}, {{{0,8}},8}, {{{0,8}},136}, {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208},
{{{0,8}},72}, {{{0,9}},240}, {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176},
{{{85,8}},227}, {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200}, {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240},
{{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168}, {{{0,8}},4}, {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
{{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232}, {{{80,7}},8}, {{{0,8}},92}, {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200},
{{{0,8}},28}, {{{0,9}},152}, {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168},
{{{0,9}},216}, {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184}, {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232},
{{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248}, {{{80,7}},3}, {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152},
{{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163}, {{{83,7}},35}, {{{0,8}},114}, {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216},
{{{0,8}},50}, {{{0,9}},196}, {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184},
{{{0,9}},164}, {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228}, {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248},
{{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148}, {{{84,7}},67}, {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
{{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212}, {{{82,7}},19}, {{{0,8}},106}, {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196},
{{{0,8}},42}, {{{0,9}},180}, {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164},
{{{0,9}},244}, {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0}, {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228},
{{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204}, {{{81,7}},15}, {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148},
{{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172}, {{{0,8}},6}, {{{0,8}},134}, {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212},
{{{0,8}},70}, {{{0,9}},236}, {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180},
{{{0,9}},156}, {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220}, {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244},
{{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188}, {{{0,8}},14}, {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
{{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252}, {{{96,7}},256}, {{{0,8}},81}, {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204},
{{{0,8}},17}, {{{85,8}},131}, {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172},
{{{0,9}},194}, {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162}, {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236},
{{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226}, {{{80,7}},6}, {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156},
{{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146}, {{{83,7}},59}, {{{0,8}},121}, {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220},
{{{0,8}},57}, {{{0,9}},210}, {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188},
{{{0,9}},178}, {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242}, {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252},
{{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258}, {{{83,7}},43}, {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
{{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202}, {{{81,7}},13}, {{{0,8}},101}, {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194},
{{{0,8}},37}, {{{0,9}},170}, {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162},
{{{0,9}},234}, {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154}, {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226},
{{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218}, {{{82,7}},23}, {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146},
{{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186}, {{{0,8}},13}, {{{0,8}},141}, {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210},
{{{0,8}},77}, {{{0,9}},250}, {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178},
{{{85,8}},195}, {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198}, {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242},
{{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166}, {{{0,8}},3}, {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
{{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230}, {{{80,7}},7}, {{{0,8}},91}, {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202},
{{{0,8}},27}, {{{0,9}},150}, {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170},
{{{0,9}},214}, {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182}, {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234},
{{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246}, {{{80,7}},5}, {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154},
{{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0}, {{{83,7}},51}, {{{0,8}},119}, {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218},
{{{0,8}},55}, {{{0,9}},206}, {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186},
{{{0,9}},174}, {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238}, {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250},
{{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158}, {{{84,7}},99}, {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
{{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222}, {{{82,7}},27}, {{{0,8}},111}, {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198},
{{{0,8}},47}, {{{0,9}},190}, {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166},
{{{0,9}},254}, {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115}, {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230},
{{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193}, {{{80,7}},10}, {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150},
{{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161}, {{{0,8}},0}, {{{0,8}},128}, {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214},
{{{0,8}},64}, {{{0,9}},225}, {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182},
{{{0,9}},145}, {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209}, {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246},
{{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177}, {{{0,8}},8}, {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
{{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241}, {{{80,7}},4}, {{{0,8}},84}, {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206},
{{{0,8}},20}, {{{85,8}},227}, {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174},
{{{0,9}},201}, {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169}, {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238},
{{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233}, {{{80,7}},8}, {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158},
{{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153}, {{{84,7}},83}, {{{0,8}},124}, {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222},
{{{0,8}},60}, {{{0,9}},217}, {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190},
{{{0,9}},185}, {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249}, {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254},
{{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163}, {{{83,7}},35}, {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115},
{{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197}, {{{81,7}},11}, {{{0,8}},98}, {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193},
{{{0,8}},34}, {{{0,9}},165}, {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161},
{{{0,9}},229}, {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149}, {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225},
{{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213}, {{{82,7}},19}, {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145},
{{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181}, {{{0,8}},10}, {{{0,8}},138}, {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209},
{{{0,8}},74}, {{{0,9}},245}, {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177},
{{{192,8}},0}, {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205}, {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241},
{{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173}, {{{0,8}},6}, {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227},
{{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237}, {{{80,7}},9}, {{{0,8}},94}, {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201},
{{{0,8}},30}, {{{0,9}},157}, {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169},
{{{0,9}},221}, {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189}, {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233},
{{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253}, {{{96,7}},256}, {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153},
{{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131}, {{{82,7}},31}, {{{0,8}},113}, {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217},
{{{0,8}},49}, {{{0,9}},195}, {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185},
{{{0,9}},163}, {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227}, {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249},
{{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147}, {{{83,7}},59}, {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163},
{{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211}, {{{81,7}},17}, {{{0,8}},105}, {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197},
{{{0,8}},41}, {{{0,9}},179}, {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165},
{{{0,9}},243}, {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258}, {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229},
{{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203}, {{{81,7}},13}, {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149},
{{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171}, {{{0,8}},5}, {{{0,8}},133}, {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213},
{{{0,8}},69}, {{{0,9}},235}, {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181},
{{{0,9}},155}, {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219}, {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245},
{{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187}, {{{0,8}},13}, {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0},
{{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251}, {{{80,7}},3}, {{{0,8}},83}, {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205},
{{{0,8}},19}, {{{85,8}},195}, {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173},
{{{0,9}},199}, {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167}, {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237},
{{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231}, {{{80,7}},7}, {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157},
{{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151}, {{{84,7}},67}, {{{0,8}},123}, {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221},
{{{0,8}},59}, {{{0,9}},215}, {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189},
{{{0,9}},183}, {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247}, {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253},
{{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0}, {{{83,7}},51}, {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131},
{{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207}, {{{81,7}},15}, {{{0,8}},103}, {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195},
{{{0,8}},39}, {{{0,9}},175}, {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163},
{{{0,9}},239}, {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159}, {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227},
{{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223}, {{{82,7}},27}, {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147},
{{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191}, {{{0,8}},15}, {{{0,8}},143}, {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211},
{{{0,8}},79}, {{{0,9}},255} {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179},
{{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243},
{{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258},
{{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203},
{{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171},
{{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235},
{{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155},
{{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219},
{{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187},
{{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251},
{{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195},
{{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199},
{{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167},
{{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231},
{{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151},
{{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215},
{{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183},
{{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247},
{{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0},
{{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207},
{{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175},
{{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239},
{{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159},
{{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223},
{{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191},
{{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255}
}; };
local inflate_huft fixed_td[] = { local inflate_huft fixed_td[] = {
{{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097}, {{{81,5}},5}, {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097},
{{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385}, {{{80,5}},3}, {{{88,5}},513}, {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385},
{{{84,5}},33}, {{{92,5}},8193}, {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193},
{{{192,5}},24577}, {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145}, {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577},
{{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577}, {{{80,5}},4}, {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145},
{{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289}, {{{82,5}},13}, {{{90,5}},3073}, {{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577},
{{{86,5}},193}, {{{192,5}},24577} {{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289},
{{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577}
}; };

View File

@@ -1,5 +1,5 @@
/* inflate.c -- zlib interface to inflate modules /* inflate.c -- zlib interface to inflate modules
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */

View File

@@ -1,5 +1,5 @@
/* inftrees.c -- generate Huffman trees for efficient decoding /* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -11,7 +11,7 @@
#endif #endif
const char inflate_copyright[] = const char inflate_copyright[] =
" inflate 1.1.2 Copyright 1995-1998 Mark Adler "; " inflate 1.1.4 Copyright 1995-2002 Mark Adler ";
/* /*
If you use the zlib library in a product, an acknowledgment is welcome 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 in the documentation of your product. If for some reason you cannot
@@ -24,6 +24,7 @@ struct internal_state {int dummy;}; /* for buggy compilers */
#define exop word.what.Exop #define exop word.what.Exop
#define bits word.what.Bits #define bits word.what.Bits
local int huft_build OF(( local int huft_build OF((
uIntf *, /* code lengths in bits */ uIntf *, /* code lengths in bits */
uInt, /* number of codes */ uInt, /* number of codes */
@@ -94,6 +95,7 @@ local int huft_build(uIntf* b, uInt n, uInt s, const uIntf* d, const uIntf* e,
inflate_huft* FAR *t, uIntf* m, inflate_huft* hp, uInt* hn, uIntf* v) inflate_huft* FAR *t, uIntf* m, inflate_huft* hp, uInt* hn, uIntf* v)
#else #else
local int huft_build(b, n, s, d, e, t, m, hp, hn, v) local int huft_build(b, n, s, d, e, t, m, hp, hn, v)
#endif
uIntf *b; /* code lengths in bits (all assumed <= BMAX) */ uIntf *b; /* code lengths in bits (all assumed <= BMAX) */
uInt n; /* number of codes (assumed <= 288) */ uInt n; /* number of codes (assumed <= 288) */
uInt s; /* number of simple-valued codes (0..s-1) */ uInt s; /* number of simple-valued codes (0..s-1) */
@@ -107,9 +109,7 @@ uIntf *v; /* working area: values in order of bit length */
/* Given a list of code lengths and a maximum table size, make a set of /* Given a list of code lengths and a maximum table size, make a set of
tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR
if the given code set is incomplete (the tables are still built in this if the given code set is incomplete (the tables are still built in this
case), Z_DATA_ERROR if the input is invalid (an over-subscribed set of case), or Z_DATA_ERROR if the input is invalid. */
lengths), or Z_MEM_ERROR if not enough memory. */
#endif
{ {
uInt a; /* counter for codes of length k */ uInt a; /* counter for codes of length k */
@@ -235,7 +235,7 @@ uIntf *v; /* working area: values in order of bit length */
/* allocate new table */ /* allocate new table */
if (*hn + z > MANY) /* (note: doesn't matter for fixed) */ if (*hn + z > MANY) /* (note: doesn't matter for fixed) */
return Z_MEM_ERROR; /* not enough memory */ return Z_DATA_ERROR; /* overflow of MANY */
u[h] = q = hp + *hn; u[h] = q = hp + *hn;
*hn += z; *hn += z;

View File

@@ -1,5 +1,5 @@
/* inftrees.h -- header to use inftrees.c /* inftrees.h -- header to use inftrees.c
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */

View File

@@ -1,5 +1,5 @@
/* inflate_util.c -- data and routines common to blocks and codes /* inflate_util.c -- data and routines common to blocks and codes
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */

View File

@@ -1,5 +1,5 @@
/* infutil.h -- types and macros common to blocks and codes /* infutil.h -- types and macros common to blocks and codes
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */

View File

@@ -1,5 +1,5 @@
/* maketree.c -- make inffixed.h table for decoding fixed codes /* maketree.c -- make inffixed.h table for decoding fixed codes
* Copyright (C) 1998 Mark Adler * Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -24,36 +24,6 @@
#define exop word.what.Exop #define exop word.what.Exop
#define bits word.what.Bits #define bits word.what.Bits
/* showtree is only used for debugging purposes */
void showtree(uInt b, inflate_huft *t, int d)
{
int i, e;
char p[2*d+1];
for (i = 0; i < 2*d; i++)
p[i] = ' ';
p[i] = 0;
printf("%s[%d]\n", p, 1<<b);
for (i = 0; i < (1<<b); i++)
{
e = t[i].exop;
if (e == 0) /* simple code */
printf("%s%d(%d): literal=%d\n", p, i, t[i].bits, t[i].base);
else if (e & 16) /* length */
printf("%s%d(%d): length/distance=%d+(%d)\n",
p, i, t[i].bits, t[i].base, e & 15);
else if ((e & 64) == 0) /* next table */
{
printf("%s%d(%d): *sub table*\n", p, i, t[i].bits);
showtree(e, t + t[i].base, d + 1);
}
else if (e & 32) /* end of block */
printf("%s%d(%d): end of block\n", p, i, t[i].bits);
else /* bad code */
printf("%s%d: bad code\n", p, i);
}
}
/* generate initialization table for an inflate_huft structure array */ /* generate initialization table for an inflate_huft structure array */
void maketree(uInt b, inflate_huft *t) void maketree(uInt b, inflate_huft *t)
{ {
@@ -68,9 +38,9 @@ void maketree(uInt b, inflate_huft *t)
fprintf(stderr, "maketree: cannot initialize sub-tables!\n"); fprintf(stderr, "maketree: cannot initialize sub-tables!\n");
exit(1); exit(1);
} }
if (i % 5 == 0) if (i % 4 == 0)
printf("\n "); printf("\n ");
printf(" {{%u,%u},%u}", t[i].exop, t[i].bits, t[i].base); printf(" {{{%u,%u}},%u}", t[i].exop, t[i].bits, t[i].base);
if (++i == (1<<b)) if (++i == (1<<b))
break; break;
putchar(','); putchar(',');
@@ -95,10 +65,6 @@ void main(void)
fprintf(stderr, "inflate_trees_fixed error %d\n", r); fprintf(stderr, "inflate_trees_fixed error %d\n", r);
return; return;
} }
/* puts("Literal/Length Tree:");
showtree(bl, tl, 1);
puts("Distance Tree:");
showtree(bd, td, 1); */
puts("/* inffixed.h -- table for decoding fixed codes"); puts("/* inffixed.h -- table for decoding fixed codes");
puts(" * Generated automatically by the maketree.c program"); puts(" * Generated automatically by the maketree.c program");
puts(" */"); puts(" */");

View File

@@ -1,5 +1,5 @@
/* minigzip.c -- simulate gzip using the zlib compression library /* minigzip.c -- simulate gzip using the zlib compression library
* Copyright (C) 1995-1998 Jean-loup Gailly. * Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -48,6 +48,9 @@
# define GZ_SUFFIX "-gz" # define GZ_SUFFIX "-gz"
# define fileno(file) file->__file # define fileno(file) file->__file
#endif #endif
#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
# include <unix.h> /* for fileno */
#endif
#ifndef WIN32 /* unlink already in stdio.h for WIN32 */ #ifndef WIN32 /* unlink already in stdio.h for WIN32 */
extern int unlink OF((const char *)); extern int unlink OF((const char *));

View File

@@ -1,5 +1,5 @@
/* trees.c -- output deflated data using Huffman coding /* trees.c -- output deflated data using Huffman coding
* Copyright (C) 1995-1998 Jean-loup Gailly * Copyright (C) 1995-2002 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -254,6 +254,13 @@ local void tr_static_init()
if (static_init_done) return; if (static_init_done) return;
/* For some embedded targets, global variables are not initialized: */
static_l_desc.static_tree = static_ltree;
static_l_desc.extra_bits = extra_lbits;
static_d_desc.static_tree = static_dtree;
static_d_desc.extra_bits = extra_dbits;
static_bl_desc.extra_bits = extra_blbits;
/* Initialize the mapping length (0..255) -> length code (0..28) */ /* Initialize the mapping length (0..255) -> length code (0..28) */
length = 0; length = 0;
for (code = 0; code < LENGTH_CODES-1; code++) { for (code = 0; code < LENGTH_CODES-1; code++) {
@@ -386,8 +393,6 @@ void _tr_init(s)
{ {
tr_static_init(); tr_static_init();
s->compressed_len = 0L;
s->l_desc.dyn_tree = s->dyn_ltree; s->l_desc.dyn_tree = s->dyn_ltree;
s->l_desc.stat_desc = &static_l_desc; s->l_desc.stat_desc = &static_l_desc;
@@ -401,6 +406,7 @@ void _tr_init(s)
s->bi_valid = 0; s->bi_valid = 0;
s->last_eob_len = 8; /* enough lookahead for inflate */ s->last_eob_len = 8; /* enough lookahead for inflate */
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
s->compressed_len = 0L;
s->bits_sent = 0L; s->bits_sent = 0L;
#endif #endif
@@ -612,7 +618,7 @@ local void gen_codes (tree, max_code, bl_count)
/* Check that the bit counts in bl_count are consistent. The last code /* Check that the bit counts in bl_count are consistent. The last code
* must be all ones. * must be all ones.
*/ */
Assert (code + bl_count[MAX_BITS]-1 == (ush)(1<<MAX_BITS)-(ush)1, Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
"inconsistent bit counts"); "inconsistent bit counts");
Tracev((stderr,"\ngen_codes: max_code %d ", max_code)); Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
@@ -913,9 +919,10 @@ void _tr_stored_block(s, buf, stored_len, eof)
#endif #endif
{ {
send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */
#ifdef __WXDEBUG__
s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
s->compressed_len += (stored_len + 4) << 3; s->compressed_len += (stored_len + 4) << 3;
#endif
copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
} }
@@ -939,7 +946,9 @@ void _tr_align(s)
{ {
send_bits(s, STATIC_TREES<<1, 3); send_bits(s, STATIC_TREES<<1, 3);
send_code(s, END_BLOCK, static_ltree); send_code(s, END_BLOCK, static_ltree);
#ifdef __WXDEBUG__
s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
#endif
bi_flush(s); bi_flush(s);
/* Of the 10 bits for the empty block, we have already sent /* Of the 10 bits for the empty block, we have already sent
* (10 - bi_valid) bits. The lookahead for the last real code (before * (10 - bi_valid) bits. The lookahead for the last real code (before
@@ -949,7 +958,9 @@ void _tr_align(s)
if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { if (1 + s->last_eob_len + 10 - s->bi_valid < 9) {
send_bits(s, STATIC_TREES<<1, 3); send_bits(s, STATIC_TREES<<1, 3);
send_code(s, END_BLOCK, static_ltree); send_code(s, END_BLOCK, static_ltree);
#ifdef __WXDEBUG__
s->compressed_len += 10L; s->compressed_len += 10L;
#endif
bi_flush(s); bi_flush(s);
} }
s->last_eob_len = 7; s->last_eob_len = 7;
@@ -957,13 +968,12 @@ void _tr_align(s)
/* =========================================================================== /* ===========================================================================
* Determine the best encoding for the current block: dynamic trees, static * Determine the best encoding for the current block: dynamic trees, static
* trees or store, and output the encoded block to the zip file. This function * trees or store, and output the encoded block to the zip file.
* returns the total compressed length for the file so far.
*/ */
#if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */ #if defined(__VISAGECPP__) /* Visualage can't handle this antiquated interface */
ulg _tr_flush_block(deflate_state* s, charf* buf, ulg stored_len, int eof) void _tr_flush_block(deflate_state* s, charf* buf, ulg stored_len, int eof)
#else #else
ulg _tr_flush_block(s, buf, stored_len, eof) void _tr_flush_block(s, buf, stored_len, eof)
deflate_state *s; deflate_state *s;
charf *buf; /* input block, or NULL if too old */ charf *buf; /* input block, or NULL if too old */
ulg stored_len; /* length of input block */ ulg stored_len; /* length of input block */
@@ -1011,25 +1021,6 @@ ulg _tr_flush_block(s, buf, stored_len, eof)
opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
} }
/* If compression failed and this is the first and last block,
* and if the .zip file can be seeked (to rewrite the local header),
* the whole file is transformed into a stored file:
*/
#ifdef STORED_FILE_OK
# ifdef FORCE_STORED_FILE
if (eof && s->compressed_len == 0L) { /* force stored file */
# else
if (stored_len <= opt_lenb && eof && s->compressed_len==0L && seekable()) {
# endif
/* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
if (buf == (charf*)0) error ("block vanished");
copy_block(buf, (unsigned)stored_len, 0); /* without header */
s->compressed_len = stored_len << 3;
s->method = STORED;
} else
#endif /* STORED_FILE_OK */
#ifdef FORCE_STORED #ifdef FORCE_STORED
if (buf != (char*)0) { /* force stored block */ if (buf != (char*)0) { /* force stored block */
#else #else
@@ -1051,25 +1042,32 @@ ulg _tr_flush_block(s, buf, stored_len, eof)
#endif #endif
send_bits(s, (STATIC_TREES<<1)+eof, 3); send_bits(s, (STATIC_TREES<<1)+eof, 3);
compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
#ifdef __WXDEBUG__
s->compressed_len += 3 + s->static_len; s->compressed_len += 3 + s->static_len;
#endif
} else { } else {
send_bits(s, (DYN_TREES<<1)+eof, 3); send_bits(s, (DYN_TREES<<1)+eof, 3);
send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
max_blindex+1); max_blindex+1);
compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
#ifdef __WXDEBUG__
s->compressed_len += 3 + s->opt_len; s->compressed_len += 3 + s->opt_len;
#endif
} }
Assert (s->compressed_len == s->bits_sent, "bad compressed size"); Assert (s->compressed_len == s->bits_sent, "bad compressed size");
/* The above check is made mod 2^32, for files larger than 512 MB
* and uLong implemented on 32 bits.
*/
init_block(s); init_block(s);
if (eof) { if (eof) {
bi_windup(s); bi_windup(s);
#ifdef __WXDEBUG__
s->compressed_len += 7; /* align on byte boundary */ s->compressed_len += 7; /* align on byte boundary */
#endif
} }
Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
s->compressed_len-7*eof)); s->compressed_len-7*eof));
return s->compressed_len >> 3;
} }
/* =========================================================================== /* ===========================================================================
@@ -1173,7 +1171,7 @@ local void compress_block(s, ltree, dtree)
} /* literal or match pair ? */ } /* literal or match pair ? */
/* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
Assert((unsigned)s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow"); Assert(s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow");
} while (lx < s->last_lit); } while (lx < s->last_lit);

View File

@@ -1,5 +1,5 @@
/* uncompr.c -- decompress a memory buffer /* uncompr.c -- decompress a memory buffer
* Copyright (C) 1995-1998 Jean-loup Gailly. * Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */

View File

@@ -1,5 +1,5 @@
/* zconf.h -- configuration of the zlib compression library /* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-1998 Jean-loup Gailly. * Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@@ -91,8 +91,8 @@
# define NO_DUMMY_DECL # define NO_DUMMY_DECL
#endif #endif
/* Borland C incorrectly complains about missing returns: */ /* Old Borland C incorrectly complains about missing returns: */
#if defined(__BORLANDC__) #if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
# define NEED_DUMMY_RETURN # define NEED_DUMMY_RETURN
#endif #endif
@@ -148,7 +148,7 @@
/* MSC small or medium model */ /* MSC small or medium model */
# define SMALL_MEDIUM # define SMALL_MEDIUM
# ifdef _MSC_VER # ifdef _MSC_VER
# define FAR __far # define FAR _far
# else # else
# define FAR far # define FAR far
# endif # endif
@@ -156,12 +156,13 @@
#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
# ifndef __32BIT__ # ifndef __32BIT__
# define SMALL_MEDIUM # define SMALL_MEDIUM
# define FAR __far # define FAR _far
# endif # endif
#endif #endif
/* Compile with -DZLIB_DLL for Windows DLL support */ /* Compile with -DZLIB_DLL for Windows DLL support */
#if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL) #if defined(ZLIB_DLL)
# if defined(_WINDOWS) || defined(WINDOWS)
# ifdef FAR # ifdef FAR
# undef FAR # undef FAR
# endif # endif
@@ -172,26 +173,51 @@
# else # else
# define ZEXPORTVA FAR _cdecl _export # define ZEXPORTVA FAR _cdecl _export
# endif # endif
# endif
# if defined (__BORLANDC__)
# if (__BORLANDC__ >= 0x0500) && defined (WIN32)
# include <windows.h>
# define ZEXPORT __declspec(dllexport) WINAPI
# define ZEXPORTRVA __declspec(dllexport) WINAPIV
#else #else
# if defined (__BORLANDC__) && defined (_Windows) && defined (__DLL__) # if defined (_Windows) && defined (__DLL__)
# define ZEXPORT _export # define ZEXPORT _export
# define ZEXPORTVA _export # define ZEXPORTVA _export
# endif
# endif
# endif
#endif
#if defined (__BEOS__)
# if defined (ZLIB_DLL)
# define ZEXTERN extern __declspec(dllexport)
# else # else
# define ZEXTERN extern __declspec(dllimport)
# endif
#endif
#ifndef ZEXPORT
# define ZEXPORT # define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA # define ZEXPORTVA
# endif # endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif #endif
#ifndef FAR #ifndef FAR
# define FAR # define FAR
#endif #endif
#if !defined(MACOS) && !defined(TARGET_OS_MAC)
typedef unsigned char Byte; /* 8 bits */ typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */ typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */ typedef unsigned long uLong; /* 32 bits or more */
#if defined(__BORLANDC__) && defined(SMALL_MEDIUM) #ifdef SMALL_MEDIUM
/* Borland C/C++ ignores FAR inside typedef */ /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR # define Bytef Byte FAR
#else #else
typedef Byte FAR Bytef; typedef Byte FAR Bytef;
@@ -220,6 +246,7 @@ typedef uLong FAR uLongf;
#ifndef SEEK_SET #ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif #endif
#ifndef z_off_t #ifndef z_off_t
# define z_off_t long # define z_off_t long

View File

@@ -1,4 +1,4 @@
.TH ZLIB 3 "19 March 1998" .TH ZLIB 3 "11 March 2002"
.SH NAME .SH NAME
zlib \- compression/decompression library zlib \- compression/decompression library
.SH SYNOPSIS .SH SYNOPSIS
@@ -81,8 +81,8 @@ These documents are also available in other formats from:
.IP .IP
ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
.SH AUTHORS .SH AUTHORS
Version 1.1.2 Version 1.1.4
Copyright (C) 1995-1998 Jean-loup Gailly (jloup@gzip.org) Copyright (C) 1995-2002 Jean-loup Gailly (jloup@gzip.org)
and Mark Adler (madler@alumni.caltech.edu). and Mark Adler (madler@alumni.caltech.edu).
.LP .LP
This software is provided "as-is," This software is provided "as-is,"

View File

@@ -1,7 +1,7 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library /* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.1.2, March 19th, 1998 version 1.1.4, March 11th, 2002
Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -31,13 +31,13 @@
#ifndef _ZLIB_H #ifndef _ZLIB_H
#define _ZLIB_H #define _ZLIB_H
#include "../zlib/zconf.h" #include "zconf.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#define ZLIB_VERSION "1.1.2" #define ZLIB_VERSION "1.1.4"
/* /*
The 'zlib' compression library provides in-memory compression and The 'zlib' compression library provides in-memory compression and
@@ -168,7 +168,7 @@ typedef z_stream FAR *z_streamp;
/* basic functions */ /* basic functions */
extern const char * ZEXPORT zlibVersion OF((void)); ZEXTERN const char * ZEXPORT zlibVersion OF((void));
/* The application can compare zlibVersion and ZLIB_VERSION for consistency. /* The application can compare zlibVersion and ZLIB_VERSION for consistency.
If the first character differs, the library code actually used is If the first character differs, the library code actually used is
not compatible with the zlib.h header file used by the application. not compatible with the zlib.h header file used by the application.
@@ -176,7 +176,7 @@ extern const char * ZEXPORT zlibVersion OF((void));
*/ */
/* /*
extern int ZEXPORT deflateInit OF((z_streamp strm, int level)); ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
Initializes the internal stream state for compression. The fields Initializes the internal stream state for compression. The fields
zalloc, zfree and opaque must be initialized before by the caller. zalloc, zfree and opaque must be initialized before by the caller.
@@ -198,7 +198,7 @@ extern int ZEXPORT deflateInit OF((z_streamp strm, int level));
*/ */
extern int ZEXPORT deflate OF((z_streamp strm, int flush)); ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
/* /*
deflate compresses as much data as possible, and stops when the input deflate compresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may introduce some buffer becomes empty or the output buffer becomes full. It may introduce some
@@ -271,11 +271,12 @@ extern int ZEXPORT deflate OF((z_streamp strm, int flush));
processed or more output produced), Z_STREAM_END if all input has been processed or more output produced), Z_STREAM_END if all input has been
consumed and all output has been produced (only when flush is set to consumed and all output has been produced (only when flush is set to
Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible. if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible
(for example avail_in or avail_out was zero).
*/ */
extern int ZEXPORT deflateEnd OF((z_streamp strm)); ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
/* /*
All dynamically allocated data structures for this stream are freed. All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any This function discards any unprocessed input and does not flush any
@@ -290,7 +291,7 @@ extern int ZEXPORT deflateEnd OF((z_streamp strm));
/* /*
extern int ZEXPORT inflateInit OF((z_streamp strm)); ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
Initializes the internal stream state for decompression. The fields Initializes the internal stream state for decompression. The fields
next_in, avail_in, zalloc, zfree and opaque must be initialized before by next_in, avail_in, zalloc, zfree and opaque must be initialized before by
@@ -310,7 +311,7 @@ extern int ZEXPORT inflateInit OF((z_streamp strm));
*/ */
extern int ZEXPORT inflate OF((z_streamp strm, int flush)); ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
/* /*
inflate decompresses as much data as possible, and stops when the input inflate decompresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may some buffer becomes empty or the output buffer becomes full. It may some
@@ -379,7 +380,7 @@ extern int ZEXPORT inflate OF((z_streamp strm, int flush));
*/ */
extern int ZEXPORT inflateEnd OF((z_streamp strm)); ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
/* /*
All dynamically allocated data structures for this stream are freed. All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any This function discards any unprocessed input and does not flush any
@@ -397,7 +398,7 @@ extern int ZEXPORT inflateEnd OF((z_streamp strm));
*/ */
/* /*
extern int ZEXPORT deflateInit2 OF((z_streamp strm, ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
int level, int level,
int method, int method,
int windowBits, int windowBits,
@@ -440,14 +441,14 @@ extern int ZEXPORT deflateInit2 OF((z_streamp strm,
not perform any compression: this will be done by deflate(). not perform any compression: this will be done by deflate().
*/ */
extern int ZEXPORT deflateSetDictionary OF((z_streamp strm, ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
const Bytef *dictionary, const Bytef *dictionary,
uInt dictLength)); uInt dictLength));
/* /*
Initializes the compression dictionary from the given byte sequence Initializes the compression dictionary from the given byte sequence
without producing any compressed output. This function must be called without producing any compressed output. This function must be called
immediately after deflateInit or deflateInit2, before any call of immediately after deflateInit, deflateInit2 or deflateReset, before any
deflate. The compressor and decompressor must use exactly the same call of deflate. The compressor and decompressor must use exactly the same
dictionary (see inflateSetDictionary). dictionary (see inflateSetDictionary).
The dictionary should consist of strings (byte sequences) that are likely The dictionary should consist of strings (byte sequences) that are likely
@@ -476,7 +477,7 @@ extern int ZEXPORT deflateSetDictionary OF((z_streamp strm,
perform any compression: this will be done by deflate(). perform any compression: this will be done by deflate().
*/ */
extern int ZEXPORT deflateCopy OF((z_streamp dest, ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
z_streamp source)); z_streamp source));
/* /*
Sets the destination stream as a complete copy of the source stream. Sets the destination stream as a complete copy of the source stream.
@@ -494,7 +495,7 @@ extern int ZEXPORT deflateCopy OF((z_streamp dest,
destination. destination.
*/ */
extern int ZEXPORT deflateReset OF((z_streamp strm)); ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
/* /*
This function is equivalent to deflateEnd followed by deflateInit, This function is equivalent to deflateEnd followed by deflateInit,
but does not free and reallocate all the internal compression state. but does not free and reallocate all the internal compression state.
@@ -505,7 +506,9 @@ extern int ZEXPORT deflateReset OF((z_streamp strm));
stream state was inconsistent (such as zalloc or state being NULL). stream state was inconsistent (such as zalloc or state being NULL).
*/ */
extern int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy)); ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
int level,
int strategy));
/* /*
Dynamically update the compression level and compression strategy. The Dynamically update the compression level and compression strategy. The
interpretation of level and strategy is as in deflateInit2. This can be interpretation of level and strategy is as in deflateInit2. This can be
@@ -525,7 +528,7 @@ extern int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy));
*/ */
/* /*
extern int ZEXPORT inflateInit2 OF((z_streamp strm, ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
int windowBits)); int windowBits));
This is another version of inflateInit with an extra parameter. The This is another version of inflateInit with an extra parameter. The
@@ -547,7 +550,7 @@ extern int ZEXPORT inflateInit2 OF((z_streamp strm,
modified, but next_out and avail_out are unchanged.) modified, but next_out and avail_out are unchanged.)
*/ */
extern int ZEXPORT inflateSetDictionary OF((z_streamp strm, ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
const Bytef *dictionary, const Bytef *dictionary,
uInt dictLength)); uInt dictLength));
/* /*
@@ -566,7 +569,7 @@ extern int ZEXPORT inflateSetDictionary OF((z_streamp strm,
inflate(). inflate().
*/ */
extern int ZEXPORT inflateSync OF((z_streamp strm)); ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
/* /*
Skips invalid compressed data until a full flush point (see above the Skips invalid compressed data until a full flush point (see above the
description of deflate with Z_FULL_FLUSH) can be found, or until all description of deflate with Z_FULL_FLUSH) can be found, or until all
@@ -581,7 +584,7 @@ extern int ZEXPORT inflateSync OF((z_streamp strm));
until success or end of the input data. until success or end of the input data.
*/ */
extern int ZEXPORT inflateReset OF((z_streamp strm)); ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
/* /*
This function is equivalent to inflateEnd followed by inflateInit, This function is equivalent to inflateEnd followed by inflateInit,
but does not free and reallocate all the internal decompression state. but does not free and reallocate all the internal decompression state.
@@ -602,7 +605,7 @@ extern int ZEXPORT inflateReset OF((z_streamp strm));
utility functions can easily be modified if you need special options. utility functions can easily be modified if you need special options.
*/ */
extern int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen)); const Bytef *source, uLong sourceLen));
/* /*
Compresses the source buffer into the destination buffer. sourceLen is Compresses the source buffer into the destination buffer. sourceLen is
@@ -617,7 +620,7 @@ extern int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
buffer. buffer.
*/ */
extern int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen, const Bytef *source, uLong sourceLen,
int level)); int level));
/* /*
@@ -632,7 +635,7 @@ extern int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
Z_STREAM_ERROR if the level parameter is invalid. Z_STREAM_ERROR if the level parameter is invalid.
*/ */
extern int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen)); const Bytef *source, uLong sourceLen));
/* /*
Decompresses the source buffer into the destination buffer. sourceLen is Decompresses the source buffer into the destination buffer. sourceLen is
@@ -653,7 +656,7 @@ extern int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
typedef voidp gzFile; typedef voidp gzFile;
extern gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
/* /*
Opens a gzip (.gz) file for reading or writing. The mode parameter Opens a gzip (.gz) file for reading or writing. The mode parameter
is as in fopen ("rb" or "wb") but can also include a compression level is as in fopen ("rb" or "wb") but can also include a compression level
@@ -669,7 +672,7 @@ extern gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
can be checked to distinguish the two cases (if errno is zero, the can be checked to distinguish the two cases (if errno is zero, the
zlib error is Z_MEM_ERROR). */ zlib error is Z_MEM_ERROR). */
extern gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
/* /*
gzdopen() associates a gzFile with the file descriptor fd. File gzdopen() associates a gzFile with the file descriptor fd. File
descriptors are obtained from calls like open, dup, creat, pipe or descriptors are obtained from calls like open, dup, creat, pipe or
@@ -682,7 +685,7 @@ extern gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
the (de)compression state. the (de)compression state.
*/ */
extern int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
/* /*
Dynamically update the compression level or strategy. See the description Dynamically update the compression level or strategy. See the description
of deflateInit2 for the meaning of these parameters. of deflateInit2 for the meaning of these parameters.
@@ -690,7 +693,7 @@ extern int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
opened for writing. opened for writing.
*/ */
extern int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
/* /*
Reads the given number of uncompressed bytes from the compressed file. Reads the given number of uncompressed bytes from the compressed file.
If the input file was not in gzip format, gzread copies the given number If the input file was not in gzip format, gzread copies the given number
@@ -698,28 +701,29 @@ extern int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
gzread returns the number of uncompressed bytes actually read (0 for gzread returns the number of uncompressed bytes actually read (0 for
end of file, -1 for error). */ end of file, -1 for error). */
extern int ZEXPORT gzwrite OF((gzFile file, const voidp buf, unsigned len)); ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
const voidp buf, unsigned len));
/* /*
Writes the given number of uncompressed bytes into the compressed file. Writes the given number of uncompressed bytes into the compressed file.
gzwrite returns the number of uncompressed bytes actually written gzwrite returns the number of uncompressed bytes actually written
(0 in case of error). (0 in case of error).
*/ */
extern int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
/* /*
Converts, formats, and writes the args to the compressed file under Converts, formats, and writes the args to the compressed file under
control of the format string, as in fprintf. gzprintf returns the number of control of the format string, as in fprintf. gzprintf returns the number of
uncompressed bytes actually written (0 in case of error). uncompressed bytes actually written (0 in case of error).
*/ */
extern int ZEXPORT gzputs OF((gzFile file, const char *s)); ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
/* /*
Writes the given null-terminated string to the compressed file, excluding Writes the given null-terminated string to the compressed file, excluding
the terminating null character. the terminating null character.
gzputs returns the number of characters written, or -1 in case of error. gzputs returns the number of characters written, or -1 in case of error.
*/ */
extern char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
/* /*
Reads bytes from the compressed file until len-1 characters are read, or Reads bytes from the compressed file until len-1 characters are read, or
a newline character is read and transferred to buf, or an end-of-file a newline character is read and transferred to buf, or an end-of-file
@@ -728,19 +732,19 @@ extern char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
gzgets returns buf, or Z_NULL in case of error. gzgets returns buf, or Z_NULL in case of error.
*/ */
extern int ZEXPORT gzputc OF((gzFile file, int c)); ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
/* /*
Writes c, converted to an unsigned char, into the compressed file. Writes c, converted to an unsigned char, into the compressed file.
gzputc returns the value that was written, or -1 in case of error. gzputc returns the value that was written, or -1 in case of error.
*/ */
extern int ZEXPORT gzgetc OF((gzFile file)); ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
/* /*
Reads one byte from the compressed file. gzgetc returns this byte Reads one byte from the compressed file. gzgetc returns this byte
or -1 in case of end of file or error. or -1 in case of end of file or error.
*/ */
extern int ZEXPORT gzflush OF((gzFile file, int flush)); ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
/* /*
Flushes all pending output into the compressed file. The parameter Flushes all pending output into the compressed file. The parameter
flush is as in the deflate() function. The return value is the zlib flush is as in the deflate() function. The return value is the zlib
@@ -750,10 +754,11 @@ extern int ZEXPORT gzflush OF((gzFile file, int flush));
degrade compression. degrade compression.
*/ */
extern z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence)); ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
z_off_t offset, int whence));
/* /*
Sets the starting position for the next gzread or gzwrite on the given Sets the starting position for the next gzread or gzwrite on the
compressed file. The offset represents a number of bytes in the given compressed file. The offset represents a number of bytes in the
uncompressed data stream. The whence parameter is defined as in lseek(2); uncompressed data stream. The whence parameter is defined as in lseek(2);
the value SEEK_END is not supported. the value SEEK_END is not supported.
If the file is opened for reading, this function is emulated but can be If the file is opened for reading, this function is emulated but can be
@@ -767,14 +772,14 @@ extern z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence));
would be before the current position. would be before the current position.
*/ */
extern int ZEXPORT gzrewind OF((gzFile file)); ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
/* /*
Rewinds the given file. This function is supported only for reading. Rewinds the given file. This function is supported only for reading.
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
*/ */
extern z_off_t ZEXPORT gztell OF((gzFile file)); ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
/* /*
Returns the starting position for the next gzread or gzwrite on the Returns the starting position for the next gzread or gzwrite on the
given compressed file. This position represents a number of bytes in the given compressed file. This position represents a number of bytes in the
@@ -783,20 +788,20 @@ extern z_off_t ZEXPORT gztell OF((gzFile file));
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
*/ */
extern int ZEXPORT gzeof OF((gzFile file)); ZEXTERN int ZEXPORT gzeof OF((gzFile file));
/* /*
Returns 1 when EOF has previously been detected reading the given Returns 1 when EOF has previously been detected reading the given
input stream, otherwise zero. input stream, otherwise zero.
*/ */
extern int ZEXPORT gzclose OF((gzFile file)); ZEXTERN int ZEXPORT gzclose OF((gzFile file));
/* /*
Flushes all pending output if necessary, closes the compressed file Flushes all pending output if necessary, closes the compressed file
and deallocates all the (de)compression state. The return value is the zlib and deallocates all the (de)compression state. The return value is the zlib
error number (see function gzerror below). error number (see function gzerror below).
*/ */
extern const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
/* /*
Returns the error message for the last error which occurred on the Returns the error message for the last error which occurred on the
given compressed file. errnum is set to zlib error number. If an given compressed file. errnum is set to zlib error number. If an
@@ -813,7 +818,7 @@ extern const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
compression library. compression library.
*/ */
extern uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
/* /*
Update a running Adler-32 checksum with the bytes buf[0..len-1] and Update a running Adler-32 checksum with the bytes buf[0..len-1] and
@@ -830,7 +835,7 @@ extern uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
if (adler != original_adler) error(); if (adler != original_adler) error();
*/ */
extern uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
/* /*
Update a running crc with the bytes buf[0..len-1] and return the updated Update a running crc with the bytes buf[0..len-1] and return the updated
crc. If buf is NULL, this function returns the required initial value crc. If buf is NULL, this function returns the required initial value
@@ -852,15 +857,15 @@ extern uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
/* deflateInit and inflateInit are macros to allow checking the zlib version /* deflateInit and inflateInit are macros to allow checking the zlib version
* and the compiler's view of z_stream: * and the compiler's view of z_stream:
*/ */
extern int ZEXPORT deflateInit_ OF((z_streamp strm, int level, ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
const char *version, int stream_size)); const char *version, int stream_size));
extern int ZEXPORT inflateInit_ OF((z_streamp strm, ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
const char *version, int stream_size)); const char *version, int stream_size));
extern int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
int windowBits, int memLevel, int windowBits, int memLevel,
int strategy, const char *version, int strategy, const char *version,
int stream_size)); int stream_size));
extern int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
const char *version, int stream_size)); const char *version, int stream_size));
#define deflateInit(strm, level) \ #define deflateInit(strm, level) \
deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
@@ -877,9 +882,9 @@ extern int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
struct internal_state {int dummy;}; /* hack for buggy compilers */ struct internal_state {int dummy;}; /* hack for buggy compilers */
#endif #endif
extern const char * ZEXPORT zError OF((int err)); ZEXTERN const char * ZEXPORT zError OF((int err));
extern int ZEXPORT inflateSyncPoint OF((z_streamp z)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
extern const uLongf * ZEXPORT get_crc_table OF((void)); ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
#ifdef __cplusplus #ifdef __cplusplus
} }