]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Kill z_crc_t
authorDaniel Axtens <dja@axtens.net>
Mon, 11 May 2015 13:29:29 +0000 (23:29 +1000)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Wed, 13 May 2015 12:31:52 +0000 (14:31 +0200)
Signed-off-by: Daniel Axtens <dja@axtens.net>
Conflicts:
crc32.c

configure
crc32.c
crc32.h
zconf.h.in
zlib.h

index f388587abf736d3dbf41933f46c3aa1522e990b7..93210bcdbb7f9c4dc911a797177db0ae6e450ac3 100755 (executable)
--- a/configure
+++ b/configure
@@ -741,7 +741,6 @@ echo BUILDDIR = $BUILDDIR >> configure.log
 echo STATICLIB = $STATICLIB >> configure.log
 echo TEST = $TEST >> configure.log
 echo VER = $VER >> configure.log
-echo Z_U4 = $Z_U4 >> configure.log
 echo exec_prefix = $exec_prefix >> configure.log
 echo includedir = $includedir >> configure.log
 echo libdir = $libdir >> configure.log
diff --git a/crc32.c b/crc32.c
index 338e9dcfe97aceea6bcb404abf94bbfb61e191ce..3dd4c7d82e180f6da48ea58d20727445ea868532 100644 (file)
--- a/crc32.c
+++ b/crc32.c
@@ -59,10 +59,10 @@ static uint32_t crc32_combine_ (uint32_t crc1, uint32_t crc2, z_off64_t len2);
 #ifdef DYNAMIC_CRC_TABLE
 
 static volatile int crc_table_empty = 1;
-static z_crc_t crc_table[8][256];
+static uint32_t crc_table[8][256];
 static void make_crc_table (void);
 #ifdef MAKECRCH
-   static void write_table (FILE *, const z_crc_t *);
+   static void write_table (FILE *, const uint32_t *);
 #endif /* MAKECRCH */
 /*
   Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
@@ -92,9 +92,9 @@ static void make_crc_table (void);
 */
 static void make_crc_table()
 {
-    z_crc_t c;
+    uint32_t c;
     int n, k;
-    z_crc_t poly;                       /* polynomial exclusive-or pattern */
+    uint32_t poly;                       /* polynomial exclusive-or pattern */
     /* terms of polynomial defining this crc (except x^32): */
     static volatile int first = 1;      /* flag to limit concurrent making */
     static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
@@ -108,11 +108,11 @@ static void make_crc_table()
         /* make exclusive-or pattern from polynomial (0xedb88320) */
         poly = 0;
         for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++)
