bsps/.../motorola_powerpc/bootloader/zlib.c: Fix old-style prototypes

This zlib source is a hacked down version just for the decompression
phase for the bootloader used by this family of BSPs. The proper
fix is to redo the hackery with a new version of zlib. But that
is risky so this is just addressing the warnings.

Updates #5276
This commit is contained in:
Joel Sherrill
2025-06-24 20:22:26 +00:00
committed by Gedare Bloom
parent d4755476bc
commit 28cef0e987
+104 -100
View File
@@ -294,8 +294,8 @@ struct internal_state {
};
int inflateReset(z)
z_stream *z;
int inflateReset(
z_stream *z)
{
uLong c;
@@ -309,8 +309,8 @@ z_stream *z;
return Z_OK;
}
int inflateEnd(z)
z_stream *z;
int inflateEnd(
z_stream *z)
{
uLong c;
@@ -324,9 +324,9 @@ z_stream *z;
return Z_OK;
}
int inflateInit2(z, w)
z_stream *z;
int w;
int inflateInit2(
z_stream *z,
int w)
{
/* initialize state */
if (z == Z_NULL)
@@ -369,8 +369,8 @@ int w;
return Z_OK;
}
int inflateInit(z)
z_stream *z;
int inflateInit(
z_stream *z)
{
return inflateInit2(z, DEF_WBITS);
}
@@ -378,9 +378,9 @@ z_stream *z;
#define NEEDBYTE {if(z->avail_in==0)goto empty;r=Z_OK;}
#define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
int inflate(z, f)
z_stream *z;
int f;
int inflate(
z_stream *z,
int f)
{
int r;
uInt b;
@@ -495,16 +495,16 @@ int f;
* will have been updated if need be.
*/
int inflateIncomp(z)
z_stream *z;
int inflateIncomp(
z_stream *z)
{
if (z->state->mode != BLOCKS)
return Z_DATA_ERROR;
return inflate_addhistory(z->state->blocks, z);
}
int inflateSync(z)
z_stream *z;
int inflateSync(
z_stream *z)
{
uInt n; /* number of bytes to look at */
Bytef *p; /* pointer to bytes */
@@ -724,10 +724,10 @@ local uInt border[] = { /* Order of the bit length code lengths */
the two sets of lengths.
*/
local void inflate_blocks_reset(s, z, c)
inflate_blocks_statef *s;
z_stream *z;
uLongf *c;
local void inflate_blocks_reset(
inflate_blocks_statef *s,
z_stream *z,
uLongf *c)
{
if (s->checkfn != Z_NULL)
*c = s->check;
@@ -748,10 +748,10 @@ uLongf *c;
Trace("inflate: blocks reset\n");
}
local inflate_blocks_statef *inflate_blocks_new(z, c, w)
z_stream *z;
check_func c;
uInt w;
local inflate_blocks_statef *inflate_blocks_new(
z_stream *z,
check_func c,
uInt w)
{
inflate_blocks_statef *s;
@@ -771,10 +771,10 @@ uInt w;
return s;
}
local int inflate_blocks(s, z, r)
inflate_blocks_statef *s;
z_stream *z;
int r;
local int inflate_blocks(
inflate_blocks_statef *s,
z_stream *z,
int r)
{
uInt t; /* temporary storage */
uLong b; /* bit buffer */
@@ -1033,10 +1033,10 @@ int r;
}
}
local int inflate_blocks_free(s, z, c)
inflate_blocks_statef *s;
z_stream *z;
uLongf *c;
local int inflate_blocks_free(
inflate_blocks_statef *s,
z_stream *z,
uLongf *c)
{
inflate_blocks_reset(s, z, c);
ZFREE(z, s->window, s->end - s->window);
@@ -1053,9 +1053,9 @@ uLongf *c;
* BLOCKS). On exit, the output will also be caught up, and the checksum
* will have been updated if need be.
*/
local int inflate_addhistory(s, z)
inflate_blocks_statef *s;
z_stream *z;
local int inflate_addhistory(
inflate_blocks_statef *s,
z_stream *z)
{
uLong b; /* bit buffer */ /* NOT USED HERE */
uInt k; /* bits in bit buffer */ /* NOT USED HERE */
@@ -1102,8 +1102,8 @@ z_stream *z;
* At the end of a Deflate-compressed PPP packet, we expect to have seen
* a `stored' block type value but not the (zero) length bytes.
*/
local int inflate_packet_flush(s)
inflate_blocks_statef *s;
local int inflate_packet_flush(
inflate_blocks_statef *s)
{
if (s->mode != LENS)
return Z_DATA_ERROR;
@@ -1200,15 +1200,15 @@ local uInt cpdext[] = { /* Extra bits for distance codes */
uInt inflate_hufts;
#endif
local int huft_build(b, n, s, d, e, t, m, zs)
uIntf *b; /* code lengths in bits (all assumed <= BMAX) */
uInt n; /* number of codes (assumed <= N_MAX) */
uInt s; /* number of simple-valued codes (0..s-1) */
uIntf *d; /* list of base values for non-simple codes */
uIntf *e; /* list of extra bits for non-simple codes */
inflate_huft * FAR *t; /* result: starting table */
uIntf *m; /* maximum lookup bits, returns actual */
z_stream *zs; /* for zalloc function */
local int huft_build(
uIntf *b, /* code lengths in bits (all assumed <= BMAX) */
uInt n, /* number of codes (assumed <= N_MAX) */
uInt s, /* number of simple-valued codes (0..s-1) */
uIntf *d, /* list of base values for non-simple codes */
uIntf *e, /* list of extra bits for non-simple codes */
inflate_huft * FAR *t, /* result: starting table */
uIntf *m, /* maximum lookup bits, returns actual */
z_stream *zs) /* for zalloc function */
/* Given a list of code lengths and a maximum table size, make a set of
tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR
if the given code set is incomplete (the tables are still built in this
@@ -1395,11 +1395,11 @@ z_stream *zs; /* for zalloc function */
return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK;
}
local int inflate_trees_bits(c, bb, tb, z)
uIntf *c; /* 19 code lengths */
uIntf *bb; /* bits tree desired/actual depth */
inflate_huft * FAR *tb; /* bits tree result */
z_stream *z; /* for zfree function */
local int inflate_trees_bits(
uIntf *c, /* 19 code lengths */
uIntf *bb, /* bits tree desired/actual depth */
inflate_huft * FAR *tb, /* bits tree result */
z_stream *z) /* for zfree function */
{
int r;
@@ -1415,15 +1415,15 @@ z_stream *z; /* for zfree function */
return r;
}
local int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, z)
uInt nl; /* number of literal/length codes */
uInt nd; /* number of distance codes */
uIntf *c; /* that many (total) code lengths */
uIntf *bl; /* literal desired/actual bit depth */
uIntf *bd; /* distance desired/actual bit depth */
inflate_huft * FAR *tl; /* literal/length tree result */
inflate_huft * FAR *td; /* distance tree result */
z_stream *z; /* for zfree function */
local int inflate_trees_dynamic(
uInt nl, /* number of literal/length codes */
uInt nd, /* number of distance codes */
uIntf *c, /* that many (total) code lengths */
uIntf *bl, /* literal desired/actual bit depth */
uIntf *bd, /* distance desired/actual bit depth */
inflate_huft * FAR *tl, /* literal/length tree result */
inflate_huft * FAR *td, /* distance tree result */
z_stream *z) /* for zfree function */
{
int r;
@@ -1475,10 +1475,10 @@ local uInt fixed_bd;
local inflate_huft *fixed_tl;
local inflate_huft *fixed_td;
local voidpf falloc(q, n, s)
voidpf q; /* opaque pointer (not used) */
uInt n; /* number of items */
uInt s; /* size of item */
local voidpf falloc(
voidpf q, /* opaque pointer (not used) */
uInt n, /* number of items */
uInt s) /* size of item */
{
Assert(s == sizeof(inflate_huft) && n <= fixed_left,
"inflate_trees falloc overflow");
@@ -1487,20 +1487,20 @@ uInt s; /* size of item */
return (voidpf)(fixed_mem + fixed_left);
}
local void ffree(q, p, n)
voidpf q;
voidpf p;
uInt n;
local void ffree(
voidpf q,
voidpf p,
uInt n)
{
Assert(0, "inflate_trees ffree called!");
if (q) q = p; /* to make some compilers happy */
}
local int inflate_trees_fixed(bl, bd, tl, td)
uIntf *bl; /* literal desired/actual bit depth */
uIntf *bd; /* distance desired/actual bit depth */
inflate_huft * FAR *tl; /* literal/length tree result */
inflate_huft * FAR *td; /* distance tree result */
local int inflate_trees_fixed(
uIntf *bl, /* literal desired/actual bit depth */
uIntf *bd, /* distance desired/actual bit depth */
inflate_huft * FAR *tl, /* literal/length tree result */
inflate_huft * FAR *td) /* distance tree result */
{
/* build fixed tables if not built already--lock out other instances */
while (++fixed_lock > 1)
@@ -1545,9 +1545,9 @@ inflate_huft * FAR *td; /* distance tree result */
return Z_OK;
}
local int inflate_trees_free(t, z)
inflate_huft *t; /* table to free */
z_stream *z; /* for zfree function */
local int inflate_trees_free(
inflate_huft *t, /* table to free */
z_stream *z) /* for zfree function */
/* Free the malloc'ed tables built by huft_build(), which makes a linked
list of the tables it made, with the links in a dummy first entry of
each table. */
@@ -1616,10 +1616,12 @@ struct inflate_codes_state {
};
local inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z)
uInt bl, bd;
inflate_huft *tl, *td;
z_stream *z;
local inflate_codes_statef *inflate_codes_new(
uInt bl,
uInt bd,
inflate_huft *tl,
inflate_huft *td,
z_stream *z)
{
inflate_codes_statef *c;
@@ -1636,10 +1638,10 @@ z_stream *z;
return c;
}
local int inflate_codes(s, z, r)
inflate_blocks_statef *s;
z_stream *z;
int r;
local int inflate_codes(
inflate_blocks_statef *s,
z_stream *z,
int r)
{
uInt j; /* temporary storage */
inflate_huft *t; /* temporary pointer */
@@ -1795,9 +1797,9 @@ int r;
}
}
local void inflate_codes_free(c, z)
inflate_codes_statef *c;
z_stream *z;
local void inflate_codes_free(
inflate_codes_statef *c,
z_stream *z)
{
ZFREE(z, c, sizeof(struct inflate_codes_state));
Tracev(( "inflate: codes free\n"));
@@ -1810,10 +1812,10 @@ z_stream *z;
*/
/* copy as much as possible from the sliding window to the output area */
local int inflate_flush(s, z, r)
inflate_blocks_statef *s;
z_stream *z;
int r;
local int inflate_flush(
inflate_blocks_statef *s,
z_stream *z,
int r)
{
uInt n;
Bytef *p, *q;
@@ -1896,11 +1898,13 @@ int r;
at least ten. The ten bytes are six bytes for the longest length/
distance pair plus four bytes for overloading the bit buffer. */
local int inflate_fast(bl, bd, tl, td, s, z)
uInt bl, bd;
inflate_huft *tl, *td;
inflate_blocks_statef *s;
z_stream *z;
local int inflate_fast(
uInt bl,
uInt bd,
inflate_huft *tl,
inflate_huft *td,
inflate_blocks_statef *s,
z_stream *z)
{
inflate_huft *t; /* temporary pointer */
uInt e; /* extra bits or operation */
@@ -2074,10 +2078,10 @@ char *z_errmsg[] = {
#define DO16(buf) DO8(buf); DO8(buf);
/* ========================================================================= */
uLong adler32(adler, buf, len)
uLong adler;
Bytef *buf;
uInt len;
uLong adler32(
uLong adler,
Bytef *buf,
uInt len)
{
unsigned long s1 = adler & 0xffff;
unsigned long s2 = (adler >> 16) & 0xffff;