summaryrefslogtreecommitdiff
path: root/ext/zlib/win32/zlib-1.2.11-mswin.patch
blob: 8810b4403c2a6f567de4b74bfc5981756620afeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
diff -ru zlib-1.2.11/gzread.c zlib-1.2.11/gzread.c
--- zlib-1.2.11/gzread.c	2016-12-31 23:37:10.000000000 +0900
+++ zlib-1.2.11/gzread.c	2020-11-23 19:35:00.550987184 +0900
@@ -316,7 +316,7 @@
         /* set n to the maximum amount of len that fits in an unsigned int */
         n = -1;
         if (n > len)
-            n = len;
+            n = (unsigned)len;
 
         /* first just try copying data from the output buffer */
         if (state->x.have) {
@@ -397,7 +397,7 @@
     }
 
     /* read len or fewer bytes to buf */
-    len = gz_read(state, buf, len);
+    len = (unsigned)gz_read(state, buf, len);
 
     /* check for an error */
     if (len == 0 && state->err != Z_OK && state->err != Z_BUF_ERROR)
@@ -469,7 +469,7 @@
     }
 
     /* nothing there -- try gz_read() */
-    ret = gz_read(state, buf, 1);
+    ret = (int)gz_read(state, buf, 1);
     return ret < 1 ? -1 : buf[0];
 }
 
diff -ru zlib-1.2.11/gzwrite.c zlib-1.2.11/gzwrite.c
--- zlib-1.2.11/gzwrite.c	2017-01-15 09:29:40.000000000 +0900
+++ zlib-1.2.11/gzwrite.c	2020-11-23 19:35:41.530494030 +0900
@@ -209,7 +209,7 @@
                               state->in);
             copy = state->size - have;
             if (copy > len)
-                copy = len;
+                copy = (unsigned)len;
             memcpy(state->in + have, buf, copy);
             state->strm.avail_in += copy;
             state->x.pos += copy;
@@ -229,7 +229,7 @@
         do {
             unsigned n = (unsigned)-1;
             if (n > len)
-                n = len;
+                n = (unsigned)len;
             state->strm.avail_in = n;
             state->x.pos += n;
             if (gz_comp(state, Z_NO_FLUSH) == -1)
@@ -368,7 +368,7 @@
 
     /* write string */
     len = strlen(str);
-    ret = gz_write(state, str, len);
+    ret = (int)gz_write(state, str, len);
     return ret == 0 && len != 0 ? -1 : ret;
 }
 
diff -ru zlib-1.2.11/win32/Makefile.msc zlib-1.2.11/win32/Makefile.msc
--- zlib-1.2.11/win32/Makefile.msc	2017-01-15 09:07:08.000000000 +0900
+++ zlib-1.2.11/win32/Makefile.msc	2020-11-23 22:37:19.746500208 +0900
@@ -37,6 +37,22 @@
        gzwrite.obj infback.obj inflate.obj inftrees.obj inffast.obj trees.obj uncompr.obj zutil.obj
 OBJA =
 
+!ifdef USE_ASM
+LOC = -DASMV -DASMINF
+!if "$(ARCH)" == "i386"
+OBJA = inffas32.obj match686.obj
+!else if "$(ARCH)" == "x64"
+AS = ml64
+LOC = $(LOC) -I.
+OBJA = inffasx64.obj gvmat64.obj inffas8664.obj
+!endif
+!endif
+
+!if "$(ARCH)" == "x64"
+ZBASE = 0x5A4C000000
+!else
+ZBASE = 0x5A4C0000
+!endif
 
 # targets
 all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
@@ -49,7 +65,7 @@
 
 $(SHAREDLIB): $(TOP)/win32/zlib.def $(OBJS) $(OBJA) zlib1.res
 	$(LD) $(LDFLAGS) -def:$(TOP)/win32/zlib.def -dll -implib:$(IMPLIB) \
-	  -out:$@ -base:0x5A4C0000 $(OBJS) $(OBJA) zlib1.res
+	  -out:$@ -base:$(ZBASE) $(OBJS) $(OBJA) zlib1.res
 	if exist $@.manifest \
 	  mt -nologo -manifest $@.manifest -outputresource:$@;2