Commit 002d6a94 authored by Alexandre Julliard's avatar Alexandre Julliard

zlib: Run source files through zlib2ansi to avoid K&R function definitions.

parent 36203f1b
...@@ -60,10 +60,10 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); ...@@ -60,10 +60,10 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
#endif #endif
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT adler32_z(adler, buf, len) uLong ZEXPORT adler32_z(
uLong adler; uLong adler,
const Bytef *buf; const Bytef *buf,
z_size_t len; z_size_t len)
{ {
unsigned long sum2; unsigned long sum2;
unsigned n; unsigned n;
...@@ -131,19 +131,19 @@ uLong ZEXPORT adler32_z(adler, buf, len) ...@@ -131,19 +131,19 @@ uLong ZEXPORT adler32_z(adler, buf, len)
} }
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT adler32(adler, buf, len) uLong ZEXPORT adler32(
uLong adler; uLong adler,
const Bytef *buf; const Bytef *buf,
uInt len; uInt len)
{ {
return adler32_z(adler, buf, len); return adler32_z(adler, buf, len);
} }
/* ========================================================================= */ /* ========================================================================= */
local uLong adler32_combine_(adler1, adler2, len2) local uLong adler32_combine_(
uLong adler1; uLong adler1,
uLong adler2; uLong adler2,
z_off64_t len2; z_off64_t len2)
{ {
unsigned long sum1; unsigned long sum1;
unsigned long sum2; unsigned long sum2;
...@@ -169,18 +169,18 @@ local uLong adler32_combine_(adler1, adler2, len2) ...@@ -169,18 +169,18 @@ local uLong adler32_combine_(adler1, adler2, len2)
} }
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT adler32_combine(adler1, adler2, len2) uLong ZEXPORT adler32_combine(
uLong adler1; uLong adler1,
uLong adler2; uLong adler2,
z_off_t len2; z_off_t len2)
{ {
return adler32_combine_(adler1, adler2, len2); return adler32_combine_(adler1, adler2, len2);
} }
uLong ZEXPORT adler32_combine64(adler1, adler2, len2) uLong ZEXPORT adler32_combine64(
uLong adler1; uLong adler1,
uLong adler2; uLong adler2,
z_off64_t len2; z_off64_t len2)
{ {
return adler32_combine_(adler1, adler2, len2); return adler32_combine_(adler1, adler2, len2);
} }
...@@ -123,8 +123,8 @@ local z_crc_t x2nmodp OF((z_off64_t n, unsigned k)); ...@@ -123,8 +123,8 @@ local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
instruction, if one is available. This assumes that word_t is either 32 bits instruction, if one is available. This assumes that word_t is either 32 bits
or 64 bits. or 64 bits.
*/ */
local z_word_t byte_swap(word) local z_word_t byte_swap(
z_word_t word; z_word_t word)
{ {
# if W == 8 # if W == 8
return return
...@@ -223,8 +223,8 @@ struct once_s { ...@@ -223,8 +223,8 @@ struct once_s {
/* Test and set. Alas, not atomic, but tries to minimize the period of /* Test and set. Alas, not atomic, but tries to minimize the period of
vulnerability. */ vulnerability. */
local int test_and_set OF((int volatile *)); local int test_and_set OF((int volatile *));
local int test_and_set(flag) local int test_and_set(
int volatile *flag; int volatile *flag)
{ {
int was; int was;
...@@ -447,10 +447,10 @@ local void make_crc_table() ...@@ -447,10 +447,10 @@ local void make_crc_table()
Write the 32-bit values in table[0..k-1] to out, five per line in Write the 32-bit values in table[0..k-1] to out, five per line in
hexadecimal separated by commas. hexadecimal separated by commas.
*/ */
local void write_table(out, table, k) local void write_table(
FILE *out; FILE *out,
const z_crc_t FAR *table; const z_crc_t FAR *table,
int k; int k)
{ {
int n; int n;
...@@ -464,10 +464,10 @@ local void write_table(out, table, k) ...@@ -464,10 +464,10 @@ local void write_table(out, table, k)
Write the high 32-bits of each value in table[0..k-1] to out, five per line Write the high 32-bits of each value in table[0..k-1] to out, five per line
in hexadecimal separated by commas. in hexadecimal separated by commas.
*/ */
local void write_table32hi(out, table, k) local void write_table32hi(
FILE *out; FILE *out,
const z_word_t FAR *table; const z_word_t FAR *table,
int k; int k)
{ {
int n; int n;
...@@ -484,10 +484,10 @@ int k; ...@@ -484,10 +484,10 @@ int k;
bits. If not, then the type cast and format string can be adjusted bits. If not, then the type cast and format string can be adjusted
accordingly. accordingly.
*/ */
local void write_table64(out, table, k) local void write_table64(
FILE *out; FILE *out,
const z_word_t FAR *table; const z_word_t FAR *table,
int k; int k)
{ {
int n; int n;
...@@ -548,9 +548,9 @@ local void braid(ltl, big, n, w) ...@@ -548,9 +548,9 @@ local void braid(ltl, big, n, w)
Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial, Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial,
reflected. For speed, this requires that a not be zero. reflected. For speed, this requires that a not be zero.
*/ */
local z_crc_t multmodp(a, b) local z_crc_t multmodp(
z_crc_t a; z_crc_t a,
z_crc_t b; z_crc_t b)
{ {
z_crc_t m, p; z_crc_t m, p;
...@@ -572,9 +572,9 @@ local z_crc_t multmodp(a, b) ...@@ -572,9 +572,9 @@ local z_crc_t multmodp(a, b)
Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been
initialized. initialized.
*/ */
local z_crc_t x2nmodp(n, k) local z_crc_t x2nmodp(
z_off64_t n; z_off64_t n,
unsigned k; unsigned k)
{ {
z_crc_t p; z_crc_t p;
...@@ -619,10 +619,10 @@ const z_crc_t FAR * ZEXPORT get_crc_table() ...@@ -619,10 +619,10 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
#define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */ #define Z_BATCH_ZEROS 0xa10d3d0c /* computed from Z_BATCH = 3990 */
#define Z_BATCH_MIN 800 /* fewest words in a final batch */ #define Z_BATCH_MIN 800 /* fewest words in a final batch */
unsigned long ZEXPORT crc32_z(crc, buf, len) unsigned long ZEXPORT crc32_z(
unsigned long crc; unsigned long crc,
const unsigned char FAR *buf; const unsigned char FAR *buf,
z_size_t len; z_size_t len)
{ {
z_crc_t val; z_crc_t val;
z_word_t crc1, crc2; z_word_t crc1, crc2;
...@@ -723,8 +723,8 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) ...@@ -723,8 +723,8 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
least-significant byte of the word as the first byte of data, without any pre least-significant byte of the word as the first byte of data, without any pre
or post conditioning. This is used to combine the CRCs of each braid. or post conditioning. This is used to combine the CRCs of each braid.
*/ */
local z_crc_t crc_word(data) local z_crc_t crc_word(
z_word_t data; z_word_t data)
{ {
int k; int k;
for (k = 0; k < W; k++) for (k = 0; k < W; k++)
...@@ -732,8 +732,8 @@ local z_crc_t crc_word(data) ...@@ -732,8 +732,8 @@ local z_crc_t crc_word(data)
return (z_crc_t)data; return (z_crc_t)data;
} }
local z_word_t crc_word_big(data) local z_word_t crc_word_big(
z_word_t data; z_word_t data)
{ {
int k; int k;
for (k = 0; k < W; k++) for (k = 0; k < W; k++)
...@@ -745,10 +745,10 @@ local z_word_t crc_word_big(data) ...@@ -745,10 +745,10 @@ local z_word_t crc_word_big(data)
#endif #endif
/* ========================================================================= */ /* ========================================================================= */
unsigned long ZEXPORT crc32_z(crc, buf, len) unsigned long ZEXPORT crc32_z(
unsigned long crc; unsigned long crc,
const unsigned char FAR *buf; const unsigned char FAR *buf,
z_size_t len; z_size_t len)
{ {
/* Return initial CRC, if requested. */ /* Return initial CRC, if requested. */
if (buf == Z_NULL) return 0; if (buf == Z_NULL) return 0;
...@@ -1069,19 +1069,19 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) ...@@ -1069,19 +1069,19 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
#endif #endif
/* ========================================================================= */ /* ========================================================================= */
unsigned long ZEXPORT crc32(crc, buf, len) unsigned long ZEXPORT crc32(
unsigned long crc; unsigned long crc,
const unsigned char FAR *buf; const unsigned char FAR *buf,
uInt len; uInt len)
{ {
return crc32_z(crc, buf, len); return crc32_z(crc, buf, len);
} }
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT crc32_combine64(crc1, crc2, len2) uLong ZEXPORT crc32_combine64(
uLong crc1; uLong crc1,
uLong crc2; uLong crc2,
z_off64_t len2; z_off64_t len2)
{ {
#ifdef DYNAMIC_CRC_TABLE #ifdef DYNAMIC_CRC_TABLE
once(&made, make_crc_table); once(&made, make_crc_table);
...@@ -1090,17 +1090,17 @@ uLong ZEXPORT crc32_combine64(crc1, crc2, len2) ...@@ -1090,17 +1090,17 @@ uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
} }
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT crc32_combine(crc1, crc2, len2) uLong ZEXPORT crc32_combine(
uLong crc1; uLong crc1,
uLong crc2; uLong crc2,
z_off_t len2; z_off_t len2)
{ {
return crc32_combine64(crc1, crc2, (z_off64_t)len2); return crc32_combine64(crc1, crc2, (z_off64_t)len2);
} }
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT crc32_combine_gen64(len2) uLong ZEXPORT crc32_combine_gen64(
z_off64_t len2; z_off64_t len2)
{ {
#ifdef DYNAMIC_CRC_TABLE #ifdef DYNAMIC_CRC_TABLE
once(&made, make_crc_table); once(&made, make_crc_table);
...@@ -1109,17 +1109,17 @@ uLong ZEXPORT crc32_combine_gen64(len2) ...@@ -1109,17 +1109,17 @@ uLong ZEXPORT crc32_combine_gen64(len2)
} }
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT crc32_combine_gen(len2) uLong ZEXPORT crc32_combine_gen(
z_off_t len2; z_off_t len2)
{ {
return crc32_combine_gen64((z_off64_t)len2); return crc32_combine_gen64((z_off64_t)len2);
} }
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT crc32_combine_op(crc1, crc2, op) uLong ZEXPORT crc32_combine_op(
uLong crc1; uLong crc1,
uLong crc2; uLong crc2,
uLong op; uLong op)
{ {
return multmodp(op, crc1) ^ (crc2 & 0xffffffff); return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
} }
...@@ -195,8 +195,8 @@ local const config configuration_table[10] = { ...@@ -195,8 +195,8 @@ local const config configuration_table[10] = {
* bit values at the expense of memory usage). We slide even when level == 0 to * bit values at the expense of memory usage). We slide even when level == 0 to
* keep the hash table consistent if we switch back to level > 0 later. * keep the hash table consistent if we switch back to level > 0 later.
*/ */
local void slide_hash(s) local void slide_hash(
deflate_state *s; deflate_state *s)
{ {
unsigned n, m; unsigned n, m;
Posf *p; Posf *p;
...@@ -222,11 +222,11 @@ local void slide_hash(s) ...@@ -222,11 +222,11 @@ local void slide_hash(s)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateInit_(strm, level, version, stream_size) int ZEXPORT deflateInit_(
z_streamp strm; z_streamp strm,
int level; int level,
const char *version; const char *version,
int stream_size; int stream_size)
{ {
return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
Z_DEFAULT_STRATEGY, version, stream_size); Z_DEFAULT_STRATEGY, version, stream_size);
...@@ -234,16 +234,15 @@ int ZEXPORT deflateInit_(strm, level, version, stream_size) ...@@ -234,16 +234,15 @@ int ZEXPORT deflateInit_(strm, level, version, stream_size)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, int ZEXPORT deflateInit2_(
version, stream_size) z_streamp strm,
z_streamp strm; int level,
int level; int method,
int method; int windowBits,
int windowBits; int memLevel,
int memLevel; int strategy,
int strategy; const char *version,
const char *version; int stream_size)
int stream_size;
{ {
deflate_state *s; deflate_state *s;
int wrap = 1; int wrap = 1;
...@@ -386,8 +385,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, ...@@ -386,8 +385,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
/* ========================================================================= /* =========================================================================
* Check for a valid deflate stream state. Return 0 if ok, 1 if not. * Check for a valid deflate stream state. Return 0 if ok, 1 if not.
*/ */
local int deflateStateCheck(strm) local int deflateStateCheck(
z_streamp strm; z_streamp strm)
{ {
deflate_state *s; deflate_state *s;
if (strm == Z_NULL || if (strm == Z_NULL ||
...@@ -409,10 +408,10 @@ local int deflateStateCheck(strm) ...@@ -409,10 +408,10 @@ local int deflateStateCheck(strm)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength) int ZEXPORT deflateSetDictionary(
z_streamp strm; z_streamp strm,
const Bytef *dictionary; const Bytef *dictionary,
uInt dictLength; uInt dictLength)
{ {
deflate_state *s; deflate_state *s;
uInt str, n; uInt str, n;
...@@ -478,10 +477,10 @@ int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength) ...@@ -478,10 +477,10 @@ int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength) int ZEXPORT deflateGetDictionary(
z_streamp strm; z_streamp strm,
Bytef *dictionary; Bytef *dictionary,
uInt *dictLength; uInt *dictLength)
{ {
deflate_state *s; deflate_state *s;
uInt len; uInt len;
...@@ -500,8 +499,8 @@ int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength) ...@@ -500,8 +499,8 @@ int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateResetKeep(strm) int ZEXPORT deflateResetKeep(
z_streamp strm; z_streamp strm)
{ {
deflate_state *s; deflate_state *s;
...@@ -538,8 +537,8 @@ int ZEXPORT deflateResetKeep(strm) ...@@ -538,8 +537,8 @@ int ZEXPORT deflateResetKeep(strm)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateReset(strm) int ZEXPORT deflateReset(
z_streamp strm; z_streamp strm)
{ {
int ret; int ret;
...@@ -550,9 +549,9 @@ int ZEXPORT deflateReset(strm) ...@@ -550,9 +549,9 @@ int ZEXPORT deflateReset(strm)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateSetHeader(strm, head) int ZEXPORT deflateSetHeader(
z_streamp strm; z_streamp strm,
gz_headerp head; gz_headerp head)
{ {
if (deflateStateCheck(strm) || strm->state->wrap != 2) if (deflateStateCheck(strm) || strm->state->wrap != 2)
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
...@@ -561,10 +560,10 @@ int ZEXPORT deflateSetHeader(strm, head) ...@@ -561,10 +560,10 @@ int ZEXPORT deflateSetHeader(strm, head)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflatePending(strm, pending, bits) int ZEXPORT deflatePending(
unsigned *pending; z_streamp strm,
int *bits; unsigned *pending,
z_streamp strm; int *bits)
{ {
if (deflateStateCheck(strm)) return Z_STREAM_ERROR; if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
if (pending != Z_NULL) if (pending != Z_NULL)
...@@ -575,10 +574,10 @@ int ZEXPORT deflatePending(strm, pending, bits) ...@@ -575,10 +574,10 @@ int ZEXPORT deflatePending(strm, pending, bits)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflatePrime(strm, bits, value) int ZEXPORT deflatePrime(
z_streamp strm; z_streamp strm,
int bits; int bits,
int value; int value)
{ {
deflate_state *s; deflate_state *s;
int put; int put;
...@@ -602,10 +601,10 @@ int ZEXPORT deflatePrime(strm, bits, value) ...@@ -602,10 +601,10 @@ int ZEXPORT deflatePrime(strm, bits, value)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateParams(strm, level, strategy) int ZEXPORT deflateParams(
z_streamp strm; z_streamp strm,
int level; int level,
int strategy; int strategy)
{ {
deflate_state *s; deflate_state *s;
compress_func func; compress_func func;
...@@ -651,12 +650,12 @@ int ZEXPORT deflateParams(strm, level, strategy) ...@@ -651,12 +650,12 @@ int ZEXPORT deflateParams(strm, level, strategy)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) int ZEXPORT deflateTune(
z_streamp strm; z_streamp strm,
int good_length; int good_length,
int max_lazy; int max_lazy,
int nice_length; int nice_length,
int max_chain; int max_chain)
{ {
deflate_state *s; deflate_state *s;
...@@ -693,9 +692,9 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) ...@@ -693,9 +692,9 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
* *
* Shifts are used to approximate divisions, for speed. * Shifts are used to approximate divisions, for speed.
*/ */
uLong ZEXPORT deflateBound(strm, sourceLen) uLong ZEXPORT deflateBound(
z_streamp strm; z_streamp strm,
uLong sourceLen; uLong sourceLen)
{ {
deflate_state *s; deflate_state *s;
uLong fixedlen, storelen, wraplen; uLong fixedlen, storelen, wraplen;
...@@ -765,9 +764,9 @@ uLong ZEXPORT deflateBound(strm, sourceLen) ...@@ -765,9 +764,9 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
* IN assertion: the stream state is correct and there is enough room in * IN assertion: the stream state is correct and there is enough room in
* pending_buf. * pending_buf.
*/ */
local void putShortMSB(s, b) local void putShortMSB(
deflate_state *s; deflate_state *s,
uInt b; uInt b)
{ {
put_byte(s, (Byte)(b >> 8)); put_byte(s, (Byte)(b >> 8));
put_byte(s, (Byte)(b & 0xff)); put_byte(s, (Byte)(b & 0xff));
...@@ -779,8 +778,8 @@ local void putShortMSB(s, b) ...@@ -779,8 +778,8 @@ local void putShortMSB(s, b)
* applications may wish to modify it to avoid allocating a large * applications may wish to modify it to avoid allocating a large
* strm->next_out buffer and copying into it. (See also read_buf()). * strm->next_out buffer and copying into it. (See also read_buf()).
*/ */
local void flush_pending(strm) local void flush_pending(
z_streamp strm; z_streamp strm)
{ {
unsigned len; unsigned len;
deflate_state *s = strm->state; deflate_state *s = strm->state;
...@@ -812,9 +811,9 @@ local void flush_pending(strm) ...@@ -812,9 +811,9 @@ local void flush_pending(strm)
} while (0) } while (0)
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflate(strm, flush) int ZEXPORT deflate(
z_streamp strm; z_streamp strm,
int flush; int flush)
{ {
int old_flush; /* value of flush param for previous deflate call */ int old_flush; /* value of flush param for previous deflate call */
deflate_state *s; deflate_state *s;
...@@ -1127,8 +1126,8 @@ int ZEXPORT deflate(strm, flush) ...@@ -1127,8 +1126,8 @@ int ZEXPORT deflate(strm, flush)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateEnd(strm) int ZEXPORT deflateEnd(
z_streamp strm; z_streamp strm)
{ {
int status; int status;
...@@ -1153,9 +1152,9 @@ int ZEXPORT deflateEnd(strm) ...@@ -1153,9 +1152,9 @@ int ZEXPORT deflateEnd(strm)
* To simplify the source, this is not supported for 16-bit MSDOS (which * To simplify the source, this is not supported for 16-bit MSDOS (which
* doesn't have enough memory anyway to duplicate compression states). * doesn't have enough memory anyway to duplicate compression states).
*/ */
int ZEXPORT deflateCopy(dest, source) int ZEXPORT deflateCopy(
z_streamp dest; z_streamp dest,
z_streamp source; z_streamp source)
{ {
#ifdef MAXSEG_64K #ifdef MAXSEG_64K
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
...@@ -1212,10 +1211,10 @@ int ZEXPORT deflateCopy(dest, source) ...@@ -1212,10 +1211,10 @@ int ZEXPORT deflateCopy(dest, source)
* allocating a large strm->next_in buffer and copying from it. * allocating a large strm->next_in buffer and copying from it.
* (See also flush_pending()). * (See also flush_pending()).
*/ */
local unsigned read_buf(strm, buf, size) local unsigned read_buf(
z_streamp strm; z_streamp strm,
Bytef *buf; Bytef *buf,
unsigned size; unsigned size)
{ {
unsigned len = strm->avail_in; unsigned len = strm->avail_in;
...@@ -1242,8 +1241,8 @@ local unsigned read_buf(strm, buf, size) ...@@ -1242,8 +1241,8 @@ local unsigned read_buf(strm, buf, size)
/* =========================================================================== /* ===========================================================================
* Initialize the "longest match" routines for a new zlib stream * Initialize the "longest match" routines for a new zlib stream
*/ */
local void lm_init(s) local void lm_init(
deflate_state *s; deflate_state *s)
{ {
s->window_size = (ulg)2L*s->w_size; s->window_size = (ulg)2L*s->w_size;
...@@ -1275,9 +1274,9 @@ local void lm_init(s) ...@@ -1275,9 +1274,9 @@ local void lm_init(s)
* string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
* OUT assertion: the match length is not greater than s->lookahead. * OUT assertion: the match length is not greater than s->lookahead.
*/ */
local uInt longest_match(s, cur_match) local uInt longest_match(
deflate_state *s; deflate_state *s,
IPos cur_match; /* current match */ IPos cur_match)
{ {
unsigned chain_length = s->max_chain_length;/* max hash chain length */ unsigned chain_length = s->max_chain_length;/* max hash chain length */
register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *scan = s->window + s->strstart; /* current string */
...@@ -1426,9 +1425,9 @@ local uInt longest_match(s, cur_match) ...@@ -1426,9 +1425,9 @@ local uInt longest_match(s, cur_match)
/* --------------------------------------------------------------------------- /* ---------------------------------------------------------------------------
* Optimized version for FASTEST only * Optimized version for FASTEST only
*/ */
local uInt longest_match(s, cur_match) local uInt longest_match(
deflate_state *s; deflate_state *s,
IPos cur_match; /* current match */ IPos cur_match)
{ {
register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *scan = s->window + s->strstart; /* current string */
register Bytef *match; /* matched string */ register Bytef *match; /* matched string */
...@@ -1490,10 +1489,11 @@ local uInt longest_match(s, cur_match) ...@@ -1490,10 +1489,11 @@ local uInt longest_match(s, cur_match)
/* =========================================================================== /* ===========================================================================
* Check that the match at match_start is indeed a match. * Check that the match at match_start is indeed a match.
*/ */
local void check_match(s, start, match, length) local void check_match(
deflate_state *s; deflate_state *s,
IPos start, match; IPos start,
int length; IPos match,
int length)
{ {
/* check that the match is indeed a match */ /* check that the match is indeed a match */
if (zmemcmp(s->window + match, if (zmemcmp(s->window + match,
...@@ -1524,8 +1524,8 @@ local void check_match(s, start, match, length) ...@@ -1524,8 +1524,8 @@ local void check_match(s, start, match, length)
* performed for at least two bytes (required for the zip translate_eol * performed for at least two bytes (required for the zip translate_eol
* option -- not supported here). * option -- not supported here).
*/ */
local void fill_window(s) local void fill_window(
deflate_state *s; deflate_state *s)
{ {
unsigned n; unsigned n;
unsigned more; /* Amount of free space at the end of the window. */ unsigned more; /* Amount of free space at the end of the window. */
...@@ -1687,9 +1687,9 @@ local void fill_window(s) ...@@ -1687,9 +1687,9 @@ local void fill_window(s)
* copied. It is most efficient with large input and output buffers, which * copied. It is most efficient with large input and output buffers, which
* maximizes the opportunities to have a single copy from next_in to next_out. * maximizes the opportunities to have a single copy from next_in to next_out.
*/ */
local block_state deflate_stored(s, flush) local block_state deflate_stored(
deflate_state *s; deflate_state *s,
int flush; int flush)
{ {
/* Smallest worthy block size when not flushing or finishing. By default /* Smallest worthy block size when not flushing or finishing. By default
* this is 32K. This can be as small as 507 bytes for memLevel == 1. For * this is 32K. This can be as small as 507 bytes for memLevel == 1. For
...@@ -1874,9 +1874,9 @@ local block_state deflate_stored(s, flush) ...@@ -1874,9 +1874,9 @@ local block_state deflate_stored(s, flush)
* new strings in the dictionary only for unmatched strings or for short * new strings in the dictionary only for unmatched strings or for short
* matches. It is used only for the fast compression options. * matches. It is used only for the fast compression options.
*/ */
local block_state deflate_fast(s, flush) local block_state deflate_fast(
deflate_state *s; deflate_state *s,
int flush; int flush)
{ {
IPos hash_head; /* head of the hash chain */ IPos hash_head; /* head of the hash chain */
int bflush; /* set if current block must be flushed */ int bflush; /* set if current block must be flushed */
...@@ -1976,9 +1976,9 @@ local block_state deflate_fast(s, flush) ...@@ -1976,9 +1976,9 @@ local block_state deflate_fast(s, flush)
* evaluation for matches: a match is finally adopted only if there is * evaluation for matches: a match is finally adopted only if there is
* no better match at the next window position. * no better match at the next window position.
*/ */
local block_state deflate_slow(s, flush) local block_state deflate_slow(
deflate_state *s; deflate_state *s,
int flush; int flush)
{ {
IPos hash_head; /* head of hash chain */ IPos hash_head; /* head of hash chain */
int bflush; /* set if current block must be flushed */ int bflush; /* set if current block must be flushed */
...@@ -2107,9 +2107,9 @@ local block_state deflate_slow(s, flush) ...@@ -2107,9 +2107,9 @@ local block_state deflate_slow(s, flush)
* one. Do not maintain a hash table. (It will be regenerated if this run of * one. Do not maintain a hash table. (It will be regenerated if this run of
* deflate switches away from Z_RLE.) * deflate switches away from Z_RLE.)
*/ */
local block_state deflate_rle(s, flush) local block_state deflate_rle(
deflate_state *s; deflate_state *s,
int flush; int flush)
{ {
int bflush; /* set if current block must be flushed */ int bflush; /* set if current block must be flushed */
uInt prev; /* byte at distance one to match */ uInt prev; /* byte at distance one to match */
...@@ -2181,9 +2181,9 @@ local block_state deflate_rle(s, flush) ...@@ -2181,9 +2181,9 @@ local block_state deflate_rle(s, flush)
* For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. * 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.) * (It will be regenerated if this run of deflate switches away from Huffman.)
*/ */
local block_state deflate_huff(s, flush) local block_state deflate_huff(
deflate_state *s; deflate_state *s,
int flush; int flush)
{ {
int bflush; /* set if current block must be flushed */ int bflush; /* set if current block must be flushed */
......
...@@ -47,9 +47,9 @@ ...@@ -47,9 +47,9 @@
requires strm->avail_out >= 258 for each loop to avoid checking for requires strm->avail_out >= 258 for each loop to avoid checking for
output space. output space.
*/ */
void ZLIB_INTERNAL inflate_fast(strm, start) void ZLIB_INTERNAL inflate_fast(
z_streamp strm; z_streamp strm,
unsigned start; /* inflate()'s starting value for strm->avail_out */ unsigned start)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
z_const unsigned char FAR *in; /* local strm->next_in */ z_const unsigned char FAR *in; /* local strm->next_in */
......
...@@ -102,8 +102,8 @@ local int updatewindow OF((z_streamp strm, const unsigned char FAR *end, ...@@ -102,8 +102,8 @@ local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf, local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
unsigned len)); unsigned len));
local int inflateStateCheck(strm) local int inflateStateCheck(
z_streamp strm; z_streamp strm)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
if (strm == Z_NULL || if (strm == Z_NULL ||
...@@ -116,8 +116,8 @@ z_streamp strm; ...@@ -116,8 +116,8 @@ z_streamp strm;
return 0; return 0;
} }
int ZEXPORT inflateResetKeep(strm) int ZEXPORT inflateResetKeep(
z_streamp strm; z_streamp strm)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
...@@ -142,8 +142,8 @@ z_streamp strm; ...@@ -142,8 +142,8 @@ z_streamp strm;
return Z_OK; return Z_OK;
} }
int ZEXPORT inflateReset(strm) int ZEXPORT inflateReset(
z_streamp strm; z_streamp strm)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
...@@ -155,9 +155,9 @@ z_streamp strm; ...@@ -155,9 +155,9 @@ z_streamp strm;
return inflateResetKeep(strm); return inflateResetKeep(strm);
} }
int ZEXPORT inflateReset2(strm, windowBits) int ZEXPORT inflateReset2(
z_streamp strm; z_streamp strm,
int windowBits; int windowBits)
{ {
int wrap; int wrap;
struct inflate_state FAR *state; struct inflate_state FAR *state;
...@@ -195,11 +195,11 @@ int windowBits; ...@@ -195,11 +195,11 @@ int windowBits;
return inflateReset(strm); return inflateReset(strm);
} }
int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) int ZEXPORT inflateInit2_(
z_streamp strm; z_streamp strm,
int windowBits; int windowBits,
const char *version; const char *version,
int stream_size; int stream_size)
{ {
int ret; int ret;
struct inflate_state FAR *state; struct inflate_state FAR *state;
...@@ -239,18 +239,18 @@ int stream_size; ...@@ -239,18 +239,18 @@ int stream_size;
return ret; return ret;
} }
int ZEXPORT inflateInit_(strm, version, stream_size) int ZEXPORT inflateInit_(
z_streamp strm; z_streamp strm,
const char *version; const char *version,
int stream_size; int stream_size)
{ {
return inflateInit2_(strm, DEF_WBITS, version, stream_size); return inflateInit2_(strm, DEF_WBITS, version, stream_size);
} }
int ZEXPORT inflatePrime(strm, bits, value) int ZEXPORT inflatePrime(
z_streamp strm; z_streamp strm,
int bits; int bits,
int value; int value)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
...@@ -278,8 +278,8 @@ int value; ...@@ -278,8 +278,8 @@ int value;
used for threaded applications, since the rewriting of the tables and virgin used for threaded applications, since the rewriting of the tables and virgin
may not be thread-safe. may not be thread-safe.
*/ */
local void fixedtables(state) local void fixedtables(
struct inflate_state FAR *state; struct inflate_state FAR *state)
{ {
#ifdef BUILDFIXED #ifdef BUILDFIXED
static int virgin = 1; static int virgin = 1;
...@@ -396,10 +396,10 @@ void makefixed() ...@@ -396,10 +396,10 @@ void makefixed()
output will fall in the output data, making match copies simpler and faster. 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. The advantage may be dependent on the size of the processor's data caches.
*/ */
local int updatewindow(strm, end, copy) local int updatewindow(
z_streamp strm; z_streamp strm,
const Bytef *end; const Bytef *end,
unsigned copy; unsigned copy)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
unsigned dist; unsigned dist;
...@@ -622,9 +622,9 @@ unsigned copy; ...@@ -622,9 +622,9 @@ unsigned copy;
will return Z_BUF_ERROR if it has not reached the end of the stream. will return Z_BUF_ERROR if it has not reached the end of the stream.
*/ */
int ZEXPORT inflate(strm, flush) int ZEXPORT inflate(
z_streamp strm; z_streamp strm,
int flush; int flush)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
z_const unsigned char FAR *next; /* next input */ z_const unsigned char FAR *next; /* next input */
...@@ -1301,8 +1301,8 @@ int flush; ...@@ -1301,8 +1301,8 @@ int flush;
return ret; return ret;
} }
int ZEXPORT inflateEnd(strm) int ZEXPORT inflateEnd(
z_streamp strm; z_streamp strm)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
if (inflateStateCheck(strm)) if (inflateStateCheck(strm))
...@@ -1315,10 +1315,10 @@ z_streamp strm; ...@@ -1315,10 +1315,10 @@ z_streamp strm;
return Z_OK; return Z_OK;
} }
int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength) int ZEXPORT inflateGetDictionary(
z_streamp strm; z_streamp strm,
Bytef *dictionary; Bytef *dictionary,
uInt *dictLength; uInt *dictLength)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
...@@ -1338,10 +1338,10 @@ uInt *dictLength; ...@@ -1338,10 +1338,10 @@ uInt *dictLength;
return Z_OK; return Z_OK;
} }
int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) int ZEXPORT inflateSetDictionary(
z_streamp strm; z_streamp strm,
const Bytef *dictionary; const Bytef *dictionary,
uInt dictLength; uInt dictLength)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
unsigned long dictid; unsigned long dictid;
...@@ -1373,9 +1373,9 @@ uInt dictLength; ...@@ -1373,9 +1373,9 @@ uInt dictLength;
return Z_OK; return Z_OK;
} }
int ZEXPORT inflateGetHeader(strm, head) int ZEXPORT inflateGetHeader(
z_streamp strm; z_streamp strm,
gz_headerp head; gz_headerp head)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
...@@ -1401,10 +1401,10 @@ gz_headerp head; ...@@ -1401,10 +1401,10 @@ gz_headerp head;
called again with more data and the *have state. *have is initialized to called again with more data and the *have state. *have is initialized to
zero for the first call. zero for the first call.
*/ */
local unsigned syncsearch(have, buf, len) local unsigned syncsearch(
unsigned FAR *have; unsigned FAR *have,
const unsigned char FAR *buf; const unsigned char FAR *buf,
unsigned len; unsigned len)
{ {
unsigned got; unsigned got;
unsigned next; unsigned next;
...@@ -1424,8 +1424,8 @@ unsigned len; ...@@ -1424,8 +1424,8 @@ unsigned len;
return next; return next;
} }
int ZEXPORT inflateSync(strm) int ZEXPORT inflateSync(
z_streamp strm; z_streamp strm)
{ {
unsigned len; /* number of bytes to look at or looked at */ unsigned len; /* number of bytes to look at or looked at */
int flags; /* temporary to save header status */ int flags; /* temporary to save header status */
...@@ -1482,8 +1482,8 @@ z_streamp strm; ...@@ -1482,8 +1482,8 @@ z_streamp strm;
block. When decompressing, PPP checks that at the end of input packet, block. When decompressing, PPP checks that at the end of input packet,
inflate is waiting for these length bytes. inflate is waiting for these length bytes.
*/ */
int ZEXPORT inflateSyncPoint(strm) int ZEXPORT inflateSyncPoint(
z_streamp strm; z_streamp strm)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
...@@ -1492,9 +1492,9 @@ z_streamp strm; ...@@ -1492,9 +1492,9 @@ z_streamp strm;
return state->mode == STORED && state->bits == 0; return state->mode == STORED && state->bits == 0;
} }
int ZEXPORT inflateCopy(dest, source) int ZEXPORT inflateCopy(
z_streamp dest; z_streamp dest,
z_streamp source; z_streamp source)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
struct inflate_state FAR *copy; struct inflate_state FAR *copy;
...@@ -1539,9 +1539,9 @@ z_streamp source; ...@@ -1539,9 +1539,9 @@ z_streamp source;
return Z_OK; return Z_OK;
} }
int ZEXPORT inflateUndermine(strm, subvert) int ZEXPORT inflateUndermine(
z_streamp strm; z_streamp strm,
int subvert; int subvert)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
...@@ -1557,9 +1557,9 @@ int subvert; ...@@ -1557,9 +1557,9 @@ int subvert;
#endif #endif
} }
int ZEXPORT inflateValidate(strm, check) int ZEXPORT inflateValidate(
z_streamp strm; z_streamp strm,
int check; int check)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
...@@ -1572,8 +1572,8 @@ int check; ...@@ -1572,8 +1572,8 @@ int check;
return Z_OK; return Z_OK;
} }
long ZEXPORT inflateMark(strm) long ZEXPORT inflateMark(
z_streamp strm; z_streamp strm)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
...@@ -1585,8 +1585,8 @@ z_streamp strm; ...@@ -1585,8 +1585,8 @@ z_streamp strm;
(state->mode == MATCH ? state->was - state->length : 0)); (state->mode == MATCH ? state->was - state->length : 0));
} }
unsigned long ZEXPORT inflateCodesUsed(strm) unsigned long ZEXPORT inflateCodesUsed(
z_streamp strm; z_streamp strm)
{ {
struct inflate_state FAR *state; struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return (unsigned long)-1; if (inflateStateCheck(strm)) return (unsigned long)-1;
......
...@@ -29,13 +29,13 @@ const char inflate_copyright[] = ...@@ -29,13 +29,13 @@ const char inflate_copyright[] =
table index bits. It will differ if the request is greater than the table index bits. It will differ if the request is greater than the
longest code or if it is less than the shortest code. longest code or if it is less than the shortest code.
*/ */
int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work) int ZLIB_INTERNAL inflate_table(
codetype type; codetype type,
unsigned short FAR *lens; unsigned short FAR *lens,
unsigned codes; unsigned codes,
code FAR * FAR *table; code FAR * FAR *table,
unsigned FAR *bits; unsigned FAR *bits,
unsigned short FAR *work; unsigned short FAR *work)
{ {
unsigned len; /* a code's length in bits */ unsigned len; /* a code's length in bits */
unsigned sym; /* index of code symbols */ unsigned sym; /* index of code symbols */
......
...@@ -183,10 +183,10 @@ local void gen_trees_header OF((void)); ...@@ -183,10 +183,10 @@ local void gen_trees_header OF((void));
#ifdef ZLIB_DEBUG #ifdef ZLIB_DEBUG
local void send_bits OF((deflate_state *s, int value, int length)); local void send_bits OF((deflate_state *s, int value, int length));
local void send_bits(s, value, length) local void send_bits(
deflate_state *s; deflate_state *s,
int value; /* value to send */ int value,
int length; /* number of bits */ int length)
{ {
Tracevv((stderr," l %2d v %4x ", length, value)); Tracevv((stderr," l %2d v %4x ", length, value));
Assert(length > 0 && length <= 15, "invalid length"); Assert(length > 0 && length <= 15, "invalid length");
...@@ -376,8 +376,8 @@ void gen_trees_header() ...@@ -376,8 +376,8 @@ void gen_trees_header()
/* =========================================================================== /* ===========================================================================
* Initialize the tree data structures for a new zlib stream. * Initialize the tree data structures for a new zlib stream.
*/ */
void ZLIB_INTERNAL _tr_init(s) void ZLIB_INTERNAL _tr_init(
deflate_state *s; deflate_state *s)
{ {
tr_static_init(); tr_static_init();
...@@ -404,8 +404,8 @@ void ZLIB_INTERNAL _tr_init(s) ...@@ -404,8 +404,8 @@ void ZLIB_INTERNAL _tr_init(s)
/* =========================================================================== /* ===========================================================================
* Initialize a new block. * Initialize a new block.
*/ */
local void init_block(s) local void init_block(
deflate_state *s; deflate_state *s)
{ {
int n; /* iterates over tree elements */ int n; /* iterates over tree elements */
...@@ -448,10 +448,10 @@ local void init_block(s) ...@@ -448,10 +448,10 @@ local void init_block(s)
* when the heap property is re-established (each father smaller than its * when the heap property is re-established (each father smaller than its
* two sons). * two sons).
*/ */
local void pqdownheap(s, tree, k) local void pqdownheap(
deflate_state *s; deflate_state *s,
ct_data *tree; /* the tree to restore */ ct_data *tree,
int k; /* node to move down */ int k)
{ {
int v = s->heap[k]; int v = s->heap[k];
int j = k << 1; /* left son of k */ int j = k << 1; /* left son of k */
...@@ -483,9 +483,9 @@ local void pqdownheap(s, tree, k) ...@@ -483,9 +483,9 @@ local void pqdownheap(s, tree, k)
* The length opt_len is updated; static_len is also updated if stree is * The length opt_len is updated; static_len is also updated if stree is
* not null. * not null.
*/ */
local void gen_bitlen(s, desc) local void gen_bitlen(
deflate_state *s; deflate_state *s,
tree_desc *desc; /* the tree descriptor */ tree_desc *desc)
{ {
ct_data *tree = desc->dyn_tree; ct_data *tree = desc->dyn_tree;
int max_code = desc->max_code; int max_code = desc->max_code;
...@@ -569,10 +569,10 @@ local void gen_bitlen(s, desc) ...@@ -569,10 +569,10 @@ local void gen_bitlen(s, desc)
* OUT assertion: the field code is set for all tree elements of non * OUT assertion: the field code is set for all tree elements of non
* zero code length. * zero code length.
*/ */
local void gen_codes(tree, max_code, bl_count) local void gen_codes(
ct_data *tree; /* the tree to decorate */ ct_data *tree,
int max_code; /* largest code with non zero frequency */ int max_code,
ushf *bl_count; /* number of codes at each bit length */ ushf *bl_count)
{ {
ush next_code[MAX_BITS+1]; /* next code value for each bit length */ ush next_code[MAX_BITS+1]; /* next code value for each bit length */
unsigned code = 0; /* running code value */ unsigned code = 0; /* running code value */
...@@ -612,9 +612,9 @@ local void gen_codes(tree, max_code, bl_count) ...@@ -612,9 +612,9 @@ local void gen_codes(tree, max_code, bl_count)
* and corresponding code. The length opt_len is updated; static_len is * 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. * also updated if stree is not null. The field max_code is set.
*/ */
local void build_tree(s, desc) local void build_tree(
deflate_state *s; deflate_state *s,
tree_desc *desc; /* the tree descriptor */ tree_desc *desc)
{ {
ct_data *tree = desc->dyn_tree; ct_data *tree = desc->dyn_tree;
const ct_data *stree = desc->stat_desc->static_tree; const ct_data *stree = desc->stat_desc->static_tree;
...@@ -700,10 +700,10 @@ local void build_tree(s, desc) ...@@ -700,10 +700,10 @@ local void build_tree(s, desc)
* Scan a literal or distance tree to determine the frequencies of the codes * Scan a literal or distance tree to determine the frequencies of the codes
* in the bit length tree. * in the bit length tree.
*/ */
local void scan_tree(s, tree, max_code) local void scan_tree(
deflate_state *s; deflate_state *s,
ct_data *tree; /* the tree to be scanned */ ct_data *tree,
int max_code; /* and its largest code of non zero frequency */ int max_code)
{ {
int n; /* iterates over all tree elements */ int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */ int prevlen = -1; /* last emitted length */
...@@ -745,10 +745,10 @@ local void scan_tree(s, tree, max_code) ...@@ -745,10 +745,10 @@ local void scan_tree(s, tree, max_code)
* Send a literal or distance tree in compressed form, using the codes in * Send a literal or distance tree in compressed form, using the codes in
* bl_tree. * bl_tree.
*/ */
local void send_tree(s, tree, max_code) local void send_tree(
deflate_state *s; deflate_state *s,
ct_data *tree; /* the tree to be scanned */ ct_data *tree,
int max_code; /* and its largest code of non zero frequency */ int max_code)
{ {
int n; /* iterates over all tree elements */ int n; /* iterates over all tree elements */
int prevlen = -1; /* last emitted length */ int prevlen = -1; /* last emitted length */
...@@ -796,8 +796,8 @@ local void send_tree(s, tree, max_code) ...@@ -796,8 +796,8 @@ local void send_tree(s, tree, max_code)
* Construct the Huffman tree for the bit lengths and return the index in * Construct the Huffman tree for the bit lengths and return the index in
* bl_order of the last bit length code to send. * bl_order of the last bit length code to send.
*/ */
local int build_bl_tree(s) local int build_bl_tree(
deflate_state *s; deflate_state *s)
{ {
int max_blindex; /* index of last bit length code of non zero freq */ int max_blindex; /* index of last bit length code of non zero freq */
...@@ -831,9 +831,11 @@ local int build_bl_tree(s) ...@@ -831,9 +831,11 @@ local int build_bl_tree(s)
* lengths of the bit length codes, the literal tree and the distance tree. * lengths of the bit length codes, the literal tree and the distance tree.
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
*/ */
local void send_all_trees(s, lcodes, dcodes, blcodes) local void send_all_trees(
deflate_state *s; deflate_state *s,
int lcodes, dcodes, blcodes; /* number of codes for each tree */ int lcodes,
int dcodes,
int blcodes)
{ {
int rank; /* index in bl_order */ int rank; /* index in bl_order */
...@@ -860,11 +862,11 @@ local void send_all_trees(s, lcodes, dcodes, blcodes) ...@@ -860,11 +862,11 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
/* =========================================================================== /* ===========================================================================
* Send a stored block * Send a stored block
*/ */
void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) void ZLIB_INTERNAL _tr_stored_block(
deflate_state *s; deflate_state *s,
charf *buf; /* input block */ charf *buf,
ulg stored_len; /* length of input block */ ulg stored_len,
int last; /* one if this is the last block for a file */ int last)
{ {
send_bits(s, (STORED_BLOCK<<1) + last, 3); /* send block type */ send_bits(s, (STORED_BLOCK<<1) + last, 3); /* send block type */
bi_windup(s); /* align on byte boundary */ bi_windup(s); /* align on byte boundary */
...@@ -884,8 +886,8 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) ...@@ -884,8 +886,8 @@ 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) * Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
*/ */
void ZLIB_INTERNAL _tr_flush_bits(s) void ZLIB_INTERNAL _tr_flush_bits(
deflate_state *s; deflate_state *s)
{ {
bi_flush(s); bi_flush(s);
} }
...@@ -894,8 +896,8 @@ void ZLIB_INTERNAL _tr_flush_bits(s) ...@@ -894,8 +896,8 @@ void ZLIB_INTERNAL _tr_flush_bits(s)
* Send one empty static block to give enough lookahead for inflate. * Send one empty static block to give enough lookahead for inflate.
* This takes 10 bits, of which 7 may remain in the bit buffer. * This takes 10 bits, of which 7 may remain in the bit buffer.
*/ */
void ZLIB_INTERNAL _tr_align(s) void ZLIB_INTERNAL _tr_align(
deflate_state *s; deflate_state *s)
{ {
send_bits(s, STATIC_TREES<<1, 3); send_bits(s, STATIC_TREES<<1, 3);
send_code(s, END_BLOCK, static_ltree); send_code(s, END_BLOCK, static_ltree);
...@@ -909,11 +911,11 @@ void ZLIB_INTERNAL _tr_align(s) ...@@ -909,11 +911,11 @@ void ZLIB_INTERNAL _tr_align(s)
* Determine the best encoding for the current block: dynamic trees, static * Determine the best encoding for the current block: dynamic trees, static
* trees or store, and write out the encoded block. * trees or store, and write out the encoded block.
*/ */
void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) void ZLIB_INTERNAL _tr_flush_block(
deflate_state *s; deflate_state *s,
charf *buf; /* input block, or NULL if too old */ charf *buf,
ulg stored_len; /* length of input block */ ulg stored_len,
int last; /* one if this is the last block for a file */ int last)
{ {
ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ 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 */ int max_blindex = 0; /* index of last bit length code of non zero freq */
...@@ -1011,10 +1013,10 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) ...@@ -1011,10 +1013,10 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
* Save the match info and tally the frequency counts. Return true if * Save the match info and tally the frequency counts. Return true if
* the current block must be flushed. * the current block must be flushed.
*/ */
int ZLIB_INTERNAL _tr_tally(s, dist, lc) int ZLIB_INTERNAL _tr_tally(
deflate_state *s; deflate_state *s,
unsigned dist; /* distance of matched string */ unsigned dist,
unsigned lc; /* match length - MIN_MATCH or unmatched char (dist==0) */ unsigned lc)
{ {
s->sym_buf[s->sym_next++] = (uch)dist; s->sym_buf[s->sym_next++] = (uch)dist;
s->sym_buf[s->sym_next++] = (uch)(dist >> 8); s->sym_buf[s->sym_next++] = (uch)(dist >> 8);
...@@ -1039,10 +1041,10 @@ int ZLIB_INTERNAL _tr_tally(s, dist, lc) ...@@ -1039,10 +1041,10 @@ int ZLIB_INTERNAL _tr_tally(s, dist, lc)
/* =========================================================================== /* ===========================================================================
* Send the block data compressed using the given Huffman trees * Send the block data compressed using the given Huffman trees
*/ */
local void compress_block(s, ltree, dtree) local void compress_block(
deflate_state *s; deflate_state *s,
const ct_data *ltree; /* literal tree */ const ct_data *ltree,
const ct_data *dtree; /* distance tree */ const ct_data *dtree)
{ {
unsigned dist; /* distance of matched string */ unsigned dist; /* distance of matched string */
int lc; /* match length or unmatched char (if dist == 0) */ int lc; /* match length or unmatched char (if dist == 0) */
...@@ -1099,8 +1101,8 @@ local void compress_block(s, ltree, dtree) ...@@ -1099,8 +1101,8 @@ local void compress_block(s, ltree, dtree)
* (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
* IN assertion: the fields Freq of dyn_ltree are set. * IN assertion: the fields Freq of dyn_ltree are set.
*/ */
local int detect_data_type(s) local int detect_data_type(
deflate_state *s; deflate_state *s)
{ {
/* block_mask is the bit mask of block-listed bytes /* block_mask is the bit mask of block-listed bytes
* set bits 0..6, 14..25, and 28..31 * set bits 0..6, 14..25, and 28..31
...@@ -1133,9 +1135,9 @@ local int detect_data_type(s) ...@@ -1133,9 +1135,9 @@ local int detect_data_type(s)
* method would use a table) * method would use a table)
* IN assertion: 1 <= len <= 15 * IN assertion: 1 <= len <= 15
*/ */
local unsigned bi_reverse(code, len) local unsigned bi_reverse(
unsigned code; /* the value to invert */ unsigned code,
int len; /* its bit length */ int len)
{ {
register unsigned res = 0; register unsigned res = 0;
do { do {
...@@ -1148,8 +1150,8 @@ local unsigned bi_reverse(code, len) ...@@ -1148,8 +1150,8 @@ local unsigned bi_reverse(code, len)
/* =========================================================================== /* ===========================================================================
* Flush the bit buffer, keeping at most 7 bits in it. * Flush the bit buffer, keeping at most 7 bits in it.
*/ */
local void bi_flush(s) local void bi_flush(
deflate_state *s; deflate_state *s)
{ {
if (s->bi_valid == 16) { if (s->bi_valid == 16) {
put_short(s, s->bi_buf); put_short(s, s->bi_buf);
...@@ -1165,8 +1167,8 @@ local void bi_flush(s) ...@@ -1165,8 +1167,8 @@ local void bi_flush(s)
/* =========================================================================== /* ===========================================================================
* Flush the bit buffer and align the output on a byte boundary * Flush the bit buffer and align the output on a byte boundary
*/ */
local void bi_windup(s) local void bi_windup(
deflate_state *s; deflate_state *s)
{ {
if (s->bi_valid > 8) { if (s->bi_valid > 8) {
put_short(s, s->bi_buf); put_short(s, s->bi_buf);
......
...@@ -121,8 +121,8 @@ uLong ZEXPORT zlibCompileFlags() ...@@ -121,8 +121,8 @@ uLong ZEXPORT zlibCompileFlags()
# endif # endif
int ZLIB_INTERNAL z_verbose = verbose; int ZLIB_INTERNAL z_verbose = verbose;
void ZLIB_INTERNAL z_error(m) void ZLIB_INTERNAL z_error(
char *m; char *m)
{ {
fprintf(stderr, "%s\n", m); fprintf(stderr, "%s\n", m);
exit(1); exit(1);
...@@ -132,8 +132,8 @@ void ZLIB_INTERNAL z_error(m) ...@@ -132,8 +132,8 @@ void ZLIB_INTERNAL z_error(m)
/* exported to allow conversion of error code to string for compress() and /* exported to allow conversion of error code to string for compress() and
* uncompress() * uncompress()
*/ */
const char * ZEXPORT zError(err) const char * ZEXPORT zError(
int err; int err)
{ {
return ERR_MSG(err); return ERR_MSG(err);
} }
...@@ -148,10 +148,10 @@ const char * ZEXPORT zError(err) ...@@ -148,10 +148,10 @@ const char * ZEXPORT zError(err)
#ifndef HAVE_MEMCPY #ifndef HAVE_MEMCPY
void ZLIB_INTERNAL zmemcpy(dest, source, len) void ZLIB_INTERNAL zmemcpy(
Bytef* dest; Bytef* dest,
const Bytef* source; const Bytef* source,
uInt len; uInt len)
{ {
if (len == 0) return; if (len == 0) return;
do { do {
...@@ -159,10 +159,10 @@ void ZLIB_INTERNAL zmemcpy(dest, source, len) ...@@ -159,10 +159,10 @@ void ZLIB_INTERNAL zmemcpy(dest, source, len)
} while (--len != 0); } while (--len != 0);
} }
int ZLIB_INTERNAL zmemcmp(s1, s2, len) int ZLIB_INTERNAL zmemcmp(
const Bytef* s1; const Bytef* s1,
const Bytef* s2; const Bytef* s2,
uInt len; uInt len)
{ {
uInt j; uInt j;
...@@ -172,9 +172,9 @@ int ZLIB_INTERNAL zmemcmp(s1, s2, len) ...@@ -172,9 +172,9 @@ int ZLIB_INTERNAL zmemcmp(s1, s2, len)
return 0; return 0;
} }
void ZLIB_INTERNAL zmemzero(dest, len) void ZLIB_INTERNAL zmemzero(
Bytef* dest; Bytef* dest,
uInt len; uInt len)
{ {
if (len == 0) return; if (len == 0) return;
do { do {
...@@ -304,19 +304,19 @@ extern voidp calloc OF((uInt items, uInt size)); ...@@ -304,19 +304,19 @@ extern voidp calloc OF((uInt items, uInt size));
extern void free OF((voidpf ptr)); extern void free OF((voidpf ptr));
#endif #endif
voidpf ZLIB_INTERNAL zcalloc(opaque, items, size) voidpf ZLIB_INTERNAL zcalloc(
voidpf opaque; voidpf opaque,
unsigned items; unsigned items,
unsigned size; unsigned size)
{ {
(void)opaque; (void)opaque;
return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
(voidpf)calloc(items, size); (voidpf)calloc(items, size);
} }
void ZLIB_INTERNAL zcfree(opaque, ptr) void ZLIB_INTERNAL zcfree(
voidpf opaque; voidpf opaque,
voidpf ptr; voidpf ptr)
{ {
(void)opaque; (void)opaque;
free(ptr); free(ptr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment