[Zlib-devel] zlib 1.2.7.1 (Mark Adler)

Theo Niessink theo at taletn.com
Mon Mar 25 13:02:49 EDT 2013


Mark Adler <madler at madler.net> wrote:
> 
> Please take a look at zlib 1.2.7.1, which you can download from here:
> 
>     https://github.com/madler/zlib/tree/develop

I have just tested 1.2.7.1 on x86 and x64 MSVC, and I couldn't compile on
both. However, after applying the attached patches (see below) everything
seems to work fine.

Beware though that I am not entirely sure of the last patch, because it will
truncate the 64-bit pointers, but I am guessing it won't matter because
truncation will hopefully happen after substracting the two pointers, and
the result will be known to be less than 32-bit (right?).

--

>From 4d0ec1147292069a366e91795bb7733c76695ba4 Mon Sep 17 00:00:00 2001
From: Theo Niessink <theo at taletn.com>
Date: Mon, 25 Mar 2013 17:13:53 +0100
Subject: [PATCH 1/3] Fix UINT_MAX for MSVC.

---
 zconf.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/zconf.h b/zconf.h
index 80de2ce..5b94594 100644
--- a/zconf.h
+++ b/zconf.h
@@ -393,11 +393,11 @@ typedef uLong FAR uLongf;
 
 #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
 #  include <limits.h>
-#  if (UINT_MAX == 4294967295)
+#  if (UINT_MAX == 0xFFFFFFFF)
 #    define Z_U4 unsigned
-#  elif (ULONG_MAX == 4294967295)
+#  elif (ULONG_MAX == 0xFFFFFFFF)
 #    define Z_U4 unsigned long
-#  elif (USHRT_MAX == 4294967295)
+#  elif (USHRT_MAX == 0xFFFFFFFF)
 #    define Z_U4 unsigned short
 #  endif
 #endif
-- 
1.8.1.msysgit.1

>From ab507e4aeaa8a9891a8e08f7608a6c718cd81eea Mon Sep 17 00:00:00 2001
From: Theo Niessink <theo at taletn.com>
Date: Mon, 25 Mar 2013 17:19:44 +0100
Subject: [PATCH 2/3] Fix $example.exe typo in win32/Makefile.msc.

---
 win32/Makefile.msc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/win32/Makefile.msc b/win32/Makefile.msc
index aaf2082..67b7731 100644
--- a/win32/Makefile.msc
+++ b/win32/Makefile.msc
@@ -40,7 +40,7 @@ OBJA =
 
 # targets
 all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
-     $example.exe minigzip.exe example_d.exe minigzip_d.exe
+     example.exe minigzip.exe example_d.exe minigzip_d.exe
 
 $(STATICLIB): $(OBJS) $(OBJA)
 	$(AR) $(ARFLAGS) -out:$@ $(OBJS) $(OBJA)
-- 
1.8.1.msysgit.1

>From 7578c49ff5e8a8ecef55cdbd33f39145428f59ee Mon Sep 17 00:00:00 2001
From: Theo Niessink <theo at taletn.com>
Date: Mon, 25 Mar 2013 17:50:49 +0100
Subject: [PATCH 3/3] Fix pointer/unsigned warning on MSVC x64.

---
 gzwrite.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gzwrite.c b/gzwrite.c
index 3729a29..81882b7 100644
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -211,7 +211,7 @@ int ZEXPORT gzwrite(file, buf, len)
 
             if (strm->avail_in == 0)
                 strm->next_in = state->in;
-            have = strm->next_in + strm->avail_in - state->in;
+            have = (unsigned)(strm->next_in + strm->avail_in - state->in);
             copy = state->size - have;
             if (copy > len)
                 copy = len;
@@ -273,7 +273,7 @@ int ZEXPORT gzputc(file, c)
     if (state->size) {
         if (strm->avail_in == 0)
             strm->next_in = state->in;
-        have = strm->next_in + strm->avail_in - state->in;
+        have = (unsigned)(strm->next_in + strm->avail_in - state->in);
         if (have < state->size) {
             state->in[have] = c;
             strm->avail_in++;
-- 
1.8.1.msysgit.1





More information about the Zlib-devel mailing list