Sync with userland (1.1.4)

This commit is contained in:
fvdl 2002-03-12 00:42:23 +00:00
parent 40a8bc1d34
commit 104148a990
18 changed files with 177 additions and 154 deletions

View File

@ -1,11 +1,10 @@
/* $NetBSD: adler32.c,v 1.3 1998/11/01 21:28:51 tron Exp $ */
/* $NetBSD: adler32.c,v 1.4 2002/03/12 00:42:23 fvdl Exp $ */
/* 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
*/
/* @(#) Id */
/* @(#) $Id: adler32.c,v 1.4 2002/03/12 00:42:23 fvdl Exp $ */
#include "zlib.h"

View File

@ -1,11 +1,11 @@
/* $NetBSD: crc32.c,v 1.3 1998/11/01 21:28:51 tron Exp $ */
/* $NetBSD: crc32.c,v 1.4 2002/03/12 00:42:23 fvdl Exp $ */
/* 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
*/
/* @(#) Id */
/* @(#) $Id: crc32.c,v 1.4 2002/03/12 00:42:23 fvdl Exp $ */
#include "zlib.h"
@ -15,7 +15,7 @@
local int crc_table_empty = 1;
local uLongf crc_table[256];
local void make_crc_table OF((void));
local void make_crc_table __P((void));
/*
Generate a table for a byte-wise 32-bit CRC calculation on the polynomial:

View File

@ -1,7 +1,7 @@
/* $NetBSD: infblock.c,v 1.3 1998/11/01 21:28:51 tron Exp $ */
/* $NetBSD: infblock.c,v 1.4 2002/03/12 00:42:23 fvdl Exp $ */
/* 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
*/
@ -251,10 +251,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;
@ -315,11 +317,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
}
@ -331,6 +335,7 @@ int r;
}
s->sub.decode.codes = c;
}
ZFREE(z, s->sub.trees.blens);
s->mode = CODES;
case CODES:
UPDATE

View File

@ -1,7 +1,7 @@
/* $NetBSD: infblock.h,v 1.3 1998/11/01 21:28:51 tron Exp $ */
/* $NetBSD: infblock.h,v 1.4 2002/03/12 00:42:23 fvdl Exp $ */
/* 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
*/
@ -13,29 +13,29 @@
struct inflate_blocks_state;
typedef struct inflate_blocks_state FAR inflate_blocks_statef;
extern inflate_blocks_statef * inflate_blocks_new OF((
extern inflate_blocks_statef * inflate_blocks_new __P((
z_streamp z,
check_func c, /* check function */
uInt w)); /* window size */
extern int inflate_blocks OF((
extern int inflate_blocks __P((
inflate_blocks_statef *,
z_streamp ,
int)); /* initial return code */
extern void inflate_blocks_reset OF((
extern void inflate_blocks_reset __P((
inflate_blocks_statef *,
z_streamp ,
uLongf *)); /* check value on output */
extern int inflate_blocks_free OF((
extern int inflate_blocks_free __P((
inflate_blocks_statef *,
z_streamp));
extern void inflate_set_dictionary OF((
extern void inflate_set_dictionary __P((
inflate_blocks_statef *s,
const Bytef *d, /* dictionary */
uInt n)); /* dictionary length */
extern int inflate_blocks_sync_point OF((
extern int inflate_blocks_sync_point __P((
inflate_blocks_statef *s));

View File

@ -1,7 +1,7 @@
/* $NetBSD: infcodes.c,v 1.3 1998/11/03 15:49:39 tron Exp $ */
/* $NetBSD: infcodes.c,v 1.4 2002/03/12 00:42:23 fvdl Exp $ */
/* 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
*/
@ -198,15 +198,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

View File

@ -1,7 +1,7 @@
/* $NetBSD: infcodes.h,v 1.3 1998/11/03 15:49:39 tron Exp $ */
/* $NetBSD: infcodes.h,v 1.4 2002/03/12 00:42:23 fvdl Exp $ */
/* 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
*/
@ -13,17 +13,17 @@
struct inflate_codes_state;
typedef struct inflate_codes_state FAR inflate_codes_statef;
extern inflate_codes_statef *inflate_codes_new OF((
extern inflate_codes_statef *inflate_codes_new __P((
uInt, uInt,
inflate_huft *, inflate_huft *,
z_streamp ));
extern int inflate_codes OF((
extern int inflate_codes __P((
inflate_blocks_statef *,
z_streamp ,
int));
extern void inflate_codes_free OF((
extern void inflate_codes_free __P((
inflate_codes_statef *,
z_streamp ));

View File

@ -1,7 +1,7 @@
/* $NetBSD: inffast.c,v 1.3 1998/11/01 21:28:51 tron Exp $ */
/* $NetBSD: inffast.c,v 1.4 2002/03/12 00:42:23 fvdl Exp $ */
/* 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
*/
@ -95,28 +95,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);
}
}
do { /* copy all or what's left */
*q++ = *r++;
} while (--c);
else /* normal copy */
{
*q++ = *r++; c--;
*q++ = *r++; c--;
do {
*q++ = *r++;
} while (--c);
}
break;
}
else if ((e & 64) == 0)

View File

@ -1,7 +1,7 @@
/* $NetBSD: inffast.h,v 1.3 1998/11/03 15:49:39 tron Exp $ */
/* $NetBSD: inffast.h,v 1.4 2002/03/12 00:42:24 fvdl Exp $ */
/* 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
*/
@ -10,7 +10,7 @@
subject to change. Applications should only use zlib.h.
*/
extern int inflate_fast OF((
extern int inflate_fast __P((
uInt,
uInt,
inflate_huft *,

View File

@ -1,5 +1,3 @@
/* $NetBSD: inffixed.h,v 1.1 1998/11/03 22:00:37 tron Exp $ */
/* inffixed.h -- table for decoding fixed codes
* Generated automatically by the maketree.c program
*/

View File

@ -1,7 +1,7 @@
/* $NetBSD: inflate.c,v 1.3 1998/11/01 21:28:51 tron Exp $ */
/* $NetBSD: inflate.c,v 1.4 2002/03/12 00:42:24 fvdl Exp $ */
/* 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
*/

View File

@ -1,7 +1,7 @@
/* $NetBSD: inftrees.c,v 1.4 2000/03/30 12:19:49 augustss Exp $ */
/* $NetBSD: inftrees.c,v 1.5 2002/03/12 00:42:24 fvdl Exp $ */
/* 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
*/
@ -13,7 +13,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
@ -27,7 +27,7 @@ struct internal_state {int dummy;}; /* for buggy compilers */
#define bits word.what.Bits
local int huft_build OF((
local int huft_build __P((
uIntf *, /* code lengths in bits */
uInt, /* number of codes */
uInt, /* number of "simple" codes */
@ -106,8 +106,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
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 */
@ -115,16 +114,16 @@ uIntf *v; /* working area: values in order of bit length */
uInt f; /* i repeats in table every f entries */
int g; /* maximum code length */
int h; /* table level */
uInt i; /* counter, current code */
uInt j; /* counter */
int k; /* number of bits in current code */
register uInt i; /* counter, current code */
register uInt j; /* counter */
register int k; /* number of bits in current code */
int l; /* bits per table (returned in m) */
uInt mask; /* (1 << w) - 1, to avoid cc -O bug on HP */
uIntf *p; /* pointer into c[], b[], or v[] */
register uIntf *p; /* pointer into c[], b[], or v[] */
inflate_huft *q; /* points to current table */
struct inflate_huft_s r; /* table entry for structure assignment */
inflate_huft *u[BMAX]; /* table stack */
int w; /* bits before this table == (l * h) */
register int w; /* bits before this table == (l * h) */
uInt x[BMAX+1]; /* bit offsets, then code stack */
uIntf *xp; /* pointer into x */
int y; /* number of dummy codes added */
@ -233,7 +232,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;

View File

@ -1,7 +1,7 @@
/* $NetBSD: inftrees.h,v 1.3 1998/11/01 21:28:51 tron Exp $ */
/* $NetBSD: inftrees.h,v 1.4 2002/03/12 00:42:24 fvdl Exp $ */
/* 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
*/
@ -34,14 +34,14 @@ struct inflate_huft_s {
value below is more than safe. */
#define MANY 1440
extern int inflate_trees_bits OF((
extern int inflate_trees_bits __P((
uIntf *, /* 19 code lengths */
uIntf *, /* bits tree desired/actual depth */
inflate_huft * FAR *, /* bits tree result */
inflate_huft *, /* space for trees */
z_streamp)); /* for messages */
extern int inflate_trees_dynamic OF((
extern int inflate_trees_dynamic __P((
uInt, /* number of literal/length codes */
uInt, /* number of distance codes */
uIntf *, /* that many (total) code lengths */
@ -52,7 +52,7 @@ extern int inflate_trees_dynamic OF((
inflate_huft *, /* space for trees */
z_streamp)); /* for messages */
extern int inflate_trees_fixed OF((
extern int inflate_trees_fixed __P((
uIntf *, /* literal desired/actual bit depth */
uIntf *, /* distance desired/actual bit depth */
inflate_huft * FAR *, /* literal/length tree result */

View File

@ -1,7 +1,7 @@
/* $NetBSD: infutil.c,v 1.3 1998/11/01 21:28:51 tron Exp $ */
/* $NetBSD: infutil.c,v 1.4 2002/03/12 00:42:24 fvdl Exp $ */
/* 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
*/

View File

@ -1,7 +1,7 @@
/* $NetBSD: infutil.h,v 1.3 1998/11/01 21:28:51 tron Exp $ */
/* $NetBSD: infutil.h,v 1.4 2002/03/12 00:42:24 fvdl Exp $ */
/* 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
*/
@ -90,7 +90,7 @@ struct inflate_blocks_state {
extern uInt inflate_mask[17];
/* copy as much as possible from the sliding window to the output area */
extern int inflate_flush OF((
extern int inflate_flush __P((
inflate_blocks_statef *,
z_streamp ,
int));

View File

@ -1,11 +1,11 @@
/* $NetBSD: uncompr.c,v 1.1 1999/04/15 00:48:03 simonb Exp $ */
/* $NetBSD: uncompr.c,v 1.2 2002/03/12 00:42:24 fvdl Exp $ */
/* 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
*/
/* @(#) Id */
/* @(#) $Id: uncompr.c,v 1.2 2002/03/12 00:42:24 fvdl Exp $ */
#include "zlib.h"

View File

@ -1,11 +1,11 @@
/* $NetBSD: zconf.h,v 1.3 1998/11/01 21:28:51 tron Exp $ */
/* $NetBSD: zconf.h,v 1.4 2002/03/12 00:42:24 fvdl Exp $ */
/* 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
*/
/* @(#) Id */
/* @(#) $Id: zconf.h,v 1.4 2002/03/12 00:42:24 fvdl Exp $ */
#ifndef _ZCONF_H
#define _ZCONF_H
@ -137,11 +137,11 @@
/* Type declarations */
#ifndef OF /* function prototypes */
#ifndef __P /* function prototypes */
# ifdef STDC
# define OF(args) args
# define __P(args) args
# else
# define OF(args) ()
# define __P(args) ()
# endif
#endif
@ -242,7 +242,7 @@ typedef uLong FAR uLongf;
typedef Byte *voidp;
#endif
#ifdef HAVE_UNISTD_H
#if defined(HAVE_UNISTD_H)
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# define z_off_t off_t

View File

@ -1,9 +1,9 @@
/* $NetBSD: zlib.h,v 1.3 1998/11/01 21:28:51 tron Exp $ */
/* $NetBSD: zlib.h,v 1.4 2002/03/12 00:42:24 fvdl Exp $ */
/* 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
@ -33,13 +33,17 @@
#ifndef _ZLIB_H
#define _ZLIB_H
#ifdef __NetBSD__
#include <sys/cdefs.h>
#endif
#include "zconf.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ZLIB_VERSION "1.1.3"
#define ZLIB_VERSION "1.1.4"
/*
The 'zlib' compression library provides in-memory compression and
@ -62,8 +66,8 @@ extern "C" {
crash even in case of corrupted input.
*/
typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
typedef void (*free_func) OF((voidpf opaque, voidpf address));
typedef voidpf (*alloc_func) __P((voidpf opaque, uInt items, uInt size));
typedef void (*free_func) __P((voidpf opaque, voidpf address));
struct internal_state;
@ -170,7 +174,7 @@ typedef z_stream FAR *z_streamp;
/* basic functions */
ZEXTERN const char * ZEXPORT zlibVersion OF((void));
ZEXTERN const char * ZEXPORT zlibVersion __P((void));
/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
If the first character differs, the library code actually used is
not compatible with the zlib.h header file used by the application.
@ -178,7 +182,7 @@ ZEXTERN const char * ZEXPORT zlibVersion OF((void));
*/
/*
ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
ZEXTERN int ZEXPORT deflateInit __P((z_streamp strm, int level));
Initializes the internal stream state for compression. The fields
zalloc, zfree and opaque must be initialized before by the caller.
@ -200,7 +204,7 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
*/
ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
ZEXTERN int ZEXPORT deflate __P((z_streamp strm, int flush));
/*
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
@ -278,7 +282,7 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
*/
ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
ZEXTERN int ZEXPORT deflateEnd __P((z_streamp strm));
/*
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any
@ -293,7 +297,7 @@ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
/*
ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
ZEXTERN int ZEXPORT inflateInit __P((z_streamp strm));
Initializes the internal stream state for decompression. The fields
next_in, avail_in, zalloc, zfree and opaque must be initialized before by
@ -313,7 +317,7 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
*/
ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
ZEXTERN int ZEXPORT inflate __P((z_streamp strm, int flush));
/*
inflate decompresses as much data as possible, and stops when the input
buffer becomes empty or the output buffer becomes full. It may some
@ -382,7 +386,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
*/
ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
ZEXTERN int ZEXPORT inflateEnd __P((z_streamp strm));
/*
All dynamically allocated data structures for this stream are freed.
This function discards any unprocessed input and does not flush any
@ -400,7 +404,7 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
*/
/*
ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
ZEXTERN int ZEXPORT deflateInit2 __P((z_streamp strm,
int level,
int method,
int windowBits,
@ -443,7 +447,7 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
not perform any compression: this will be done by deflate().
*/
ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
ZEXTERN int ZEXPORT deflateSetDictionary __P((z_streamp strm,
const Bytef *dictionary,
uInt dictLength));
/*
@ -479,7 +483,7 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
perform any compression: this will be done by deflate().
*/
ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
ZEXTERN int ZEXPORT deflateCopy __P((z_streamp dest,
z_streamp source));
/*
Sets the destination stream as a complete copy of the source stream.
@ -497,7 +501,7 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
destination.
*/
ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
ZEXTERN int ZEXPORT deflateReset __P((z_streamp strm));
/*
This function is equivalent to deflateEnd followed by deflateInit,
but does not free and reallocate all the internal compression state.
@ -508,7 +512,7 @@ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
stream state was inconsistent (such as zalloc or state being NULL).
*/
ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
ZEXTERN int ZEXPORT deflateParams __P((z_streamp strm,
int level,
int strategy));
/*
@ -530,7 +534,7 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
*/
/*
ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
ZEXTERN int ZEXPORT inflateInit2 __P((z_streamp strm,
int windowBits));
This is another version of inflateInit with an extra parameter. The
@ -552,7 +556,7 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
modified, but next_out and avail_out are unchanged.)
*/
ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
ZEXTERN int ZEXPORT inflateSetDictionary __P((z_streamp strm,
const Bytef *dictionary,
uInt dictLength));
/*
@ -571,7 +575,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
inflate().
*/
ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
ZEXTERN int ZEXPORT inflateSync __P((z_streamp strm));
/*
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
@ -586,7 +590,7 @@ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
until success or end of the input data.
*/
ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
ZEXTERN int ZEXPORT inflateReset __P((z_streamp strm));
/*
This function is equivalent to inflateEnd followed by inflateInit,
but does not free and reallocate all the internal decompression state.
@ -607,7 +611,7 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
utility functions can easily be modified if you need special options.
*/
ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
ZEXTERN int ZEXPORT compress __P((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen));
/*
Compresses the source buffer into the destination buffer. sourceLen is
@ -622,7 +626,7 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
buffer.
*/
ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
ZEXTERN int ZEXPORT compress2 __P((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen,
int level));
/*
@ -637,7 +641,7 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
Z_STREAM_ERROR if the level parameter is invalid.
*/
ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
ZEXTERN int ZEXPORT uncompress __P((Bytef *dest, uLongf *destLen,
const Bytef *source, uLong sourceLen));
/*
Decompresses the source buffer into the destination buffer. sourceLen is
@ -658,7 +662,7 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
typedef voidp gzFile;
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
ZEXTERN gzFile ZEXPORT gzopen __P((const char *path, const char *mode));
/*
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
@ -674,7 +678,7 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
can be checked to distinguish the two cases (if errno is zero, the
zlib error is Z_MEM_ERROR). */
ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
ZEXTERN gzFile ZEXPORT gzdopen __P((int fd, const char *mode));
/*
gzdopen() associates a gzFile with the file descriptor fd. File
descriptors are obtained from calls like open, dup, creat, pipe or
@ -687,7 +691,7 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
the (de)compression state.
*/
ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
ZEXTERN int ZEXPORT gzsetparams __P((gzFile file, int level, int strategy));
/*
Dynamically update the compression level or strategy. See the description
of deflateInit2 for the meaning of these parameters.
@ -695,7 +699,7 @@ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
opened for writing.
*/
ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
ZEXTERN int ZEXPORT gzread __P((gzFile file, voidp buf, unsigned len));
/*
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
@ -703,7 +707,7 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
gzread returns the number of uncompressed bytes actually read (0 for
end of file, -1 for error). */
ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
ZEXTERN int ZEXPORT gzwrite __P((gzFile file,
const voidp buf, unsigned len));
/*
Writes the given number of uncompressed bytes into the compressed file.
@ -711,21 +715,22 @@ ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
(0 in case of error).
*/
ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
ZEXTERN int ZEXPORTVA gzprintf __P((gzFile file, const char *format, ...))
__attribute__((__format__(__printf__, 2, 3)));
/*
Converts, formats, and writes the args to the compressed file under
control of the format string, as in fprintf. gzprintf returns the number of
uncompressed bytes actually written (0 in case of error).
*/
ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
ZEXTERN int ZEXPORT gzputs __P((gzFile file, const char *s));
/*
Writes the given null-terminated string to the compressed file, excluding
the terminating null character.
gzputs returns the number of characters written, or -1 in case of error.
*/
ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
ZEXTERN char * ZEXPORT gzgets __P((gzFile file, char *buf, int len));
/*
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
@ -734,19 +739,19 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
gzgets returns buf, or Z_NULL in case of error.
*/
ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
ZEXTERN int ZEXPORT gzputc __P((gzFile file, int c));
/*
Writes c, converted to an unsigned char, into the compressed file.
gzputc returns the value that was written, or -1 in case of error.
*/
ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
ZEXTERN int ZEXPORT gzgetc __P((gzFile file));
/*
Reads one byte from the compressed file. gzgetc returns this byte
or -1 in case of end of file or error.
*/
ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
ZEXTERN int ZEXPORT gzflush __P((gzFile file, int flush));
/*
Flushes all pending output into the compressed file. The parameter
flush is as in the deflate() function. The return value is the zlib
@ -754,10 +759,16 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
the flush parameter is Z_FINISH and all output could be flushed.
gzflush should be called only when strictly necessary because it can
degrade compression.
*/
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
/*
* NetBSD note:
* "long" gzseek has been there till Oct 1999 (1.4L), which was wrong.
*/
ZEXTERN z_off_t ZEXPORT gzseek __P((gzFile file,
z_off_t offset, int whence));
/*
Sets the starting position for the next gzread or gzwrite on the
given compressed file. The offset represents a number of bytes in the
@ -774,14 +785,18 @@ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
would be before the current position.
*/
ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
ZEXTERN int ZEXPORT gzrewind __P((gzFile file));
/*
Rewinds the given file. This function is supported only for reading.
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
*/
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
/*
* NetBSD note:
* "long" gztell has been there till Oct 1999 (1.4L), which was wrong.
*/
ZEXTERN z_off_t ZEXPORT gztell __P((gzFile file));
/*
Returns the starting position for the next gzread or gzwrite on the
given compressed file. This position represents a number of bytes in the
@ -790,20 +805,20 @@ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
*/
ZEXTERN int ZEXPORT gzeof OF((gzFile file));
ZEXTERN int ZEXPORT gzeof __P((gzFile file));
/*
Returns 1 when EOF has previously been detected reading the given
input stream, otherwise zero.
*/
ZEXTERN int ZEXPORT gzclose OF((gzFile file));
ZEXTERN int ZEXPORT gzclose __P((gzFile file));
/*
Flushes all pending output if necessary, closes the compressed file
and deallocates all the (de)compression state. The return value is the zlib
error number (see function gzerror below).
*/
ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
ZEXTERN const char * ZEXPORT gzerror __P((gzFile file, int *errnum));
/*
Returns the error message for the last error which occurred on the
given compressed file. errnum is set to zlib error number. If an
@ -820,7 +835,7 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
compression library.
*/
ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
ZEXTERN uLong ZEXPORT adler32 __P((uLong adler, const Bytef *buf, uInt len));
/*
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
@ -837,7 +852,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
if (adler != original_adler) error();
*/
ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
ZEXTERN uLong ZEXPORT crc32 __P((uLong crc, const Bytef *buf, uInt len));
/*
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
@ -859,15 +874,15 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
/* deflateInit and inflateInit are macros to allow checking the zlib version
* and the compiler's view of z_stream:
*/
ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
ZEXTERN int ZEXPORT deflateInit_ __P((z_streamp strm, int level,
const char *version, int stream_size));
ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
ZEXTERN int ZEXPORT inflateInit_ __P((z_streamp strm,
const char *version, int stream_size));
ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
ZEXTERN int ZEXPORT deflateInit2_ __P((z_streamp strm, int level, int method,
int windowBits, int memLevel,
int strategy, const char *version,
int stream_size));
ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
ZEXTERN int ZEXPORT inflateInit2_ __P((z_streamp strm, int windowBits,
const char *version, int stream_size));
#define deflateInit(strm, level) \
deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
@ -884,9 +899,9 @@ ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
struct internal_state {int dummy;}; /* hack for buggy compilers */
#endif
ZEXTERN const char * ZEXPORT zError OF((int err));
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
ZEXTERN const char * ZEXPORT zError __P((int err));
ZEXTERN int ZEXPORT inflateSyncPoint __P((z_streamp z));
ZEXTERN const uLongf * ZEXPORT get_crc_table __P((void));
#ifdef __cplusplus
}

View File

@ -1,7 +1,7 @@
/* $NetBSD: zutil.h,v 1.9 1999/11/13 21:24:20 thorpej Exp $ */
/* $NetBSD: zutil.h,v 1.10 2002/03/12 00:42:24 fvdl Exp $ */
/* 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
*/
@ -10,7 +10,7 @@
subject to change. Applications should only use zlib.h.
*/
/* @(#) Id */
/* @(#) $Id: zutil.h,v 1.10 2002/03/12 00:42:24 fvdl Exp $ */
#ifndef _Z_UTIL_H
#define _Z_UTIL_H
@ -160,7 +160,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
/* functions */
#ifdef HAVE_STRERROR
extern char *strerror OF((int));
extern char *strerror __P((int));
# define zstrerror(errnum) strerror(errnum)
#else
# define zstrerror(errnum) ""
@ -190,16 +190,16 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
# define zmemzero(dest, len) memset(dest, 0, len)
# endif
#else
extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
extern void zmemzero OF((Bytef* dest, uInt len));
extern void zmemcpy __P((Bytef* dest, const Bytef* source, uInt len));
extern int zmemcmp __P((const Bytef* s1, const Bytef* s2, uInt len));
extern void zmemzero __P((Bytef* dest, uInt len));
#endif
/* Diagnostic functions */
#if defined(DEBUG) && !defined(_KERNEL) && !defined(_STANDALONE)
# include <stdio.h>
extern int z_verbose;
extern void z_error OF((char *m));
extern void z_error __P((char *m));
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
@ -216,10 +216,10 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
#endif
typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf,
typedef uLong (ZEXPORT *check_func) __P((uLong check, const Bytef *buf,
uInt len));
voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
void zcfree OF((voidpf opaque, voidpf ptr));
voidpf zcalloc __P((voidpf opaque, unsigned items, unsigned size));
void zcfree __P((voidpf opaque, voidpf ptr));
#define ZALLOC(strm, items, size) \
(*((strm)->zalloc))((strm)->opaque, (items), (size))