Reduced usages of EscapedString

This commit is contained in:
Benoit Blanchon
2014-08-01 15:22:30 +02:00
parent 1a01800782
commit 7c99d4d63d
6 changed files with 20 additions and 25 deletions

View File

@ -4,6 +4,7 @@
*/
#include "JsonObjectBase.h"
#include <string.h> // for strcmp
using namespace ArduinoJson::Generator;
using namespace ArduinoJson::Internals;
@ -19,7 +20,7 @@ size_t JsonObjectBase::printTo(Print& p) const
const KeyValuePair* current = items;
for (int i = count; i > 0; i--)
{
n += current->key.printTo(p);
n += EscapedString(current->key).printTo(p);
n += p.write(':');
n += current->value.printTo(p);
@ -40,7 +41,7 @@ JsonValue& JsonObjectBase::operator[](char const* key)
{
for (int i = 0; i < count; ++i)
{
if (items[i].key.equals(key))
if (!strcmp(items[i].key, key))
{
return items[i].value;
}
@ -49,6 +50,6 @@ JsonValue& JsonObjectBase::operator[](char const* key)
if (count >= capacity)
return JsonValue::null();
items[count].key.set(key);
items[count].key = key;
return items[count++].value;
}