mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7f16734d27
commit
e6bf7809f3
5 changed files with 25 additions and 14 deletions
19
bignum.c
19
bignum.c
|
@ -202,32 +202,31 @@ rb_cstr2inum(str, base)
|
|||
|
||||
while (*str && ISSPACE(*str)) str++;
|
||||
|
||||
if (*str == '+') {
|
||||
if (str[0] == '+') {
|
||||
str++;
|
||||
}
|
||||
else if (*str == '-') {
|
||||
else if (str[0] == '-') {
|
||||
str++;
|
||||
sign = 0;
|
||||
}
|
||||
if (base == 0) {
|
||||
if (*str == '0') {
|
||||
str++;
|
||||
if (*str == 'x' || *str == 'X') {
|
||||
str++;
|
||||
if (str[0] == '0') {
|
||||
if (str[1] == 'x' || str[1] == 'X') {
|
||||
base = 16;
|
||||
}
|
||||
else if (*str == 'b' || *str == 'B') {
|
||||
str++;
|
||||
else if (str[1] == 'b' || str[1] == 'B') {
|
||||
base = 2;
|
||||
}
|
||||
else {
|
||||
base = 8;
|
||||
if (!*str) return INT2FIX(0);
|
||||
if (!str[1]) return INT2FIX(0);
|
||||
}
|
||||
}
|
||||
else if (str[0] == 0) {
|
||||
return INT2FIX(0);
|
||||
}
|
||||
else {
|
||||
base = 10;
|
||||
if (!*str) return INT2FIX(0);
|
||||
}
|
||||
}
|
||||
if (base == 8) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue