From 6c9bd474aa08312ef2e2e9655a80e18db24a1680 Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Sun, 29 Apr 2012 16:18:12 -0700 Subject: Fix type mismatch between get_crc_table() and crc_table. crc_table is made using a four-byte integer (when that can be determined). However get_crc_table() returned a pointer to an unsigned long, which could be eight bytes. This fixes that by creating a new z_crc_t type for the crc_table. This type is also used for the BYFOUR crc calculations that depend on a four-byte type. The four-byte type can now be determined by ./configure, which also solves a problem where ./configure --solo would never use BYFOUR. No the Z_U4 #define indicates that four- byte integer was found either by ./configure or by zconf.h. --- zconf.h.in | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'zconf.h.in') diff --git a/zconf.h.in b/zconf.h.in index 8c6f945..8a46a58 100644 --- a/zconf.h.in +++ b/zconf.h.in @@ -388,6 +388,29 @@ typedef uLong FAR uLongf; typedef Byte *voidp; #endif +/* ./configure may #define Z_U4 here */ + +#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) +# include +# if (UINT_MAX == 0xffffffffUL) +# define Z_U4 unsigned +# else +# if (ULONG_MAX == 0xffffffffUL) +# define Z_U4 unsigned long +# else +# if (USHRT_MAX == 0xffffffffUL) +# define Z_U4 unsigned short +# endif +# endif +# 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 -- cgit v1.2.1