зеркало из https://github.com/github/ruby.git
* numeric.c (check_int): use PRIxVALUE format specifier.
* numeric.c (check_uint, rb_num2fix, int_chr): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
c3e7816a78
Коммит
5342ed85f9
|
@ -22,6 +22,12 @@ Tue May 27 17:54:35 2008 Akinori MUSHA <knu@iDaemons.org>
|
|||
* ext/stringio/stringio.c (strio_each_byte): Return self instead
|
||||
of nil as the rdoc says.
|
||||
|
||||
Tue May 27 15:36:27 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* numeric.c (check_int): use PRIxVALUE format specifier.
|
||||
|
||||
* numeric.c (check_uint, rb_num2fix, int_chr): ditto.
|
||||
|
||||
Tue May 27 13:14:53 2008 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* enum.c (enum_to_a): Pass arguments through to #each().
|
||||
|
|
16
numeric.c
16
numeric.c
|
@ -1559,22 +1559,14 @@ check_int(SIGNED_VALUE num)
|
|||
else {
|
||||
return;
|
||||
}
|
||||
#ifdef LONG_LONG_VALUE
|
||||
rb_raise(rb_eRangeError, "integer %lld too %s to convert to `int'", num, s);
|
||||
#else
|
||||
rb_raise(rb_eRangeError, "integer %ld too %s to convert to `int'", num, s);
|
||||
#endif
|
||||
rb_raise(rb_eRangeError, "integer " PRIdVALUE " too %s to convert to `int'", num, s);
|
||||
}
|
||||
|
||||
static void
|
||||
check_uint(VALUE num)
|
||||
{
|
||||
if (num > UINT_MAX) {
|
||||
#ifdef LONG_LONG_VALUE
|
||||
rb_raise(rb_eRangeError, "integer %llu too big to convert to `unsigned int'", num);
|
||||
#else
|
||||
rb_raise(rb_eRangeError, "integer %lu too big to convert to `unsigned int'", num);
|
||||
#endif
|
||||
rb_raise(rb_eRangeError, "integer " PRIuVALUE " too big to convert to `unsigned int'", num);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1644,7 +1636,7 @@ rb_num2fix(VALUE val)
|
|||
|
||||
v = rb_num2long(val);
|
||||
if (!FIXABLE(v))
|
||||
rb_raise(rb_eRangeError, "integer %ld out of range of fixnum", v);
|
||||
rb_raise(rb_eRangeError, "integer " PRIdVALUE " out of range of fixnum", v);
|
||||
return LONG2FIX(v);
|
||||
}
|
||||
|
||||
|
@ -1872,7 +1864,7 @@ int_chr(int argc, VALUE *argv, VALUE num)
|
|||
case 0:
|
||||
if (i < 0 || 0xff < i) {
|
||||
out_of_range:
|
||||
rb_raise(rb_eRangeError, "%ld out of char range", i);
|
||||
rb_raise(rb_eRangeError, PRIdVALUE " out of char range", i);
|
||||
}
|
||||
c = i;
|
||||
if (i < 0x80) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче