zlib 1.1.4 update

This commit is contained in:
chombier 2002-03-25 11:55:15 +00:00
parent b1007783ac
commit c78a616986
31 changed files with 76 additions and 84 deletions

Binary file not shown.

BIN
zlib/FAQ

Binary file not shown.

Binary file not shown.

Binary file not shown.

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.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
@ -226,18 +226,11 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
if (strm == Z_NULL) return Z_STREAM_ERROR; if (strm == Z_NULL) return Z_STREAM_ERROR;
strm->msg = Z_NULL; strm->msg = Z_NULL;
#ifdef _KERNEL
if (strm->zalloc == Z_NULL || strm->zfree == Z_NULL)
ssh_fatal("strm->zalloc == Z_NULL or strm->zfree == Z_NULL in _KERNEL compile");
#else
if (strm->zalloc == Z_NULL) { if (strm->zalloc == Z_NULL) {
strm->zalloc = zcalloc; strm->zalloc = zcalloc;
strm->opaque = (voidpf)0; strm->opaque = (voidpf)0;
} }
if (strm->zfree == Z_NULL) if (strm->zfree == Z_NULL) strm->zfree = zcfree;
strm->zfree = zcfree;
#endif /* _KERNEL */
if (level == Z_DEFAULT_COMPRESSION) level = 6; if (level == Z_DEFAULT_COMPRESSION) level = 6;
#ifdef FASTEST #ifdef FASTEST
@ -249,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;
} }

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
*/ */

View File

@ -1,5 +1,5 @@
/* example.c -- usage example of the zlib compression library /* example.c -- usage example 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
*/ */

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.

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
*/ */
@ -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;
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;
} }
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

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
*/ */
@ -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

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
*/ */
@ -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 */
{ /* 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 {
}
do { /* copy all or what's left */
*q++ = *r++; *q++ = *r++;
} while (--c); } 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);
}
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

@ -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
*/ */
@ -92,18 +92,12 @@ int stream_size;
if (z == Z_NULL) if (z == Z_NULL)
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
z->msg = Z_NULL; z->msg = Z_NULL;
#ifdef _KERNEL
if (z->zalloc == Z_NULL || z->zfree == Z_NULL)
ssh_fatal("z->zalloc == Z_NULL or z->zfree == Z_NULL in _KERNEL compile");
#else
if (z->zalloc == Z_NULL) if (z->zalloc == Z_NULL)
{ {
z->zalloc = zcalloc; z->zalloc = zcalloc;
z->opaque = (voidpf)0; z->opaque = (voidpf)0;
} }
if (z->zfree == Z_NULL) if (z->zfree == Z_NULL) z->zfree = zcfree;
z->zfree = zcfree;
#endif /* _KERNEL */
if ((z->state = (struct internal_state FAR *) if ((z->state = (struct internal_state FAR *)
ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL) ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL)
return Z_MEM_ERROR; return Z_MEM_ERROR;

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.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 */
/* 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 */
/* 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
*/ */

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
*/ */

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
*/ */
@ -230,7 +230,7 @@ local void send_bits(s, value, length)
#endif /* DEBUG */ #endif /* DEBUG */
#define ZMAX(a,b) (a >= b ? a : b) #define MAX(a,b) (a >= b ? a : b)
/* the arguments must not have side effects */ /* the arguments must not have side effects */
/* =========================================================================== /* ===========================================================================
@ -675,7 +675,7 @@ local void build_tree(s, desc)
/* Create a new node father of n and m */ /* Create a new node father of n and m */
tree[node].Freq = tree[n].Freq + tree[m].Freq; tree[node].Freq = tree[n].Freq + tree[m].Freq;
s->depth[node] = (uch) (ZMAX(s->depth[n], s->depth[m]) + 1); s->depth[node] = (uch) (MAX(s->depth[n], s->depth[m]) + 1);
tree[n].Dad = tree[m].Dad = (ush)node; tree[n].Dad = tree[m].Dad = (ush)node;
#ifdef DUMP_BL_TREE #ifdef DUMP_BL_TREE
if (tree == s->bl_tree) { if (tree == s->bl_tree) {

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
*/ */
@ -237,7 +237,7 @@ typedef uLong FAR uLongf;
typedef Byte *voidp; typedef Byte *voidp;
#endif #endif
#if defined(HAVE_UNISTD_H) && !defined(_KERNEL) #ifdef HAVE_UNISTD_H
# include <sys/types.h> /* for off_t */ # include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */ # include <unistd.h> /* for SEEK_* and off_t */
# define z_off_t off_t # define z_off_t off_t

Binary file not shown.

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.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 @@
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

View File

@ -1,5 +1,5 @@
/* 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
*/ */
@ -198,7 +198,6 @@ void zcfree (voidpf opaque, voidpf ptr)
#endif /* MSC */ #endif /* MSC */
#ifndef _KERNEL
#ifndef MY_ZCALLOC /* Any system without a special alloc function */ #ifndef MY_ZCALLOC /* Any system without a special alloc function */
#ifndef STDC #ifndef STDC
@ -227,4 +226,3 @@ void zcfree (opaque, ptr)
} }
#endif /* MY_ZCALLOC */ #endif /* MY_ZCALLOC */
#endif /* _KERNEL */

View File

@ -1,5 +1,5 @@
/* 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
*/ */
@ -15,16 +15,12 @@
#include "zlib.h" #include "zlib.h"
#ifdef _KERNEL
#include "kernel_includes.h"
#else /* _KERNEL */
#ifdef STDC #ifdef STDC
# include <stddef.h> # include <stddef.h>
# include <string.h> # include <string.h>
# include <stdlib.h> # include <stdlib.h>
#endif /* STDC */ #endif
#endif /* _KERNEL */ #ifdef NO_ERRNO_H
#if defined(NO_ERRNO_H) || defined(_KERNEL)
extern int errno; extern int errno;
#else #else
# include <errno.h> # include <errno.h>