]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix build when DYNAMIC_CRC_TABLE is defined.
authorMika T. Lindqvist <postmaster@raasu.org>
Mon, 20 May 2019 08:41:09 +0000 (11:41 +0300)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Wed, 29 May 2019 09:46:35 +0000 (11:46 +0200)
crc32.c
functable.c

diff --git a/crc32.c b/crc32.c
index ddc2e12dc718519818ec7c436100613ba8041f31..6c495a57ad58f5488e43ee9e033cfc0a083e19da 100644 (file)
--- a/crc32.c
+++ b/crc32.c
@@ -13,6 +13,7 @@
 
 # include "zbuild.h"
 # include "gzendian.h"
+# include <inttypes.h>
 
 /*
   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" : ", "));
 }
index 449f66ccb0c52001f93227cdb426f83534c7668c..108509798f62d2eff5f055e4a6553856e93fdd97 100644 (file)
@@ -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