-            poly |= (z_crc_t)1 << (31 - p[n]);
+            poly |= (uint32_t)1 << (31 - p[n]);
 
         /* generate a crc for every 8-bit value */
         for (n = 0; n < 256; n++) {
-            c = (z_crc_t)n;
+            c = (uint32_t)n;
             for (k = 0; k < 8; k++)
                 c = c & 1 ? poly ^ (c >> 1) : c >> 1;
             crc_table[0][n] = c;
@@ -147,7 +147,7 @@ static void make_crc_table()
         if (out == NULL) return;
         fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
         fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
-        fprintf(out, "static const z_crc_t ");
+        fprintf(out, "static const uint32_t ");
         fprintf(out, "crc_table[8][256] =\n{\n  {\n");
         write_table(out, crc_table[0]);
         for (k = 1; k < 8; k++) {
@@ -161,7 +161,7 @@ static void make_crc_table()
 }
 
 #ifdef MAKECRCH
-static void write_table(FILE *out, const z_crc_t *table)
+static void write_table(FILE *out, const uint32_t *table)
 {
     int n;
 
@@ -182,13 +182,13 @@ static void write_table(FILE *out, const z_crc_t *table)
 /* =========================================================================
  * This function can be used by asm versions of crc32()
  */
-const z_crc_t * ZEXPORT get_crc_table()
+const uint32_t * ZEXPORT get_crc_table()
 {
 #ifdef DYNAMIC_CRC_TABLE
     if (crc_table_empty)
         make_crc_table();
 #endif /* DYNAMIC_CRC_TABLE */
-    return (const z_crc_t *)crc_table;
+    return (const uint32_t *)crc_table;
 }
 
 /* ========================================================================= */
@@ -244,17 +244,17 @@ uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, uInt len)
 /* ========================================================================= */
 static uint32_t crc32_little(uint32_t crc, const unsigned char *buf, unsigned len)
 {
-    register z_crc_t c;
-    register const z_crc_t *buf4;
+    register uint32_t c;
+    register const uint32_t *buf4;
 
-    c = (z_crc_t)crc;
+    c = (uint32_t)crc;
     c = ~c;
     while (len && ((ptrdiff_t)buf & 3)) {
         c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
         len--;
     }
 
-    buf4 = (const z_crc_t *)(const void *)buf;
+    buf4 = (const uint32_t *)(const void *)buf;
 
 #ifndef UNROLL_LESS
     while (len >= 32) {
@@ -287,17 +287,17 @@ static uint32_t crc32_little(uint32_t crc, const unsigned char *buf, unsigned le
 /* ========================================================================= */
 static uint32_t crc32_big(uint32_t crc, const unsigned char *buf, unsigned len)
 {
-    register z_crc_t c;
-    register const z_crc_t *buf4;
+    register uint32_t c;
+    register const uint32_t *buf4;
 
-    c = ZSWAP32((z_crc_t)crc);
+    c = ZSWAP32((uint32_t)crc);
     c = ~c;
     while (len && ((ptrdiff_t)buf & 3)) {
         c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
         len--;
     }
 
-    buf4 = (const z_crc_t *)(const void *)buf;
+    buf4 = (const uint32_t *)(const void *)buf;
     buf4--;
 
 #ifndef UNROLL_LESS
diff --git a/crc32.h b/crc32.h
index a7badcb1d8d6c095823bc00f50b05f8c88979031..a56e50b620e9a2daec3536c6ed760f2389fcbfd3 100644 (file)
--- a/crc32.h
+++ b/crc32.h
@@ -2,7 +2,7 @@
  * Generated automatically by crc32.c
  */
 
-static const z_crc_t crc_table[8][256] =
+static const uint32_t crc_table[8][256] =
 {
   {
     0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
index 6612f6d37489798e8e02f9845f525b0ed72185bc..d419dda3f5bb4661f5d9a64ca7cf8a34d7279816 100644 (file)
@@ -107,23 +107,6 @@ typedef void const *voidpc;
 typedef void       *voidpf;
 typedef void       *voidp;
 
-#if !defined(Z_U4)
-#  include <limits.h>
-#  if (UINT_MAX == 0xffffffffUL)
-#    define Z_U4 unsigned
-#  elif (ULONG_MAX == 0xffffffffUL)
-#    define Z_U4 unsigned long
-#  elif (USHRT_MAX == 0xffffffffUL)
-#    define Z_U4 unsigned short
-#  endif
-#endif
-
-#ifdef Z_U4
-   typedef Z_U4 z_crc_t;
-#else
-   typedef unsigned long z_crc_t;
-#endif
-
 #ifdef HAVE_UNISTD_H    /* may be set to #if 1 by ./configure */
 #  define Z_HAVE_UNISTD_H
 #endif
diff --git a/zlib.h b/zlib.h
index 732c94b7ef42505e5392ae88756af097e44bdf5e..f0a1eceb53312c32baeb6e2f016bfd2a3b668501 100644 (file)
--- a/zlib.h
+++ b/zlib.h
@@ -1727,7 +1727,7 @@ ZEXTERN int ZEXPORT gzgetc_ (gzFile file);  /* backward compatibility */
 /* undocumented functions */
 ZEXTERN const char   * ZEXPORT zError           (int);
 ZEXTERN int            ZEXPORT inflateSyncPoint (z_stream *);
-ZEXTERN const z_crc_t * ZEXPORT get_crc_table   (void);
+ZEXTERN const uint32_t * ZEXPORT get_crc_table   (void);
 ZEXTERN int            ZEXPORT inflateUndermine (z_stream *, int);
 ZEXTERN int            ZEXPORT inflateResetKeep (z_stream *);
 ZEXTERN int            ZEXPORT deflateResetKeep (z_stream *);