зеркало из https://github.com/github/ruby.git
* numeric.c (int_chr): raise error when the value is negative.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
7724d13635
Коммит
74dcda0d41
|
@ -1,3 +1,7 @@
|
|||
Wed Oct 13 21:13:00 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* numeric.c (int_chr): raise error when the value is negative.
|
||||
|
||||
Wed Oct 13 19:24:08 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
|
||||
|
||||
* vm.c (ruby_vm_destruct): This function type was wrong; correct to the prototype.
|
||||
|
|
11
numeric.c
11
numeric.c
|
@ -2120,9 +2120,18 @@ static VALUE
|
|||
int_chr(int argc, VALUE *argv, VALUE num)
|
||||
{
|
||||
char c;
|
||||
unsigned int i = NUM2UINT(num);
|
||||
unsigned int i;
|
||||
rb_encoding *enc;
|
||||
|
||||
if (rb_num_to_uint(num, &i) == 0) {
|
||||
}
|
||||
else if (FIXNUM_P(num)) {
|
||||
rb_raise(rb_eRangeError, "%ld out of char range", FIX2LONG(num));
|
||||
}
|
||||
else {
|
||||
rb_raise(rb_eRangeError, "bignum out of char range");
|
||||
}
|
||||
|
||||
switch (argc) {
|
||||
case 0:
|
||||
if (0xff < i) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче