forked from bblanchon/ArduinoJson
Fixed static JsonString not being saved by reference
This commit is contained in:
@ -79,7 +79,7 @@ TEST_CASE("JsonVariant and strings") {
|
|||||||
variant.set(JsonString(str, true));
|
variant.set(JsonString(str, true));
|
||||||
strcpy(str, "world");
|
strcpy(str, "world");
|
||||||
|
|
||||||
REQUIRE(variant == "hello");
|
REQUIRE(variant == "world");
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("stores non-static JsonString by copy") {
|
SECTION("stores non-static JsonString by copy") {
|
||||||
|
@ -53,10 +53,11 @@ class StringAdapter : public RamStringAdapter {
|
|||||||
return _isStatic;
|
return _isStatic;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* const char* save(MemoryPool* pool) const {
|
const char* save(MemoryPool* pool) const {
|
||||||
if (_isStatic) return c_str();
|
if (_isStatic)
|
||||||
return RamStringAdapter::save(pool);
|
return data();
|
||||||
}*/
|
return RamStringAdapter::save(pool);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _isStatic;
|
bool _isStatic;
|
||||||
|
Reference in New Issue
Block a user