Skip to content

Commit

Permalink
Fix compile warnings in zlib
Browse files Browse the repository at this point in the history
  • Loading branch information
bvschaik committed Dec 6, 2024
1 parent 4ab3415 commit 336e982
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 248 deletions.
25 changes: 5 additions & 20 deletions ext/zlib/adler32.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
# define MOD63(a) a %= BASE
#endif

uLong ZEXPORT adler32_z(adler, buf, len)
uLong adler;
const Bytef *buf;
z_size_t len;
uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len)
{
unsigned long sum2;
unsigned n;
Expand Down Expand Up @@ -116,18 +113,12 @@ uLong ZEXPORT adler32_z(adler, buf, len)
return adler | (sum2 << 16);
}

uLong ZEXPORT adler32(adler, buf, len)
uLong adler;
const Bytef *buf;
uInt len;
uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)
{
return adler32_z(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;
Expand All @@ -150,18 +141,12 @@ local uLong adler32_combine_(adler1, adler2, len2)
return sum1 | (sum2 << 16);
}

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)
{
return adler32_combine_(adler1, adler2, len2);
}

uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
uLong adler1;
uLong adler2;
z_off64_t len2;
uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2)
{
return adler32_combine_(adler1, adler2, len2);
}
47 changes: 10 additions & 37 deletions ext/zlib/crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ local void make_crc_table()
}

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

Expand All @@ -133,10 +131,7 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
}
#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
unsigned long ZEXPORT crc32_z(crc, buf, len)
unsigned long crc;
const unsigned char FAR *buf;
z_size_t len;
unsigned long ZEXPORT crc32_z(unsigned long crc, const unsigned char FAR *buf, z_size_t len)
{
if (buf == Z_NULL) return 0UL;

Expand Down Expand Up @@ -166,10 +161,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
} while (--len);
return crc ^ 0xffffffffUL;
}
unsigned long ZEXPORT crc32(crc, buf, len)
unsigned long crc;
const unsigned char FAR *buf;
uInt len;
unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf, uInt len)
{
return crc32_z(crc, buf, len);
}
Expand All @@ -179,10 +171,7 @@ unsigned long ZEXPORT crc32(crc, buf, len)
c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
#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;
z_size_t len;
local unsigned long crc32_little(unsigned long crc, const unsigned char FAR *buf, z_size_t len)
{
register z_crc_t c;
register const z_crc_t FAR *buf4;
Expand Down Expand Up @@ -215,10 +204,7 @@ local unsigned long crc32_little(crc, buf, len)
c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
#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;
z_size_t len;
local unsigned long crc32_big(unsigned long crc, const unsigned char FAR *buf, z_size_t len)
{
register z_crc_t c;
register const z_crc_t FAR *buf4;
Expand Down Expand Up @@ -251,9 +237,7 @@ local unsigned long crc32_big(crc, buf, len)
#endif

#define GF2_DIM 32
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 @@ -266,19 +250,14 @@ local unsigned long gf2_matrix_times(mat, vec)
}
return sum;
}
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;

for (n = 0; n < GF2_DIM; n++)
square[n] = gf2_matrix_times(mat, mat[n]);
}
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;
Expand Down Expand Up @@ -309,18 +288,12 @@ local uLong crc32_combine_(crc1, crc2, len2)
crc1 ^= crc2;
return crc1;
}
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)
{
return crc32_combine_(crc1, crc2, len2);
}

uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
uLong crc1;
uLong crc2;
z_off64_t len2;
uLong ZEXPORT crc32_combine64(uLong crc1, uLong crc2, z_off64_t len2)
{
return crc32_combine_(crc1, crc2, len2);
}
Loading

0 comments on commit 336e982

Please sign in to comment.