Commit 8625e5e7 authored by Shane Hathaway's avatar Shane Hathaway

Updated to zlib version 1.1.4.

parent 1a0ea1b2
/* 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
*/ */
/* @(#) $Id: adler32.c,v 1.2 2001/06/04 19:41:16 shane Exp $ */ /* @(#) $Id: adler32.c,v 1.3 2002/03/11 22:22:12 shane Exp $ */
#include "zlib.h" #include "zlib.h"
......
/* 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
*/ */
/* @(#) $Id: compress.c,v 1.2 2001/06/04 19:41:16 shane Exp $ */ /* @(#) $Id: compress.c,v 1.3 2002/03/11 22:22:12 shane Exp $ */
#include "zlib.h" #include "zlib.h"
......
/* 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
*/ */
/* @(#) $Id: crc32.c,v 1.2 2001/06/04 19:41:16 shane Exp $ */ /* @(#) $Id: crc32.c,v 1.3 2002/03/11 22:22:12 shane Exp $ */
#include "zlib.h" #include "zlib.h"
......
/* 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
*/ */
...@@ -47,12 +47,12 @@ ...@@ -47,12 +47,12 @@
* *
*/ */
/* @(#) $Id: deflate.c,v 1.2 2001/06/04 19:41:16 shane Exp $ */ /* @(#) $Id: deflate.c,v 1.3 2002/03/11 22:22:12 shane Exp $ */
#include "deflate.h" #include "deflate.h"
const char deflate_copyright[] = 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 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
...@@ -242,7 +242,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, ...@@ -242,7 +242,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;
} }
......
/* 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
*/ */
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
subject to change. Applications should only use zlib.h. subject to change. Applications should only use zlib.h.
*/ */
/* @(#) $Id: deflate.h,v 1.2 2001/06/04 19:41:16 shane Exp $ */ /* @(#) $Id: deflate.h,v 1.3 2002/03/11 22:22:12 shane Exp $ */
#ifndef _DEFLATE_H #ifndef _DEFLATE_H
#define _DEFLATE_H #define _DEFLATE_H
......
/* 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.
*/ */
/* @(#) $Id: gzio.c,v 1.2 2001/06/04 19:41:16 shane Exp $ */ /* @(#) $Id: gzio.c,v 1.3 2002/03/11 22:22:12 shane Exp $ */
#include <stdio.h> #include <stdio.h>
......
/* 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
*/ */
...@@ -249,10 +249,12 @@ int r; ...@@ -249,10 +249,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;
...@@ -313,11 +315,13 @@ int r; ...@@ -313,11 +315,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
} }
...@@ -329,6 +333,7 @@ int r; ...@@ -329,6 +333,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
......
/* 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
*/ */
......
/* 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
*/ */
...@@ -196,15 +196,9 @@ int r; ...@@ -196,15 +196,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
......
/* 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
*/ */
......
/* 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
*/ */
...@@ -93,28 +93,41 @@ z_streamp z; ...@@ -93,28 +93,41 @@ z_streamp z;
/* do the copy */ /* do the copy */
m -= c; m -= c;
if ((uInt)(q - s->window) >= d) /* offset before dest */ r = q - d;
{ /* just copy */ if (r < s->window) /* wrap if needed */
r = q - d;
*q++ = *r++; c--; /* minimum count is three, */
*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);
}
}
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; break;
} }
else if ((e & 64) == 0) else if ((e & 64) == 0)
......
/* 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
*/ */
......
/* 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
*/ */
......
/* 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 @@ ...@@ -11,7 +11,7 @@
#endif #endif
const char inflate_copyright[] = 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 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
...@@ -104,8 +104,7 @@ uIntf *v; /* working area: values in order of bit length */ ...@@ -104,8 +104,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. */
{ {
uInt a; /* counter for codes of length k */ uInt a; /* counter for codes of length k */
...@@ -231,7 +230,7 @@ uIntf *v; /* working area: values in order of bit length */ ...@@ -231,7 +230,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;
......
/* 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
*/ */
......
/* 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
*/ */
......
/* 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
*/ */
......
/* 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
*/ */
......
/* 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
*/ */
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* Addison-Wesley, 1983. ISBN 0-201-06672-6. * Addison-Wesley, 1983. ISBN 0-201-06672-6.
*/ */
/* @(#) $Id: trees.c,v 1.2 2001/06/04 19:41:16 shane Exp $ */ /* @(#) $Id: trees.c,v 1.3 2002/03/11 22:22:12 shane Exp $ */
/* #define GEN_TREES_H */ /* #define GEN_TREES_H */
......
/* 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
*/ */
/* @(#) $Id: uncompr.c,v 1.2 2001/06/04 19:41:16 shane Exp $ */ /* @(#) $Id: uncompr.c,v 1.3 2002/03/11 22:22:12 shane Exp $ */
#include "zlib.h" #include "zlib.h"
......
/* 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
*/ */
/* @(#) $Id: zconf.h,v 1.2 2001/06/04 19:41:16 shane Exp $ */ /* @(#) $Id: zconf.h,v 1.3 2002/03/11 22:22:12 shane Exp $ */
#ifndef _ZCONF_H #ifndef _ZCONF_H
#define _ZCONF_H #define _ZCONF_H
......
/* zlib.h -- interface of the 'zlib' general purpose compression library /* 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 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
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
extern "C" { extern "C" {
#endif #endif
#define ZLIB_VERSION "1.1.3" #define ZLIB_VERSION "1.1.4"
/* /*
The 'zlib' compression library provides in-memory compression and The 'zlib' compression library provides in-memory compression and
......
/* zutil.c -- target dependent utility functions for the compression library /* 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 * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* @(#) $Id: zutil.c,v 1.2 2001/06/04 19:41:16 shane Exp $ */ /* @(#) $Id: zutil.c,v 1.3 2002/03/11 22:22:12 shane Exp $ */
#include "zutil.h" #include "zutil.h"
......
/* zutil.h -- internal interface and configuration of the compression library /* 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 * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
subject to change. Applications should only use zlib.h. subject to change. Applications should only use zlib.h.
*/ */
/* @(#) $Id: zutil.h,v 1.2 2001/06/04 19:41:16 shane Exp $ */ /* @(#) $Id: zutil.h,v 1.3 2002/03/11 22:22:12 shane Exp $ */
#ifndef _Z_UTIL_H #ifndef _Z_UTIL_H
#define _Z_UTIL_H #define _Z_UTIL_H
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment