1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/zlib/win32/zlib-1.2.11-mswin.patch
Nobuyoshi Nakada 48d1e8682c
zlib: patches for mswin64
* cast to suppress C4267 warnings; no possible loss of data as
  following the comparison.

* shift base address to suppress LNK4281; although /DYNAMICBASE is
  preferable, not sure from which version of link.exe supports it.
2020-11-24 08:27:08 +09:00

95 lines
2.9 KiB
Diff

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