diff options
-rw-r--r-- | sys/net/zlib.c | 92 | ||||
-rw-r--r-- | sys/net/zlib.h | 20 |
2 files changed, 56 insertions, 56 deletions
diff --git a/sys/net/zlib.c b/sys/net/zlib.c index ebcdd8997fa..1a21e49fb74 100644 --- a/sys/net/zlib.c +++ b/sys/net/zlib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zlib.c,v 1.8 2000/06/16 21:47:14 provos Exp $ */ +/* $OpenBSD: zlib.c,v 1.9 2001/01/29 06:12:11 mickey Exp $ */ /* $NetBSD: zlib.c,v 1.2 1996/03/16 23:55:40 christos Exp $ */ /* @@ -143,7 +143,7 @@ typedef uLong (*check_func) OF((uLong check, Bytef *buf, uInt len)); /* deflate.h -- internal compression state * Copyright (C) 1995 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 */ /* WARNING: this file should *not* be used by applications. It is @@ -214,7 +214,7 @@ typedef struct static_tree_desc_s static_tree_desc; typedef struct tree_desc_s { ct_data *dyn_tree; /* the dynamic tree */ int max_code; /* largest code with non zero frequency */ - static_tree_desc *stat_desc; /* the corresponding static tree */ + const static_tree_desc *stat_desc; /* the corresponding static tree */ } FAR tree_desc; typedef ush Pos; @@ -429,7 +429,7 @@ local void ct_stored_type_only OF((deflate_state *s)); /*+++++*/ /* deflate.c -- compress data using the deflation algorithm * Copyright (C) 1995 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 */ /* @@ -678,7 +678,7 @@ int deflateReset (strm) z_stream *strm; { deflate_state *s; - + if (strm == Z_NULL || strm->state == Z_NULL || strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR; @@ -713,7 +713,7 @@ local void putShortMSB (s, b) { put_byte(s, (Byte)(b >> 8)); put_byte(s, (Byte)(b & 0xff)); -} +} /* ========================================================================= * Flush as much pending output as possible. @@ -748,7 +748,7 @@ int deflate (strm, flush) deflate_state *state = (deflate_state *) strm->state; if (strm == Z_NULL || state == Z_NULL) return Z_STREAM_ERROR; - + if (strm->next_in == Z_NULL && strm->avail_in != 0) { ERR_RETURN(strm, Z_STREAM_ERROR); } @@ -1301,7 +1301,7 @@ local int deflate_fast(s, flush) * always MIN_MATCH bytes ahead. */ } while (--s->match_length != 0); - s->strstart++; + s->strstart++; } else { s->strstart += s->match_length; s->match_length = 0; @@ -1319,7 +1319,7 @@ local int deflate_fast(s, flush) Tracevv((stderr,"%c", s->window[s->strstart])); bflush = ct_tally (s, 0, s->window[s->strstart]); s->lookahead--; - s->strstart++; + s->strstart++; } if (bflush) FLUSH_BLOCK(s, Z_NO_FLUSH); } @@ -1452,7 +1452,7 @@ local int deflate_slow(s, flush) /*+++++*/ /* trees.c -- output deflated data using Huffman coding * Copyright (C) 1995 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 */ /* @@ -1506,16 +1506,16 @@ local int deflate_slow(s, flush) #define REPZ_11_138 18 /* repeat a zero length 11-138 times (7 bits of repeat count) */ -local int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ +local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; -local int extra_dbits[D_CODES] /* extra bits for each distance code */ +local const int extra_dbits[D_CODES] /* extra bits for each distance code */ = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; -local int extra_blbits[BL_CODES]/* extra bits for each bit length code */ +local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; -local uch bl_order[BL_CODES] +local const uch bl_order[BL_CODES] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; /* The lengths of the bit length codes are sent in order of decreasing * probability, to avoid transmitting the lengths for unused bit length codes. @@ -1560,19 +1560,19 @@ local int base_dist[D_CODES]; struct static_tree_desc_s { ct_data *static_tree; /* static tree or NULL */ - intf *extra_bits; /* extra bits for each code or NULL */ + const intf *extra_bits; /* extra bits for each code or NULL */ int extra_base; /* base index for extra_bits */ int elems; /* max number of elements in the tree */ int max_length; /* max bit length for the codes */ }; -local static_tree_desc static_l_desc = +local const static_tree_desc static_l_desc = {static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; -local static_tree_desc static_d_desc = +local const static_tree_desc static_d_desc = {static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; -local static_tree_desc static_bl_desc = +local const static_tree_desc static_bl_desc = {(ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; /* =========================================================================== @@ -1864,7 +1864,7 @@ local void gen_bitlen(s, desc) ct_data *tree = desc->dyn_tree; int max_code = desc->max_code; ct_data *stree = desc->stat_desc->static_tree; - intf *extra = desc->stat_desc->extra_bits; + const intf *extra = desc->stat_desc->extra_bits; int base = desc->stat_desc->extra_base; int max_length = desc->stat_desc->max_length; int h; /* heap index */ @@ -2591,7 +2591,7 @@ local void copy_block(s, buf, len, header) s->last_eob_len = 8; /* enough lookahead for inflate */ if (header) { - put_short(s, (ush)len); + put_short(s, (ush)len); put_short(s, (ush)~len); #ifdef DEBUG_ZLIB s->bits_sent += 2*16; @@ -2609,7 +2609,7 @@ local void copy_block(s, buf, len, header) /*+++++*/ /* infblock.h -- header to use infblock.c * Copyright (C) 1995 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 */ /* WARNING: this file should *not* be used by applications. It is @@ -2650,7 +2650,7 @@ local int inflate_packet_flush OF(( /*+++++*/ /* inftrees.h -- header to use inftrees.c * Copyright (C) 1995 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 */ /* WARNING: this file should *not* be used by applications. It is @@ -2712,7 +2712,7 @@ local int inflate_trees_free OF(( /*+++++*/ /* infcodes.h -- header to use infcodes.c * Copyright (C) 1995 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 */ /* WARNING: this file should *not* be used by applications. It is @@ -2741,7 +2741,7 @@ local void inflate_codes_free OF(( /*+++++*/ /* inflate.c -- zlib interface to inflate modules * Copyright (C) 1995 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 private state */ @@ -2773,7 +2773,7 @@ struct internal_state { /* mode independent information */ int nowrap; /* flag for no wrapper */ uInt wbits; /* log2(window size) (8..15, defaults to 15) */ - inflate_blocks_statef + inflate_blocks_statef *blocks; /* current inflate_blocks state */ }; @@ -3048,7 +3048,7 @@ z_stream *z; /*+++++*/ /* infutil.h -- types and macros common to blocks and codes * Copyright (C) 1995 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 */ /* WARNING: this file should *not* be used by applications. It is @@ -3086,7 +3086,7 @@ struct inflate_blocks_state { } trees; /* if DTREE, decoding info for trees */ struct { inflate_huft *tl, *td; /* trees to free */ - inflate_codes_statef + inflate_codes_statef *codes; } decode; /* if CODES, current state */ } sub; /* submode */ @@ -3129,7 +3129,7 @@ struct inflate_blocks_state { #define LOAD {LOADIN LOADOUT} /* And'ing with mask[n] masks the lower n bits */ -local uInt inflate_mask[] = { +local const uInt inflate_mask[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff @@ -3144,7 +3144,7 @@ local int inflate_flush OF(( /*+++++*/ /* inffast.h -- header to use inffast.c * Copyright (C) 1995 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 */ /* WARNING: this file should *not* be used by applications. It is @@ -3164,7 +3164,7 @@ local int inflate_fast OF(( /*+++++*/ /* infblock.c -- interpret and process block types to last block * Copyright (C) 1995 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 */ /* Table for deflate from PKZIP's appnote.txt. */ @@ -3584,7 +3584,7 @@ z_stream *z; n -= t; z->total_out += t; s->read = q; /* drag read pointer forward */ -/* WRAP */ /* expand WRAP macro by hand to handle s->read */ +/* WRAP */ /* expand WRAP macro by hand to handle s->read */ if (q == s->end) { s->read = q = s->window; m = WAVAIL; @@ -3612,7 +3612,7 @@ local int inflate_packet_flush(s) /*+++++*/ /* inftrees.c -- generate Huffman trees for efficient decoding * Copyright (C) 1995 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 */ /* simplify the use of the inflate_huft type with some defines */ @@ -3626,8 +3626,8 @@ local int huft_build OF(( uIntf *, /* code lengths in bits */ uInt, /* number of codes */ uInt, /* number of "simple" codes */ - uIntf *, /* list of base values for non-simple codes */ - uIntf *, /* list of extra bits for non-simple codes */ + const uIntf *, /* list of base values for non-simple codes */ + const uIntf *, /* list of extra bits for non-simple codes */ inflate_huft * FAR*,/* result: starting table */ uIntf *, /* maximum lookup bits (returns actual) */ z_stream *)); /* for zalloc function */ @@ -3643,18 +3643,18 @@ local void ffree OF(( uInt n)); /* number of bytes (not used) */ /* Tables for deflate from PKZIP's appnote.txt. */ -local uInt cplens[] = { /* Copy lengths for literal codes 257..285 */ +local const uInt cplens[] = { /* Copy lengths for literal codes 257..285 */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; /* actually lengths - 2; also see note #13 above about 258 */ -local uInt cplext[] = { /* Extra bits for literal codes 257..285 */ +local const uInt cplext[] = { /* Extra bits for literal codes 257..285 */ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 192, 192}; /* 192==invalid */ -local uInt cpdist[] = { /* Copy offsets for distance codes 0..29 */ +local const uInt cpdist[] = { /* Copy offsets for distance codes 0..29 */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; -local uInt cpdext[] = { /* Extra bits for distance codes */ +local const uInt cpdext[] = { /* Extra bits for distance codes */ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; @@ -3704,8 +3704,8 @@ local int huft_build(b, n, s, d, e, t, m, zs) uIntf *b; /* code lengths in bits (all assumed <= BMAX) */ uInt n; /* number of codes (assumed <= N_MAX) */ uInt s; /* number of simple-valued codes (0..s-1) */ -uIntf *d; /* list of base values for non-simple codes */ -uIntf *e; /* list of extra bits for non-simple codes */ +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 */ z_stream *zs; /* for zalloc function */ @@ -4075,14 +4075,14 @@ z_stream *z; /* for zfree function */ q = (--p)->next; ZFREE(z, p, p->word.Nalloc * sizeof(inflate_huft)); p = q; - } + } return Z_OK; } /*+++++*/ /* infcodes.c -- process literals and length/distance pairs * Copyright (C) 1995 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 */ /* simplify the use of the inflate_huft type with some defines */ @@ -4323,7 +4323,7 @@ z_stream *z; /*+++++*/ /* inflate_util.c -- data and routines common to blocks and codes * Copyright (C) 1995 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 */ /* copy as much as possible from the sliding window to the output area */ @@ -4400,7 +4400,7 @@ int r; /*+++++*/ /* inffast.c -- process literals and length/distance pairs fast * Copyright (C) 1995 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 */ /* simplify the use of the inflate_huft type with some defines */ @@ -4561,7 +4561,7 @@ z_stream *z; /*+++++*/ /* zutil.c -- target dependent utility functions for the compression library * Copyright (C) 1995 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 */ /* From: zutil.c,v 1.8 1995/05/03 17:27:12 jloup Exp */ @@ -4583,7 +4583,7 @@ char *z_errmsg[] = { /*+++++*/ /* adler32.c -- compute the Adler-32 checksum of a data stream * Copyright (C) 1995 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 */ /* From: adler32.c,v 1.6 1995/05/03 17:27:08 jloup Exp */ diff --git a/sys/net/zlib.h b/sys/net/zlib.h index 73daf276331..92460eaaa9b 100644 --- a/sys/net/zlib.h +++ b/sys/net/zlib.h @@ -1,4 +1,4 @@ -/* $OpenBSD: zlib.h,v 1.2 1997/02/24 13:34:07 niklas Exp $ */ +/* $OpenBSD: zlib.h,v 1.3 2001/01/29 06:12:12 mickey Exp $ */ /* $NetBSD: zlib.h,v 1.1 1996/03/15 02:28:17 paulus Exp $ */ /* @@ -40,7 +40,7 @@ /* zconf.h -- configuration of the zlib compression library * Copyright (C) 1995 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 */ /* From: zconf.h,v 1.12 1995/05/03 17:27:12 jloup Exp */ @@ -133,7 +133,7 @@ typedef uLong FAR uLongf; #define ZLIB_VERSION "0.95P" -/* +/* The 'zlib' compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method @@ -250,7 +250,7 @@ extern char *zlib_version; /* basic functions */ extern int deflateInit OF((z_stream *strm, int level)); -/* +/* Initializes the internal stream state for compression. The fields zalloc, zfree and opaque must be initialized before by the caller. If zalloc and zfree are set to Z_NULL, deflateInit updates them to @@ -326,7 +326,7 @@ extern int deflate OF((z_stream *strm, int flush)); more input data, until it returns with Z_STREAM_END or an error. After deflate has returned Z_STREAM_END, the only possible operations on the stream are deflateReset or deflateEnd. - + Z_FINISH can be used immediately after deflateInit if all the compression is to be done in a single step. In this case, avail_out must be at least 0.1% larger than avail_in plus 12 bytes. If deflate does not return @@ -358,7 +358,7 @@ extern int deflateEnd OF((z_stream *strm)); extern int inflateInit OF((z_stream *strm)); -/* +/* Initializes the internal stream state for decompression. The fields zalloc and zfree must be initialized before by the caller. If zalloc and zfree are set to Z_NULL, inflateInit updates them to use default allocation @@ -446,7 +446,7 @@ extern int deflateInit2 OF((z_stream *strm, int memLevel, int strategy, int minCompression)); -/* +/* This is another version of deflateInit with more compression options. The fields next_in, zalloc and zfree must be initialized before by the caller. @@ -498,7 +498,7 @@ extern int deflateInit2 OF((z_stream *strm, deflateInit2 does not perform any compression: this will be done by deflate(). */ - + extern int deflateCopy OF((z_stream *dest, z_stream *source)); /* @@ -535,7 +535,7 @@ extern int deflateReset OF((z_stream *strm)); extern int inflateInit2 OF((z_stream *strm, int windowBits)); -/* +/* This is another version of inflateInit with more compression options. The fields next_out, zalloc and zfree must be initialized before by the caller. @@ -567,7 +567,7 @@ extern int inflateInit2 OF((z_stream *strm, */ extern int inflateSync OF((z_stream *strm)); -/* +/* Skips invalid compressed data until the special marker (see deflate() above) can be found, or until all available input is skipped. No output is provided. |