🩹 Fix strtof interpreting a hex value

Bug introduced in #21532
This commit is contained in:
Scott Lahteine 2022-08-18 13:03:17 -05:00
parent 1766ee15a3
commit af1c7e1a81

View file

@ -256,12 +256,12 @@ public:
// Float removes 'E' to prevent scientific notation interpretation
static float value_float() {
if (value_ptr) {
if (!value_ptr) return 0;
char *e = value_ptr;
for (;;) {
const char c = *e;
if (c == '\0' || c == ' ') break;
if (c == 'E' || c == 'e') {
if (c == 'E' || c == 'e' || c == 'X' || c == 'x') {
*e = '\0';
const float ret = strtof(value_ptr, nullptr);
*e = c;
@ -271,8 +271,6 @@ public:
}
return strtof(value_ptr, nullptr);
}
return 0;
}
// Code value as a long or ulong
static int32_t value_long() { return value_ptr ? strtol(value_ptr, nullptr, 10) : 0L; }