mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-25 08:17:32 +02:00
Now use uint8_t to store decimal count
This commit is contained in:
@ -118,7 +118,7 @@ void JsonParser::parseNumberTo(JsonValue &destination) {
|
||||
if (*endOfLong == '.') {
|
||||
// stopped on a decimal separator
|
||||
double doubleValue = strtod(_ptr, &_ptr);
|
||||
int decimals = _ptr - endOfLong - 1;
|
||||
uint8_t decimals = _ptr - endOfLong - 1;
|
||||
destination.set(doubleValue, decimals);
|
||||
} else {
|
||||
_ptr = endOfLong;
|
||||
|
@ -19,6 +19,6 @@ void JsonWriter::writeBoolean(bool value) {
|
||||
_length += _sink->print(value ? "true" : "false");
|
||||
}
|
||||
|
||||
void JsonWriter::writeDouble(double value, int decimals) {
|
||||
void JsonWriter::writeDouble(double value, uint8_t decimals) {
|
||||
_length += _sink->print(value, decimals);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ void JsonValue::set(const char *value) {
|
||||
_content.asString = value;
|
||||
}
|
||||
|
||||
void JsonValue::set(double value, int decimals) {
|
||||
void JsonValue::set(double value, uint8_t decimals) {
|
||||
if (_type == JSON_INVALID) return;
|
||||
_type = static_cast<JsonValueType>(JSON_DOUBLE_0_DECIMALS + decimals);
|
||||
_content.asDouble = value;
|
||||
|
Reference in New Issue
Block a user