From: Mika T. Lindqvist Date: Mon, 20 May 2019 08:41:09 +0000 (+0300) Subject: Fix build when DYNAMIC_CRC_TABLE is defined. X-Git-Tag: 1.9.9-b1~484 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e12905a0c2e7cad4d35d7ac7cb71978186436df4;p=thirdparty%2Fzlib-ng.git Fix build when DYNAMIC_CRC_TABLE is defined. --- diff --git a/crc32.c b/crc32.c index ddc2e12d..6c495a57 100644 --- a/crc32.c +++ b/crc32.c @@ -13,6 +13,7 @@ # include "zbuild.h" # include "gzendian.h" +# include /* Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore @@ -56,10 +57,10 @@ static uint32_t gf2_matrix_times(const uint32_t *mat, uint32_t vec) { } #ifdef DYNAMIC_CRC_TABLE -static volatile int crc_table_empty = 1; +volatile int crc_table_empty = 1; static uint32_t crc_table[8][256]; static uint32_t crc_comb[GF2_DIM][GF2_DIM]; -static void make_crc_table(void); +void make_crc_table(void); static void gf2_matrix_square(uint32_t *square, const uint32_t *mat); #ifdef MAKECRCH static void write_table(FILE *, const uint32_t *, int); @@ -99,7 +100,7 @@ static void gf2_matrix_square(uint32_t *square, const uint32_t *mat) { allow for word-at-a-time CRC calculation for both big-endian and little- endian machines, where a word is four bytes. */ -static void make_crc_table() { +void make_crc_table() { uint32_t c; int n, k; uint32_t poly; /* polynomial exclusive-or pattern */ @@ -209,7 +210,7 @@ static void write_table(FILE *out, const uint32_t *table, int k) { int n; for (n = 0; n < k; n++) - fprintf(out, "%s0x%08lx%s", n % 5 ? "" : " ", + fprintf(out, "%s0x%08" PRIx32 "%s", n % 5 ? "" : " ", (uint32_t)(table[n]), n == k - 1 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); } diff --git a/functable.c b/functable.c index 449f66cc..10850979 100644 --- a/functable.c +++ b/functable.c @@ -32,6 +32,11 @@ extern uint32_t adler32_neon(uint32_t adler, const unsigned char *buf, size_t le ZLIB_INTERNAL uint32_t crc32_generic(uint32_t, const unsigned char *, uint64_t); +#ifdef DYNAMIC_CRC_TABLE +extern volatile int crc_table_empty; +extern void make_crc_table(void); +#endif + #ifdef __ARM_FEATURE_CRC32 extern uint32_t crc32_acle(uint32_t, const unsigned char *, uint64_t); #endif