summaryrefslogtreecommitdiff
path: root/sys/net/zlib.c
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2001-01-29 06:12:13 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2001-01-29 06:12:13 +0000
commite63a1f506165494665fac74c6808682d612a3169 (patch)
treecafad6eee9f245555b3e3f9dc4bf1883a0d1dc85 /sys/net/zlib.c
parentaa5594ec1e69da765a51c82fe3776bbe9b97c362 (diff)
consts, spaces
Diffstat (limited to 'sys/net/zlib.c')
-rw-r--r--sys/net/zlib.c92
1 files changed, 46 insertions, 46 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 */