Fixed parser that incorrectly rejected floats containing a + (issue #349)

This commit is contained in:
Benoit Blanchon
2016-09-19 10:08:14 +02:00
parent 8a9b918bf4
commit deb57b960b
6 changed files with 41 additions and 33 deletions

View File

@ -50,7 +50,7 @@ class JsonParser {
static inline bool isLetterOrNumber(char c) {
return isInRange(c, '0', '9') || isInRange(c, 'a', 'z') ||
isInRange(c, 'A', 'Z') || c == '-' || c == '.';
isInRange(c, 'A', 'Z') || c == '+' || c == '-' || c == '.';
}
static inline bool isQuote(char c) {

View File

@ -17,14 +17,14 @@ template <>
inline bool JsonObject::setNodeValue(node_type *node, String &value) {
const char *dup = _buffer->strdup(value);
node->content.value = dup;
return dup;
return dup != NULL;
}
template <>
inline bool JsonObject::setNodeValue(node_type *node, const String &value) {
const char *dup = _buffer->strdup(value);
node->content.value = dup;
return dup;
return dup != NULL;
}
template <>

View File

@ -23,7 +23,7 @@ class Print {
size_t print(const char* s) {
size_t n = 0;
while (*s) {
n += write(*s++);
n += write(static_cast<uint8_t>(*s++));
}
return n;
}