forked from bblanchon/ArduinoJson
Fixed floating point value parsing in the form "4e2" or "4E2".
This commit is contained in:
1 parent
2e47d546b2
commit
1c450fd3aa
3 files changed
+8
-5
No files matched your search
@@ -165,9 +165,12 @@ void JsonParser::parseBooleanTo(JsonVariant &destination) {
|
||||
void JsonParser::parseNumberTo(JsonVariant &destination) {
|
||||
char *endOfLong;
|
||||
long longValue = strtol(_ptr, &endOfLong, 10);
|
||||
char stopChar = *endOfLong;
|
||||
|
||||
// Could it be a floating point value?
|
||||
if (*endOfLong == '.') {
|
||||
bool couldBeFloat = stopChar == '.' || stopChar == 'e' || stopChar == 'E';
|
||||
|
||||
if (couldBeFloat) {
|
||||
// Yes => parse it as a double
|
||||
double doubleValue = strtod(_ptr, &_ptr);
|
||||
// Count the decimal digits
|
||||
|
||||
Reference in new issue
Block a user