input cast to unsigned char for unqualified tolower(); close #342

This commit is contained in:
Yukihiro Matsumoto
2012-07-04 17:12:47 +09:00
parent f141ae42c0
commit 472847adc2
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -802,8 +802,9 @@ readint_float(codegen_scope *s, const char *p, int base)
mrb_float f = 0;
int n;
while (p <= e) {
char c = tolower(*p);
while (p < e) {
char c = *p;
c = tolower((unsigned char)c);
for (n=0; n<base; n++) {
if (mrb_digitmap[n] == c) {
f *= base;
+1 -1
View File
@@ -3949,7 +3949,7 @@ parser_yylex(parser_state *p)
}
if (!ISXDIGIT(c)) break;
nondigit = 0;
tokadd(p, c);
tokadd(p, tolower(c));
} while ((c = nextc(p)) != -1);
}
pushback(p, c);