ruby/ruby-1.8.4-64bit-pack.patch
Akira TAGOH 63eb84af23 - ruby-1.8.4-64bit-pack.patch: backport patch to fix unpack(l) not working
on 64bit arch and integer overflow on template w. (#189350)
- updated License tag to be more comfortable, and with a pointer to get
    more details, like Python package does. (#179933)
2006-04-20 09:52:09 +00:00

27 lines
880 B
Diff

diff -ruN ruby-1.8.4.orig/pack.c ruby-1.8.4/pack.c
--- ruby-1.8.4.orig/pack.c 2005-10-13 23:30:49.000000000 +0900
+++ ruby-1.8.4/pack.c 2006-04-20 13:50:25.000000000 +0900
@@ -347,11 +347,11 @@
return 0; /* not reached */
}
-#if SIZEOF_LONG == SIZE32 || SIZEOF_INT == SIZE32
+#if SIZEOF_LONG == SIZE32
# define EXTEND32(x)
#else
/* invariant in modulo 1<<31 */
-# define EXTEND32(x) do {if (!natint) {(x) = (I32)(((1<<31)-1-(x))^~(~0<<31));}} while(0)
+# define EXTEND32(x) do { if (!natint) {(x) = (((1L<<31)-1-(x))^~(~0L<<31));}} while(0)
#endif
#if SIZEOF_SHORT == SIZE16
# define EXTEND16(x)
@@ -1951,7 +1951,7 @@
case 'w':
{
unsigned long ul = 0;
- unsigned long ulmask = 0xfeL << ((sizeof(unsigned long) - 1) * 8);
+ unsigned long ulmask = 0xfeUL << ((sizeof(unsigned long) - 1UL) * 8UL);
while (len > 0 && s < send) {
ul <<= 7;