mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/date/date_core.c: [ruby-core:46058].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c8cde4e2be
commit
bd52bed97b
3 changed files with 14 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Mon Jul 2 05:54:58 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* ext/date/date_core.c: [ruby-core:46058].
|
||||||
|
|
||||||
Mon Jul 2 05:35:43 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
Mon Jul 2 05:35:43 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
* ext/date/date_core.c (d_lite_marshal_load): accepts old dump.
|
* ext/date/date_core.c (d_lite_marshal_load): accepts old dump.
|
||||||
|
|
|
@ -980,8 +980,14 @@ safe_mul_p(VALUE x, long m)
|
||||||
if (!FIXNUM_P(x))
|
if (!FIXNUM_P(x))
|
||||||
return 0;
|
return 0;
|
||||||
ix = FIX2LONG(x);
|
ix = FIX2LONG(x);
|
||||||
if (ix >= (FIXNUM_MAX / m))
|
if (ix < 0) {
|
||||||
return 0;
|
if (ix <= (FIXNUM_MIN / m))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (ix >= (FIXNUM_MAX / m))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -294,6 +294,8 @@ class TestSH < Test::Unit::TestCase
|
||||||
assert_raise(Errno::ERANGE) do
|
assert_raise(Errno::ERANGE) do
|
||||||
Date.new(1 << 10000).strftime('%Y')
|
Date.new(1 << 10000).strftime('%Y')
|
||||||
end
|
end
|
||||||
|
assert_equal('-3786825600', Date.new(1850).strftime('%s'))
|
||||||
|
assert_equal('-3786825600000', Date.new(1850).strftime('%Q'))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_cmp
|
def test_cmp
|
||||||
|
|
Loading…
Add table
Reference in a new issue