Skip to content

Commit

Permalink
sorry. I made wrong tags.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.ruby-lang.org/repos/ruby/tags/v1_8_5_71@12993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
shyouhei committed Aug 15, 2007
2 parents f2ca2e1 + d973fca commit f65d4c4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
5 changes: 0 additions & 5 deletions ChangeLog
@@ -1,8 +1,3 @@
Thu Aug 16 05:02:39 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>

* bignum.c (rb_cstr_to_inum): check leading non-digits.
[ruby-core:11691]

Thu Aug 16 05:00:01 2007 Yukihiro Matsumoto <matz@ruby-lang.org>

* numeric.c (fix_pow): 0**2 should not raise floating point
Expand Down
31 changes: 15 additions & 16 deletions bignum.c
Expand Up @@ -331,13 +331,6 @@ rb_cstr_to_inum(str, base, badcheck)
VALUE z;
BDIGIT *zds;

#define conv_digit(c) \
(!ISASCII(c) ? -1 : \
isdigit(c) ? ((c) - '0') : \
islower(c) ? ((c) - 'a' + 10) : \
isupper(c) ? ((c) - 'A' + 10) : \
-1)

if (!str) {
if (badcheck) goto bad;
return INT2FIX(0);
Expand Down Expand Up @@ -430,13 +423,7 @@ rb_cstr_to_inum(str, base, badcheck)
}
if (*str == '0') { /* squeeze preceeding 0s */
while (*++str == '0');
if (!*str) --str;
}
c = *str;
c = conv_digit(c);
if (c < 0 || c >= base) {
if (badcheck) goto bad;
return INT2FIX(0);
--str;
}
len *= strlen(str)*sizeof(char);

Expand Down Expand Up @@ -470,15 +457,27 @@ rb_cstr_to_inum(str, base, badcheck)
z = bignew(len, sign);
zds = BDIGITS(z);
for (i=len;i--;) zds[i]=0;
while ((c = *str++) != 0) {
while (c = *str++) {
if (c == '_') {
if (badcheck) {
if (nondigit) goto bad;
nondigit = c;
}
continue;
}
else if ((c = conv_digit(c)) < 0) {
else if (!ISASCII(c)) {
break;
}
else if (isdigit(c)) {
c -= '0';
}
else if (islower(c)) {
c -= 'a' - 10;
}
else if (isupper(c)) {
c -= 'A' - 10;
}
else {
break;
}
if (c >= base) break;
Expand Down
2 changes: 1 addition & 1 deletion version.h
Expand Up @@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2007-08-16"
#define RUBY_VERSION_CODE 185
#define RUBY_RELEASE_CODE 20070816
#define RUBY_PATCHLEVEL 72
#define RUBY_PATCHLEVEL 71

#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
Expand Down

0 comments on commit f65d4c4

Please sign in to comment.