aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.transmeta.com>2003-05-27 19:41:03 -0700
committerRussell King <rmk@flint.arm.linux.org.uk>2003-05-27 19:41:03 -0700
commit999f677fe55c02bfff65944b676b22201580777d (patch)
treee2a1b9abc4ece3996ce468ccb9697343827707ab /lib
parentcca66bf22dba028eaf62494237d19f1aa174ce58 (diff)
downloadhistory-999f677fe55c02bfff65944b676b22201580777d.tar.gz
Make zlib_inflate look more like ANSI C code.
Anybody who still thinks K&R makes sense should just be shot.
Diffstat (limited to 'lib')
-rw-r--r--lib/zlib_inflate/infblock.c48
-rw-r--r--lib/zlib_inflate/infcodes.c28
-rw-r--r--lib/zlib_inflate/inffast.c14
-rw-r--r--lib/zlib_inflate/inflate.c53
-rw-r--r--lib/zlib_inflate/inftrees.c70
-rw-r--r--lib/zlib_inflate/infutil.c9
6 files changed, 124 insertions, 98 deletions
diff --git a/lib/zlib_inflate/infblock.c b/lib/zlib_inflate/infblock.c
index c8dad267ece362..2471add1f7ebb8 100644
--- a/lib/zlib_inflate/infblock.c
+++ b/lib/zlib_inflate/infblock.c
@@ -65,10 +65,11 @@ local const uInt border[] = { /* Order of the bit length code lengths */
*/
-void zlib_inflate_blocks_reset(s, z, c)
-inflate_blocks_statef *s;
-z_streamp z;
-uLongf *c;
+void zlib_inflate_blocks_reset(
+ inflate_blocks_statef *s,
+ z_streamp z,
+ uLongf *c
+)
{
if (c != Z_NULL)
*c = s->check;
@@ -82,10 +83,11 @@ uLongf *c;
z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0);
}
-inflate_blocks_statef *zlib_inflate_blocks_new(z, c, w)
-z_streamp z;
-check_func c;
-uInt w;
+inflate_blocks_statef *zlib_inflate_blocks_new(
+ z_streamp z,
+ check_func c,
+ uInt w
+)
{
inflate_blocks_statef *s;
@@ -100,10 +102,11 @@ uInt w;
}
-int zlib_inflate_blocks(s, z, r)
-inflate_blocks_statef *s;
-z_streamp z;
-int r;
+int zlib_inflate_blocks(
+ inflate_blocks_statef *s,
+ z_streamp z,
+ int r
+)
{
uInt t; /* temporary storage */
uLong b; /* bit buffer */
@@ -325,19 +328,21 @@ int r;
}
-int zlib_inflate_blocks_free(s, z)
-inflate_blocks_statef *s;
-z_streamp z;
+int zlib_inflate_blocks_free(
+ inflate_blocks_statef *s,
+ z_streamp z
+)
{
zlib_inflate_blocks_reset(s, z, Z_NULL);
return Z_OK;
}
-void zlib_inflate_set_dictionary(s, d, n)
-inflate_blocks_statef *s;
-const Bytef *d;
-uInt n;
+void zlib_inflate_set_dictionary(
+ inflate_blocks_statef *s,
+ const Bytef *d,
+ uInt n
+)
{
memcpy(s->window, d, n);
s->read = s->write = s->window + n;
@@ -348,8 +353,9 @@ uInt n;
* by Z_SYNC_FLUSH or Z_FULL_FLUSH.
* IN assertion: s != Z_NULL
*/
-int zlib_inflate_blocks_sync_point(s)
-inflate_blocks_statef *s;
+int zlib_inflate_blocks_sync_point(
+ inflate_blocks_statef *s
+)
{
return s->mode == LENS;
}
diff --git a/lib/zlib_inflate/infcodes.c b/lib/zlib_inflate/infcodes.c
index f65aafcb199e4f..0202b4f87f697b 100644
--- a/lib/zlib_inflate/infcodes.c
+++ b/lib/zlib_inflate/infcodes.c
@@ -14,11 +14,13 @@
#define exop word.what.Exop
#define bits word.what.Bits
-inflate_codes_statef *zlib_inflate_codes_new(bl, bd, tl, td, z)
-uInt bl, bd;
-inflate_huft *tl;
-inflate_huft *td; /* need separate declaration for Borland C++ */
-z_streamp z;
+inflate_codes_statef *zlib_inflate_codes_new(
+ uInt bl,
+ uInt bd,
+ inflate_huft *tl,
+ inflate_huft *td, /* need separate declaration for Borland C++ */
+ z_streamp z
+)
{
inflate_codes_statef *c;
@@ -34,10 +36,11 @@ z_streamp z;
}
-int zlib_inflate_codes(s, z, r)
-inflate_blocks_statef *s;
-z_streamp z;
-int r;
+int zlib_inflate_codes(
+ inflate_blocks_statef *s,
+ z_streamp z,
+ int r
+)
{
uInt j; /* temporary storage */
inflate_huft *t; /* temporary pointer */
@@ -197,8 +200,9 @@ int r;
}
-void zlib_inflate_codes_free(c, z)
-inflate_codes_statef *c;
-z_streamp z;
+void zlib_inflate_codes_free(
+ inflate_codes_statef *c,
+ z_streamp z
+)
{
}
diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c
index 7daeff79aaf91a..6b4b5e1dc02233 100644
--- a/lib/zlib_inflate/inffast.c
+++ b/lib/zlib_inflate/inffast.c
@@ -25,12 +25,14 @@ struct inflate_codes_state;
at least ten. The ten bytes are six bytes for the longest length/
distance pair plus four bytes for overloading the bit buffer. */
-int zlib_inflate_fast(bl, bd, tl, td, s, z)
-uInt bl, bd;
-inflate_huft *tl;
-inflate_huft *td; /* need separate declaration for Borland C++ */
-inflate_blocks_statef *s;
-z_streamp z;
+int zlib_inflate_fast(
+ uInt bl,
+ uInt bd,
+ inflate_huft *tl,
+ inflate_huft *td, /* need separate declaration for Borland C++ */
+ inflate_blocks_statef *s,
+ z_streamp z
+)
{
inflate_huft *t; /* temporary pointer */
uInt e; /* extra bits or operation */
diff --git a/lib/zlib_inflate/inflate.c b/lib/zlib_inflate/inflate.c
index 9c790b98eae763..063b10f85aea4c 100644
--- a/lib/zlib_inflate/inflate.c
+++ b/lib/zlib_inflate/inflate.c
@@ -14,8 +14,9 @@ int ZEXPORT zlib_inflate_workspacesize(void)
}
-int ZEXPORT zlib_inflateReset(z)
-z_streamp z;
+int ZEXPORT zlib_inflateReset(
+ z_streamp z
+)
{
if (z == Z_NULL || z->state == Z_NULL || z->workspace == Z_NULL)
return Z_STREAM_ERROR;
@@ -27,8 +28,9 @@ z_streamp z;
}
-int ZEXPORT zlib_inflateEnd(z)
-z_streamp z;
+int ZEXPORT zlib_inflateEnd(
+ z_streamp z
+)
{
if (z == Z_NULL || z->state == Z_NULL || z->workspace == Z_NULL)
return Z_STREAM_ERROR;
@@ -39,11 +41,12 @@ z_streamp z;
}
-int ZEXPORT zlib_inflateInit2_(z, w, version, stream_size)
-z_streamp z;
-int w;
-const char *version;
-int stream_size;
+int ZEXPORT zlib_inflateInit2_(
+ z_streamp z,
+ int w,
+ const char *version,
+ int stream_size
+)
{
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
stream_size != sizeof(z_stream) || z->workspace == Z_NULL)
@@ -100,10 +103,11 @@ static int zlib_inflate_packet_flush(inflate_blocks_statef *s)
}
-int ZEXPORT zlib_inflateInit_(z, version, stream_size)
-z_streamp z;
-const char *version;
-int stream_size;
+int ZEXPORT zlib_inflateInit_(
+ z_streamp z,
+ const char *version,
+ int stream_size
+)
{
return zlib_inflateInit2_(z, DEF_WBITS, version, stream_size);
}
@@ -113,9 +117,10 @@ int stream_size;
#define NEEDBYTE {if(z->avail_in==0)goto empty;r=trv;}
#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
-int ZEXPORT zlib_inflate(z, f)
-z_streamp z;
-int f;
+int ZEXPORT zlib_inflate(
+ z_streamp z,
+ int f
+)
{
int r, trv;
uInt b;
@@ -245,8 +250,9 @@ int f;
}
-int ZEXPORT zlib_inflateSync(z)
-z_streamp z;
+int ZEXPORT zlib_inflateSync(
+ z_streamp z
+)
{
uInt n; /* number of bytes to look at */
Bytef *p; /* pointer to bytes */
@@ -303,8 +309,9 @@ z_streamp z;
* decompressing, PPP checks that at the end of input packet, inflate is
* waiting for these length bytes.
*/
-int ZEXPORT zlib_inflateSyncPoint(z)
-z_streamp z;
+int ZEXPORT zlib_inflateSyncPoint(
+ z_streamp z
+)
{
if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL)
return Z_STREAM_ERROR;
@@ -373,8 +380,10 @@ static int zlib_inflate_addhistory(inflate_blocks_statef *s,
* will have been updated if need be.
*/
-int ZEXPORT zlib_inflateIncomp(z)
-z_stream *z;
+int ZEXPORT zlib_inflateIncomp(
+ z_stream *z
+
+)
{
if (z->state->mode != BLOCKS)
return Z_DATA_ERROR;
diff --git a/lib/zlib_inflate/inftrees.c b/lib/zlib_inflate/inftrees.c
index d3ea7ef0755103..2d6b665761f91f 100644
--- a/lib/zlib_inflate/inftrees.c
+++ b/lib/zlib_inflate/inftrees.c
@@ -87,17 +87,18 @@ local const uInt cpdext[30] = { /* Extra bits for distance codes */
/* If BMAX needs to be larger than 16, then h and x[] should be uLong. */
#define BMAX 15 /* maximum bit length of any code */
-local int huft_build(b, n, s, d, e, t, m, hp, hn, v)
-uIntf *b; /* code lengths in bits (all assumed <= BMAX) */
-uInt n; /* number of codes (assumed <= 288) */
-uInt s; /* number of simple-valued codes (0..s-1) */
-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 */
-inflate_huft *hp; /* space for trees */
-uInt *hn; /* hufts used in space */
-uIntf *v; /* working area: values in order of bit length */
+local int huft_build(
+ uIntf *b, /* code lengths in bits (all assumed <= BMAX) */
+ uInt n, /* number of codes (assumed <= 288) */
+ uInt s, /* number of simple-valued codes (0..s-1) */
+ 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 */
+ inflate_huft *hp, /* space for trees */
+ uInt *hn, /* hufts used in space */
+ 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
@@ -288,12 +289,13 @@ uIntf *v; /* working area: values in order of bit length */
}
-int zlib_inflate_trees_bits(c, bb, tb, hp, z)
-uIntf *c; /* 19 code lengths */
-uIntf *bb; /* bits tree desired/actual depth */
-inflate_huft * FAR *tb; /* bits tree result */
-inflate_huft *hp; /* space for trees */
-z_streamp z; /* for messages */
+int zlib_inflate_trees_bits(
+ uIntf *c, /* 19 code lengths */
+ uIntf *bb, /* bits tree desired/actual depth */
+ inflate_huft * FAR *tb, /* bits tree result */
+ inflate_huft *hp, /* space for trees */
+ z_streamp z /* for messages */
+)
{
int r;
uInt hn = 0; /* hufts used in space */
@@ -312,16 +314,17 @@ z_streamp z; /* for messages */
return r;
}
-int zlib_inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z)
-uInt nl; /* number of literal/length codes */
-uInt nd; /* number of distance codes */
-uIntf *c; /* that many (total) code lengths */
-uIntf *bl; /* literal desired/actual bit depth */
-uIntf *bd; /* distance desired/actual bit depth */
-inflate_huft * FAR *tl; /* literal/length tree result */
-inflate_huft * FAR *td; /* distance tree result */
-inflate_huft *hp; /* space for trees */
-z_streamp z; /* for messages */
+int zlib_inflate_trees_dynamic(
+ uInt nl, /* number of literal/length codes */
+ uInt nd, /* number of distance codes */
+ uIntf *c, /* that many (total) code lengths */
+ uIntf *bl, /* literal desired/actual bit depth */
+ uIntf *bd, /* distance desired/actual bit depth */
+ inflate_huft * FAR *tl, /* literal/length tree result */
+ inflate_huft * FAR *td, /* distance tree result */
+ inflate_huft *hp, /* space for trees */
+ z_streamp z /* for messages */
+)
{
int r;
uInt hn = 0; /* hufts used in space */
@@ -376,12 +379,13 @@ z_streamp z; /* for messages */
#include "inffixed.h"
-int zlib_inflate_trees_fixed(bl, bd, tl, td, z)
-uIntf *bl; /* literal desired/actual bit depth */
-uIntf *bd; /* distance desired/actual bit depth */
-inflate_huft * FAR *tl; /* literal/length tree result */
-inflate_huft * FAR *td; /* distance tree result */
-z_streamp z; /* for memory allocation */
+int zlib_inflate_trees_fixed(
+ uIntf *bl, /* literal desired/actual bit depth */
+ uIntf *bd, /* distance desired/actual bit depth */
+ inflate_huft * FAR *tl, /* literal/length tree result */
+ inflate_huft * FAR *td, /* distance tree result */
+ z_streamp z /* for memory allocation */
+)
{
*bl = fixed_bl;
*bd = fixed_bd;
diff --git a/lib/zlib_inflate/infutil.c b/lib/zlib_inflate/infutil.c
index 1d65399de80fe7..0ae6ddefa35d76 100644
--- a/lib/zlib_inflate/infutil.c
+++ b/lib/zlib_inflate/infutil.c
@@ -20,10 +20,11 @@ uInt zlib_inflate_mask[17] = {
/* copy as much as possible from the sliding window to the output area */
-int zlib_inflate_flush(s, z, r)
-inflate_blocks_statef *s;
-z_streamp z;
-int r;
+int zlib_inflate_flush(
+ inflate_blocks_statef *s,
+ z_streamp z,
+ int r
+)
{
uInt n;
Bytef *p;