Skip to content

Commit

Permalink
zlib: replace old K&R function prototypes by C standard compliant pro…
Browse files Browse the repository at this point in the history
…totypes
  • Loading branch information
jmalak committed Mar 16, 2024
1 parent 20db8e7 commit a94bd07
Show file tree
Hide file tree
Showing 14 changed files with 142 additions and 438 deletions.
10 changes: 2 additions & 8 deletions contrib/zlib/adler32.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@
#endif

/* ========================================================================= */
uLong ZEXPORT adler32(adler, buf, len)
uLong adler;
const Bytef *buf;
uInt len;
uLong ZEXPORT adler32( uLong adler, const Bytef *buf, uInt len )
{
unsigned long sum2;
unsigned n;
Expand Down Expand Up @@ -125,10 +122,7 @@ uLong ZEXPORT adler32(adler, buf, len)
}

/* ========================================================================= */
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
uLong adler1;
uLong adler2;
z_off_t len2;
uLong ZEXPORT adler32_combine( uLong adler1, uLong adler2, z_off_t len2 )
{
unsigned long sum1;
unsigned long sum2;
Expand Down
16 changes: 3 additions & 13 deletions contrib/zlib/compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.
*/
int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
int level;
int ZEXPORT compress2( Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level )
{
z_stream stream;
int err;
Expand Down Expand Up @@ -59,11 +54,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)

/* ===========================================================================
*/
int ZEXPORT compress (dest, destLen, source, sourceLen)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
int ZEXPORT compress( Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen )
{
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
}
Expand All @@ -72,8 +63,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen)
If the default memLevel or windowBits for deflateInit() is changed, then
this function needs to be updated.
*/
uLong ZEXPORT compressBound (sourceLen)
uLong sourceLen;
uLong ZEXPORT compressBound( uLong sourceLen )
{
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11;
}
36 changes: 9 additions & 27 deletions contrib/zlib/crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ local void make_crc_table OF((void));
allow for word-at-a-time CRC calculation for both big-endian and little-
endian machines, where a word is four bytes.
*/
local void make_crc_table()
local void make_crc_table( void )
{
unsigned long c;
int n, k;
Expand Down Expand Up @@ -180,9 +180,7 @@ local void make_crc_table()
}

#ifdef MAKECRCH
local void write_table(out, table)
FILE *out;
const unsigned long FAR *table;
local void write_table( FILE *out, const unsigned long FAR *table )
{
int n;

Expand All @@ -202,7 +200,7 @@ local void write_table(out, table)
/* =========================================================================
* This function can be used by asm versions of crc32()
*/
const unsigned long FAR * ZEXPORT get_crc_table()
const unsigned long FAR * ZEXPORT get_crc_table( void )
{
#ifdef DYNAMIC_CRC_TABLE
if (crc_table_empty)
Expand All @@ -216,10 +214,7 @@ const unsigned long FAR * ZEXPORT get_crc_table()
#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1

/* ========================================================================= */
unsigned long ZEXPORT crc32(crc, buf, len)
unsigned long crc;
const unsigned char FAR *buf;
unsigned len;
unsigned long ZEXPORT crc32( unsigned long crc, const unsigned char FAR *buf, unsigned len )
{
if (buf == Z_NULL) return 0UL;

Expand Down Expand Up @@ -259,10 +254,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 FAR *buf;
unsigned len;
local unsigned long crc32_little( unsigned long crc, const unsigned char FAR *buf, unsigned len )
{
register u4 c;
register const u4 FAR *buf4;
Expand Down Expand Up @@ -299,10 +291,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 FAR *buf;
unsigned len;
local unsigned long crc32_big( unsigned long crc, const unsigned char FAR *buf, unsigned len )
{
register u4 c;
register const u4 FAR *buf4;
Expand Down Expand Up @@ -339,9 +328,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;

Expand All @@ -356,9 +343,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;

Expand All @@ -367,10 +352,7 @@ local void gf2_matrix_square(square, mat)
}

/* ========================================================================= */
uLong ZEXPORT crc32_combine(crc1, crc2, len2)
uLong crc1;
uLong crc2;
z_off_t len2;
uLong ZEXPORT crc32_combine( uLong crc1, uLong crc2, z_off_t len2 )
{
int n;
unsigned long row;
Expand Down
Loading

0 comments on commit a94bd07

Please sign in to comment.