summaryrefslogtreecommitdiff
path: root/pack.c
diff options
context:
space:
mode:
authorocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-17 02:21:39 +0000
committerocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-17 02:21:39 +0000
commit386352b47463a112027a227cefc86b226ed8fd7b (patch)
treefdfa3437bb61bdbd7fbe821683bdd82f65ee5313 /pack.c
parent26899051a0456daffa5ddbaecc8fa566dad49dfc (diff)
* util.c (ruby_strtod): Float("1e") should fail. [ruby-core:7330]
* pack.c (EXTEND32): unpack("l") did not work where sizeof(long) != 4. [ruby-talk:180024] * pack.c (pack_unpack): fixed integer overflow on template "w". [ruby-talk:180126] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pack.c b/pack.c
index 05e112e79d..0e5f2b89ed 100644
--- a/pack.c
+++ b/pack.c
@@ -347,11 +347,11 @@ num2i32(x)
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 @@ pack_unpack(str, fmt)
case 'w':
{
unsigned long ul = 0;
- unsigned long ulmask = 0xfeL << ((sizeof(unsigned long) - 1) * 8);
+ unsigned long ulmask = 0xfeUL << ((sizeof(unsigned long) - 1) * 8);
while (len > 0 && s < send) {
ul <<= 7;