mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/zlib/zlib.c (rb_gzfile_set_mtime): Use NUM2UINT.
The old logic doesn't work well on LP64 platforms as: .. -2**63-1 => error, -2**63 .. -2**62-1 => success, -2**62 .. -2**31-1 => error, -2**31 .. 2**31-1 => success, 2**31 .. 2**62-1 => error, 2**62 .. 2**64-1 => success, 2**64 .. => error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f4eeca1d16
commit
87877eb04f
2 changed files with 15 additions and 7 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
Mon Apr 1 22:26:17 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/zlib/zlib.c (rb_gzfile_set_mtime): Use NUM2UINT.
|
||||
The old logic doesn't work well on LP64 platforms as:
|
||||
.. -2**63-1 => error,
|
||||
-2**63 .. -2**62-1 => success,
|
||||
-2**62 .. -2**31-1 => error,
|
||||
-2**31 .. 2**31-1 => success,
|
||||
2**31 .. 2**62-1 => error,
|
||||
2**62 .. 2**64-1 => success,
|
||||
2**64 .. => error.
|
||||
|
||||
Mon Apr 1 22:08:02 2013 Benoit Daloze <eregontp@gmail.com>
|
||||
|
||||
* ext/zlib/zlib.c (Zlib::Inflate.new):
|
||||
|
|
|
@ -3188,13 +3188,9 @@ rb_gzfile_set_mtime(VALUE obj, VALUE mtime)
|
|||
rb_raise(cGzError, "header is already written");
|
||||
}
|
||||
|
||||
if (FIXNUM_P(mtime)) {
|
||||
gz->mtime = FIX2INT(mtime);
|
||||
}
|
||||
else {
|
||||
val = rb_Integer(mtime);
|
||||
gz->mtime = FIXNUM_P(val) ? FIX2UINT(val) : rb_big2ulong(val);
|
||||
}
|
||||
val = rb_Integer(mtime);
|
||||
gz->mtime = NUM2UINT(val);
|
||||
|
||||
return mtime;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue