summaryrefslogtreecommitdiffstats
path: root/libpng
diff options
context:
space:
mode:
Diffstat (limited to 'libpng')
-rw-r--r--libpng/adler32.c7
-rw-r--r--libpng/compress.c15
-rw-r--r--libpng/crc32.c9
-rw-r--r--libpng/deflate.c92
-rw-r--r--libpng/deflate.h2
-rw-r--r--libpng/gzio.c102
-rw-r--r--libpng/infblock.c38
-rw-r--r--libpng/infblock.h2
-rw-r--r--libpng/infcodes.c31
-rw-r--r--libpng/infcodes.h2
-rw-r--r--libpng/inffast.c59
-rw-r--r--libpng/inffast.h2
-rw-r--r--libpng/inflate.c34
-rw-r--r--libpng/inftrees.c75
-rw-r--r--libpng/inftrees.h2
-rw-r--r--libpng/infutil.c7
-rw-r--r--libpng/infutil.h2
-rw-r--r--libpng/trees.c132
-rw-r--r--libpng/uncompr.c8
-rw-r--r--libpng/zconf.h2
-rw-r--r--libpng/zlib.h6
-rw-r--r--libpng/zutil.c33
-rw-r--r--libpng/zutil.h2
23 files changed, 252 insertions, 412 deletions
diff --git a/libpng/adler32.c b/libpng/adler32.c
index 16cf9a7..8990fd6 100644
--- a/libpng/adler32.c
+++ b/libpng/adler32.c
@@ -1,5 +1,5 @@
/* 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
*/
@@ -18,10 +18,7 @@
#define DO16(buf) DO8(buf,0); DO8(buf,8);
/* ========================================================================= */
-uLong ZEXPORT adler32(adler, buf, len)
- uLong adler;
- const Bytef *buf;
- uInt len;
+uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)
{
unsigned long s1 = adler & 0xffff;
unsigned long s2 = (adler >> 16) & 0xffff;
diff --git a/libpng/compress.c b/libpng/compress.c
index 1cee470..fcd0fa8 100644
--- a/libpng/compress.c
+++ b/libpng/compress.c
@@ -1,5 +1,5 @@
/* 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
*/
@@ -18,12 +18,7 @@
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.
*/
-int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
- int level;
+int ZEXPORT compress2 (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)
{
z_stream stream;
int err;
@@ -58,11 +53,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
/* ===========================================================================
*/
-int ZEXPORT compress (dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
+int ZEXPORT compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
{
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
}
diff --git a/libpng/crc32.c b/libpng/crc32.c
index a91101a..50fa876 100644
--- a/libpng/crc32.c
+++ b/libpng/crc32.c
@@ -1,5 +1,5 @@
/* 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
*/
@@ -124,7 +124,7 @@ local const uLongf crc_table[256] = {
/* =========================================================================
* This function can be used by asm versions of crc32()
*/
-const uLongf * ZEXPORT get_crc_table()
+const uLongf * ZEXPORT get_crc_table(void)
{
#ifdef DYNAMIC_CRC_TABLE
if (crc_table_empty) make_crc_table();
@@ -139,10 +139,7 @@ const uLongf * ZEXPORT get_crc_table()
#define DO8(buf) DO4(buf); DO4(buf);
/* ========================================================================= */
-uLong ZEXPORT crc32(crc, buf, len)
- uLong crc;
- const Bytef *buf;
- uInt len;
+uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len)
{
if (buf == Z_NULL) return 0L;
#ifdef DYNAMIC_CRC_TABLE
diff --git a/libpng/deflate.c b/libpng/deflate.c
index 25d5818..bb39139 100644
--- a/libpng/deflate.c
+++ b/libpng/deflate.c
@@ -1,5 +1,5 @@
/* 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
*/
@@ -52,7 +52,7 @@
#include "deflate.h"
const char deflate_copyright[] =
- " deflate 1.1.3 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
in the documentation of your product. If for some reason you cannot
@@ -187,11 +187,7 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
/* ========================================================================= */
-int ZEXPORT deflateInit_(strm, level, version, stream_size)
- z_streamp strm;
- int level;
- const char *version;
- int stream_size;
+int ZEXPORT deflateInit_(z_streamp strm, int level, const char *version, int stream_size)
{
return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
Z_DEFAULT_STRATEGY, version, stream_size);
@@ -199,16 +195,7 @@ int ZEXPORT deflateInit_(strm, level, version, stream_size)
}
/* ========================================================================= */
-int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
- version, stream_size)
- z_streamp strm;
- int level;
- int method;
- int windowBits;
- int memLevel;
- int strategy;
- const char *version;
- int stream_size;
+int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)
{
deflate_state *s;
int noheader = 0;
@@ -242,7 +229,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
windowBits = -windowBits;
}
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) {
return Z_STREAM_ERROR;
}
@@ -288,10 +275,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
}
/* ========================================================================= */
-int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
- z_streamp strm;
- const Bytef *dictionary;
- uInt dictLength;
+int ZEXPORT deflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength)
{
deflate_state *s;
uInt length = dictLength;
@@ -329,8 +313,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
}
/* ========================================================================= */
-int ZEXPORT deflateReset (strm)
- z_streamp strm;
+int ZEXPORT deflateReset (z_streamp strm)
{
deflate_state *s;
@@ -359,10 +342,7 @@ int ZEXPORT deflateReset (strm)
}
/* ========================================================================= */
-int ZEXPORT deflateParams(strm, level, strategy)
- z_streamp strm;
- int level;
- int strategy;
+int ZEXPORT deflateParams(z_streamp strm, int level, int strategy)
{
deflate_state *s;
compress_func func;
@@ -399,9 +379,7 @@ int ZEXPORT deflateParams(strm, level, strategy)
* IN assertion: the stream state is correct and there is enough room in
* pending_buf.
*/
-local void putShortMSB (s, b)
- deflate_state *s;
- uInt b;
+local void putShortMSB (deflate_state *s, uInt b)
{
put_byte(s, (Byte)(b >> 8));
put_byte(s, (Byte)(b & 0xff));
@@ -413,8 +391,7 @@ local void putShortMSB (s, b)
* to avoid allocating a large strm->next_out buffer and copying into it.
* (See also read_buf()).
*/
-local void flush_pending(strm)
- z_streamp strm;
+local void flush_pending(z_streamp strm)
{
unsigned len = strm->state->pending;
@@ -433,9 +410,7 @@ local void flush_pending(strm)
}
/* ========================================================================= */
-int ZEXPORT deflate (strm, flush)
- z_streamp strm;
- int flush;
+int ZEXPORT deflate (z_streamp strm, int flush)
{
int old_flush; /* value of flush param for previous deflate call */
deflate_state *s;
@@ -567,8 +542,7 @@ int ZEXPORT deflate (strm, flush)
}
/* ========================================================================= */
-int ZEXPORT deflateEnd (strm)
- z_streamp strm;
+int ZEXPORT deflateEnd (z_streamp strm)
{
int status;
@@ -597,9 +571,7 @@ int ZEXPORT deflateEnd (strm)
* To simplify the source, this is not supported for 16-bit MSDOS (which
* doesn't have enough memory anyway to duplicate compression states).
*/
-int ZEXPORT deflateCopy (dest, source)
- z_streamp dest;
- z_streamp source;
+int ZEXPORT deflateCopy (z_streamp dest, z_streamp source)
{
#ifdef MAXSEG_64K
return Z_STREAM_ERROR;
@@ -659,10 +631,7 @@ int ZEXPORT deflateCopy (dest, source)
* allocating a large strm->next_in buffer and copying from it.
* (See also flush_pending()).
*/
-local int read_buf(strm, buf, size)
- z_streamp strm;
- Bytef *buf;
- unsigned size;
+local int read_buf(z_streamp strm, Bytef *buf, unsigned int size)
{
unsigned len = strm->avail_in;
@@ -684,8 +653,7 @@ local int read_buf(strm, buf, size)
/* ===========================================================================
* Initialize the "longest match" routines for a new zlib stream
*/
-local void lm_init (s)
- deflate_state *s;
+local void lm_init (deflate_state *s)
{
s->window_size = (ulg)2L*s->w_size;
@@ -723,9 +691,9 @@ local void lm_init (s)
* match.S. The code will be functionally equivalent.
*/
#ifndef FASTEST
-local uInt longest_match(s, cur_match)
- deflate_state *s;
- IPos cur_match; /* current match */
+local uInt longest_match(deflate_state *s, IPos cur_match)
+
+ /* current match */
{
unsigned chain_length = s->max_chain_length;/* max hash chain length */
register Bytef *scan = s->window + s->strstart; /* current string */
@@ -865,9 +833,7 @@ local uInt longest_match(s, cur_match)
/* ---------------------------------------------------------------------------
* Optimized version for level == 1 only
*/
-local uInt longest_match(s, cur_match)
- deflate_state *s;
- IPos cur_match; /* current match */
+local uInt longest_match(deflate_state *s, IPos cur_match)
{
register Bytef *scan = s->window + s->strstart; /* current string */
register Bytef *match; /* matched string */
@@ -924,10 +890,7 @@ local uInt longest_match(s, cur_match)
/* ===========================================================================
* Check that the match at match_start is indeed a match.
*/
-local void check_match(s, start, match, length)
- deflate_state *s;
- IPos start, match;
- int length;
+local void check_match(default_state *s, IPos start, IPos match, int length)
{
/* check that the match is indeed a match */
if (zmemcmp(s->window + match,
@@ -958,8 +921,7 @@ local void check_match(s, start, match, length)
* performed for at least two bytes (required for the zip translate_eol
* option -- not supported here).
*/
-local void fill_window(s)
- deflate_state *s;
+local void fill_window(deflate_state *s)
{
register unsigned n, m;
register Posf *p;
@@ -1078,9 +1040,7 @@ local void fill_window(s)
* NOTE: this function should be optimized to avoid extra copying from
* window to pending_buf.
*/
-local block_state deflate_stored(s, flush)
- deflate_state *s;
- int flush;
+local block_state deflate_stored(deflate_state *s, int flush)
{
/* Stored blocks are limited to 0xffff bytes, pending_buf is limited
* to pending_buf_size, and each stored block has a 5 byte header:
@@ -1136,9 +1096,7 @@ local block_state deflate_stored(s, flush)
* new strings in the dictionary only for unmatched strings or for short
* matches. It is used only for the fast compression options.
*/
-local block_state deflate_fast(s, flush)
- deflate_state *s;
- int flush;
+local block_state deflate_fast(deflate_state *s, int flush)
{
IPos hash_head = NIL; /* head of the hash chain */
int bflush; /* set if current block must be flushed */
@@ -1232,9 +1190,7 @@ local block_state deflate_fast(s, flush)
* evaluation for matches: a match is finally adopted only if there is
* no better match at the next window position.
*/
-local block_state deflate_slow(s, flush)
- deflate_state *s;
- int flush;
+local block_state deflate_slow(deflate_state *s, int flush)
{
IPos hash_head = NIL; /* head of hash chain */
int bflush; /* set if current block must be flushed */
diff --git a/libpng/deflate.h b/libpng/deflate.h
index 962676d..b99a48a 100644
--- a/libpng/deflate.h
+++ b/libpng/deflate.h
@@ -1,5 +1,5 @@
/* 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
*/
diff --git a/libpng/gzio.c b/libpng/gzio.c
index f7c336a..2723a0e 100644
--- a/libpng/gzio.c
+++ b/libpng/gzio.c
@@ -1,5 +1,5 @@
/* 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
*
* Compile this file with -DNO_DEFLATE to avoid the compression code.
@@ -70,10 +70,7 @@ local uLong getLong OF((gz_stream *s));
can be checked to distinguish the two cases (if errno is zero, the
zlib error is Z_MEM_ERROR).
*/
-local gzFile gz_open (path, mode, fd)
- const char *path;
- const char *mode;
- int fd;
+local gzFile gz_open (const char *path, const char *mode, int fd)
{
int err;
int level = Z_DEFAULT_COMPRESSION; /* compression level */
@@ -180,9 +177,7 @@ local gzFile gz_open (path, mode, fd)
/* ===========================================================================
Opens a gzip (.gz) file for reading or writing.
*/
-gzFile ZEXPORT gzopen (path, mode)
- const char *path;
- const char *mode;
+gzFile ZEXPORT gzopen (const char *path, const char *mode)
{
return gz_open (path, mode, -1);
}
@@ -191,9 +186,7 @@ gzFile ZEXPORT gzopen (path, mode)
Associate a gzFile with the file descriptor fd. fd is not dup'ed here
to mimic the behavio(u)r of fdopen.
*/
-gzFile ZEXPORT gzdopen (fd, mode)
- int fd;
- const char *mode;
+gzFile ZEXPORT gzdopen (int fd, const char *mode)
{
char name[20];
@@ -206,10 +199,7 @@ gzFile ZEXPORT gzdopen (fd, mode)
/* ===========================================================================
* Update the compression level and strategy
*/
-int ZEXPORT gzsetparams (file, level, strategy)
- gzFile file;
- int level;
- int strategy;
+int ZEXPORT gzsetparams (gzFile file, int level, int strategy)
{
gz_stream *s = (gz_stream*)file;
@@ -233,8 +223,7 @@ int ZEXPORT gzsetparams (file, level, strategy)
for end of file.
IN assertion: the stream s has been sucessfully opened for reading.
*/
-local int get_byte(s)
- gz_stream *s;
+local int get_byte(gz_stream *s)
{
if (s->z_eof) return EOF;
if (s->stream.avail_in == 0) {
@@ -260,8 +249,7 @@ local int get_byte(s)
s->stream.avail_in is zero for the first time, but may be non-zero
for concatenated .gz files.
*/
-local void check_header(s)
- gz_stream *s;
+local void check_header(gz_stream *s)
{
int method; /* method byte */
int flags; /* flags byte */
@@ -313,8 +301,7 @@ local void check_header(s)
* Cleanup then free the given gz_stream. Return a zlib error code.
Try freeing in the reverse order of allocations.
*/
-local int destroy (s)
- gz_stream *s;
+local int destroy (gz_stream *s)
{
int err = Z_OK;
@@ -352,10 +339,7 @@ local int destroy (s)
Reads the given number of uncompressed bytes from the compressed file.
gzread returns the number of bytes actually read (0 for end of file).
*/
-int ZEXPORT gzread (file, buf, len)
- gzFile file;
- voidp buf;
- unsigned len;
+int ZEXPORT gzread (gzFile file, voidp buf, unsigned int len)
{
gz_stream *s = (gz_stream*)file;
Bytef *start = (Bytef*)buf; /* starting point for crc computation */
@@ -446,8 +430,7 @@ int ZEXPORT gzread (file, buf, len)
Reads one byte from the compressed file. gzgetc returns this byte
or -1 in case of end of file or error.
*/
-int ZEXPORT gzgetc(file)
- gzFile file;
+int ZEXPORT gzgetc(gzFile file)
{
unsigned char c;
@@ -464,10 +447,7 @@ int ZEXPORT gzgetc(file)
The current implementation is not optimized at all.
*/
-char * ZEXPORT gzgets(file, buf, len)
- gzFile file;
- char *buf;
- int len;
+char * ZEXPORT gzgets(gzFile file, char *buf, int len)
{
char *b = buf;
if (buf == Z_NULL || len <= 0) return Z_NULL;
@@ -483,10 +463,7 @@ char * ZEXPORT gzgets(file, buf, len)
Writes the given number of uncompressed bytes into the compressed file.
gzwrite returns the number of bytes actually written (0 in case of error).
*/
-int ZEXPORT gzwrite (file, buf, len)
- gzFile file;
- const voidp buf;
- unsigned len;
+int ZEXPORT gzwrite (gzFile file, const voidp buf, unsigned int len)
{
gz_stream *s = (gz_stream*)file;
@@ -542,12 +519,11 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
}
#else /* not ANSI C */
-int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
- gzFile file;
- const char *format;
- int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
+int ZEXPORTVA gzprintf (gzFile file, const char *format,
+ int a1, int a2, int a3, int a4, int a5,
+ int a6, int a7, int a8, int a9, int a10,
+ int a11, int a12, int a13, int a14, int a15,
+ int a16, int a17, int a18, int a19, int a20)
{
char buf[Z_PRINTF_BUFSIZE];
int len;
@@ -570,9 +546,7 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
Writes c, converted to an unsigned char, into the compressed file.
gzputc returns the value that was written, or -1 in case of error.
*/
-int ZEXPORT gzputc(file, c)
- gzFile file;
- int c;
+int ZEXPORT gzputc(gzFile file, int c)
{
unsigned char cc = (unsigned char) c; /* required for big endian systems */
@@ -585,9 +559,7 @@ int ZEXPORT gzputc(file, c)
the terminating null character.
gzputs returns the number of characters written, or -1 in case of error.
*/
-int ZEXPORT gzputs(file, s)
- gzFile file;
- const char *s;
+int ZEXPORT gzputs(gzFile file, const char *s)
{
return gzwrite(file, (char*)s, (unsigned)strlen(s));
}
@@ -597,9 +569,7 @@ int ZEXPORT gzputs(file, s)
Flushes all pending output into the compressed file. The parameter
flush is as in the deflate() function.
*/
-local int do_flush (file, flush)
- gzFile file;
- int flush;
+local int do_flush (gzFile file, int flush)
{
uInt len;
int done = 0;
@@ -636,9 +606,7 @@ local int do_flush (file, flush)
return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
}
-int ZEXPORT gzflush (file, flush)
- gzFile file;
- int flush;
+int ZEXPORT gzflush (gzFile file, int flush)
{
gz_stream *s = (gz_stream*)file;
int err = do_flush (file, flush);
@@ -657,10 +625,7 @@ int ZEXPORT gzflush (file, flush)
SEEK_END is not implemented, returns error.
In this version of the library, gzseek can be extremely slow.
*/
-z_off_t ZEXPORT gzseek (file, offset, whence)
- gzFile file;
- z_off_t offset;
- int whence;
+z_off_t ZEXPORT gzseek (gzFile file, long int offset, int whence)
{
gz_stream *s = (gz_stream*)file;
@@ -738,8 +703,7 @@ z_off_t ZEXPORT gzseek (file, offset, whence)
/* ===========================================================================
Rewinds input file.
*/
-int ZEXPORT gzrewind (file)
- gzFile file;
+int ZEXPORT gzrewind (gzFile file)
{
gz_stream *s = (gz_stream*)file;
@@ -765,8 +729,7 @@ int ZEXPORT gzrewind (file)
given compressed file. This position represents a number of bytes in the
uncompressed data stream.
*/
-z_off_t ZEXPORT gztell (file)
- gzFile file;
+z_off_t ZEXPORT gztell (gzFile file)
{
return gzseek(file, 0L, SEEK_CUR);
}
@@ -775,8 +738,7 @@ z_off_t ZEXPORT gztell (file)
Returns 1 when EOF has previously been detected reading the given
input stream, otherwise zero.
*/
-int ZEXPORT gzeof (file)
- gzFile file;
+int ZEXPORT gzeof (gzFile file)
{
gz_stream *s = (gz_stream*)file;
@@ -786,9 +748,7 @@ int ZEXPORT gzeof (file)
/* ===========================================================================
Outputs a long in LSB order to the given file
*/
-local void putLong (file, x)
- FILE *file;
- uLong x;
+local void putLong (FILE *file, uLong x)
{
int n;
for (n = 0; n < 4; n++) {
@@ -801,8 +761,7 @@ local void putLong (file, x)
Reads a long in LSB order from the given gz_stream. Sets z_err in case
of error.
*/
-local uLong getLong (s)
- gz_stream *s;
+local uLong getLong (gz_stream *s)
{
uLong x = (uLong)get_byte(s);
int c;
@@ -819,8 +778,7 @@ local uLong getLong (s)
Flushes all pending output if necessary, closes the compressed file
and deallocates all the (de)compression state.
*/
-int ZEXPORT gzclose (file)
- gzFile file;
+int ZEXPORT gzclose (gzFile file)
{
int err;
gz_stream *s = (gz_stream*)file;
@@ -848,9 +806,7 @@ int ZEXPORT gzclose (file)
errnum is set to Z_ERRNO and the application may consult errno
to get the exact error code.
*/
-const char* ZEXPORT gzerror (file, errnum)
- gzFile file;
- int *errnum;
+const char* ZEXPORT gzerror (gzFile file, int *errnum)
{
char *m;
gz_stream *s = (gz_stream*)file;
diff --git a/libpng/infblock.c b/libpng/infblock.c
index f4920fa..62f3b6e 100644
--- a/libpng/infblock.c
+++ b/libpng/infblock.c
@@ -1,5 +1,5 @@
/* 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
*/
@@ -65,10 +65,7 @@ local const uInt border[] = { /* Order of the bit length code lengths */
*/
-void inflate_blocks_reset(s, z, c)
-inflate_blocks_statef *s;
-z_streamp z;
-uLongf *c;
+void inflate_blocks_reset(inflate_blocks_statef *s, z_streamp z, uLongf *c)
{
if (c != Z_NULL)
*c = s->check;
@@ -86,10 +83,7 @@ uLongf *c;
}
-inflate_blocks_statef *inflate_blocks_new(z, c, w)
-z_streamp z;
-check_func c;
-uInt w;
+inflate_blocks_statef *inflate_blocks_new(z_streamp z, check_func c, uInt w)
{
inflate_blocks_statef *s;
@@ -117,10 +111,7 @@ uInt w;
}
-int inflate_blocks(s, z, r)
-inflate_blocks_statef *s;
-z_streamp z;
-int r;
+int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r)
{
uInt t; /* temporary storage */
uLong b; /* bit buffer */
@@ -249,10 +240,12 @@ int r;
&s->sub.trees.tb, s->hufts, z);
if (t != Z_OK)
{
- ZFREE(z, s->sub.trees.blens);
r = t;
if (r == Z_DATA_ERROR)
+ {
+ ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
+ }
LEAVE
}
s->sub.trees.index = 0;
@@ -313,11 +306,13 @@ int r;
t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
s->sub.trees.blens, &bl, &bd, &tl, &td,
s->hufts, z);
- ZFREE(z, s->sub.trees.blens);
if (t != Z_OK)
{
if (t == (uInt)Z_DATA_ERROR)
+ {
+ ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
+ }
r = t;
LEAVE
}
@@ -329,6 +324,7 @@ int r;
}
s->sub.decode.codes = c;
}
+ ZFREE(z, s->sub.trees.blens);
s->mode = CODES;
case CODES:
UPDATE
@@ -364,9 +360,7 @@ int r;
}
-int inflate_blocks_free(s, z)
-inflate_blocks_statef *s;
-z_streamp z;
+int inflate_blocks_free(inflate_blocks_statef *s, z_streamp z)
{
inflate_blocks_reset(s, z, Z_NULL);
ZFREE(z, s->window);
@@ -377,10 +371,7 @@ z_streamp z;
}
-void inflate_set_dictionary(s, d, n)
-inflate_blocks_statef *s;
-const Bytef *d;
-uInt n;
+void inflate_set_dictionary(inflate_blocks_statef *s, const Bytef *d, uInt n)
{
zmemcpy(s->window, d, n);
s->read = s->write = s->window + n;
@@ -391,8 +382,7 @@ uInt n;
* by Z_SYNC_FLUSH or Z_FULL_FLUSH.
* IN assertion: s != Z_NULL
*/
-int inflate_blocks_sync_point(s)
-inflate_blocks_statef *s;
+int inflate_blocks_sync_point(inflate_blocks_statef *s)
{
return s->mode == LENS;
}
diff --git a/libpng/infblock.h b/libpng/infblock.h
index bd25c80..173b226 100644
--- a/libpng/infblock.h
+++ b/libpng/infblock.h
@@ -1,5 +1,5 @@
/* 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
*/
diff --git a/libpng/infcodes.c b/libpng/infcodes.c
index d4e5ee9..a6e6f9f 100644
--- a/libpng/infcodes.c
+++ b/libpng/infcodes.c
@@ -1,5 +1,5 @@
/* 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
*/
@@ -56,11 +56,11 @@ struct inflate_codes_state {
};
-inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z)
-uInt bl, bd;
-inflate_huft *tl;
-inflate_huft *td; /* need separate declaration for Borland C++ */
-z_streamp z;
+inflate_codes_statef *inflate_codes_new(uInt bl, uInt bd, inflate_huft *tl, inflate_huft *td, z_streamp z)
+
+
+ /* need separate declaration for Borland C++ */
+
{
inflate_codes_statef *c;
@@ -78,10 +78,7 @@ z_streamp z;
}
-int inflate_codes(s, z, r)
-inflate_blocks_statef *s;
-z_streamp z;
-int r;
+int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
{
uInt j; /* temporary storage */
inflate_huft *t; /* temporary pointer */
@@ -196,15 +193,9 @@ int r;
Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));
c->mode = COPY;
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;
- if ((uInt)(q - s->window) < c->sub.copy.dist)
- f = s->end - (c->sub.copy.dist - (uInt)(q - s->window));
-#endif
+ while (f < s->window) /* modulo window size-"while" instead */
+ f += s->end - s->window; /* of "if" handles invalid distances */
while (c->len)
{
NEEDOUT
@@ -248,9 +239,7 @@ int r;
}
-void inflate_codes_free(c, z)
-inflate_codes_statef *c;
-z_streamp z;
+void inflate_codes_free(inflate_codes_statef *c, z_streamp z)
{
ZFREE(z, c);
Tracev((stderr, "inflate: codes free\n"));
diff --git a/libpng/infcodes.h b/libpng/infcodes.h
index 6c750d8..46821a0 100644
--- a/libpng/infcodes.h
+++ b/libpng/infcodes.h
@@ -1,5 +1,5 @@
/* 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
*/
diff --git a/libpng/inffast.c b/libpng/inffast.c
index 61a78ee..1f0d650 100644
--- a/libpng/inffast.c
+++ b/libpng/inffast.c
@@ -1,5 +1,5 @@
/* 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
*/
@@ -25,12 +25,12 @@ struct inflate_codes_state {int dummy;}; /* for buggy compilers */
at least ten. The ten bytes are six bytes for the longest length/
distance pair plus four bytes for overloading the bit buffer. */
-int inflate_fast(bl, bd, tl, td, s, z)
-uInt bl, bd;
-inflate_huft *tl;
-inflate_huft *td; /* need separate declaration for Borland C++ */
-inflate_blocks_statef *s;
-z_streamp z;
+int inflate_fast(uInt bl, uInt bd, inflate_huft *tl, inflate_huft *td, inflate_blocks_statef *s, z_streamp z)
+
+
+ /* need separate declaration for Borland C++ */
+
+
{
inflate_huft *t; /* temporary pointer */
uInt e; /* extra bits or operation */
@@ -93,28 +93,41 @@ z_streamp z;
/* do the copy */
m -= c;
- if ((uInt)(q - s->window) >= d) /* offset before dest */
- { /* just copy */
- r = q - d;
- *q++ = *r++; c--; /* minimum count is three, */
- *q++ = *r++; c--; /* so unroll loop a little */
- }
- else /* else offset after destination */
+ r = q - d;
+ if (r < s->window) /* wrap if needed */
{
- e = d - (uInt)(q - s->window); /* bytes from offset to end */
- r = s->end - e; /* pointer to offset */
- if (c > e) /* if source crosses, */
+ do {
+ r += s->end - s->window; /* force pointer in window */
+ } 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 {
- *q++ = *r++;
+ *q++ = *r++;
} 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);
+ }
+ }
+ else /* normal copy */
+ {
+ *q++ = *r++; c--;
+ *q++ = *r++; c--;
+ do {
+ *q++ = *r++;
+ } while (--c);
}
- do { /* copy all or what's left */
- *q++ = *r++;
- } while (--c);
break;
}
else if ((e & 64) == 0)
diff --git a/libpng/inffast.h b/libpng/inffast.h
index 8facec5..a31a4bb 100644
--- a/libpng/inffast.h
+++ b/libpng/inffast.h
@@ -1,5 +1,5 @@
/* 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
*/
diff --git a/libpng/inflate.c b/libpng/inflate.c
index 32e9b8d..5425855 100644
--- a/libpng/inflate.c
+++ b/libpng/inflate.c
@@ -1,5 +1,5 @@
/* 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
*/
@@ -50,8 +50,7 @@ struct internal_state {
};
-int ZEXPORT inflateReset(z)
-z_streamp z;
+int ZEXPORT inflateReset(z_streamp z)
{
if (z == Z_NULL || z->state == Z_NULL)
return Z_STREAM_ERROR;
@@ -64,8 +63,7 @@ z_streamp z;
}
-int ZEXPORT inflateEnd(z)
-z_streamp z;
+int ZEXPORT inflateEnd(z_streamp z)
{
if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL)
return Z_STREAM_ERROR;
@@ -78,11 +76,7 @@ z_streamp z;
}
-int ZEXPORT inflateInit2_(z, w, version, stream_size)
-z_streamp z;
-int w;
-const char *version;
-int stream_size;
+int ZEXPORT inflateInit2_(z_streamp z, int w, const char *version, int stream_size)
{
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
stream_size != sizeof(z_stream))
@@ -135,10 +129,7 @@ int stream_size;
}
-int ZEXPORT inflateInit_(z, version, stream_size)
-z_streamp z;
-const char *version;
-int stream_size;
+int ZEXPORT inflateInit_(z_streamp z, const char *version, int stream_size)
{
return inflateInit2_(z, DEF_WBITS, version, stream_size);
}
@@ -147,9 +138,7 @@ int stream_size;
#define NEEDBYTE {if(z->avail_in==0)return r;r=f;}
#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
-int ZEXPORT inflate(z, f)
-z_streamp z;
-int f;
+int ZEXPORT inflate(z_streamp z, int f)
{
int r;
uInt b;
@@ -275,10 +264,7 @@ int f;
}
-int ZEXPORT inflateSetDictionary(z, dictionary, dictLength)
-z_streamp z;
-const Bytef *dictionary;
-uInt dictLength;
+int ZEXPORT inflateSetDictionary(z_streamp z, const Bytef *dictionary, uInt dictLength)
{
uInt length = dictLength;
@@ -299,8 +285,7 @@ uInt dictLength;
}
-int ZEXPORT inflateSync(z)
-z_streamp z;
+int ZEXPORT inflateSync(z_streamp z)
{
uInt n; /* number of bytes to look at */
Bytef *p; /* pointer to bytes */
@@ -357,8 +342,7 @@ z_streamp z;
* decompressing, PPP checks that at the end of input packet, inflate is
* waiting for these length bytes.
*/
-int ZEXPORT inflateSyncPoint(z)
-z_streamp z;
+int ZEXPORT inflateSyncPoint(z_streamp z)
{
if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL)
return Z_STREAM_ERROR;
diff --git a/libpng/inftrees.c b/libpng/inftrees.c
index ef1e0b6..901204d 100644
--- a/libpng/inftrees.c
+++ b/libpng/inftrees.c
@@ -1,5 +1,5 @@
/* 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
*/
@@ -11,7 +11,7 @@
#endif
const char inflate_copyright[] =
- " inflate 1.1.3 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
in the documentation of your product. If for some reason you cannot
@@ -90,22 +90,21 @@ local const uInt cpdext[30] = { /* Extra bits for distance codes */
/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */
#define BMAX 15 /* maximum bit length of any code */
-local int huft_build(b, n, s, d, e, t, m, hp, hn, v)
-uIntf *b; /* code lengths in bits (all assumed <= BMAX) */
-uInt n; /* number of codes (assumed <= 288) */
-uInt s; /* number of simple-valued codes (0..s-1) */
-const uIntf *d; /* list of base values for non-simple codes */
-const uIntf *e; /* list of extra bits for non-simple codes */
-inflate_huft * FAR *t; /* result: starting table */
-uIntf *m; /* maximum lookup bits, returns actual */
-inflate_huft *hp; /* space for trees */
-uInt *hn; /* hufts used in space */
-uIntf *v; /* working area: values in order of bit length */
+local int huft_build(uIntf *b, uInt n, uInt s, const uIntf *d, const uIntf *e, inflate_huft **t, uIntf *m, inflate_huft *hp, uInt *hn, uIntf *v)
+ /* code lengths in bits (all assumed <= BMAX) */
+ /* number of codes (assumed <= 288) */
+ /* number of simple-valued codes (0..s-1) */
+ /* list of base values for non-simple codes */
+ /* list of extra bits for non-simple codes */
+ /* result: starting table */
+ /* maximum lookup bits, returns actual */
+ /* space for trees */
+ /* hufts used in space */
+ /* working area: values in order of bit length */
/* 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
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
- lengths), or Z_MEM_ERROR if not enough memory. */
+ case), or Z_DATA_ERROR if the input is invalid. */
{
uInt a; /* counter for codes of length k */
@@ -231,7 +230,7 @@ uIntf *v; /* working area: values in order of bit length */
/* allocate new table */
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;
*hn += z;
@@ -291,12 +290,12 @@ uIntf *v; /* working area: values in order of bit length */
}
-int inflate_trees_bits(c, bb, tb, hp, z)
-uIntf *c; /* 19 code lengths */
-uIntf *bb; /* bits tree desired/actual depth */
-inflate_huft * FAR *tb; /* bits tree result */
-inflate_huft *hp; /* space for trees */
-z_streamp z; /* for messages */
+int inflate_trees_bits(uIntf *c, uIntf *bb, inflate_huft **tb, inflate_huft *hp, z_streamp z)
+ /* 19 code lengths */
+ /* bits tree desired/actual depth */
+ /* bits tree result */
+ /* space for trees */
+ /* for messages */
{
int r;
uInt hn = 0; /* hufts used in space */
@@ -318,16 +317,16 @@ z_streamp z; /* for messages */
}
-int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z)
-uInt nl; /* number of literal/length codes */
-uInt nd; /* number of distance codes */
-uIntf *c; /* that many (total) code lengths */
-uIntf *bl; /* literal desired/actual bit depth */
-uIntf *bd; /* distance desired/actual bit depth */
-inflate_huft * FAR *tl; /* literal/length tree result */
-inflate_huft * FAR *td; /* distance tree result */
-inflate_huft *hp; /* space for trees */
-z_streamp z; /* for messages */
+int inflate_trees_dynamic(uInt nl, uInt nd, uIntf *c, uIntf *bl, uIntf *bd, inflate_huft **tl, inflate_huft **td, inflate_huft *hp, z_streamp z)
+ /* number of literal/length codes */
+ /* number of distance codes */
+ /* that many (total) code lengths */
+ /* literal desired/actual bit depth */
+ /* distance desired/actual bit depth */
+ /* literal/length tree result */
+ /* distance tree result */
+ /* space for trees */
+ /* for messages */
{
int r;
uInt hn = 0; /* hufts used in space */
@@ -396,12 +395,12 @@ local inflate_huft *fixed_td;
#endif
-int inflate_trees_fixed(bl, bd, tl, td, z)
-uIntf *bl; /* literal desired/actual bit depth */
-uIntf *bd; /* distance desired/actual bit depth */
-inflate_huft * FAR *tl; /* literal/length tree result */
-inflate_huft * FAR *td; /* distance tree result */
-z_streamp z; /* for memory allocation */
+int inflate_trees_fixed(uIntf *bl, uIntf *bd, inflate_huft **tl, inflate_huft **td, z_streamp z)
+ /* literal desired/actual bit depth */
+ /* distance desired/actual bit depth */
+ /* literal/length tree result */
+ /* distance tree result */
+ /* for memory allocation */
{
#ifdef BUILDFIXED
/* build fixed tables if not already */
diff --git a/libpng/inftrees.h b/libpng/inftrees.h
index 85853e0..04b73b7 100644
--- a/libpng/inftrees.h
+++ b/libpng/inftrees.h
@@ -1,5 +1,5 @@
/* 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
*/
diff --git a/libpng/infutil.c b/libpng/infutil.c
index 824dab5..537c8c7 100644
--- a/libpng/infutil.c
+++ b/libpng/infutil.c
@@ -1,5 +1,5 @@
/* 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
*/
@@ -20,10 +20,7 @@ uInt inflate_mask[17] = {
/* copy as much as possible from the sliding window to the output area */
-int inflate_flush(s, z, r)
-inflate_blocks_statef *s;
-z_streamp z;
-int r;
+int inflate_flush(inflate_blocks_statef *s, z_streamp z, int r)
{
uInt n;
Bytef *p;
diff --git a/libpng/infutil.h b/libpng/infutil.h
index 99d1135..4401df8 100644
--- a/libpng/infutil.h
+++ b/libpng/infutil.h
@@ -1,5 +1,5 @@
/* 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
*/
diff --git a/libpng/trees.c b/libpng/trees.c
index f01fb30..6125d6b 100644
--- a/libpng/trees.c
+++ b/libpng/trees.c
@@ -1,5 +1,5 @@
/* 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
*/
@@ -189,10 +189,7 @@ local void gen_trees_header OF((void));
#ifdef DEBUG
local void send_bits OF((deflate_state *s, int value, int length));
-local void send_bits(s, value, length)
- deflate_state *s;
- int value; /* value to send */
- int length; /* number of bits */
+local void send_bits(deflate_state s, int value, int length)
{
Tracevv((stderr," l %2d v %4x ", length, value));
Assert(length > 0 && length <= 15, "invalid length");
@@ -236,7 +233,7 @@ local void send_bits(s, value, length)
/* ===========================================================================
* Initialize the various 'constant' tables.
*/
-local void tr_static_init()
+local void tr_static_init(void)
{
#if defined(GEN_TREES_H) || !defined(STDC)
static int static_init_done = 0;
@@ -380,8 +377,7 @@ void gen_trees_header()
/* ===========================================================================
* Initialize the tree data structures for a new zlib stream.
*/
-void _tr_init(s)
- deflate_state *s;
+void _tr_init(deflate_state *s)
{
tr_static_init();
@@ -409,8 +405,7 @@ void _tr_init(s)
/* ===========================================================================
* Initialize a new block.
*/
-local void init_block(s)
- deflate_state *s;
+local void init_block(deflate_state *s)
{
int n; /* iterates over tree elements */
@@ -453,10 +448,10 @@ local void init_block(s)
* when the heap property is re-established (each father smaller than its
* two sons).
*/
-local void pqdownheap(s, tree, k)
- deflate_state *s;
- ct_data *tree; /* the tree to restore */
- int k; /* node to move down */
+local void pqdownheap(deflate_state *s, ct_data *tree, int k)
+
+ /* the tree to restore */
+ /* node to move down */
{
int v = s->heap[k];
int j = k << 1; /* left son of k */
@@ -488,9 +483,9 @@ local void pqdownheap(s, tree, k)
* The length opt_len is updated; static_len is also updated if stree is
* not null.
*/
-local void gen_bitlen(s, desc)
- deflate_state *s;
- tree_desc *desc; /* the tree descriptor */
+local void gen_bitlen(deflate_state *s, tree_desc *desc)
+
+ /* the tree descriptor */
{
ct_data *tree = desc->dyn_tree;
int max_code = desc->max_code;
@@ -575,10 +570,10 @@ local void gen_bitlen(s, desc)
* OUT assertion: the field code is set for all tree elements of non
* zero code length.
*/
-local void gen_codes (tree, max_code, bl_count)
- ct_data *tree; /* the tree to decorate */
- int max_code; /* largest code with non zero frequency */
- ushf *bl_count; /* number of codes at each bit length */
+local void gen_codes (ct_data *tree, int max_code, ushf *bl_count)
+ /* the tree to decorate */
+ /* largest code with non zero frequency */
+ /* number of codes at each bit length */
{
ush next_code[MAX_BITS+1]; /* next code value for each bit length */
ush code = 0; /* running code value */
@@ -617,9 +612,9 @@ local void gen_codes (tree, max_code, bl_count)
* and corresponding code. The length opt_len is updated; static_len is
* also updated if stree is not null. The field max_code is set.
*/
-local void build_tree(s, desc)
- deflate_state *s;
- tree_desc *desc; /* the tree descriptor */
+local void build_tree(deflate_state *s, tree_desc *desc)
+
+ /* the tree descriptor */
{
ct_data *tree = desc->dyn_tree;
const ct_data *stree = desc->stat_desc->static_tree;
@@ -704,10 +699,10 @@ local void build_tree(s, desc)
* Scan a literal or distance tree to determine the frequencies of the codes
* in the bit length tree.
*/
-local void scan_tree (s, tree, max_code)
- deflate_state *s;
- ct_data *tree; /* the tree to be scanned */
- int max_code; /* and its largest code of non zero frequency */
+local void scan_tree (deflate_state *s, ct_data *tree, int max_code)
+
+ /* the tree to be scanned */
+ /* and its largest code of non zero frequency */
{
int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */
@@ -749,10 +744,10 @@ local void scan_tree (s, tree, max_code)
* Send a literal or distance tree in compressed form, using the codes in
* bl_tree.
*/
-local void send_tree (s, tree, max_code)
- deflate_state *s;
- ct_data *tree; /* the tree to be scanned */
- int max_code; /* and its largest code of non zero frequency */
+local void send_tree (deflate_state *s, ct_data *tree, int max_code)
+
+ /* the tree to be scanned */
+ /* and its largest code of non zero frequency */
{
int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */
@@ -800,8 +795,7 @@ local void send_tree (s, tree, max_code)
* Construct the Huffman tree for the bit lengths and return the index in
* bl_order of the last bit length code to send.
*/
-local int build_bl_tree(s)
- deflate_state *s;
+local int build_bl_tree(deflate_state *s)
{
int max_blindex; /* index of last bit length code of non zero freq */
@@ -835,9 +829,9 @@ local int build_bl_tree(s)
* lengths of the bit length codes, the literal tree and the distance tree.
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
*/
-local void send_all_trees(s, lcodes, dcodes, blcodes)
- deflate_state *s;
- int lcodes, dcodes, blcodes; /* number of codes for each tree */
+local void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes)
+
+ /* number of codes for each tree */
{
int rank; /* index in bl_order */
@@ -864,11 +858,11 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
/* ===========================================================================
* Send a stored block
*/
-void _tr_stored_block(s, buf, stored_len, eof)
- deflate_state *s;
- charf *buf; /* input block */
- ulg stored_len; /* length of input block */
- int eof; /* true if this is the last block for a file */
+void _tr_stored_block(deflate_state *s, charf *buf, ulg stored_len, int eof)
+
+ /* input block */
+ /* length of input block */
+ /* true if this is the last block for a file */
{
send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */
#ifdef DEBUG
@@ -889,8 +883,7 @@ void _tr_stored_block(s, buf, stored_len, eof)
* To simplify the code, we assume the worst case of last real code encoded
* on one bit only.
*/
-void _tr_align(s)
- deflate_state *s;
+void _tr_align(deflate_state *s)
{
send_bits(s, STATIC_TREES<<1, 3);
send_code(s, END_BLOCK, static_ltree);
@@ -918,11 +911,11 @@ void _tr_align(s)
* Determine the best encoding for the current block: dynamic trees, static
* trees or store, and output the encoded block to the zip file.
*/
-void _tr_flush_block(s, buf, stored_len, eof)
- deflate_state *s;
- charf *buf; /* input block, or NULL if too old */
- ulg stored_len; /* length of input block */
- int eof; /* true if this is the last block for a file */
+void _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len, int eof)
+
+ /* input block, or NULL if too old */
+ /* length of input block */
+ /* true if this is the last block for a file */
{
ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
int max_blindex = 0; /* index of last bit length code of non zero freq */
@@ -1018,10 +1011,10 @@ void _tr_flush_block(s, buf, stored_len, eof)
* Save the match info and tally the frequency counts. Return true if
* the current block must be flushed.
*/
-int _tr_tally (s, dist, lc)
- deflate_state *s;
- unsigned dist; /* distance of matched string */
- unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
+int _tr_tally (deflate_state *s, unsigned int dist, unsigned int lc)
+
+ /* distance of matched string */
+ /* match length-MIN_MATCH or unmatched char (if dist==0) */
{
s->d_buf[s->last_lit] = (ush)dist;
s->l_buf[s->last_lit++] = (uch)lc;
@@ -1068,10 +1061,10 @@ int _tr_tally (s, dist, lc)
/* ===========================================================================
* Send the block data compressed using the given Huffman trees
*/
-local void compress_block(s, ltree, dtree)
- deflate_state *s;
- ct_data *ltree; /* literal tree */
- ct_data *dtree; /* distance tree */
+local void compress_block(deflate_state *s, ct_data *ltree, ct_data *dtree)
+
+ /* literal tree */
+ /* distance tree */
{
unsigned dist; /* distance of matched string */
int lc; /* match length or unmatched char (if dist == 0) */
@@ -1121,8 +1114,7 @@ local void compress_block(s, ltree, dtree)
* IN assertion: the fields freq of dyn_ltree are set and the total of all
* frequencies does not exceed 64K (to fit in an int on 16 bit machines).
*/
-local void set_data_type(s)
- deflate_state *s;
+local void set_data_type(deflate_state *s)
{
int n = 0;
unsigned ascii_freq = 0;
@@ -1138,9 +1130,9 @@ local void set_data_type(s)
* method would use a table)
* IN assertion: 1 <= len <= 15
*/
-local unsigned bi_reverse(code, len)
- unsigned code; /* the value to invert */
- int len; /* its bit length */
+local unsigned bi_reverse(unsigned int code, int len)
+ /* the value to invert */
+ /* its bit length */
{
register unsigned res = 0;
do {
@@ -1153,8 +1145,7 @@ local unsigned bi_reverse(code, len)
/* ===========================================================================
* Flush the bit buffer, keeping at most 7 bits in it.
*/
-local void bi_flush(s)
- deflate_state *s;
+local void bi_flush(deflate_state *s)
{
if (s->bi_valid == 16) {
put_short(s, s->bi_buf);
@@ -1170,8 +1161,7 @@ local void bi_flush(s)
/* ===========================================================================
* Flush the bit buffer and align the output on a byte boundary
*/
-local void bi_windup(s)
- deflate_state *s;
+local void bi_windup(deflate_state *s)
{
if (s->bi_valid > 8) {
put_short(s, s->bi_buf);
@@ -1189,11 +1179,11 @@ local void bi_windup(s)
* Copy a stored block, storing first the length and its
* one's complement if requested.
*/
-local void copy_block(s, buf, len, header)
- deflate_state *s;
- charf *buf; /* the input data */
- unsigned len; /* its length */
- int header; /* true if block header must be written */
+local void copy_block(deflate_state *s, charf *buf, unsigned int len, int header)
+
+ /* the input data */
+ /* its length */
+ /* true if block header must be written */
{
bi_windup(s); /* align on byte boundary */
s->last_eob_len = 8; /* enough lookahead for inflate */
diff --git a/libpng/uncompr.c b/libpng/uncompr.c
index d103321..ebcb33f 100644
--- a/libpng/uncompr.c
+++ b/libpng/uncompr.c
@@ -1,5 +1,5 @@
/* 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
*/
@@ -22,11 +22,7 @@
enough memory, Z_BUF_ERROR if there was not enough room in the output
buffer, or Z_DATA_ERROR if the input data was corrupted.
*/
-int ZEXPORT uncompress (dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
+int ZEXPORT uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
{
z_stream stream;
int err;
diff --git a/libpng/zconf.h b/libpng/zconf.h
index 6d450fc..eb0ae2e 100644
--- a/libpng/zconf.h
+++ b/libpng/zconf.h
@@ -1,5 +1,5 @@
/* 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
*/
diff --git a/libpng/zlib.h b/libpng/zlib.h
index 49f56b4..52cb529 100644
--- a/libpng/zlib.h
+++ b/libpng/zlib.h
@@ -1,7 +1,7 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.1.3, July 9th, 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
warranty. In no event will the authors be held liable for any damages
@@ -37,7 +37,7 @@
extern "C" {
#endif
-#define ZLIB_VERSION "1.1.3"
+#define ZLIB_VERSION "1.1.4"
/*
The 'zlib' compression library provides in-memory compression and
diff --git a/libpng/zutil.c b/libpng/zutil.c
index b3de4e8..64cec41 100644
--- a/libpng/zutil.c
+++ b/libpng/zutil.c
@@ -1,5 +1,5 @@
/* zutil.c -- target dependent utility functions for the 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
*/
@@ -26,7 +26,7 @@ const char *z_errmsg[10] = {
""};
-const char * ZEXPORT zlibVersion()
+const char * ZEXPORT zlibVersion(void)
{
return ZLIB_VERSION;
}
@@ -38,8 +38,7 @@ const char * ZEXPORT zlibVersion()
# endif
int z_verbose = verbose;
-void z_error (m)
- char *m;
+void z_error (char *m)
{
fprintf(stderr, "%s\n", m);
exit(1);
@@ -49,8 +48,7 @@ void z_error (m)
/* exported to allow conversion of error code to string for compress() and
* uncompress()
*/
-const char * ZEXPORT zError(err)
- int err;
+const char * ZEXPORT zError(int err)
{
return ERR_MSG(err);
}
@@ -58,10 +56,7 @@ const char * ZEXPORT zError(err)
#ifndef HAVE_MEMCPY
-void zmemcpy(dest, source, len)
- Bytef* dest;
- const Bytef* source;
- uInt len;
+void zmemcpy(Bytef *dest, const Bytef *source, uint len)
{
if (len == 0) return;
do {
@@ -69,10 +64,7 @@ void zmemcpy(dest, source, len)
} while (--len != 0);
}
-int zmemcmp(s1, s2, len)
- const Bytef* s1;
- const Bytef* s2;
- uInt len;
+int zmemcmp(const Bytef *s1, const Bytef *s2, uint len)
{
uInt j;
@@ -82,9 +74,7 @@ int zmemcmp(s1, s2, len)
return 0;
}
-void zmemzero(dest, len)
- Bytef* dest;
- uInt len;
+void zmemzero(Bytef *dest, uInt len)
{
if (len == 0) return;
do {
@@ -205,18 +195,13 @@ extern voidp calloc OF((uInt items, uInt size));
extern void free OF((voidpf ptr));
#endif
-voidpf zcalloc (opaque, items, size)
- voidpf opaque;
- unsigned items;
- unsigned size;
+voidpf zcalloc (voidpf opaque, unsigned int items, unsigned int size)
{
if (opaque) items += size - size; /* make compiler happy */
return (voidpf)calloc(items, size);
}
-void zcfree (opaque, ptr)
- voidpf opaque;
- voidpf ptr;
+void zcfree (voidpf opaque, voidpf ptr)
{
free(ptr);
if (opaque) return; /* make compiler happy */
diff --git a/libpng/zutil.h b/libpng/zutil.h
index 6f2cb97..718ebc1 100644
--- a/libpng/zutil.h
+++ b/libpng/zutil.h
@@ -1,5 +1,5 @@
/* zutil.h -- internal interface and configuration of the 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
*/