]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Type cleanup.
authorMika Lindqvist <postmaster@raasu.org>
Mon, 14 Dec 2015 08:11:39 +0000 (10:11 +0200)
committerMika Lindqvist <postmaster@raasu.org>
Mon, 14 Dec 2015 09:00:22 +0000 (11:00 +0200)
24 files changed:
adler32.c
arch/x86/fill_window_sse.c
compress.c
crc32.c
deflate.c
deflate.h
deflate_medium.c
gzguts.h
gzlib.c
infback.c
inffast.c
inffast.h
inflate.c
inflate.h
match.c
match.h
test/example.c
test/minigzip.c
trees.c
uncompr.c
zconf.h.in
zlib.h
zutil.c
zutil.h

index 6b6e8d4eb1b91d937c8cddfe3b72254456c5d82d..495101dd5d0c7ddd1021c1c9f6147fc47f0e9f2e 100644 (file)
--- a/adler32.c
+++ b/adler32.c
@@ -60,7 +60,7 @@ static uint32_t adler32_combine_(uint32_t adler1, uint32_t adler2, z_off64_t len
 #endif
 
 /* ========================================================================= */
-uint32_t ZEXPORT adler32(uint32_t adler, const unsigned char *buf, uInt len) {
+uint32_t ZEXPORT adler32(uint32_t adler, const unsigned char *buf, uint32_t len) {
     uint32_t sum2;
     unsigned n;
 
index b9c79ff5062783b54d45c39ef12bc1d3b8fb584d..d82b1d1bcb8daea1a1483085175b85ce81cec504 100644 (file)
@@ -21,12 +21,12 @@ ZLIB_INTERNAL void fill_window_sse(deflate_state *s) {
     register unsigned n;
     register Pos *p;
     unsigned more;    /* Amount of free space at the end of the window. */
-    uInt wsize = s->w_size;
+    unsigned int wsize = s->w_size;
 
     Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
 
     do {
-        more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
+        more = (unsigned)(s->window_size -(unsigned long)s->lookahead -(unsigned long)s->strstart);
 
         /* Deal with !@#$% 64K limit: */
         if (sizeof(int) <= 2) {
@@ -105,7 +105,7 @@ ZLIB_INTERNAL void fill_window_sse(deflate_state *s) {
 
         /* Initialize the hash value now that we have some input: */
         if (s->lookahead + s->insert >= MIN_MATCH) {
-            uInt str = s->strstart - s->insert;
+            unsigned int str = s->strstart - s->insert;
             s->ins_h = s->window[str];
             if (str >= 1)
                 UPDATE_HASH(s, s->ins_h, str + 1 - (MIN_MATCH-1));
@@ -135,8 +135,8 @@ ZLIB_INTERNAL void fill_window_sse(deflate_state *s) {
      * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
      */
     if (s->high_water < s->window_size) {
-        ulg curr = s->strstart + (ulg)(s->lookahead);
-        ulg init;
+        unsigned long curr = s->strstart + (unsigned long)(s->lookahead);
+        unsigned long init;
 
         if (s->high_water < curr) {
             /* Previous high water mark below current data -- zero WIN_INIT
@@ -147,12 +147,12 @@ ZLIB_INTERNAL void fill_window_sse(deflate_state *s) {
                 init = WIN_INIT;
             memset(s->window + curr, 0, (unsigned)init);
             s->high_water = curr + init;
-        } else if (s->high_water < (ulg)curr + WIN_INIT) {
+        } else if (s->high_water < (unsigned long)curr + WIN_INIT) {
             /* High water mark at or above current data, but below current data
              * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
              * to end of window, whichever is less.
              */
-            init = (ulg)curr + WIN_INIT - s->high_water;
+            init = (unsigned long)curr + WIN_INIT - s->high_water;
             if (init > s->window_size - s->high_water)
                 init = s->window_size - s->high_water;
             memset(s->window + s->high_water, 0, (unsigned)init);
@@ -160,6 +160,6 @@ ZLIB_INTERNAL void fill_window_sse(deflate_state *s) {
         }
     }
 
-    Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, "not enough room for search");
+    Assert((unsigned long)s->strstart <= s->window_size - MIN_LOOKAHEAD, "not enough room for search");
 }
 #endif
index 31ffdb14a46ffe50bf65a572b1a42eeae95b10d8..7c823abfde074a2b530d7e4898c10198536ff526 100644 (file)
@@ -1,5 +1,5 @@
 /* compress.c -- compress a memory buffer
- * Copyright (C) 1995-2005, 2014 Jean-loup Gailly, Mark Adler
+ * Copyright (C) 1995-2005, 2014 Jean-loup Gailly, Mark Adler.
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
    memory, Z_BUF_ERROR if there was not enough room in the output buffer,
    Z_STREAM_ERROR if the level parameter is invalid.
 */
-int ZEXPORT compress2(unsigned char *dest, uLong *destLen, const unsigned char *source,
-                        uLong sourceLen, int level) {
+int ZEXPORT compress2(unsigned char *dest, unsigned long *destLen, const unsigned char *source,
+                        unsigned long sourceLen, int level) {
     z_stream stream;
     int err;
-    const uInt max = (uInt)0 - 1;
-    uLong left;
+    const unsigned int max = (unsigned int)0 - 1;
+    unsigned long left;
 
     left = *destLen;
     *destLen = 0;
@@ -44,11 +44,11 @@ int ZEXPORT compress2(unsigned char *dest, uLong *destLen, const unsigned char *
 
     do {
         if (stream.avail_out == 0) {
-            stream.avail_out = left > (uLong)max ? max : (uInt)left;
+            stream.avail_out = left > (unsigned long)max ? max : (unsigned int)left;
             left -= stream.avail_out;
         }
         if (stream.avail_in == 0) {
-            stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
+            stream.avail_in = sourceLen > (unsigned long)max ? max : (unsigned int)sourceLen;
             sourceLen -= stream.avail_in;
         }
         err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
@@ -61,15 +61,14 @@ int ZEXPORT compress2(unsigned char *dest, uLong *destLen, const unsigned char *
 
 /* ===========================================================================
  */
-int ZEXPORT compress(unsigned char *dest, uLong *destLen, const unsigned char *source, uLong sourceLen) {
+int ZEXPORT compress(unsigned char *dest, unsigned long *destLen, const unsigned char *source, unsigned long sourceLen) {
     return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
 }
 
 /* ===========================================================================
-     If the default memLevel or windowBits for deflateInit() is changed, then
+   If the default memLevel or windowBits for deflateInit() is changed, then
    this function needs to be updated.
  */
-uLong ZEXPORT compressBound(uLong sourceLen) {
-    return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
-           (sourceLen >> 25) + 13;
+unsigned long ZEXPORT compressBound(unsigned long sourceLen) {
+    return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + (sourceLen >> 25) + 13;
 }
diff --git a/crc32.c b/crc32.c
index 7ab796d1267334a611fd58e8d77f001865a7fe22..960a5523557a4d3d9b8436b9fb075ba414841de4 100644 (file)
--- a/crc32.c
+++ b/crc32.c
@@ -13,7 +13,7 @@
 
 #ifdef __MINGW32__
 # include <sys/param.h>
-#elif _WIN32
+#elif defined(WIN32) || defined(_WIN32)
 # define LITTLE_ENDIAN 1234
 # define BIG_ENDIAN 4321
 # if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64)
@@ -49,9 +49,9 @@
 #include "deflate.h"
 
 #if BYTE_ORDER == LITTLE_ENDIAN
-static uint32_t crc32_little(uint32_t, const unsigned char *, unsigned);
+static uint32_t crc32_little(uint32_t, const unsigned char *, z_off64_t);
 #elif BYTE_ORDER == BIG_ENDIAN
-static uint32_t crc32_big(uint32_t, const unsigned char *, unsigned);
+static uint32_t crc32_big(uint32_t, const unsigned char *, z_off64_t);
 #endif
 
 /* Local functions for crc concatenation */
@@ -196,7 +196,7 @@ const uint32_t * ZEXPORT get_crc_table(void) {
 #define DO4 DO1; DO1; DO1; DO1
 
 /* ========================================================================= */
-uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, uInt len) {
+uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, z_off64_t len) {
     if (buf == Z_NULL) return 0;
 
 #ifdef DYNAMIC_CRC_TABLE
@@ -240,7 +240,7 @@ uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, uInt len) {
 #define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
 
 /* ========================================================================= */
-static uint32_t crc32_little(uint32_t crc, const unsigned char *buf, unsigned len) {
+static uint32_t crc32_little(uint32_t crc, const unsigned char *buf, z_off64_t len) {
     register uint32_t c;
     register const uint32_t *buf4;
 
@@ -282,7 +282,7 @@ static uint32_t crc32_little(uint32_t crc, const unsigned char *buf, unsigned le
 #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
 
 /* ========================================================================= */
-static uint32_t crc32_big(uint32_t crc, const unsigned char *buf, unsigned len) {
+static uint32_t crc32_big(uint32_t crc, const unsigned char *buf, z_off64_t len) {
     register uint32_t c;
     register const uint32_t *buf4;
 
index 56af046a1495d6cc84a56462442bb4c65d11bed3..16808bd6c0b0fa353fc2a354f5389ff42b0f5c38 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -79,9 +79,9 @@ block_state deflate_slow         (deflate_state *s, int flush);
 local block_state deflate_rle    (deflate_state *s, int flush);
 local block_state deflate_huff   (deflate_state *s, int flush);
 local void lm_init               (deflate_state *s);
-local void putShortMSB           (deflate_state *s, uInt b);
-ZLIB_INTERNAL void flush_pending(z_stream *strm);
-ZLIB_INTERNAL int read_buf(z_stream *strm, unsigned char *buf, unsigned size);
+local void putShortMSB           (deflate_state *s, uint16_t b);
+ZLIB_INTERNAL void flush_pending (z_stream *strm);
+ZLIB_INTERNAL int read_buf       (z_stream *strm, unsigned char *buf, unsigned size);
 
 extern void crc_reset(deflate_state *const s);
 extern void crc_finalize(deflate_state *const s);
@@ -253,7 +253,7 @@ int ZEXPORT deflateInit2_(z_stream *strm, int level, int method, int windowBits,
 
     overlay = (uint16_t *) ZALLOC(strm, s->lit_bufsize, sizeof(uint16_t)+2);
     s->pending_buf = (unsigned char *) overlay;
-    s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(uint16_t)+2L);
+    s->pending_buf_size = (unsigned long)s->lit_bufsize * (sizeof(uint16_t)+2L);
 
     if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
         s->pending_buf == Z_NULL) {
@@ -273,11 +273,11 @@ int ZEXPORT deflateInit2_(z_stream *strm, int level, int method, int windowBits,
 }
 
 /* ========================================================================= */
-int ZEXPORT deflateSetDictionary(z_stream *strm, const unsigned char *dictionary, uInt  dictLength) {
+int ZEXPORT deflateSetDictionary(z_stream *strm, const unsigned char *dictionary, unsigned int dictLength) {
     deflate_state *s;
-    uInt str, n;
+    unsigned int str, n;
     int wrap;
-    unsigned avail;
+    uint32_t avail;
     const unsigned char *next;
 
     if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
@@ -383,7 +383,7 @@ int ZEXPORT deflateSetHeader(z_stream *strm, gz_headerp head) {
 }
 
 /* ========================================================================= */
-int ZEXPORT deflatePending(z_stream *strm, unsigned *pending, int *bits) {
+int ZEXPORT deflatePending(z_stream *strm, uint32_t *pending, int *bits) {
     if (strm == Z_NULL || strm->state == Z_NULL)
         return Z_STREAM_ERROR;
     if (pending != Z_NULL)
@@ -481,9 +481,9 @@ int ZEXPORT deflateTune(z_stream *strm, int good_length, int max_lazy, int nice_
  * upper bound of about 14% expansion does not seem onerous for output buffer
  * allocation.
  */
-uLong ZEXPORT deflateBound(z_stream *strm, uLong sourceLen) {
+unsigned long ZEXPORT deflateBound(z_stream *strm, unsigned long sourceLen) {
     deflate_state *s;
-    uLong complen, wraplen;
+    unsigned long complen, wraplen;
     unsigned char *str;
 
     /* conservative upper bound for compressed data */
@@ -541,7 +541,7 @@ uLong ZEXPORT deflateBound(z_stream *strm, uLong sourceLen) {
  * IN assertion: the stream state is correct and there is enough room in
  * pending_buf.
  */
-local void putShortMSB(deflate_state *s, uInt b) {
+local void putShortMSB(deflate_state *s, uint16_t b) {
     put_byte(s, (unsigned char)(b >> 8));
     put_byte(s, (unsigned char)(b & 0xff));
 }
@@ -553,7 +553,7 @@ local void putShortMSB(deflate_state *s, uInt b) {
  * (See also read_buf()).
  */
 ZLIB_INTERNAL void flush_pending(z_stream *strm) {
-    unsigned len;
+    uint32_t len;
     deflate_state *s = strm->state;
 
     _tr_flush_bits(s);
@@ -640,8 +640,8 @@ int ZEXPORT deflate(z_stream *strm, int flush) {
         } else
 #endif
         {
-            uInt header = (Z_DEFLATED + ((s->w_bits-8) << 4)) << 8;
-            uInt level_flags;
+            unsigned int header = (Z_DEFLATED + ((s->w_bits-8) << 4)) << 8;
+            unsigned int level_flags;
 
             if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
                 level_flags = 0;
@@ -661,8 +661,8 @@ int ZEXPORT deflate(z_stream *strm, int flush) {
 
             /* Save the adler32 of the preset dictionary: */
             if (s->strstart != 0) {
-                putShortMSB(s, (uInt)(strm->adler >> 16));
-                putShortMSB(s, (uInt)(strm->adler & 0xffff));
+                putShortMSB(s, (uint16_t)(strm->adler >> 16));
+                putShortMSB(s, (uint16_t)strm->adler);
             }
             strm->adler = adler32(0L, Z_NULL, 0);
         }
@@ -670,7 +670,7 @@ int ZEXPORT deflate(z_stream *strm, int flush) {
 #ifdef GZIP
     if (s->status == EXTRA_STATE) {
         if (s->gzhead->extra != Z_NULL) {
-            uInt beg = s->pending;  /* start of bytes to update crc */
+            uint32_t beg = s->pending;  /* start of bytes to update crc */
 
             while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
                 if (s->pending == s->pending_buf_size) {
@@ -696,7 +696,7 @@ int ZEXPORT deflate(z_stream *strm, int flush) {
     }
     if (s->status == NAME_STATE) {
         if (s->gzhead->name != Z_NULL) {
-            uInt beg = s->pending;  /* start of bytes to update crc */
+            uint32_t beg = s->pending;  /* start of bytes to update crc */
             int val;
 
             do {
@@ -725,7 +725,7 @@ int ZEXPORT deflate(z_stream *strm, int flush) {
     }
     if (s->status == COMMENT_STATE) {
         if (s->gzhead->comment != Z_NULL) {
-            uInt beg = s->pending;  /* start of bytes to update crc */
+            uint32_t beg = s->pending;  /* start of bytes to update crc */
             int val;
 
             do {
@@ -869,8 +869,8 @@ int ZEXPORT deflate(z_stream *strm, int flush) {
     } else
 #endif
     {
-        putShortMSB(s, (uInt)(strm->adler >> 16));
-        putShortMSB(s, (uInt)(strm->adler & 0xffff));
+        putShortMSB(s, (uint16_t)(strm->adler >> 16));
+        putShortMSB(s, (uint16_t)strm->adler);
     }
     flush_pending(strm);
     /* If avail_out is zero, the application will call deflate again
@@ -948,7 +948,7 @@ int ZEXPORT deflateCopy(z_stream *dest, z_stream *source) {
     memcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(unsigned char));
     memcpy((void *)ds->prev, (void *)ss->prev, ds->w_size * sizeof(Pos));
     memcpy((void *)ds->head, (void *)ss->head, ds->hash_size * sizeof(Pos));
-    memcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
+    memcpy(ds->pending_buf, ss->pending_buf, (unsigned int)ds->pending_buf_size);
 
     ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
     ds->d_buf = overlay + ds->lit_bufsize/sizeof(uint16_t);
@@ -969,7 +969,7 @@ int ZEXPORT deflateCopy(z_stream *dest, z_stream *source) {
  * (See also flush_pending()).
  */
 ZLIB_INTERNAL int read_buf(z_stream *strm, unsigned char *buf, unsigned size) {
-    unsigned len = strm->avail_in;
+    uint32_t len = strm->avail_in;
 
     if (len > size)
         len = size;
@@ -998,7 +998,7 @@ ZLIB_INTERNAL int read_buf(z_stream *strm, unsigned char *buf, unsigned size) {
  * Initialize the "longest match" routines for a new zlib stream
  */
 local void lm_init(deflate_state *s) {
-    s->window_size = (ulg)2L*s->w_size;
+    s->window_size = (unsigned long)2L*s->w_size;
 
     CLEAR_HASH(s);
 
@@ -1078,12 +1078,12 @@ void fill_window_c(deflate_state *s) {
     register unsigned n;
     register Pos *p;
     unsigned more;    /* Amount of free space at the end of the window. */
-    uInt wsize = s->w_size;
+    unsigned int wsize = s->w_size;
 
     Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
 
     do {
-        more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
+        more = (unsigned)(s->window_size -(unsigned long)s->lookahead -(unsigned long)s->strstart);
 
         /* If the window is almost full and there is insufficient lookahead,
          * move the upper half to the lower one to make room in the upper half.
@@ -1173,7 +1173,7 @@ void fill_window_c(deflate_state *s) {
 
         /* Initialize the hash value now that we have some input: */
         if (s->lookahead + s->insert >= MIN_MATCH) {
-            uInt str = s->strstart - s->insert;
+            unsigned int str = s->strstart - s->insert;
             s->ins_h = s->window[str];
             if (str >= 1)
                 UPDATE_HASH(s, s->ins_h, str + 1 - (MIN_MATCH-1));
@@ -1203,8 +1203,8 @@ void fill_window_c(deflate_state *s) {
      * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
      */
     if (s->high_water < s->window_size) {
-        ulg curr = s->strstart + (ulg)(s->lookahead);
-        ulg init;
+        unsigned long curr = s->strstart + (unsigned long)(s->lookahead);
+        unsigned long init;
 
         if (s->high_water < curr) {
             /* Previous high water mark below current data -- zero WIN_INIT
@@ -1215,12 +1215,12 @@ void fill_window_c(deflate_state *s) {
                 init = WIN_INIT;
             memset(s->window + curr, 0, (unsigned)init);
             s->high_water = curr + init;
-        } else if (s->high_water < (ulg)curr + WIN_INIT) {
+        } else if (s->high_water < (unsigned long)curr + WIN_INIT) {
             /* High water mark at or above current data, but below current data
              * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
              * to end of window, whichever is less.
              */
-            init = (ulg)curr + WIN_INIT - s->high_water;
+            init = (unsigned long)curr + WIN_INIT - s->high_water;
             if (init > s->window_size - s->high_water)
                 init = s->window_size - s->high_water;
             memset(s->window + s->high_water, 0, (unsigned)init);
@@ -1228,7 +1228,7 @@ void fill_window_c(deflate_state *s) {
         }
     }
 
-    Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
+    Assert((unsigned long)s->strstart <= s->window_size - MIN_LOOKAHEAD,
            "not enough room for search");
 }
 
@@ -1245,11 +1245,11 @@ local block_state deflate_stored(deflate_state *s, int flush) {
     /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
      * to pending_buf_size, and each stored block has a 5 byte header:
      */
-    ulg max_block_size = 0xffff;
-    ulg max_start;
+    unsigned long max_block_size = 0xffff;
+    unsigned long max_start;
 
     if (max_block_size > s->pending_buf_size - 5) {
-        max_block_size = s->pending_buf_size - 5;
+        max_block_size = (uint32_t)(s->pending_buf_size - 5);
     }
 
     /* Copy as much as possible from input to output: */
@@ -1272,16 +1272,16 @@ local block_state deflate_stored(deflate_state *s, int flush) {
 
         /* Emit a stored block if pending_buf will be full: */
         max_start = s->block_start + max_block_size;
-        if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
+        if (s->strstart == 0 || (unsigned long)s->strstart >= max_start) {
             /* strstart == 0 is possible when wraparound on 16-bit machine */
-            s->lookahead = (uInt)(s->strstart - max_start);
-            s->strstart = (uInt)max_start;
+            s->lookahead = (unsigned int)(s->strstart - max_start);
+            s->strstart = (unsigned int)max_start;
             FLUSH_BLOCK(s, 0);
         }
         /* Flush if we may have to slide, otherwise block_start may become
          * negative and the data will be gone:
          */
-        if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
+        if (s->strstart - (unsigned int)s->block_start >= MAX_DIST(s)) {
             FLUSH_BLOCK(s, 0);
         }
     }
@@ -1302,8 +1302,8 @@ local block_state deflate_stored(deflate_state *s, int flush) {
  * deflate switches away from Z_RLE.)
  */
 local block_state deflate_rle(deflate_state *s, int flush) {
-    int bflush;             /* set if current block must be flushed */
-    uInt prev;              /* byte at distance one to match */
+    int bflush;                     /* set if current block must be flushed */
+    unsigned int prev;              /* byte at distance one to match */
     unsigned char *scan, *strend;   /* scan goes up to strend for length of run */
 
     for (;;) {
@@ -1337,7 +1337,7 @@ local block_state deflate_rle(deflate_state *s, int flush) {
                 if (s->match_length > s->lookahead)
                     s->match_length = s->lookahead;
             }
-            Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
+            Assert(scan <= s->window+(unsigned int)(s->window_size-1), "wild scan");
         }
 
         /* Emit match if have run of MIN_MATCH or longer, else emit literal */
index c6ce024668052cffe7af418e5b9818d3bd107bfa..2d3202641d8d97056487f8936826e0e277989eb0 100644 (file)
--- a/deflate.h
+++ b/deflate.h
@@ -100,17 +100,17 @@ typedef unsigned IPos;
  */
 
 typedef struct internal_state {
-    z_stream *strm;      /* pointer back to this zlib stream */
-    int   status;        /* as the name implies */
-    unsigned char *pending_buf;  /* output still pending */
-    ulg   pending_buf_size; /* size of pending_buf */
-    unsigned char *pending_out;  /* next pending byte to output to the stream */
-    uInt   pending;      /* nb of bytes in the pending buffer */
-    int   wrap;          /* bit 0 true for zlib, bit 1 true for gzip */
-    gz_headerp  gzhead;  /* gzip header information to write */
-    uInt   gzindex;      /* where in extra, name, or comment */
-    unsigned char  method;        /* can only be DEFLATED */
-    int   last_flush;    /* value of flush param for previous deflate call */
+    z_stream      *strm;             /* pointer back to this zlib stream */
+    int           status;            /* as the name implies */
+    unsigned char *pending_buf;      /* output still pending */
+    unsigned long pending_buf_size;  /* size of pending_buf */
+    unsigned char *pending_out;      /* next pending byte to output to the stream */
+    unsigned int  pending;           /* nb of bytes in the pending buffer */
+    int           wrap;              /* bit 0 true for zlib, bit 1 true for gzip */
+    gz_headerp    gzhead;            /* gzip header information to write */
+    unsigned int  gzindex;           /* where in extra, name, or comment */
+    unsigned char method;            /* can only be DEFLATED */
+    int           last_flush;        /* value of flush param for previous deflate call */
 
 #ifdef X86_PCLMULQDQ_CRC
     unsigned ALIGNED_(16) crc0[4 * 5];
@@ -118,9 +118,9 @@ typedef struct internal_state {
 
                 /* used by deflate.c: */
 
-    uInt  w_size;        /* LZ77 window size (32K by default) */
-    uInt  w_bits;        /* log2(w_size)  (8..16) */
-    uInt  w_mask;        /* w_size - 1 */
+    unsigned int  w_size;            /* LZ77 window size (32K by default) */
+    unsigned int  w_bits;            /* log2(w_size)  (8..16) */
+    unsigned int  w_mask;            /* w_size - 1 */
 
     unsigned char *window;
     /* Sliding window. Input bytes are read into the second half of the window,
@@ -132,7 +132,7 @@ typedef struct internal_state {
      * To do: use the user input buffer as sliding window.
      */
 
-    ulg window_size;
+    unsigned long window_size;
     /* Actual size of window: 2*wSize, except when the user input buffer
      * is directly used as sliding window.
      */
@@ -145,12 +145,12 @@ typedef struct internal_state {
 
     Pos *head; /* Heads of the hash chains or NIL. */
 
-    uInt  ins_h;          /* hash index of string to be inserted */
-    uInt  hash_size;      /* number of elements in hash table */
-    uInt  hash_bits;      /* log2(hash_size) */
-    uInt  hash_mask;      /* hash_size-1 */
+    unsigned int  ins_h;             /* hash index of string to be inserted */
+    unsigned int  hash_size;         /* number of elements in hash table */
+    unsigned int  hash_bits;         /* log2(hash_size) */
+    unsigned int  hash_mask;         /* hash_size-1 */
 
-    uInt  hash_shift;
+    unsigned int  hash_shift;
     /* Number of bits by which ins_h must be shifted at each input
      * step. It must be such that after MIN_MATCH steps, the oldest
      * byte no longer takes part in the hash key, that is:
@@ -162,25 +162,25 @@ typedef struct internal_state {
      * negative when the window is moved backwards.
      */
 
-    uInt match_length;           /* length of best match */
-    IPos prev_match;             /* previous match */
-    int match_available;         /* set if previous match exists */
-    uInt strstart;               /* start of string to insert */
-    uInt match_start;            /* start of matching string */
-    uInt lookahead;              /* number of valid bytes ahead in window */
+    unsigned int match_length;       /* length of best match */
+    IPos         prev_match;         /* previous match */
+    int          match_available;    /* set if previous match exists */
+    unsigned int strstart;           /* start of string to insert */
+    unsigned int match_start;        /* start of matching string */
+    unsigned int lookahead;          /* number of valid bytes ahead in window */
 
-    uInt prev_length;
+    unsigned int prev_length;
     /* Length of the best match at previous step. Matches not greater than this
      * are discarded. This is used in the lazy match evaluation.
      */
 
-    uInt max_chain_length;
+    unsigned int max_chain_length;
     /* To speed up deflation, hash chains are never searched beyond this
      * length.  A higher limit improves compression ratio but degrades the
      * speed.
      */
 
-    uInt max_lazy_match;
+    unsigned int max_lazy_match;
     /* Attempt to find a better match only when the current match is strictly
      * smaller than this value. This mechanism is used only for compression
      * levels >= 4.
@@ -194,7 +194,7 @@ typedef struct internal_state {
     int level;    /* compression level (1..9) */
     int strategy; /* favor or force Huffman coding*/
 
-    uInt good_match;
+    unsigned int good_match;
     /* Use a faster search when the previous match is longer than this */
 
     int nice_match; /* Stop searching when current match exceeds this */
@@ -223,9 +223,9 @@ typedef struct internal_state {
     /* Depth of each subtree used as tie breaker for trees of equal frequency
      */
 
-    unsigned char *l_buf;          /* buffer for literals or lengths */
+    unsigned char *l_buf;       /* buffer for literals or lengths */
 
-    uInt  lit_bufsize;
+    unsigned int  lit_bufsize;
     /* Size of match buffer for literals/lengths.  There are 4 reasons for
      * limiting lit_bufsize to 64K:
      *   - frequencies can be kept in 16 bit counters
@@ -245,7 +245,7 @@ typedef struct internal_state {
      *   - I can't count above 4
      */
 
-    uInt last_lit;      /* running index in l_buf */
+    unsigned int last_lit;        /* running index in l_buf */
 
     uint16_t *d_buf;
     /* Buffer for distances. To simplify the code, d_buf and l_buf have
@@ -253,14 +253,14 @@ typedef struct internal_state {
      * array would be necessary.
      */
 
-    ulg opt_len;        /* bit length of current block with optimal trees */
-    ulg static_len;     /* bit length of current block with static trees */
-    uInt matches;       /* number of string matches in current block */
-    uInt insert;        /* bytes at end of window left to insert */
+    unsigned long opt_len;        /* bit length of current block with optimal trees */
+    unsigned long static_len;     /* bit length of current block with static trees */
+    unsigned int matches;         /* number of string matches in current block */
+    unsigned int insert;          /* bytes at end of window left to insert */
 
 #ifdef DEBUG
-    ulg compressed_len; /* total bit length of compressed file mod 2^32 */
-    ulg bits_sent;      /* bit length of compressed data sent mod 2^32 */
+    unsigned long compressed_len; /* total bit length of compressed file mod 2^32 */
+    unsigned long bits_sent;      /* bit length of compressed data sent mod 2^32 */
 #endif
 
     uint16_t bi_buf;
@@ -272,7 +272,7 @@ typedef struct internal_state {
      * are always zero.
      */
 
-    ulg high_water;
+    unsigned long high_water;
     /* High water mark offset in window for initialized bytes -- bytes above
      * this are set to zero in order to avoid memory check warnings when
      * longest match routines access bytes past the input.  This is then
@@ -334,10 +334,10 @@ typedef enum {
         /* in trees.c */
 void ZLIB_INTERNAL _tr_init(deflate_state *s);
 int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc);
-void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, char *buf, ulg stored_len, int last);
+void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, char *buf, unsigned long stored_len, int last);
 void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s);
 void ZLIB_INTERNAL _tr_align(deflate_state *s);
-void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, char *buf, ulg stored_len, int last);
+void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, char *buf, unsigned long stored_len, int last);
 void ZLIB_INTERNAL bi_windup(deflate_state *s);
 
 #define d_code(dist) ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
@@ -424,7 +424,7 @@ void ZLIB_INTERNAL bi_windup(deflate_state *s);
 local void send_bits(deflate_state *s, int value, int length) {
     Tracevv((stderr, " l %2d v %4x ", length, value));
     Assert(length > 0 && length <= 15, "invalid length");
-    s->bits_sent += (ulg)length;
+    s->bits_sent += (unsigned long)length;
 
     /* If not enough room in bi_buf, use (valid) bits from bi_buf and
      * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
index eab1d2e9b0f178a4d9634fe9cfeea8179310416d..731b8a26850e67b7fc841e40c8980384ada9608f 100644 (file)
 #include "match.h"
 
 struct match {
-    uInt match_start;
-    uInt match_length;
-    uInt strstart;
-    uInt orgstart;
+    unsigned int match_start;
+    unsigned int match_length;
+    unsigned int strstart;
+    unsigned int orgstart;
 };
 
 #define MAX_DIST2  ((1 << MAX_WBITS) - MIN_LOOKAHEAD)
index 3930d7e4179626651e832b6767c40a2fed40cf44..51435b36399a88b5598f236b6421348235081504 100644 (file)
--- a/gzguts.h
+++ b/gzguts.h
 #include <fcntl.h>
 #include "zlib.h"
 
-#ifdef _WIN32
+#ifdef WIN32
 #  include <stddef.h>
 #endif
 
-#if defined(_MSC_VER) || defined(_WIN32)
+#if defined(_MSC_VER) || defined(WIN32)
 #  include <io.h>
 #endif
 
diff --git a/gzlib.c b/gzlib.c
index 44b14a02112005bb1a8cddae224f22ac651ce943..2c84c6123c014ec8afb71dc1be8a685b8e9d59ae 100644 (file)
--- a/gzlib.c
+++ b/gzlib.c
@@ -5,7 +5,7 @@
 
 #include "gzguts.h"
 
-#if defined(_WIN32) && !defined(__BORLANDC__)
+#if defined(WIN32) && !defined(__BORLANDC__)
 #  define LSEEK _lseeki64
 #else
 #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
@@ -178,7 +178,7 @@ local gzFile gz_open(const void *path, int fd, const char *mode) {
 
     /* open the file with the appropriate flags (or just use fd) */
     state->fd = fd > -1 ? fd : (
-#if defined(_WIN32) || defined(__MINGW__)
+#if defined(WIN32) || defined(__MINGW__)
         fd == -2 ? _wopen(path, oflag, 0666) :
 #elif __CYGWIN__
         fd == -2 ? open(state->path, oflag, 0666) :
index e32e63aaf24f78c16922dea2b6e3a89ea89b87c6..9f3dc4645e8052f09643c38c288d1b9760565a3f 100644 (file)
--- a/infback.c
+++ b/infback.c
@@ -156,7 +156,7 @@ local void fixedtables(struct inflate_state *state) {
     do { \
         PULL(); \
         have--; \
-        hold += (unsigned long)(*next++) << bits; \
+        hold += (*next++ << bits); \
         bits += 8; \
     } while (0)
 
@@ -171,7 +171,7 @@ local void fixedtables(struct inflate_state *state) {
 
 /* Return the low n bits of the bit accumulator (n < 16) */
 #define BITS(n) \
-    ((unsigned)hold & ((1U << (n)) - 1))
+    (hold & ((1U << (n)) - 1))
 
 /* Remove n bits from the bit accumulator */
 #define DROPBITS(n) \
@@ -232,13 +232,13 @@ local void fixedtables(struct inflate_state *state) {
  */
 int ZEXPORT inflateBack(z_stream *strm, in_func in, void *in_desc, out_func out, void *out_desc) {
     struct inflate_state *state;
-    const unsigned char *next;    /* next input */
-    unsigned char *put;     /* next output */
+    const unsigned char *next;  /* next input */
+    unsigned char *put;         /* next output */
     unsigned have, left;        /* available input and output */
-    unsigned long hold;         /* bit buffer */
+    uint32_t hold;              /* bit buffer */
     unsigned bits;              /* bits in bit buffer */
     unsigned copy;              /* number of stored or match bytes to copy */
-    unsigned char *from;    /* where to copy match bytes from */
+    unsigned char *from;        /* where to copy match bytes from */
     code here;                  /* current decoding table entry */
     code last;                  /* parent table entry */
     unsigned len;               /* length to copy for repeats, bits to drop */
@@ -306,7 +306,7 @@ int ZEXPORT inflateBack(z_stream *strm, in_func in, void *in_desc, out_func out,
                 state->mode = BAD;
                 break;
             }
-            state->length = (unsigned)hold & 0xffff;
+            state->length = (uint16_t)hold;
             Tracev((stderr, "inflate:       stored length %u\n", state->length));
             INITBITS();
 
@@ -373,7 +373,7 @@ int ZEXPORT inflateBack(z_stream *strm, in_func in, void *in_desc, out_func out,
             while (state->have < state->nlen + state->ndist) {
                 for (;;) {
                     here = state->lencode[BITS(state->lenbits)];
-                    if ((unsigned)(here.bits) <= bits)
+                    if (here.bits <= bits)
                         break;
                     PULLBYTE();
                 }
@@ -464,7 +464,7 @@ int ZEXPORT inflateBack(z_stream *strm, in_func in, void *in_desc, out_func out,
             /* get a literal, length, or end-of-block code */
             for (;;) {
                 here = state->lencode[BITS(state->lenbits)];
-                if ((unsigned)(here.bits) <= bits)
+                if (here.bits <= bits)
                     break;
                 PULLBYTE();
             }
@@ -473,14 +473,14 @@ int ZEXPORT inflateBack(z_stream *strm, in_func in, void *in_desc, out_func out,
                 for (;;) {
                     here = state->lencode[last.val +
                             (BITS(last.bits + last.op) >> last.bits)];
-                    if ((unsigned)(last.bits + here.bits) <= bits)
+                    if ((unsigned)last.bits + (unsigned)here.bits <= bits)
                         break;
                     PULLBYTE();
                 }
                 DROPBITS(last.bits);
             }
             DROPBITS(here.bits);
-            state->length = (unsigned)here.val;
+            state->length = here.val;
 
             /* process literal */
             if (here.op == 0) {
@@ -509,7 +509,7 @@ int ZEXPORT inflateBack(z_stream *strm, in_func in, void *in_desc, out_func out,
             }
 
             /* length code -- get extra bits, if any */
-            state->extra = (unsigned)(here.op) & 15;
+            state->extra = (here.op & 15);
             if (state->extra != 0) {
                 NEEDBITS(state->extra);
                 state->length += BITS(state->extra);
@@ -520,7 +520,7 @@ int ZEXPORT inflateBack(z_stream *strm, in_func in, void *in_desc, out_func out,
             /* get distance code */
             for (;;) {
                 here = state->distcode[BITS(state->distbits)];
-                if ((unsigned)(here.bits) <= bits)
+                if (here.bits <= bits)
                     break;
                 PULLBYTE();
             }
@@ -528,7 +528,7 @@ int ZEXPORT inflateBack(z_stream *strm, in_func in, void *in_desc, out_func out,
                 last = here;
                 for (;;) {
                     here = state->distcode[last.val + (BITS(last.bits + last.op) >> last.bits)];
-                    if ((unsigned)(last.bits + here.bits) <= bits)
+                    if ((unsigned)last.bits + (unsigned)here.bits <= bits)
                         break;
                     PULLBYTE();
                 }
@@ -540,10 +540,10 @@ int ZEXPORT inflateBack(z_stream *strm, in_func in, void *in_desc, out_func out,
                 state->mode = BAD;
                 break;
             }
-            state->offset = (unsigned)here.val;
+            state->offset = here.val;
 
             /* get distance extra bits, if any */
-            state->extra = (unsigned)(here.op) & 15;
+            state->extra = (here.op & 15);
             if (state->extra != 0) {
                 NEEDBITS(state->extra);
                 state->offset += BITS(state->extra);
index b7e72d4277bb13f35d0af630e7babf37c84d1ebd..8acb261d008f7fe324044d183cfd388c48d23e9c 100644 (file)
--- a/inffast.c
+++ b/inffast.c
@@ -29,7 +29,7 @@
 
 /* Return the low n bits of the bit accumulator (n < 16) */
 #define BITS(n) \
-    ((unsigned)hold & ((1U << (n)) - 1))
+    (hold & ((1U << (n)) - 1))
 
 /* Remove n bits from the bit accumulator */
 #define DROPBITS(n) \
       requires strm->avail_out >= 258 for each loop to avoid checking for
       output space.
  */
-void ZLIB_INTERNAL inflate_fast(z_stream *strm, unsigned start) {
+void ZLIB_INTERNAL inflate_fast(z_stream *strm, unsigned long start) {
     /* start: inflate()'s starting value for strm->avail_out */
     struct inflate_state *state;
-    const unsigned char *in;      /* local strm->next_in */
-    const unsigned char *last;    /* have enough input while in < last */
-    unsigned char *out;     /* local strm->next_out */
-    unsigned char *beg;     /* inflate()'s initial strm->next_out */
-    unsigned char *end;     /* while out < end, enough space available */
+    const unsigned char *in;    /* local strm->next_in */
+    const unsigned char *last;  /* have enough input while in < last */
+    unsigned char *out;         /* local strm->next_out */
+    unsigned char *beg;         /* inflate()'s initial strm->next_out */
+    unsigned char *end;         /* while out < end, enough space available */
 #ifdef INFLATE_STRICT
     unsigned dmax;              /* maximum distance from zlib header */
 #endif
     unsigned wsize;             /* window size or zero if not using window */
     unsigned whave;             /* valid bytes in the window */
     unsigned wnext;             /* window write index */
-    unsigned char *window;  /* allocated sliding window, if wsize != 0 */
-    unsigned long hold;         /* local strm->hold */
+    unsigned char *window;      /* allocated sliding window, if wsize != 0 */
+    uint32_t hold;              /* local strm->hold */
     unsigned bits;              /* local strm->bits */
-    code const *lcode;      /* local strm->lencode */
-    code const *dcode;      /* local strm->distcode */
+    code const *lcode;          /* local strm->lencode */
+    code const *dcode;          /* local strm->distcode */
     unsigned lmask;             /* mask for first level of length codes */
     unsigned dmask;             /* mask for first level of distance codes */
     code here;                  /* retrieved table entry */
@@ -99,7 +99,7 @@ void ZLIB_INTERNAL inflate_fast(z_stream *strm, unsigned start) {
                                 /*  window position, window bytes to copy */
     unsigned len;               /* match length, unused bytes */
     unsigned dist;              /* match distance */
-    unsigned char *from;    /* where to copy match from */
+    unsigned char *from;        /* where to copy match from */
 
     /* copy state to local variables */
     state = (struct inflate_state *)strm->state;
@@ -126,26 +126,26 @@ void ZLIB_INTERNAL inflate_fast(z_stream *strm, unsigned start) {
        input data or output space */
     do {
         if (bits < 15) {
-            hold += (unsigned long)(PUP(in)) << bits;
+            hold += (PUP(in) << bits);
             bits += 8;
-            hold += (unsigned long)(PUP(in)) << bits;
+            hold += (PUP(in) << bits);
             bits += 8;
         }
         here = lcode[hold & lmask];
       dolen:
         DROPBITS(here.bits);
-        op = (unsigned)(here.op);
+        op = here.op;
         if (op == 0) {                          /* literal */
             Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
                     "inflate:         literal '%c'\n" :
                     "inflate:         literal 0x%02x\n", here.val));
             PUP(out) = (unsigned char)(here.val);
         } else if (op & 16) {                     /* length base */
-            len = (unsigned)(here.val);
+            len = here.val;
             op &= 15;                           /* number of extra bits */
             if (op) {
                 if (bits < op) {
-                    hold += (unsigned long)(PUP(in)) << bits;
+                    hold += (PUP(in) << bits);
                     bits += 8;
                 }
                 len += BITS(op);
@@ -153,23 +153,23 @@ void ZLIB_INTERNAL inflate_fast(z_stream *strm, unsigned start) {
             }
             Tracevv((stderr, "inflate:         length %u\n", len));
             if (bits < 15) {
-                hold += (unsigned long)(PUP(in)) << bits;
+                hold += (PUP(in) << bits);
                 bits += 8;
-                hold += (unsigned long)(PUP(in)) << bits;
+                hold += (PUP(in) << bits);
                 bits += 8;
             }
             here = dcode[hold & dmask];
           dodist:
             DROPBITS(here.bits);
-            op = (unsigned)(here.op);
+            op = here.op;
             if (op & 16) {                      /* distance base */
-                dist = (unsigned)(here.val);
+                dist = here.val;
                 op &= 15;                       /* number of extra bits */
                 if (bits < op) {
-                    hold += (unsigned long)(PUP(in)) << bits;
+                    hold += (PUP(in) << bits);
                     bits += 8;
                     if (bits < op) {
-                        hold += (unsigned long)(PUP(in)) << bits;
+                        hold += (PUP(in) << bits);
                         bits += 8;
                     }
                 }
index 47a218ca73dfe135d327b1fce62fa49147a3bed8..0d75614772a752050785ed9785ebded95a53d95a 100644 (file)
--- a/inffast.h
+++ b/inffast.h
@@ -10,6 +10,6 @@
    subject to change. Applications should only use zlib.h.
  */
 
-void ZLIB_INTERNAL inflate_fast(z_stream *strm, unsigned start);
+void ZLIB_INTERNAL inflate_fast(z_stream *strm, unsigned long start);
 
 #endif /* INFFAST_H_ */
index 1b9400824c60ea4bb12c724627a032716f84d193..3415aeeb02ef84fdc61eb2f87cc126f046b44cbe 100644 (file)
--- a/inflate.c
+++ b/inflate.c
 
 /* function prototypes */
 local void fixedtables(struct inflate_state *state);
-local int updatewindow(z_stream *strm, const unsigned char *end, unsigned copy);
+local int updatewindow(z_stream *strm, const unsigned char *end, uint32_t copy);
 #ifdef BUILDFIXED
     void makefixed(void);
 #endif
-local unsigned syncsearch(unsigned *have, const unsigned char *buf, unsigned len);
+local uint32_t syncsearch(uint32_t *have, const unsigned char *buf, uint32_t len);
 
 int ZEXPORT inflateResetKeep(z_stream *strm) {
     struct inflate_state *state;
@@ -350,9 +350,9 @@ void makefixed(void) {
    output will fall in the output data, making match copies simpler and faster.
    The advantage may be dependent on the size of the processor's data caches.
  */
-local int updatewindow(z_stream *strm, const unsigned char *end, unsigned copy) {
+local int updatewindow(z_stream *strm, const unsigned char *end, uint32_t copy) {
     struct inflate_state *state;
-    unsigned dist;
+    uint32_t dist;
 
     state = (struct inflate_state *)strm->state;
 
@@ -460,7 +460,7 @@ local int updatewindow(z_stream *strm, const unsigned char *end, unsigned copy)
     do { \
         if (have == 0) goto inf_leave; \
         have--; \
-        hold += (unsigned long)(*next++) << bits; \
+        hold += (*next++ << bits); \
         bits += 8; \
     } while (0)
 
@@ -474,7 +474,7 @@ local int updatewindow(z_stream *strm, const unsigned char *end, unsigned copy)
 
 /* Return the low n bits of the bit accumulator (n < 16) */
 #define BITS(n) \
-    ((unsigned)hold & ((1U << (n)) - 1))
+    (hold & ((1U << (n)) - 1))
 
 /* Remove n bits from the bit accumulator */
 #define DROPBITS(n) \
@@ -574,14 +574,14 @@ local int updatewindow(z_stream *strm, const unsigned char *end, unsigned copy)
 
 int ZEXPORT inflate(z_stream *strm, int flush) {
     struct inflate_state *state;
-    const unsigned char *next;    /* next input */
-    unsigned char *put;     /* next output */
+    const unsigned char *next;  /* next input */
+    unsigned char *put;         /* next output */
     unsigned have, left;        /* available input and output */
-    unsigned long hold;         /* bit buffer */
+    uint32_t hold;              /* bit buffer */
     unsigned bits;              /* bits in bit buffer */
-    unsigned in, out;           /* save starting available input and output */
+    uint32_t in, out;           /* save starting available input and output */
     unsigned copy;              /* number of stored or match bytes to copy */
-    unsigned char *from;    /* where to copy match bytes from */
+    unsigned char *from;        /* where to copy match bytes from */
     code here;                  /* current decoding table entry */
     code last;                  /* parent table entry */
     unsigned len;               /* length to copy for repeats, bits to drop */
@@ -694,9 +694,9 @@ int ZEXPORT inflate(z_stream *strm, int flush) {
         case EXLEN:
             if (state->flags & 0x0400) {
                 NEEDBITS(16);
-                state->length = (unsigned)(hold);
+                state->length = (uint16_t)hold;
                 if (state->head != Z_NULL)
-                    state->head->extra_len = (unsigned)hold;
+                    state->head->extra_len = (uint16_t)hold;
                 if (state->flags & 0x0200)
                     CRC2(state->check, hold);
                 INITBITS();
@@ -842,7 +842,7 @@ int ZEXPORT inflate(z_stream *strm, int flush) {
                 state->mode = BAD;
                 break;
             }
-            state->length = (unsigned)hold & 0xffff;
+            state->length = (uint16_t)hold;
             Tracev((stderr, "inflate:       stored length %u\n", state->length));
             INITBITS();
             state->mode = COPY_;
@@ -909,7 +909,7 @@ int ZEXPORT inflate(z_stream *strm, int flush) {
             while (state->have < state->nlen + state->ndist) {
                 for (;;) {
                     here = state->lencode[BITS(state->lenbits)];
-                    if ((unsigned)(here.bits) <= bits) break;
+                    if (here.bits <= bits) break;
                     PULLBYTE();
                 }
                 if (here.val < 16) {
@@ -1000,7 +1000,7 @@ int ZEXPORT inflate(z_stream *strm, int flush) {
             state->back = 0;
             for (;;) {
                 here = state->lencode[BITS(state->lenbits)];
-                if ((unsigned)(here.bits) <= bits)
+                if (here.bits <= bits)
                     break;
                 PULLBYTE();
             }
@@ -1008,7 +1008,7 @@ int ZEXPORT inflate(z_stream *strm, int flush) {
                 last = here;
                 for (;;) {
                     here = state->lencode[last.val + (BITS(last.bits + last.op) >> last.bits)];
-                    if ((unsigned)(last.bits + here.bits) <= bits)
+                    if ((unsigned)last.bits + (unsigned)here.bits <= bits)
                         break;
                     PULLBYTE();
                 }
@@ -1017,7 +1017,7 @@ int ZEXPORT inflate(z_stream *strm, int flush) {
             }
             DROPBITS(here.bits);
             state->back += here.bits;
-            state->length = (unsigned)here.val;
+            state->length = here.val;
             if ((int)(here.op) == 0) {
                 Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
                         "inflate:         literal '%c'\n" :
@@ -1036,7 +1036,7 @@ int ZEXPORT inflate(z_stream *strm, int flush) {
                 state->mode = BAD;
                 break;
             }
-            state->extra = (unsigned)(here.op) & 15;
+            state->extra = (here.op & 15);
             state->mode = LENEXT;
         case LENEXT:
             if (state->extra) {
@@ -1051,7 +1051,7 @@ int ZEXPORT inflate(z_stream *strm, int flush) {
         case DIST:
             for (;;) {
                 here = state->distcode[BITS(state->distbits)];
-                if ((unsigned)(here.bits) <= bits)
+                if (here.bits <= bits)
                     break;
                 PULLBYTE();
             }
@@ -1059,7 +1059,7 @@ int ZEXPORT inflate(z_stream *strm, int flush) {
                 last = here;
                 for (;;) {
                     here = state->distcode[last.val + (BITS(last.bits + last.op) >> last.bits)];
-                    if ((unsigned)(last.bits + here.bits) <= bits)
+                    if ((unsigned)last.bits + (unsigned)here.bits <= bits)
                         break;
                     PULLBYTE();
                 }
@@ -1073,8 +1073,8 @@ int ZEXPORT inflate(z_stream *strm, int flush) {
                 state->mode = BAD;
                 break;
             }
-            state->offset = (unsigned)here.val;
-            state->extra = (unsigned)(here.op) & 15;
+            state->offset = here.val;
+            state->extra = (here.op & 15);
             state->mode = DISTEXT;
         case DISTEXT:
             if (state->extra) {
@@ -1239,7 +1239,7 @@ int ZEXPORT inflateEnd(z_stream *strm) {
     return Z_OK;
 }
 
-int ZEXPORT inflateGetDictionary(z_stream *strm, unsigned char *dictionary, uInt *dictLength) {
+int ZEXPORT inflateGetDictionary(z_stream *strm, unsigned char *dictionary, unsigned int *dictLength) {
     struct inflate_state *state;
 
     /* check state */
@@ -1257,7 +1257,7 @@ int ZEXPORT inflateGetDictionary(z_stream *strm, unsigned char *dictionary, uInt
     return Z_OK;
 }
 
-int ZEXPORT inflateSetDictionary(z_stream *strm, const unsigned char *dictionary, uInt dictLength) {
+int ZEXPORT inflateSetDictionary(z_stream *strm, const unsigned char *dictionary, unsigned int dictLength) {
     struct inflate_state *state;
     unsigned long dictid;
     int ret;
@@ -1316,9 +1316,9 @@ int ZEXPORT inflateGetHeader(z_stream *strm, gz_headerp head) {
    called again with more data and the *have state.  *have is initialized to
    zero for the first call.
  */
-local unsigned syncsearch(unsigned *have, const unsigned char *buf, unsigned len) {
-    unsigned got;
-    unsigned next;
+local unsigned syncsearch(uint32_t *have, const unsigned char *buf, uint32_t len) {
+    uint32_t got;
+    uint32_t next;
 
     got = *have;
     next = 0;
index 9cb7f06facc6697eb421f6d76dc391d1943f86d8..2bf129db153559559c23bc15054aa6ca25c551cd 100644 (file)
--- a/inflate.h
+++ b/inflate.h
@@ -93,28 +93,28 @@ struct inflate_state {
     gz_headerp head;            /* where to save gzip header information */
         /* sliding window */
     unsigned wbits;             /* log base 2 of requested window size */
-    unsigned wsize;             /* window size or zero if not using window */
-    unsigned whave;             /* valid bytes in the window */
-    unsigned wnext;             /* window write index */
-    unsigned char *window;  /* allocated sliding window, if needed */
+    uint32_t wsize;             /* window size or zero if not using window */
+    uint32_t whave;             /* valid bytes in the window */
+    uint32_t wnext;             /* window write index */
+    unsigned char *window;      /* allocated sliding window, if needed */
         /* bit accumulator */
-    unsigned long hold;         /* input bit accumulator */
+    uint32_t hold;              /* input bit accumulator */
     unsigned bits;              /* number of bits in "in" */
         /* for string and stored block copying */
-    unsigned length;            /* literal or length of data to copy */
+    uint32_t length;            /* literal or length of data to copy */
     unsigned offset;            /* distance back to copy string from */
         /* for table and code decoding */
     unsigned extra;             /* extra bits needed */
         /* fixed and dynamic code tables */
-    code const *lencode;    /* starting table for length/literal codes */
-    code const *distcode;   /* starting table for distance codes */
+    code const *lencode;        /* starting table for length/literal codes */
+    code const *distcode;       /* starting table for distance codes */
     unsigned lenbits;           /* index bits for lencode */
     unsigned distbits;          /* index bits for distcode */
         /* dynamic table building */
     unsigned ncode;             /* number of code length code lengths */
     unsigned nlen;              /* number of length code lengths */
     unsigned ndist;             /* number of distance code lengths */
-    unsigned have;              /* number of code lengths in lens[] */
+    uint32_t have;              /* number of code lengths in lens[] */
     code *next;                 /* next available space in codes[] */
     uint16_t lens[320];         /* temporary storage for code lengths */
     uint16_t work[288];         /* work area for code table building */
diff --git a/match.c b/match.c
index 0d934e20553565c1884a34e00b0577004ce6732a..ea42561477c25e80076deb78f0d3ea552ea3b8df 100644 (file)
--- a/match.c
+++ b/match.c
@@ -76,7 +76,7 @@ ZLIB_INTERNAL unsigned longest_match(deflate_state *const s, IPos cur_match) {
      * Do not looks for matches beyond the end of the input. This is
      * necessary to make deflate deterministic
      */
-    nice_match = (uInt)s->nice_match > s->lookahead ? s->lookahead : s->nice_match;
+    nice_match = (unsigned int)s->nice_match > s->lookahead ? s->lookahead : s->nice_match;
 
     /*
      * Stop when cur_match becomes <= limit. To simplify the code,
@@ -194,7 +194,7 @@ ZLIB_INTERNAL unsigned longest_match(deflate_state *const s, IPos cur_match) {
      * Do not looks for matches beyond the end of the input. This is
      * necessary to make deflate deterministic
      */
-    nice_match = (uInt)s->nice_match > s->lookahead ? s->lookahead : s->nice_match;
+    nice_match = (unsigned int)s->nice_match > s->lookahead ? s->lookahead : s->nice_match;
 
     /*
      * Stop when cur_match becomes <= limit. To simplify the code,
@@ -290,7 +290,7 @@ ZLIB_INTERNAL unsigned longest_match(deflate_state *const s, IPos cur_match) {
  * then-clause of the "#ifdef UNALIGNED_OK"-directive)
  *
  * ------------------------------------------------------------
- * uInt longest_match(...) {
+ * unsigned int longest_match(...) {
  *    ...
  *    do {
  *        match = s->window + cur_match;                //s0
@@ -359,7 +359,7 @@ ZLIB_INTERNAL unsigned longest_match(deflate_state *const s, IPos cur_match) {
      * we prevent matches with the string of window index 0.
      */
     Pos *prev = s->prev;
-    uInt wmask = s->w_mask;
+    unsigned int wmask = s->w_mask;
 
     register unsigned char *strend = s->window + s->strstart + MAX_MATCH;
     register uint16_t scan_start = *(uint16_t*)scan;
@@ -377,9 +377,9 @@ ZLIB_INTERNAL unsigned longest_match(deflate_state *const s, IPos cur_match) {
     /* Do not look for matches beyond the end of the input. This is necessary
      * to make deflate deterministic.
      */
-    if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
+    if ((unsigned int)nice_match > s->lookahead) nice_match = s->lookahead;
 
-    Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
+    Assert((unsigned long)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
 
     do {
         Assert(cur_match < s->strstart, "no future");
@@ -464,8 +464,8 @@ ZLIB_INTERNAL unsigned longest_match(deflate_state *const s, IPos cur_match) {
         }
     } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length != 0);
 
-    if ((uInt)best_len <= s->lookahead)
-        return (uInt)best_len;
+    if ((unsigned int)best_len <= s->lookahead)
+        return (unsigned int)best_len;
     return s->lookahead;
 }
 #endif
diff --git a/match.h b/match.h
index 69b34c1f132cb77b7a9061923c6831a14537147b..7084201984980325c7c8f00ac1624ff47aaadf14 100644 (file)
--- a/match.h
+++ b/match.h
@@ -1,6 +1,6 @@
 #ifndef MATCH_H_
 #define MATCH_H_
 
-uInt longest_match  (deflate_state *s, IPos cur_match);
+unsigned int longest_match  (deflate_state *s, IPos cur_match);
 
 #endif /* MATCH_H_ */
index 7ff64c8075500e66604ff75ba83ee825ae920739..eaf45014469060534aa9e12f359523f2f583e767 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <string.h>
 #include <stdlib.h>
+#include <inttypes.h>
 
 #define TESTFILE "foo.gz"
 
@@ -26,32 +27,32 @@ const char hello[] = "hello, hello!";
  */
 
 const char dictionary[] = "hello";
-uLong dictId; /* Adler32 value of the dictionary */
-
-void test_deflate       (unsigned char *compr, uLong comprLen);
-void test_inflate       (unsigned char *compr, uLong comprLen, unsigned char *uncompr, uLong uncomprLen);
-void test_large_deflate (unsigned char *compr, uLong comprLen, unsigned char *uncompr, uLong uncomprLen);
-void test_large_inflate (unsigned char *compr, uLong comprLen, unsigned char *uncompr, uLong uncomprLen);
-void test_flush         (unsigned char *compr, uLong *comprLen);
-void test_sync          (unsigned char *compr, uLong comprLen, unsigned char *uncompr, uLong uncomprLen);
-void test_dict_deflate  (unsigned char *compr, uLong comprLen);
-void test_dict_inflate  (unsigned char *compr, uLong comprLen, unsigned char *uncompr, uLong uncomprLen);
+unsigned long dictId; /* Adler32 value of the dictionary */
+
+void test_deflate       (unsigned char *compr, unsigned long comprLen);
+void test_inflate       (unsigned char *compr, unsigned long comprLen, unsigned char *uncompr, unsigned long uncomprLen);
+void test_large_deflate (unsigned char *compr, unsigned long comprLen, unsigned char *uncompr, unsigned long uncomprLen);
+void test_large_inflate (unsigned char *compr, unsigned long comprLen, unsigned char *uncompr, unsigned long uncomprLen);
+void test_flush         (unsigned char *compr, unsigned long *comprLen);
+void test_sync          (unsigned char *compr, unsigned long comprLen, unsigned char *uncompr, unsigned long uncomprLen);
+void test_dict_deflate  (unsigned char *compr, unsigned long comprLen);
+void test_dict_inflate  (unsigned char *compr, unsigned long comprLen, unsigned char *uncompr, unsigned long uncomprLen);
 int  main               (int argc, char *argv[]);
 
 
 static alloc_func zalloc = (alloc_func)0;
 static free_func zfree = (free_func)0;
 
-void test_compress      (unsigned char *compr, uLong comprLen,
-                            unsigned char *uncompr, uLong uncomprLen);
+void test_compress      (unsigned char *compr, unsigned long comprLen,
+                            unsigned char *uncompr, unsigned long uncomprLen);
 
 /* ===========================================================================
  * Test compress() and uncompress()
  */
-void test_compress(unsigned char *compr, uLong comprLen, unsigned char *uncompr, uLong uncomprLen)
+void test_compress(unsigned char *compr, unsigned long comprLen, unsigned char *uncompr, unsigned long uncomprLen)
 {
     int err;
-    uLong len = (uLong)strlen(hello)+1;
+    unsigned long len = (unsigned long)strlen(hello)+1;
 
     err = compress(compr, &comprLen, (const unsigned char*)hello, len);
     CHECK_ERR(err, "compress");
@@ -71,12 +72,12 @@ void test_compress(unsigned char *compr, uLong comprLen, unsigned char *uncompr,
 
 #ifdef WITH_GZFILEOP
 void test_gzio          (const char *fname,
-                            unsigned char *uncompr, uLong uncomprLen);
+                            unsigned char *uncompr, unsigned long uncomprLen);
 
 /* ===========================================================================
  * Test read/write of .gz files
  */
-void test_gzio(const char *fname, unsigned char *uncompr, uLong uncomprLen)
+void test_gzio(const char *fname, unsigned char *uncompr, unsigned long uncomprLen)
 {
 #ifdef NO_GZCOMPRESS
     fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n");
@@ -159,11 +160,11 @@ void test_gzio(const char *fname, unsigned char *uncompr, uLong uncomprLen)
 /* ===========================================================================
  * Test deflate() with small buffers
  */
-void test_deflate(unsigned char *compr, uLong comprLen)
+void test_deflate(unsigned char *compr, unsigned long comprLen)
 {
     z_stream c_stream; /* compression stream */
     int err;
-    uLong len = (uLong)strlen(hello)+1;
+    unsigned long len = (unsigned long)strlen(hello)+1;
 
     c_stream.zalloc = zalloc;
     c_stream.zfree = zfree;
@@ -195,7 +196,7 @@ void test_deflate(unsigned char *compr, uLong comprLen)
 /* ===========================================================================
  * Test inflate() with small buffers
  */
-void test_inflate(unsigned char *compr, uLong comprLen, unsigned char *uncompr, uLong uncomprLen)
+void test_inflate(unsigned char *compr, unsigned long comprLen, unsigned char *uncompr, unsigned long uncomprLen)
 {
     int err;
     z_stream d_stream; /* decompression stream */
@@ -234,7 +235,7 @@ void test_inflate(unsigned char *compr, uLong comprLen, unsigned char *uncompr,
 /* ===========================================================================
  * Test deflate() with large buffers and dynamic change of compression level
  */
-void test_large_deflate(unsigned char *compr, uLong comprLen, unsigned char *uncompr, uLong uncomprLen)
+void test_large_deflate(unsigned char *compr, unsigned long comprLen, unsigned char *uncompr, unsigned long uncomprLen)
 {
     z_stream c_stream; /* compression stream */
     int err;
@@ -247,13 +248,13 @@ void test_large_deflate(unsigned char *compr, uLong comprLen, unsigned char *unc
     CHECK_ERR(err, "deflateInit");
 
     c_stream.next_out = compr;
-    c_stream.avail_out = (uInt)comprLen;
+    c_stream.avail_out = (unsigned int)comprLen;
 
     /* At this point, uncompr is still mostly zeroes, so it should compress
      * very well:
      */
     c_stream.next_in = uncompr;
-    c_stream.avail_in = (uInt)uncomprLen;
+    c_stream.avail_in = (unsigned int)uncomprLen;
     err = deflate(&c_stream, Z_NO_FLUSH);
     CHECK_ERR(err, "deflate");
     if (c_stream.avail_in != 0) {
@@ -264,14 +265,14 @@ void test_large_deflate(unsigned char *compr, uLong comprLen, unsigned char *unc
     /* Feed in already compressed data and switch to no compression: */
     deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
     c_stream.next_in = compr;
-    c_stream.avail_in = (uInt)comprLen/2;
+    c_stream.avail_in = (unsigned int)comprLen/2;
     err = deflate(&c_stream, Z_NO_FLUSH);
     CHECK_ERR(err, "deflate");
 
     /* Switch back to compressing mode: */
     deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
     c_stream.next_in = uncompr;
-    c_stream.avail_in = (uInt)uncomprLen;
+    c_stream.avail_in = (unsigned int)uncomprLen;
     err = deflate(&c_stream, Z_NO_FLUSH);
     CHECK_ERR(err, "deflate");
 
@@ -287,7 +288,7 @@ void test_large_deflate(unsigned char *compr, uLong comprLen, unsigned char *unc
 /* ===========================================================================
  * Test inflate() with large buffers
  */
-void test_large_inflate(unsigned char *compr, uLong comprLen, unsigned char *uncompr, uLong uncomprLen)
+void test_large_inflate(unsigned char *compr, unsigned long comprLen, unsigned char *uncompr, unsigned long uncomprLen)
 {
     int err;
     z_stream d_stream; /* decompression stream */
@@ -299,14 +300,14 @@ void test_large_inflate(unsigned char *compr, uLong comprLen, unsigned char *unc
     d_stream.opaque = (void *)0;
 
     d_stream.next_in  = compr;
-    d_stream.avail_in = (uInt)comprLen;
+    d_stream.avail_in = (unsigned int)comprLen;
 
     err = inflateInit(&d_stream);
     CHECK_ERR(err, "inflateInit");
 
     for (;;) {
         d_stream.next_out = uncompr;            /* discard the output */
-        d_stream.avail_out = (uInt)uncomprLen;
+        d_stream.avail_out = (unsigned int)uncomprLen;
         err = inflate(&d_stream, Z_NO_FLUSH);
         if (err == Z_STREAM_END) break;
         CHECK_ERR(err, "large inflate");
@@ -316,7 +317,7 @@ void test_large_inflate(unsigned char *compr, uLong comprLen, unsigned char *unc
     CHECK_ERR(err, "inflateEnd");
 
     if (d_stream.total_out != 2*uncomprLen + comprLen/2) {
-        fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out);
+        fprintf(stderr, "bad large inflate: %" PRId32 "\n", d_stream.total_out);
         exit(1);
     } else {
         printf("large_inflate(): OK\n");
@@ -326,11 +327,11 @@ void test_large_inflate(unsigned char *compr, uLong comprLen, unsigned char *unc
 /* ===========================================================================
  * Test deflate() with full flush
  */
-void test_flush(unsigned char *compr, uLong *comprLen)
+void test_flush(unsigned char *compr, unsigned long *comprLen)
 {
     z_stream c_stream; /* compression stream */
     int err;
-    uInt len = (uInt)strlen(hello)+1;
+    unsigned int len = (unsigned int)strlen(hello)+1;
 
     c_stream.zalloc = zalloc;
     c_stream.zfree = zfree;
@@ -342,7 +343,7 @@ void test_flush(unsigned char *compr, uLong *comprLen)
     c_stream.next_in  = (const unsigned char *)hello;
     c_stream.next_out = compr;
     c_stream.avail_in = 3;
-    c_stream.avail_out = (uInt)*comprLen;
+    c_stream.avail_out = (unsigned int)*comprLen;
     err = deflate(&c_stream, Z_FULL_FLUSH);
     CHECK_ERR(err, "deflate");
 
@@ -362,7 +363,7 @@ void test_flush(unsigned char *compr, uLong *comprLen)
 /* ===========================================================================
  * Test inflateSync()
  */
-void test_sync(unsigned char *compr, uLong comprLen, unsigned char *uncompr, uLong uncomprLen)
+void test_sync(unsigned char *compr, unsigned long comprLen, unsigned char *uncompr, unsigned long uncomprLen)
 {
     int err;
     z_stream d_stream; /* decompression stream */
@@ -380,12 +381,12 @@ void test_sync(unsigned char *compr, uLong comprLen, unsigned char *uncompr, uLo
     CHECK_ERR(err, "inflateInit");
 
     d_stream.next_out = uncompr;
-    d_stream.avail_out = (uInt)uncomprLen;
+    d_stream.avail_out = (unsigned int)uncomprLen;
 
     err = inflate(&d_stream, Z_NO_FLUSH);
     CHECK_ERR(err, "inflate");
 
-    d_stream.avail_in = (uInt)comprLen-2;   /* read all compressed data */
+    d_stream.avail_in = (unsigned int)comprLen-2;   /* read all compressed data */
     err = inflateSync(&d_stream);           /* but skip the damaged part */
     CHECK_ERR(err, "inflateSync");
 
@@ -404,7 +405,7 @@ void test_sync(unsigned char *compr, uLong comprLen, unsigned char *uncompr, uLo
 /* ===========================================================================
  * Test deflate() with preset dictionary
  */
-void test_dict_deflate(unsigned char *compr, uLong comprLen)
+void test_dict_deflate(unsigned char *compr, unsigned long comprLen)
 {
     z_stream c_stream; /* compression stream */
     int err;
@@ -422,10 +423,10 @@ void test_dict_deflate(unsigned char *compr, uLong comprLen)
 
     dictId = c_stream.adler;
     c_stream.next_out = compr;
-    c_stream.avail_out = (uInt)comprLen;
+    c_stream.avail_out = (unsigned int)comprLen;
 
     c_stream.next_in = (const unsigned char *)hello;
-    c_stream.avail_in = (uInt)strlen(hello)+1;
+    c_stream.avail_in = (unsigned int)strlen(hello)+1;
 
     err = deflate(&c_stream, Z_FINISH);
     if (err != Z_STREAM_END) {
@@ -439,7 +440,7 @@ void test_dict_deflate(unsigned char *compr, uLong comprLen)
 /* ===========================================================================
  * Test inflate() with a preset dictionary
  */
-void test_dict_inflate(unsigned char *compr, uLong comprLen, unsigned char *uncompr, uLong uncomprLen)
+void test_dict_inflate(unsigned char *compr, unsigned long comprLen, unsigned char *uncompr, unsigned long uncomprLen)
 {
     int err;
     z_stream d_stream; /* decompression stream */
@@ -451,13 +452,13 @@ void test_dict_inflate(unsigned char *compr, uLong comprLen, unsigned char *unco
     d_stream.opaque = (void *)0;
 
     d_stream.next_in  = compr;
-    d_stream.avail_in = (uInt)comprLen;
+    d_stream.avail_in = (unsigned int)comprLen;
 
     err = inflateInit(&d_stream);
     CHECK_ERR(err, "inflateInit");
 
     d_stream.next_out = uncompr;
-    d_stream.avail_out = (uInt)uncomprLen;
+    d_stream.avail_out = (unsigned int)uncomprLen;
 
     for (;;) {
         err = inflate(&d_stream, Z_NO_FLUSH);
@@ -491,8 +492,8 @@ void test_dict_inflate(unsigned char *compr, uLong comprLen, unsigned char *unco
 int main(int argc, char *argv[])
 {
     unsigned char *compr, *uncompr;
-    uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */
-    uLong uncomprLen = comprLen;
+    unsigned long comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */
+    unsigned long uncomprLen = comprLen;
     static const char* myVersion = ZLIB_VERSION;
 
     if (zlibVersion()[0] != myVersion[0]) {
@@ -506,8 +507,8 @@ int main(int argc, char *argv[])
     printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n",
             ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags());
 
-    compr    = (unsigned char*)calloc((uInt)comprLen, 1);
-    uncompr  = (unsigned char*)calloc((uInt)uncomprLen, 1);
+    compr    = (unsigned char*)calloc((unsigned int)comprLen, 1);
+    uncompr  = (unsigned char*)calloc((unsigned int)uncomprLen, 1);
     /* compr and uncompr are cleared to avoid reading uninitialized
      * data and to ensure that uncompr compresses well.
      */
index 5ea57100fe2047e68c86b5b4f3dde9c6a3559d56..15f170404e6a6f81221c956955fe7054a17cb0e2 100644 (file)
@@ -184,7 +184,7 @@ int gzread(gzFile gz, void *buf, unsigned len)
         if (strm->avail_in == 0)
         {
             strm->next_in = gz->buf;
-            strm->avail_in = (uInt)fread(gz->buf, 1, BUFLEN, gz->file);
+            strm->avail_in = (uint32_t)fread(gz->buf, 1, BUFLEN, gz->file);
         }
         if (strm->avail_in > 0)
         {
diff --git a/trees.c b/trees.c
index ab47326f1e4887174533093018b64430f0ee8e6f..72ab110fa8afc1d69516e06e266eb354a9dcd9de 100644 (file)
--- a/trees.c
+++ b/trees.c
@@ -112,11 +112,11 @@ local int base_dist[D_CODES];
 #endif /* GEN_TREES_H */
 
 struct static_tree_desc_s {
-    const ct_data *static_tree;  /* static tree or NULL */
-    const int *extra_bits;      /* extra bits for each code or NULL */
-    int     extra_base;          /* base index for extra_bits */
-    int     elems;               /* max number of elements in the tree */
-    int     max_length;          /* max bit length for the codes */
+    const ct_data *static_tree; /* static tree or NULL */
+    const int     *extra_bits;  /* extra bits for each code or NULL */
+    int            extra_base;  /* base index for extra_bits */
+    int            elems;       /* max number of elements in the tree */
+    unsigned int   max_length;  /* max bit length for the codes */
 };
 
 local const static_tree_desc  static_l_desc =
@@ -401,15 +401,15 @@ local void pqdownheap(deflate_state *s, ct_data *tree, int k) {
  */
 local void gen_bitlen(deflate_state *s, tree_desc *desc) {
     /* desc: the tree descriptor */
-    ct_data *tree        = desc->dyn_tree;
-    int max_code         = desc->max_code;
-    const ct_data *stree = desc->stat_desc->static_tree;
-    const int *extra     = desc->stat_desc->extra_bits;
-    int base             = desc->stat_desc->extra_base;
-    int max_length       = desc->stat_desc->max_length;
+    ct_data *tree           = desc->dyn_tree;
+    int max_code            = desc->max_code;
+    const ct_data *stree    = desc->stat_desc->static_tree;
+    const int *extra        = desc->stat_desc->extra_bits;
+    int base                = desc->stat_desc->extra_base;
+    unsigned int max_length = desc->stat_desc->max_length;
     int h;              /* heap index */
     int n, m;           /* iterate over the tree elements */
-    int bits;           /* bit length */
+    unsigned int bits;  /* bit length */
     int xbits;          /* extra bits */
     uint16_t f;         /* frequency */
     int overflow = 0;   /* number of elements with bit length too large */
@@ -438,9 +438,9 @@ local void gen_bitlen(deflate_state *s, tree_desc *desc) {
         if (n >= base)
             xbits = extra[n-base];
         f = tree[n].Freq;
-        s->opt_len += (ulg)f * (bits + xbits);
+        s->opt_len += (unsigned long)f * (bits + xbits);
         if (stree)
-            s->static_len += (ulg)f * (stree[n].Len + xbits);
+            s->static_len += (unsigned long)f * (stree[n].Len + xbits);
     }
     if (overflow == 0)
         return;
@@ -473,9 +473,9 @@ local void gen_bitlen(deflate_state *s, tree_desc *desc) {
             m = s->heap[--h];
             if (m > max_code)
                 continue;
-            if ((unsigned) tree[m].Len != (unsigned) bits) {
+            if (tree[m].Len != bits) {
                 Trace((stderr, "code %d bits %d->%d\n", m, tree[m].Len, bits));
-                s->opt_len += ((long)bits - (long)tree[m].Len) *(long)tree[m].Freq;
+                s->opt_len += (long)((bits - tree[m].Len) * tree[m].Freq);
                 tree[m].Len = (uint16_t)bits;
             }
             n--;
@@ -784,13 +784,13 @@ local void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes)
 /* ===========================================================================
  * Send a stored block
  */
-void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, char *buf, ulg stored_len, int last) {
+void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, char *buf, unsigned long stored_len, int last) {
     /* buf: input block */
     /* stored_len: length of input block */
     /* last: one if this is the last block for a file */
     send_bits(s, (STORED_BLOCK << 1)+last, 3);    /* send block type */
 #ifdef DEBUG
-    s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
+    s->compressed_len = (s->compressed_len + 3 + 7) & (unsigned long)~7L;
     s->compressed_len += (stored_len + 4) << 3;
 #endif
     copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
@@ -820,11 +820,11 @@ void ZLIB_INTERNAL _tr_align(deflate_state *s) {
  * Determine the best encoding for the current block: dynamic trees, static
  * trees or store, and output the encoded block to the zip file.
  */
-void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, char *buf, ulg stored_len, int last) {
+void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, char *buf, unsigned long stored_len, int last) {
     /* buf: input block, or NULL if too old */
     /* stored_len: length of input block */
     /* last: one if this is the last block for a file */
-    ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
+    unsigned long opt_lenb, static_lenb; /* opt_len and static_len in bytes */
     int max_blindex = 0;  /* index of last bit length code of non zero freq */
 
     /* Build the Huffman trees unless a stored block is forced */
@@ -897,7 +897,7 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, char *buf, ulg stored_len,
     }
     Assert(s->compressed_len == s->bits_sent, "bad compressed size");
     /* The above check is made mod 2^32, for files larger than 512 MB
-     * and uLong implemented on 32 bits.
+     * and unsigned long implemented on 32 bits.
      */
     init_block(s);
 
@@ -938,11 +938,11 @@ int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) {
     /* Try to guess if it is profitable to stop the current block here */
     if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
         /* Compute an upper bound for the compressed length */
-        ulg out_length = (ulg)s->last_lit*8L;
-        ulg in_length = (ulg)((long)s->strstart - s->block_start);
+        unsigned long out_length = (unsigned long)s->last_lit*8L;
+        unsigned long in_length = (unsigned long)((long)s->strstart - s->block_start);
         int dcode;
         for (dcode = 0; dcode < D_CODES; dcode++) {
-            out_length += (ulg)s->dyn_dtree[dcode].Freq * (5L+extra_dbits[dcode]);
+            out_length += (unsigned long)s->dyn_dtree[dcode].Freq * (5L+extra_dbits[dcode]);
         }
         out_length >>= 3;
         Tracev((stderr, "\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
@@ -999,7 +999,7 @@ local void compress_block(deflate_state *s, const ct_data *ltree, const ct_data
             } /* literal or match pair ? */
 
             /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
-            Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, "pendingBuf overflow");
+            Assert((unsigned int)(s->pending) < s->lit_bufsize + 2*lx, "pendingBuf overflow");
         } while (lx < s->last_lit);
     }
 
@@ -1110,7 +1110,7 @@ local void copy_block(deflate_state *s, char *buf, unsigned len, int header) {
 #endif
     }
 #ifdef DEBUG
-    s->bits_sent += (ulg)len << 3;
+    s->bits_sent += (unsigned long)len << 3;
 #endif
     while (len--) {
         put_byte(s, *buf++);
index 9bfb1e1e7dd853f2ad92bf120ced9ea86410e1ac..a195cdcf70243fae1f056ae0fc7fd2c8f98d145d 100644 (file)
--- a/uncompr.c
+++ b/uncompr.c
@@ -1,5 +1,5 @@
 /* uncompr.c -- decompress a memory buffer
- * Copyright (C) 1995-2003, 2010, 2014 Jean-loup Gailly, Mark Adler
+ * Copyright (C) 1995-2003, 2010, 2014 Jean-loup Gailly, Mark Adler.
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
    buffer, or Z_DATA_ERROR if the input data was corrupted, including if the
    input data is an incomplete zlib stream.
 */
-int ZEXPORT uncompress(unsigned char *dest, uLong *destLen, const unsigned char *source, uLong sourceLen) {
+int ZEXPORT uncompress(unsigned char *dest, unsigned long *destLen, const unsigned char *source, unsigned long sourceLen) {
     z_stream stream;
     int err;
-    const uInt max = (uInt)0 - 1;
-    uLong left;
-    Byte buf[1];    /* for detection of incomplete stream when *destLen == 0 */
+    const unsigned int max = (unsigned int)0 - 1;
+    unsigned long left;
+    unsigned char buf[1];    /* for detection of incomplete stream when *destLen == 0 */
 
     if (*destLen) {
         left = *destLen;
@@ -42,7 +42,7 @@ int ZEXPORT uncompress(unsigned char *dest, uLong *destLen, const unsigned char
     stream.avail_in = 0;
     stream.zalloc = (alloc_func)0;
     stream.zfree = (free_func)0;
-    stream.opaque = (void *)0;
+    stream.opaque = NULL;
 
     err = inflateInit(&stream);
     if (err != Z_OK) return err;
index 55488afa5b734bc4afcb439d5e0fed6fb6b2886c..bc5cd5456478dbb3206d57247bbaf73c072a6da0 100644 (file)
@@ -118,7 +118,7 @@ typedef void       *voidp;
 #include <sys/types.h>      /* for off_t */
 #include <stdarg.h>         /* for va_list */
 
-#ifdef _WIN32
+#ifdef WIN32
 #  include <stddef.h>         /* for wchar_t */
 #endif
 
@@ -161,10 +161,10 @@ typedef void       *voidp;
 #  define z_off_t long
 #endif
 
-#if !defined(_WIN32) && defined(Z_LARGE64)
+#if !defined(WIN32) && defined(Z_LARGE64)
 #  define z_off64_t off64_t
 #else
-#  if (defined(_WIN32) || defined(WIN32)) && !defined(__GNUC__)
+#  if defined(WIN32) && !defined(__GNUC__)
 #    define z_off64_t __int64
 #  else
 #    define z_off64_t z_off_t
diff --git a/zlib.h b/zlib.h
index 0c5994dbafc22cc52cd108894f0af3c60a506b86..57087793fb652ef95a709fb5609bcccbdf2f8e8a 100644 (file)
--- a/zlib.h
+++ b/zlib.h
@@ -84,30 +84,30 @@ extern "C" {
   even in case of corrupted input.
 */
 
-typedef void *(*alloc_func) (void *opaque, uInt items, uInt size);
+typedef void *(*alloc_func) (void *opaque, unsigned int items, unsigned int size);
 typedef void  (*free_func)  (void *opaque, void *address);
 
 struct internal_state;
 
 typedef struct z_stream_s {
-    const unsigned char *next_in;   /* next input byte */
-    uInt     avail_in;              /* number of bytes available at next_in */
-    uLong    total_in;              /* total number of input bytes read so far */
+    const unsigned char   *next_in;   /* next input byte */
+    uint32_t              avail_in;   /* number of bytes available at next_in */
+    uint32_t              total_in;   /* total number of input bytes read so far */
 
-    unsigned char    *next_out;     /* next output byte should be put there */
-    uInt     avail_out;             /* remaining free space at next_out */
-    uLong    total_out;             /* total number of bytes output so far */
+    unsigned char         *next_out;  /* next output byte should be put there */
+    uint32_t              avail_out;  /* remaining free space at next_out */
+    uint32_t              total_out;  /* total number of bytes output so far */
 
-    const char *msg;                /* last error message, NULL if no error */
-    struct internal_state *state;   /* not visible by applications */
+    const char            *msg;       /* last error message, NULL if no error */
+    struct internal_state *state;     /* not visible by applications */
 
-    alloc_func zalloc;              /* used to allocate the internal state */
-    free_func  zfree;               /* used to free the internal state */
-    void      *opaque;              /* private data object passed to zalloc and zfree */
+    alloc_func            zalloc;     /* used to allocate the internal state */
+    free_func             zfree;      /* used to free the internal state */
+    void                  *opaque;    /* private data object passed to zalloc and zfree */
 
-    int     data_type;              /* best guess about the data type: binary or text */
-    uint32_t   adler;               /* adler32 value of the uncompressed data */
-    uLong   reserved;               /* reserved for future use */
+    int                   data_type;  /* best guess about the data type: binary or text */
+    uint32_t              adler;      /* adler32 value of the uncompressed data */
+    unsigned long         reserved;   /* reserved for future use */
 } z_stream;
 
 typedef z_stream *z_streamp;  // Obsolete type, retained for compatability only
@@ -117,19 +117,19 @@ typedef z_stream *z_streamp;  // Obsolete type, retained for compatability only
   for more details on the meanings of these fields.
 */
 typedef struct gz_header_s {
-    int     text;               /* true if compressed data believed to be text */
-    uLong   time;               /* modification time */
-    int     xflags;             /* extra flags (not used when writing a gzip file) */
-    int     os;                 /* operating system */
+    int             text;       /* true if compressed data believed to be text */
+    unsigned long   time;       /* modification time */
+    int             xflags;     /* extra flags (not used when writing a gzip file) */
+    int             os;         /* operating system */
     unsigned char   *extra;     /* pointer to extra field or Z_NULL if none */
-    uInt    extra_len;          /* extra field length (valid if extra != Z_NULL) */
-    uInt    extra_max;          /* space at extra (only when reading header) */
+    unsigned int    extra_len;  /* extra field length (valid if extra != Z_NULL) */
+    unsigned int    extra_max;  /* space at extra (only when reading header) */
     unsigned char   *name;      /* pointer to zero-terminated file name or Z_NULL */
-    uInt    name_max;           /* space at name (only when reading header) */
+    unsigned int    name_max;   /* space at name (only when reading header) */
     unsigned char   *comment;   /* pointer to zero-terminated comment or Z_NULL */
-    uInt    comm_max;           /* space at comment (only when reading header) */
-    int     hcrc;               /* true if there was or will be a header crc */
-    int     done;               /* true when done reading gzip header (not used when writing a gzip file) */
+    unsigned int    comm_max;   /* space at comment (only when reading header) */
+    int             hcrc;       /* true if there was or will be a header crc */
+    int             done;       /* true when done reading gzip header (not used when writing a gzip file) */
 } gz_header;
 
 typedef gz_header *gz_headerp;
@@ -591,7 +591,7 @@ ZEXTERN int ZEXPORT deflateInit2 (z_stream *strm,
 
 ZEXTERN int ZEXPORT deflateSetDictionary(z_stream *strm,
                                              const unsigned char *dictionary,
-                                             uInt  dictLength);
+                                             unsigned int dictLength);
 /*
      Initializes the compression dictionary from the given byte sequence
    without producing any compressed output.  When using the zlib format, this
@@ -707,7 +707,7 @@ ZEXTERN int ZEXPORT deflateTune(z_stream *strm, int good_length, int max_lazy, i
    returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
  */
 
-ZEXTERN uLong ZEXPORT deflateBound(z_stream *strm, uLong sourceLen);
+ZEXTERN unsigned long ZEXPORT deflateBound(z_stream *strm, unsigned long sourceLen);
 /*
      deflateBound() returns an upper bound on the compressed size after
    deflation of sourceLen bytes.  It must be called after deflateInit() or
@@ -721,7 +721,7 @@ ZEXTERN uLong ZEXPORT deflateBound(z_stream *strm, uLong sourceLen);
    than Z_FINISH or Z_NO_FLUSH are used.
 */
 
-ZEXTERN int ZEXPORT deflatePending(z_stream *strm, unsigned *pending, int *bits);
+ZEXTERN int ZEXPORT deflatePending(z_stream *strm, uint32_t *pending, int *bits);
 /*
      deflatePending() returns the number of bytes and bits of output that have
    been generated, but not yet provided in the available output.  The bytes not
@@ -821,7 +821,7 @@ ZEXTERN int ZEXPORT inflateInit2(z_stream *strm, int  windowBits);
    deferred until inflate() is called.
 */
 
-ZEXTERN int ZEXPORT inflateSetDictionary(z_stream *strm, const unsigned char *dictionary, uInt dictLength);
+ZEXTERN int ZEXPORT inflateSetDictionary(z_stream *strm, const unsigned char *dictionary, unsigned int dictLength);
 /*
      Initializes the decompression dictionary from the given uncompressed byte
    sequence.  This function must be called immediately after a call of inflate,
@@ -842,7 +842,7 @@ ZEXTERN int ZEXPORT inflateSetDictionary(z_stream *strm, const unsigned char *di
    inflate().
 */
 
-ZEXTERN int ZEXPORT inflateGetDictionary(z_stream *strm, unsigned char *dictionary, uInt *dictLength);
+ZEXTERN int ZEXPORT inflateGetDictionary(z_stream *strm, unsigned char *dictionary, unsigned int *dictLength);
 /*
      Returns the sliding dictionary being maintained by inflate.  dictLength is
    set to the number of bytes in the dictionary, and that many bytes are copied
@@ -1017,8 +1017,8 @@ ZEXTERN int ZEXPORT inflateBackInit (z_stream *strm, int windowBits, unsigned ch
    the version of the header file.
 */
 
-typedef unsigned (*in_func) (void *, const unsigned char * *);
-typedef int (*out_func) (void *, unsigned char *, unsigned);
+typedef uint32_t (*in_func) (void *, const unsigned char * *);
+typedef int (*out_func) (void *, unsigned char *, uint32_t);
 
 ZEXTERN int ZEXPORT inflateBack(z_stream *strm, in_func in, void *in_desc, out_func out, void *out_desc);
 /*
@@ -1096,12 +1096,12 @@ ZEXTERN int ZEXPORT inflateBackEnd(z_stream *strm);
    state was inconsistent.
 */
 
-ZEXTERN uLong ZEXPORT zlibCompileFlags(void);
+ZEXTERN unsigned long ZEXPORT zlibCompileFlags(void);
 /* Return flags indicating compile-time options.
 
     Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
-     1.0: size of uInt
-     3.2: size of uLong
+     1.0: size of unsigned int
+     3.2: size of unsigned long
      5.4: size of void * (pointer)
      7.6: size of z_off_t
 
@@ -1148,7 +1148,7 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags(void);
    you need special options.
 */
 
-ZEXTERN int ZEXPORT compress(unsigned char *dest, uLong *destLen, const unsigned char *source, uLong sourceLen);
+ZEXTERN int ZEXPORT compress(unsigned char *dest, unsigned long *destLen, const unsigned char *source, unsigned long sourceLen);
 /*
      Compresses the source buffer into the destination buffer.  sourceLen is
    the byte length of the source buffer.  Upon entry, destLen is the total size
@@ -1162,8 +1162,8 @@ ZEXTERN int ZEXPORT compress(unsigned char *dest, uLong *destLen, const unsigned
    buffer.
 */
 
-ZEXTERN int ZEXPORT compress2(unsigned char *dest, uLong *destLen, const unsigned char *source,
-                              uLong sourceLen, int level);
+ZEXTERN int ZEXPORT compress2(unsigned char *dest, unsigned long *destLen, const unsigned char *source,
+                              unsigned long sourceLen, int level);
 /*
      Compresses the source buffer into the destination buffer.  The level
    parameter has the same meaning as in deflateInit.  sourceLen is the byte
@@ -1177,14 +1177,14 @@ ZEXTERN int ZEXPORT compress2(unsigned char *dest, uLong *destLen, const unsigne
    Z_STREAM_ERROR if the level parameter is invalid.
 */
 
-ZEXTERN uLong ZEXPORT compressBound(uLong sourceLen);
+ZEXTERN unsigned long ZEXPORT compressBound(unsigned long sourceLen);
 /*
      compressBound() returns an upper bound on the compressed size after
    compress() or compress2() on sourceLen bytes.  It would be used before a
    compress() or compress2() call to allocate the destination buffer.
 */
 
-ZEXTERN int ZEXPORT uncompress(unsigned char *dest, uLong *destLen, const unsigned char *source, uLong sourceLen);
+ZEXTERN int ZEXPORT uncompress(unsigned char *dest, unsigned long *destLen, const unsigned char *source, unsigned long sourceLen);
 /*
      Decompresses the source buffer into the destination buffer.  sourceLen is
    the byte length of the source buffer.  Upon entry, destLen is the total size
@@ -1553,7 +1553,7 @@ ZEXTERN void ZEXPORT gzclearerr(gzFile file);
    library.
 */
 
-ZEXTERN uint32_t ZEXPORT adler32(uint32_t adler, const unsigned char *buf, uInt len);
+ZEXTERN uint32_t ZEXPORT adler32(uint32_t adler, const unsigned char *buf, uint32_t len);
 /*
      Update a running Adler-32 checksum with the bytes buf[0..len-1] and
    return the updated checksum.  If buf is Z_NULL, this function returns the
@@ -1583,7 +1583,7 @@ ZEXTERN uint32_t ZEXPORT adler32_combine(uint32_t adler1, uint32_t adler2, z_off
    negative, the result has no meaning or utility.
 */
 
-ZEXTERN uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, uInt len);
+ZEXTERN uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, z_off64_t len);
 /*
      Update a running CRC-32 with the bytes buf[0..len-1] and return the
    updated CRC-32.  If buf is Z_NULL, this function returns the required
@@ -1601,7 +1601,7 @@ ZEXTERN uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, uInt len)
 */
 
 /*
-ZEXTERN uint32_t ZEXPORT crc32_combine(uint32_t crc1, uint32_t crc2, z_off_t len2);
+ZEXTERN uint32_t ZEXPORT crc32_combine(uint32_t crc1, uint32_t crc2, z_off64_t len2);
 
      Combine two CRC-32 check values into one.  For two sequences of bytes,
    seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
@@ -1707,15 +1707,15 @@ ZEXTERN int ZEXPORT gzgetc_(gzFile file);  /* backward compatibility */
 
 
 /* undocumented functions */
-ZEXTERN const char * ZEXPORT zError(int);
-ZEXTERN int ZEXPORT inflateSyncPoint(z_stream *);
-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 *);
+ZEXTERN const char     * ZEXPORT zError           (int);
+ZEXTERN int              ZEXPORT inflateSyncPoint (z_stream *);
+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 *);
 
 #ifdef WITH_GZFILEOP
-# if (defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW__))
+# if (defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW__))
     ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path, const char *mode);
 # endif
 ZEXTERN int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va);
diff --git a/zutil.c b/zutil.c
index 02b9ccfcd589b31049a0b9824cf3209c4e90ed2b..e46277b878693bba8d38e01cb21d863fb71fb145 100644 (file)
--- a/zutil.c
+++ b/zutil.c
@@ -30,18 +30,18 @@ const char * ZEXPORT zlibVersion(void)
     return ZLIB_VERSION;
 }
 
-uLong ZEXPORT zlibCompileFlags(void)
+unsigned long ZEXPORT zlibCompileFlags(void)
 {
-    uLong flags;
+    unsigned long flags;
 
     flags = 0;
-    switch ((int)(sizeof(uInt))) {
+    switch ((int)(sizeof(unsigned int))) {
     case 2:     break;
     case 4:     flags += 1;     break;
     case 8:     flags += 2;     break;
     default:    flags += 3;
     }
-    switch ((int)(sizeof(uLong))) {
+    switch ((int)(sizeof(unsigned long))) {
     case 2:     break;
     case 4:     flags += 1 << 2;        break;
     case 8:     flags += 2 << 2;        break;
@@ -111,7 +111,7 @@ const char * ZEXPORT zError(int err)
 void ZLIB_INTERNAL *zcalloc (void *opaque, unsigned items, unsigned size)
 {
     (void)opaque;
-    return sizeof(uInt) > 2 ? (void *)malloc(items * size) :
+    return sizeof(unsigned int) > 2 ? (void *)malloc(items * size) :
                               (void *)calloc(items, size);
 }
 
diff --git a/zutil.h b/zutil.h
index 9f86c61d9abd43f0b437567b787fa9dc214aacea..17e3a03c53335b646501a75b953ac1d1e317c15b 100644 (file)
--- a/zutil.h
+++ b/zutil.h
@@ -79,7 +79,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
 #endif
 
 /* provide prototypes for these when building zlib without LFS */
-#if !defined(_WIN32) && (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
+#if !defined(WIN32) && (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
     ZEXTERN uint32_t ZEXPORT adler32_combine64(uint32_t, uint32_t, z_off_t);
     ZEXTERN uint32_t ZEXPORT crc32_combine64(uint32_t, uint32_t, z_off_t);
 #endif
@@ -131,7 +131,7 @@ void ZLIB_INTERNAL   zcfree(void *opaque, void *ptr);
 
 /* Reverse the bytes in a 32-bit value. Use compiler intrinsics when
    possible to take advantage of hardware implementations. */
-#if defined(_WIN32) && (_MSC_VER >= 1300)
+#if defined(WIN32) && (_MSC_VER >= 1300)
 #  pragma intrinsic(_byteswap_ulong)
 #  define ZSWAP32(q) _byteswap_ulong(q)