]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Rewrite K&R-style function prototypes to ANSI-C-style.
authorhansr <hk-git@circlestorm.org>
Sat, 18 Oct 2014 20:49:16 +0000 (22:49 +0200)
committerhansr <hk-git@circlestorm.org>
Sat, 18 Oct 2014 20:49:16 +0000 (22:49 +0200)
Only internal functions, no exported functions in this commit.

16 files changed:
adler32.c
crc32.c
deflate.c
deflate.h
gzlib.c
gzread.c
gzwrite.c
infback.c
inffast.c
inflate.c
inftrees.c
test/example.c
test/infcover.c
test/minigzip.c
trees.c
zutil.c

index 9b0f42ad21a8a262143198b8c2659fd3c935e916..0ac4cf3003bd9804bb3fc44666940eb8606ccb9e 100644 (file)
--- a/adler32.c
+++ b/adler32.c
@@ -149,10 +149,7 @@ uLong ZEXPORT adler32(adler, buf, len)
 }
 
 /* ========================================================================= */
-local uLong adler32_combine_(adler1, adler2, len2)
-    uLong adler1;
-    uLong adler2;
-    z_off64_t len2;
+local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2)
 {
     unsigned long sum1;
     unsigned long sum2;
diff --git a/crc32.c b/crc32.c
index 67e3bf76cf46dc3ec50fc93977a7c308900fcea7..dc3a95217cb1cfb27baebc47886f3d67b08d3e15 100644 (file)
--- a/crc32.c
+++ b/crc32.c
@@ -161,9 +161,7 @@ local void make_crc_table()
 }
 
 #ifdef MAKECRCH
-local void write_table(out, table)
-    FILE *out;
-    const z_crc_t *table;
+local void write_table(FILE *out, const z_crc_t *table)
 {
     int n;
 
@@ -251,10 +249,7 @@ unsigned long ZEXPORT crc32(crc, buf, len)
 #define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
 
 /* ========================================================================= */
-local unsigned long crc32_little(crc, buf, len)
-    unsigned long crc;
-    const unsigned char *buf;
-    unsigned len;
+local unsigned long crc32_little(unsigned long crc, const unsigned char *buf, unsigned len)
 {
     register z_crc_t c;
     register const z_crc_t *buf4;
@@ -295,10 +290,7 @@ local unsigned long crc32_little(crc, buf, len)
 #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
 
 /* ========================================================================= */
-local unsigned long crc32_big(crc, buf, len)
-    unsigned long crc;
-    const unsigned char *buf;
-    unsigned len;
+local unsigned long crc32_big(unsigned long crc, const unsigned char *buf, unsigned len)
 {
     register z_crc_t c;
     register const z_crc_t *buf4;
@@ -335,9 +327,7 @@ local unsigned long crc32_big(crc, buf, len)
 #define GF2_DIM 32      /* dimension of GF(2) vectors (length of CRC) */
 
 /* ========================================================================= */
-local unsigned long gf2_matrix_times(mat, vec)
-    unsigned long *mat;
-    unsigned long vec;
+local unsigned long gf2_matrix_times(unsigned long *mat, unsigned long vec)
 {
     unsigned long sum;
 
@@ -352,9 +342,7 @@ local unsigned long gf2_matrix_times(mat, vec)
 }
 
 /* ========================================================================= */
-local void gf2_matrix_square(square, mat)
-    unsigned long *square;
-    unsigned long *mat;
+local void gf2_matrix_square(unsigned long *square, unsigned long *mat)
 {
     int n;
 
@@ -363,10 +351,7 @@ local void gf2_matrix_square(square, mat)
 }
 
 /* ========================================================================= */
-local uLong crc32_combine_(crc1, crc2, len2)
-    uLong crc1;
-    uLong crc2;
-    z_off64_t len2;
+local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2)
 {
     int n;
     unsigned long row;
index 992ad613b8ce03f2d4876dd79b59539d9a259f23..6ac69c41ff6065865babc6f42b3fc4dfa31cffc2 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -674,9 +674,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
  * IN assertion: the stream state is correct and there is enough room in
  * pending_buf.
  */
-local void putShortMSB (s, b)
-    deflate_state *s;
-    uInt b;
+local void putShortMSB (deflate_state *s, uInt b)
 {
     put_byte(s, (Byte)(b >> 8));
     put_byte(s, (Byte)(b & 0xff));
@@ -1124,10 +1122,7 @@ int ZEXPORT deflateCopy (dest, source)
  * allocating a large strm->next_in buffer and copying from it.
  * (See also flush_pending()).
  */
-ZLIB_INTERNAL int read_buf(strm, buf, size)
-    z_streamp strm;
-    Byte *buf;
-    unsigned size;
+ZLIB_INTERNAL int read_buf(z_streamp strm, Byte *buf, unsigned size)
 {
     unsigned len = strm->avail_in;
 
@@ -1155,8 +1150,7 @@ ZLIB_INTERNAL int read_buf(strm, buf, size)
 /* ===========================================================================
  * Initialize the "longest match" routines for a new zlib stream
  */
-local void lm_init (s)
-    deflate_state *s;
+local void lm_init (deflate_state *s)
 {
     s->window_size = (ulg)2L*s->w_size;
 
@@ -1187,10 +1181,7 @@ local void lm_init (s)
 /* ===========================================================================
  * Check that the match at match_start is indeed a match.
  */
-local void check_match(s, start, match, length)
-    deflate_state *s;
-    IPos start, match;
-    int length;
+local void check_match(deflate_state *s, IPos start, IPos match, int length)
 {
     /* check that the match is indeed a match */
     if (zmemcmp(s->window + match,
@@ -1242,8 +1233,7 @@ local void fill_window(deflate_state *s)
     fill_window_c(s);
 }
 
-local void fill_window_c(s)
-    deflate_state *s;
+local void fill_window_c(deflate_state *s)
 {
     register unsigned n;
     register Pos *p;
@@ -1434,9 +1424,7 @@ local void fill_window_c(s)
  * NOTE: this function should be optimized to avoid extra copying from
  * window to pending_buf.
  */
-local block_state deflate_stored(s, flush)
-    deflate_state *s;
-    int flush;
+local block_state deflate_stored(deflate_state *s, int flush)
 {
     /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
      * to pending_buf_size, and each stored block has a 5 byte header:
@@ -1498,9 +1486,7 @@ local block_state deflate_stored(s, flush)
  * new strings in the dictionary only for unmatched strings or for short
  * matches. It is used only for the fast compression options.
  */
-local block_state deflate_fast(s, flush)
-    deflate_state *s;
-    int flush;
+local block_state deflate_fast(deflate_state *s, int flush)
 {
     IPos hash_head;       /* head of the hash chain */
     int bflush;           /* set if current block must be flushed */
@@ -1602,9 +1588,7 @@ local block_state deflate_fast(s, flush)
  * evaluation for matches: a match is finally adopted only if there is
  * no better match at the next window position.
  */
-local block_state deflate_slow(s, flush)
-    deflate_state *s;
-    int flush;
+local block_state deflate_slow(deflate_state *s, int flush)
 {
     IPos hash_head;          /* head of hash chain */
     int bflush;              /* set if current block must be flushed */
@@ -1748,9 +1732,7 @@ local block_state deflate_slow(s, flush)
  * one.  Do not maintain a hash table.  (It will be regenerated if this run of
  * deflate switches away from Z_RLE.)
  */
-local block_state deflate_rle(s, flush)
-    deflate_state *s;
-    int flush;
+local block_state deflate_rle(deflate_state *s, int flush)
 {
     int bflush;             /* set if current block must be flushed */
     uInt prev;              /* byte at distance one to match */
@@ -1821,9 +1803,7 @@ local block_state deflate_rle(s, flush)
  * For Z_HUFFMAN_ONLY, do not look for matches.  Do not maintain a hash table.
  * (It will be regenerated if this run of deflate switches away from Huffman.)
  */
-local block_state deflate_huff(s, flush)
-    deflate_state *s;
-    int flush;
+local block_state deflate_huff(deflate_state *s, int flush)
 {
     int bflush;             /* set if current block must be flushed */
 
index 265cf9d61f8cb852d01010d8b2de525093d2d856..7f7deb3ae019989a3832322f574f328755e5c54a 100644 (file)
--- a/deflate.h
+++ b/deflate.h
@@ -417,10 +417,9 @@ void ZLIB_INTERNAL bi_windup (deflate_state *s);
  * Send a value on a given number of bits.
  * IN assertion: length <= 16 and value fits in length bits.
  */
-local void send_bits(s, value, length)
-    deflate_state *s;
-    int value;  /* value to send */
-    int length; /* number of bits */
+local void send_bits(deflate_state *s,
+                     int value,  /* value to send */
+                     int length  /* number of bits */
 {
     Tracevv((stderr," l %2d v %4x ", length, value));
     Assert(length > 0 && length <= 15, "invalid length");
diff --git a/gzlib.c b/gzlib.c
index 59aed4c71d86c45441aad8c88f305af62764afce..028a2d3c34d833dd3d7b75b727adc065ffbef87a 100644 (file)
--- a/gzlib.c
+++ b/gzlib.c
@@ -30,8 +30,7 @@ local gzFile gz_open (const void *, int, const char *);
 
    The gz_strwinerror function does not change the current setting of
    GetLastError. */
-char ZLIB_INTERNAL *gz_strwinerror (error)
-     DWORD error;
+char ZLIB_INTERNAL *gz_strwinerror (DWORD error)
 {
     static char buf[1024];
 
@@ -72,8 +71,7 @@ char ZLIB_INTERNAL *gz_strwinerror (error)
 #endif /* UNDER_CE */
 
 /* Reset gzip file state */
-local void gz_reset(state)
-    gz_statep state;
+local void gz_reset(gz_statep state)
 {
     state->x.have = 0;              /* no output data available */
     if (state->mode == GZ_READ) {   /* for reading ... */
@@ -88,10 +86,7 @@ local void gz_reset(state)
 }
 
 /* Open a gzip file either by name or file descriptor. */
-local gzFile gz_open(path, fd, mode)
-    const void *path;
-    int fd;
-    const char *mode;
+local gzFile gz_open(const void *path, int fd, const char *mode)
 {
     gz_statep state;
     size_t len;
@@ -564,10 +559,7 @@ void ZEXPORT gzclearerr(file)
    memory).  Simply save the error message as a static string.  If there is an
    allocation failure constructing the error message, then convert the error to
    out of memory. */
-void ZLIB_INTERNAL gz_error(state, err, msg)
-    gz_statep state;
-    int err;
-    const char *msg;
+void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg)
 {
     /* free previously allocated message and clear */
     if (state->msg != NULL) {
index 68bc2a36ae80c83fc51bc26980228aab058313e3..63067fdef08bd4c5ccd4e1ec81c0c12da4b67b1a 100644 (file)
--- a/gzread.c
+++ b/gzread.c
@@ -17,11 +17,7 @@ local int gz_skip (gz_statep, z_off64_t);
    state->fd, and update state->eof, state->err, and state->msg as appropriate.
    This function needs to loop on read(), since read() is not guaranteed to
    read the number of bytes requested, depending on the type of descriptor. */
-local int gz_load(state, buf, len, have)
-    gz_statep state;
-    unsigned char *buf;
-    unsigned len;
-    unsigned *have;
+local int gz_load(gz_statep state, unsigned char *buf, unsigned len, unsigned *have)
 {
     int ret;
 
@@ -48,8 +44,7 @@ local int gz_load(state, buf, len, have)
    If strm->avail_in != 0, then the current data is moved to the beginning of
    the input buffer, and then the remainder of the buffer is loaded with the
    available data from the input file. */
-local int gz_avail(state)
-    gz_statep state;
+local int gz_avail(gz_statep state)
 {
     unsigned got;
     z_streamp strm = &(state->strm);
@@ -83,8 +78,7 @@ local int gz_avail(state)
    case, all further file reads will be directly to either the output buffer or
    a user buffer.  If decompressing, the inflate state will be initialized.
    gz_look() will return 0 on success or -1 on failure. */
-local int gz_look(state)
-    gz_statep state;
+local int gz_look(gz_statep state)
 {
     z_streamp strm = &(state->strm);
 
@@ -169,8 +163,7 @@ local int gz_look(state)
    data.  If the gzip stream completes, state->how is reset to LOOK to look for
    the next gzip stream or raw data, once state->x.have is depleted.  Returns 0
    on success, -1 on failure. */
-local int gz_decomp(state)
-    gz_statep state;
+local int gz_decomp(gz_statep state)
 {
     int ret = Z_OK;
     unsigned had;
@@ -223,8 +216,7 @@ local int gz_decomp(state)
    looked for to determine whether to copy or decompress.  Returns -1 on error,
    otherwise 0.  gz_fetch() will leave state->how as COPY or GZIP unless the
    end of the input file has been reached and all data has been processed.  */
-local int gz_fetch(state)
-    gz_statep state;
+local int gz_fetch(gz_statep state)
 {
     z_streamp strm = &(state->strm);
 
@@ -253,9 +245,7 @@ local int gz_fetch(state)
 }
 
 /* Skip len uncompressed bytes of output.  Return -1 on error, 0 on success. */
-local int gz_skip(state, len)
-    gz_statep state;
-    z_off64_t len;
+local int gz_skip(gz_statep state, z_off64_t len)
 {
     unsigned n;
 
index c592d1a6a490adc9c914261b70b51581982b6646..9ea702e86aa1603cf6696c4d06848459d1ed2fed 100644 (file)
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -12,8 +12,7 @@ local int gz_zero (gz_statep, z_off64_t);
 
 /* Initialize state for writing a gzip file.  Mark initialization by setting
    state->size to non-zero.  Return -1 on failure or 0 on success. */
-local int gz_init(state)
-    gz_statep state;
+local int gz_init(gz_statep state)
 {
     int ret;
     z_streamp strm = &(state->strm);
@@ -67,9 +66,7 @@ local int gz_init(state)
    then the deflate() state is reset to start a new gzip stream.  If gz->direct
    is true, then simply write to the output file without compressing, and
    ignore flush. */
-local int gz_comp(state, flush)
-    gz_statep state;
-    int flush;
+local int gz_comp(gz_statep state, int flush)
 {
     int ret, got;
     unsigned have;
@@ -130,9 +127,7 @@ local int gz_comp(state, flush)
 }
 
 /* Compress len zeros to output.  Return -1 on error, 0 on success. */
-local int gz_zero(state, len)
-    gz_statep state;
-    z_off64_t len;
+local int gz_zero(gz_statep state, z_off64_t len)
 {
     int first;
     unsigned n;
index e873426c71ab5628de600a70deb1205be322ec1e..fdafc0a026506af36af5616f114bd4152ca562eb 100644 (file)
--- a/infback.c
+++ b/infback.c
@@ -79,8 +79,7 @@ int stream_size;
    used for threaded applications, since the rewriting of the tables and virgin
    may not be thread-safe.
  */
-local void fixedtables(state)
-struct inflate_state *state;
+local void fixedtables(struct inflate_state *state)
 {
 #ifdef BUILDFIXED
     static int virgin = 1;
index 6b82c83ba4d0e9f8ce76453fd1da6343f377b17b..9747028c045e5a02e4450c5bd8d6a0a479a49c5f 100644 (file)
--- a/inffast.c
+++ b/inffast.c
       requires strm->avail_out >= 258 for each loop to avoid checking for
       output space.
  */
-void ZLIB_INTERNAL inflate_fast(strm, start)
-z_streamp strm;
-unsigned start;         /* inflate()'s starting value for strm->avail_out */
+void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start)
 {
+    /* start: inflate()'s starting value for strm->avail_out */
     struct inflate_state *state;
     z_const unsigned char *in;      /* local strm->next_in */
     z_const unsigned char *last;    /* have enough input while in < last */
index e888e6342f5df79e756673067aa20766b311bb28..bc64251d9bde59dc08eab38c7278e43fdedf02cf 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -256,8 +256,7 @@ int value;
    used for threaded applications, since the rewriting of the tables and virgin
    may not be thread-safe.
  */
-local void fixedtables(state)
-struct inflate_state *state;
+local void fixedtables(struct inflate_state *state)
 {
 #ifdef BUILDFIXED
     static int virgin = 1;
@@ -374,10 +373,7 @@ void makefixed()
    output will fall in the output data, making match copies simpler and faster.
    The advantage may be dependent on the size of the processor's data caches.
  */
-local int updatewindow(strm, end, copy)
-z_streamp strm;
-const Byte *end;
-unsigned copy;
+local int updatewindow(z_streamp strm, const Byte *end, unsigned copy)
 {
     struct inflate_state *state;
     unsigned dist;
@@ -1349,10 +1345,7 @@ gz_headerp head;
    called again with more data and the *have state.  *have is initialized to
    zero for the first call.
  */
-local unsigned syncsearch(have, buf, len)
-unsigned *have;
-const unsigned char *buf;
-unsigned len;
+local unsigned syncsearch(unsigned *have, const unsigned char *buf, unsigned len)
 {
     unsigned got;
     unsigned next;
index 98654550eebcb2e7392a8a3b666f107c2ec7856a..2847e4871a25782c992ced1d636b2c1f7f554a62 100644 (file)
@@ -29,13 +29,8 @@ const char inflate_copyright[] =
    table index bits.  It will differ if the request is greater than the
    longest code or if it is less than the shortest code.
  */
-int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)
-codetype type;
-unsigned short *lens;
-unsigned codes;
-code * *table;
-unsigned *bits;
-unsigned short  *work;
+int ZLIB_INTERNAL inflate_table(codetype type, unsigned short *lens, unsigned codes,
+                                code * *table, unsigned *bits, unsigned short  *work)
 {
     unsigned len;               /* a code's length in bits */
     unsigned sym;               /* index of code symbols */
index b64f0d640f3b614aece58506926fcd7fc613d73d..611f89c78ab6231102c360f403c8c6744980f334 100644 (file)
@@ -29,18 +29,13 @@ const char dictionary[] = "hello";
 uLong dictId; /* Adler32 value of the dictionary */
 
 void test_deflate       (Byte *compr, uLong comprLen);
-void test_inflate       (Byte *compr, uLong comprLen,
-                            Byte *uncompr, uLong uncomprLen);
-void test_large_deflate (Byte *compr, uLong comprLen,
-                            Byte *uncompr, uLong uncomprLen);
-void test_large_inflate (Byte *compr, uLong comprLen,
-                            Byte *uncompr, uLong uncomprLen);
+void test_inflate       (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen);
+void test_large_deflate (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen);
+void test_large_inflate (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen);
 void test_flush         (Byte *compr, uLong *comprLen);
-void test_sync          (Byte *compr, uLong comprLen,
-                            Byte *uncompr, uLong uncomprLen);
+void test_sync          (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen);
 void test_dict_deflate  (Byte *compr, uLong comprLen);
-void test_dict_inflate  (Byte *compr, uLong comprLen,
-                            Byte *uncompr, uLong uncomprLen);
+void test_dict_inflate  (Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen);
 int  main               (int argc, char *argv[]);
 
 
@@ -49,9 +44,7 @@ int  main               (int argc, char *argv[]);
 void *myalloc (void *, unsigned, unsigned);
 void myfree (void *, void *);
 
-void *myalloc(q, n, m)
-    void *q;
-    unsigned n, m;
+void *myalloc(void *q, unsigned n, unsigned m)
 {
     q = Z_NULL;
     return calloc(n, m);
@@ -79,9 +72,7 @@ void test_gzio          (const char *fname,
 /* ===========================================================================
  * Test compress() and uncompress()
  */
-void test_compress(compr, comprLen, uncompr, uncomprLen)
-    Byte *compr, *uncompr;
-    uLong comprLen, uncomprLen;
+void test_compress(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
 {
     int err;
     uLong len = (uLong)strlen(hello)+1;
@@ -105,10 +96,7 @@ void test_compress(compr, comprLen, uncompr, uncomprLen)
 /* ===========================================================================
  * Test read/write of .gz files
  */
-void test_gzio(fname, uncompr, uncomprLen)
-    const char *fname; /* compressed file name */
-    Byte *uncompr;
-    uLong uncomprLen;
+void test_gzio(const char *fname, Byte *uncompr, uLong uncomprLen)
 {
 #ifdef NO_GZCOMPRESS
     fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n");
@@ -191,9 +179,7 @@ void test_gzio(fname, uncompr, uncomprLen)
 /* ===========================================================================
  * Test deflate() with small buffers
  */
-void test_deflate(compr, comprLen)
-    Byte *compr;
-    uLong comprLen;
+void test_deflate(Byte *compr, uLong comprLen)
 {
     z_stream c_stream; /* compression stream */
     int err;
@@ -229,9 +215,7 @@ void test_deflate(compr, comprLen)
 /* ===========================================================================
  * Test inflate() with small buffers
  */
-void test_inflate(compr, comprLen, uncompr, uncomprLen)
-    Byte *compr, *uncompr;
-    uLong comprLen, uncomprLen;
+void test_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
 {
     int err;
     z_stream d_stream; /* decompression stream */
@@ -270,9 +254,7 @@ void test_inflate(compr, comprLen, uncompr, uncomprLen)
 /* ===========================================================================
  * Test deflate() with large buffers and dynamic change of compression level
  */
-void test_large_deflate(compr, comprLen, uncompr, uncomprLen)
-    Byte *compr, *uncompr;
-    uLong comprLen, uncomprLen;
+void test_large_deflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
 {
     z_stream c_stream; /* compression stream */
     int err;
@@ -325,9 +307,7 @@ void test_large_deflate(compr, comprLen, uncompr, uncomprLen)
 /* ===========================================================================
  * Test inflate() with large buffers
  */
-void test_large_inflate(compr, comprLen, uncompr, uncomprLen)
-    Byte *compr, *uncompr;
-    uLong comprLen, uncomprLen;
+void test_large_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
 {
     int err;
     z_stream d_stream; /* decompression stream */
@@ -366,9 +346,7 @@ void test_large_inflate(compr, comprLen, uncompr, uncomprLen)
 /* ===========================================================================
  * Test deflate() with full flush
  */
-void test_flush(compr, comprLen)
-    Byte *compr;
-    uLong *comprLen;
+void test_flush(Byte *compr, uLong *comprLen)
 {
     z_stream c_stream; /* compression stream */
     int err;
@@ -404,9 +382,7 @@ void test_flush(compr, comprLen)
 /* ===========================================================================
  * Test inflateSync()
  */
-void test_sync(compr, comprLen, uncompr, uncomprLen)
-    Byte *compr, *uncompr;
-    uLong comprLen, uncomprLen;
+void test_sync(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
 {
     int err;
     z_stream d_stream; /* decompression stream */
@@ -448,9 +424,7 @@ void test_sync(compr, comprLen, uncompr, uncomprLen)
 /* ===========================================================================
  * Test deflate() with preset dictionary
  */
-void test_dict_deflate(compr, comprLen)
-    Byte *compr;
-    uLong comprLen;
+void test_dict_deflate(Byte *compr, uLong comprLen)
 {
     z_stream c_stream; /* compression stream */
     int err;
@@ -485,9 +459,7 @@ void test_dict_deflate(compr, comprLen)
 /* ===========================================================================
  * Test inflate() with a preset dictionary
  */
-void test_dict_inflate(compr, comprLen, uncompr, uncomprLen)
-    Byte *compr, *uncompr;
-    uLong comprLen, uncomprLen;
+void test_dict_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen)
 {
     int err;
     z_stream d_stream; /* decompression stream */
@@ -536,9 +508,7 @@ void test_dict_inflate(compr, comprLen, uncompr, uncomprLen)
  * Usage:  example [output.gz  [input.gz]]
  */
 
-int main(argc, argv)
-    int argc;
-    char *argv[];
+int main(int argc, char *argv[])
 {
     Byte *compr, *uncompr;
     uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */
index 0e582ac69774cef815e2c74deb05607e0a91a485..eca68677d0792fd3650b235c114e8587c1f844dd 100644 (file)
@@ -287,8 +287,7 @@ local unsigned char *h2b(const char *hex, unsigned *len)
    header information is collected with inflateGetHeader().  If a zlib stream
    is looking for a dictionary, then an empty dictionary is provided.
    inflate() is run until all of the input data is consumed. */
-local void inf(char *hex, char *what, unsigned step, int win, unsigned len,
-               int err)
+local void inf(char *hex, char *what, unsigned step, int win, unsigned len, int err)
 {
     int ret;
     unsigned have;
index 9037681fbfa499d1cc135b350f8d8386b2fd988b..bc041df55c4a382a628f981d3021d59a2e7b9c61 100644 (file)
@@ -61,8 +61,7 @@
    The strwinerror function does not change the current setting
    of GetLastError.  */
 
-static char *strwinerror (error)
-     DWORD error;
+static char *strwinerror (DWORD error)
 {
     static char buf[1024];
 
@@ -100,8 +99,7 @@ static char *strwinerror (error)
     return buf;
 }
 
-static void pwinerror (s)
-    const char *s;
+static void pwinerror (const char *s)
 {
     if (s && *s)
         fprintf(stderr, "%s: %s\n", s, strwinerror(GetLastError ()));
@@ -136,16 +134,13 @@ static void pwinerror (s)
 void *myalloc (void *, unsigned, unsigned);
 void myfree (void *, void *);
 
-void *myalloc(q, n, m)
-    void *q;
-    unsigned n, m;
+void *myalloc(void *q, unsigned n, unsigned m)
 {
     q = Z_NULL;
     return calloc(n, m);
 }
 
-void myfree(q, p)
-    void *q, *p;
+void myfree(void *q, void *p)
 {
     q = Z_NULL;
     free(p);
@@ -163,24 +158,17 @@ gzFile gzopen (const char *, const char *);
 gzFile gzdopen (int, const char *);
 gzFile gz_open (const char *, int, const char *);
 
-gzFile gzopen(path, mode)
-const char *path;
-const char *mode;
+gzFile gzopen(const char *path, const char *mode)
 {
     return gz_open(path, -1, mode);
 }
 
-gzFile gzdopen(fd, mode)
-int fd;
-const char *mode;
+gzFile gzdopen(int fd, const char *mode)
 {
     return gz_open(NULL, fd, mode);
 }
 
-gzFile gz_open(path, fd, mode)
-    const char *path;
-    int fd;
-    const char *mode;
+gzFile gz_open(const char *path, int fd, const char *mode)
 {
     gzFile gz;
     int ret;
@@ -217,10 +205,7 @@ gzFile gz_open(path, fd, mode)
 
 int gzwrite (gzFile, const void *, unsigned);
 
-int gzwrite(gz, buf, len)
-    gzFile gz;
-    const void *buf;
-    unsigned len;
+int gzwrite(gzFile gz, const void *buf, unsigned len)
 {
     z_stream *strm;
     unsigned char out[BUFLEN];
@@ -241,10 +226,7 @@ int gzwrite(gz, buf, len)
 
 int gzread (gzFile, void *, unsigned);
 
-int gzread(gz, buf, len)
-    gzFile gz;
-    void *buf;
-    unsigned len;
+int gzread(gzFile gz, void *buf, unsigned len)
 {
     int ret;
     unsigned got;
@@ -278,8 +260,7 @@ int gzread(gz, buf, len)
 
 int gzclose (gzFile);
 
-int gzclose(gz)
-    gzFile gz;
+int gzclose(gzFile gz)
 {
     z_stream *strm;
     unsigned char out[BUFLEN];
@@ -307,9 +288,7 @@ int gzclose(gz)
 
 const char *gzerror (gzFile, int *);
 
-const char *gzerror(gz, err)
-    gzFile gz;
-    int *err;
+const char *gzerror(gzFile gz, int *err)
 {
     *err = gz->err;
     return gz->msg;
@@ -332,8 +311,7 @@ int  main             (int argc, char *argv[]);
 /* ===========================================================================
  * Display error message and exit
  */
-void error(msg)
-    const char *msg;
+void error(const char *msg)
 {
     fprintf(stderr, "%s: %s\n", prog, msg);
     exit(1);
@@ -343,9 +321,7 @@ void error(msg)
  * Compress input to output then close both files.
  */
 
-void gz_compress(in, out)
-    FILE   *in;
-    gzFile out;
+void gz_compress(FILE   *in, gzFile out)
 {
     local char buf[BUFLEN];
     int len;
@@ -376,9 +352,7 @@ void gz_compress(in, out)
 /* Try compressing the input file at once using mmap. Return Z_OK if
  * if success, Z_ERRNO otherwise.
  */
-int gz_compress_mmap(in, out)
-    FILE   *in;
-    gzFile out;
+int gz_compress_mmap(FILE   *in, gzFile out)
 {
     int len;
     int err;
@@ -411,9 +385,7 @@ int gz_compress_mmap(in, out)
 /* ===========================================================================
  * Uncompress input to output then close both files.
  */
-void gz_uncompress(in, out)
-    gzFile in;
-    FILE   *out;
+void gz_uncompress(gzFile in, FILE   *out)
 {
     local char buf[BUFLEN];
     int len;
@@ -438,9 +410,7 @@ void gz_uncompress(in, out)
  * Compress the given file: create a corresponding .gz file and remove the
  * original.
  */
-void file_compress(file, mode)
-    char  *file;
-    char  *mode;
+void file_compress(char  *file, char  *mode)
 {
     local char outfile[MAX_NAME_LEN];
     FILE  *in;
@@ -472,8 +442,7 @@ void file_compress(file, mode)
 /* ===========================================================================
  * Uncompress the given file and remove the original.
  */
-void file_uncompress(file)
-    char  *file;
+void file_uncompress(char  *file)
 {
     local char buf[MAX_NAME_LEN];
     char *infile, *outfile;
@@ -524,9 +493,7 @@ void file_uncompress(file)
  *   -1 to -9 : compression level
  */
 
-int main(argc, argv)
-    int argc;
-    char *argv[];
+int main(int argc, char *argv[])
 {
     int copyout = 0;
     int uncompr = 0;
diff --git a/trees.c b/trees.c
index a31e4a08ea1ad38f1b6aa9d760609d63b75a329d..3504fa3172bea1f3504d272df86fec8bc0d2f6a4 100644 (file)
--- a/trees.c
+++ b/trees.c
@@ -302,8 +302,7 @@ void gen_trees_header()
 /* ===========================================================================
  * Initialize the tree data structures for a new zlib stream.
  */
-void ZLIB_INTERNAL _tr_init(s)
-    deflate_state *s;
+void ZLIB_INTERNAL _tr_init(deflate_state *s)
 {
     tr_static_init();
 
@@ -330,8 +329,7 @@ void ZLIB_INTERNAL _tr_init(s)
 /* ===========================================================================
  * Initialize a new block.
  */
-local void init_block(s)
-    deflate_state *s;
+local void init_block(deflate_state *s)
 {
     int n; /* iterates over tree elements */
 
@@ -374,11 +372,10 @@ local void init_block(s)
  * when the heap property is re-established (each father smaller than its
  * two sons).
  */
-local void pqdownheap(s, tree, k)
-    deflate_state *s;
-    ct_data *tree;  /* the tree to restore */
-    int k;               /* node to move down */
+local void pqdownheap(deflate_state *s, ct_data *tree, int k)
 {
+    /* tree: the tree to restore */
+    /* k: node to move down */
     int v = s->heap[k];
     int j = k << 1;  /* left son of k */
     while (j <= s->heap_len) {
@@ -409,10 +406,9 @@ local void pqdownheap(s, tree, k)
  *     The length opt_len is updated; static_len is also updated if stree is
  *     not null.
  */
-local void gen_bitlen(s, desc)
-    deflate_state *s;
-    tree_desc *desc;    /* the tree descriptor */
+local void gen_bitlen(deflate_state *s, tree_desc *desc)
 {
+    /* desc: the tree descriptor */
     ct_data *tree        = desc->dyn_tree;
     int max_code         = desc->max_code;
     const ct_data *stree = desc->stat_desc->static_tree;
@@ -496,11 +492,11 @@ local void gen_bitlen(s, desc)
  * OUT assertion: the field code is set for all tree elements of non
  *     zero code length.
  */
-local void gen_codes (tree, max_code, bl_count)
-    ct_data *tree;             /* the tree to decorate */
-    int max_code;              /* largest code with non zero frequency */
-    ush *bl_count;            /* number of codes at each bit length */
+local void gen_codes (ct_data *tree, int max_code, ush *bl_count)
 {
+    /* tree: the tree to decorate */
+    /* max_code: largest code with non zero frequency */
+    /* bl_count: number of codes at each bit length */
     ush next_code[MAX_BITS+1]; /* next code value for each bit length */
     ush code = 0;              /* running code value */
     int bits;                  /* bit index */
@@ -538,10 +534,9 @@ local void gen_codes (tree, max_code, bl_count)
  *     and corresponding code. The length opt_len is updated; static_len is
  *     also updated if stree is not null. The field max_code is set.
  */
-local void build_tree(s, desc)
-    deflate_state *s;
-    tree_desc *desc; /* the tree descriptor */
+local void build_tree(deflate_state *s, tree_desc *desc)
 {
+    /* desc: the tree descriptor */
     ct_data *tree         = desc->dyn_tree;
     const ct_data *stree  = desc->stat_desc->static_tree;
     int elems             = desc->stat_desc->elems;
@@ -626,11 +621,10 @@ local void build_tree(s, desc)
  * Scan a literal or distance tree to determine the frequencies of the codes
  * in the bit length tree.
  */
-local void scan_tree (s, tree, max_code)
-    deflate_state *s;
-    ct_data *tree;   /* the tree to be scanned */
-    int max_code;    /* and its largest code of non zero frequency */
+local void scan_tree (deflate_state *s, ct_data *tree, int max_code)
 {
+    /* tree: the tree to be scanned */
+    /* max_code: and its largest code of non zero frequency */
     int n;                     /* iterates over all tree elements */
     int prevlen = -1;          /* last emitted length */
     int curlen;                /* length of current code */
@@ -671,11 +665,10 @@ local void scan_tree (s, tree, max_code)
  * Send a literal or distance tree in compressed form, using the codes in
  * bl_tree.
  */
-local void send_tree (s, tree, max_code)
-    deflate_state *s;
-    ct_data *tree; /* the tree to be scanned */
-    int max_code;       /* and its largest code of non zero frequency */
+local void send_tree (deflate_state *s, ct_data *tree, int max_code)
 {
+    /* tree: the tree to be scanned */
+    /* max_code and its largest code of non zero frequency */
     int n;                     /* iterates over all tree elements */
     int prevlen = -1;          /* last emitted length */
     int curlen;                /* length of current code */
@@ -722,8 +715,7 @@ local void send_tree (s, tree, max_code)
  * Construct the Huffman tree for the bit lengths and return the index in
  * bl_order of the last bit length code to send.
  */
-local int build_bl_tree(s)
-    deflate_state *s;
+local int build_bl_tree(deflate_state *s)
 {
     int max_blindex;  /* index of last bit length code of non zero freq */
 
@@ -757,9 +749,7 @@ local int build_bl_tree(s)
  * lengths of the bit length codes, the literal tree and the distance tree.
  * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
  */
-local void send_all_trees(s, lcodes, dcodes, blcodes)
-    deflate_state *s;
-    int lcodes, dcodes, blcodes; /* number of codes for each tree */
+local void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes)
 {
     int rank;                    /* index in bl_order */
 
@@ -786,11 +776,10 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
 /* ===========================================================================
  * Send a stored block
  */
-void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
-    deflate_state *s;
-    char *buf;       /* input block */
-    ulg stored_len;   /* length of input block */
-    int last;         /* one if this is the last block for a file */
+void ZLIB_INTERNAL _tr_stored_block(deflate_state *s,
+                                    char *buf,      /* input block */
+                                    ulg stored_len, /* length of input block */
+                                    int last)        /* one if this is the last block for a file */
 {
     send_bits(s, (STORED_BLOCK<<1)+last, 3);    /* send block type */
 #ifdef DEBUG
@@ -803,8 +792,7 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
 /* ===========================================================================
  * Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
  */
-void ZLIB_INTERNAL _tr_flush_bits(s)
-    deflate_state *s;
+void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s)
 {
     bi_flush(s);
 }
@@ -813,8 +801,7 @@ void ZLIB_INTERNAL _tr_flush_bits(s)
  * Send one empty static block to give enough lookahead for inflate.
  * This takes 10 bits, of which 7 may remain in the bit buffer.
  */
-void ZLIB_INTERNAL _tr_align(s)
-    deflate_state *s;
+void ZLIB_INTERNAL _tr_align(deflate_state *s)
 {
     send_bits(s, STATIC_TREES<<1, 3);
     send_code(s, END_BLOCK, static_ltree);
@@ -828,12 +815,11 @@ void ZLIB_INTERNAL _tr_align(s)
  * Determine the best encoding for the current block: dynamic trees, static
  * trees or store, and output the encoded block to the zip file.
  */
-void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
-    deflate_state *s;
-    char *buf;       /* input block, or NULL if too old */
-    ulg stored_len;   /* length of input block */
-    int last;         /* one if this is the last block for a file */
+void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, char *buf, ulg stored_len, int last)
 {
+    /* buf: input block, or NULL if too old */
+    /* stored_len: length of input block */
+    /* last: one if this is the last block for a file */
     ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
     int max_blindex = 0;  /* index of last bit length code of non zero freq */
 
@@ -931,11 +917,10 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
  * Save the match info and tally the frequency counts. Return true if
  * the current block must be flushed.
  */
-int ZLIB_INTERNAL _tr_tally (s, dist, lc)
-    deflate_state *s;
-    unsigned dist;  /* distance of matched string */
-    unsigned lc;    /* match length-MIN_MATCH or unmatched char (if dist==0) */
+int ZLIB_INTERNAL _tr_tally (deflate_state *s, unsigned dist, unsigned lc)
 {
+    /* dist: distance of matched string */
+    /* lc: match length-MIN_MATCH or unmatched char (if dist==0) */
     s->d_buf[s->last_lit] = (ush)dist;
     s->l_buf[s->last_lit++] = (uch)lc;
     if (dist == 0) {
@@ -981,11 +966,10 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
 /* ===========================================================================
  * Send the block data compressed using the given Huffman trees
  */
-local void compress_block(s, ltree, dtree)
-    deflate_state *s;
-    const ct_data *ltree; /* literal tree */
-    const ct_data *dtree; /* distance tree */
+local void compress_block(deflate_state *s, const ct_data *ltree, const ct_data *dtree)
 {
+    /* ltree: literal tree */
+    /* dtree: distance tree */
     unsigned dist;      /* distance of matched string */
     int lc;             /* match length or unmatched char (if dist == 0) */
     unsigned lx = 0;    /* running index in l_buf */
@@ -1041,8 +1025,7 @@ local void compress_block(s, ltree, dtree)
  *   (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
  * IN assertion: the fields Freq of dyn_ltree are set.
  */
-local int detect_data_type(s)
-    deflate_state *s;
+local int detect_data_type(deflate_state *s)
 {
     /* black_mask is the bit mask of black-listed bytes
      * set bits 0..6, 14..25, and 28..31
@@ -1075,10 +1058,10 @@ local int detect_data_type(s)
  * method would use a table)
  * IN assertion: 1 <= len <= 15
  */
-local unsigned bi_reverse(code, len)
-    unsigned code; /* the value to invert */
-    int len;       /* its bit length */
+local unsigned bi_reverse(unsigned code, int len)
 {
+    /* code: the value to invert */
+    /* len: its bit length */
     register unsigned res = 0;
     do {
         res |= code & 1;
@@ -1090,8 +1073,7 @@ local unsigned bi_reverse(code, len)
 /* ===========================================================================
  * Flush the bit buffer, keeping at most 7 bits in it.
  */
-local void bi_flush(s)
-    deflate_state *s;
+local void bi_flush(deflate_state *s)
 {
     if (s->bi_valid == 16) {
         put_short(s, s->bi_buf);
@@ -1107,8 +1089,7 @@ local void bi_flush(s)
 /* ===========================================================================
  * Flush the bit buffer and align the output on a byte boundary
  */
-ZLIB_INTERNAL void bi_windup(s)
-    deflate_state *s;
+ZLIB_INTERNAL void bi_windup(deflate_state *s)
 {
     if (s->bi_valid > 8) {
         put_short(s, s->bi_buf);
@@ -1126,12 +1107,11 @@ ZLIB_INTERNAL void bi_windup(s)
  * Copy a stored block, storing first the length and its
  * one's complement if requested.
  */
-local void copy_block(s, buf, len, header)
-    deflate_state *s;
-    char    *buf;    /* the input data */
-    unsigned len;     /* its length */
-    int      header;  /* true if block header must be written */
+local void copy_block(deflate_state *s, char *buf, unsigned len, int header)
 {
+    /* buf: the input data */
+    /* len: its length */
+    /* header: true if block header must be written */
     bi_windup(s);        /* align on byte boundary */
 
     if (header) {
diff --git a/zutil.c b/zutil.c
index ec2050b3e26136bcd2a5f6b51af95fb2b6f4f824..afad9804af4e6d69659919b64cdadb4caabd4b4d 100644 (file)
--- a/zutil.c
+++ b/zutil.c
@@ -120,19 +120,14 @@ const char * ZEXPORT zError(err)
 
 #ifndef MY_ZCALLOC /* Any system without a special alloc function */
 
-voidp ZLIB_INTERNAL zcalloc (opaque, items, size)
-    voidp opaque;
-    unsigned items;
-    unsigned size;
+voidp ZLIB_INTERNAL zcalloc (voidp opaque, unsigned items, unsigned size)
 {
     if (opaque) items += size - size; /* make compiler happy */
     return sizeof(uInt) > 2 ? (voidp)malloc(items * size) :
                               (voidp)calloc(items, size);
 }
 
-void ZLIB_INTERNAL zcfree (opaque, ptr)
-    voidp opaque;
-    voidp ptr;
+void ZLIB_INTERNAL zcfree (voidp opaque, voidp ptr)
 {
     free(ptr);
     if (opaque) return; /* make compiler happy */