Skip to content

Commit b24d02a

Browse files
committed
Re-apply 29b4533
1 parent af0d024 commit b24d02a

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

quickjs.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12056,7 +12056,7 @@ static JSValue js_atof(JSContext *ctx, const char *str, const char **pp,
1205612056
to_digit((uint8_t)p[1]) < radix)) {
1205712057
p++;
1205812058
}
12059-
if (!(flags & ATOD_INT_ONLY)) {
12059+
if (!(flags & ATOD_INT_ONLY) && radix == 10) {
1206012060
if (*p == '.' && (p > p_start || to_digit((uint8_t)p[1]) < radix)) {
1206112061
is_float = true;
1206212062
p++;
@@ -12066,9 +12066,7 @@ static JSValue js_atof(JSContext *ctx, const char *str, const char **pp,
1206612066
(*p == sep && to_digit((uint8_t)p[1]) < radix))
1206712067
p++;
1206812068
}
12069-
if (p > p_start &&
12070-
(((*p == 'e' || *p == 'E') && radix == 10) ||
12071-
((*p == 'p' || *p == 'P') && (radix == 2 || radix == 8 || radix == 16)))) {
12069+
if (p > p_start && (*p == 'e' || *p == 'E')) {
1207212070
const char *p1 = p + 1;
1207312071
is_float = true;
1207412072
if (*p1 == '+') {
@@ -12109,14 +12107,6 @@ static JSValue js_atof(JSContext *ctx, const char *str, const char **pp,
1210912107
if (*p == 'n') {
1211012108
p++;
1211112109
atod_type = ATOD_TYPE_BIG_INT;
12112-
} else {
12113-
if (is_float && radix != 10)
12114-
goto fail;
12115-
}
12116-
} else {
12117-
if (atod_type == ATOD_TYPE_FLOAT64) {
12118-
if (is_float && radix != 10)
12119-
goto fail;
1212012110
}
1212112111
}
1212212112

0 commit comments

Comments
 (0)