mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-30 10:47:34 +02:00
Fix JsonVariantTests
This commit is contained in:
@ -20,6 +20,9 @@ inline ArrayImpl::iterator ArrayImpl::at(size_t index) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline VariantData* ArrayImpl::addElement() {
|
inline VariantData* ArrayImpl::addElement() {
|
||||||
|
if (!data_)
|
||||||
|
return nullptr;
|
||||||
|
ARDUINOJSON_ASSERT(resources_ != nullptr);
|
||||||
auto slot = resources_->allocVariant();
|
auto slot = resources_->allocVariant();
|
||||||
if (!slot)
|
if (!slot)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -32,6 +32,9 @@ inline CollectionImpl::iterator CollectionImpl::createIterator() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void CollectionImpl::appendOne(Slot<VariantData> slot) {
|
inline void CollectionImpl::appendOne(Slot<VariantData> slot) {
|
||||||
|
ARDUINOJSON_ASSERT(data_ != nullptr);
|
||||||
|
ARDUINOJSON_ASSERT(resources_ != nullptr);
|
||||||
|
|
||||||
if (data_->tail != NULL_SLOT) {
|
if (data_->tail != NULL_SLOT) {
|
||||||
auto tail = resources_->getVariant(data_->tail);
|
auto tail = resources_->getVariant(data_->tail);
|
||||||
tail->setNext(slot.id());
|
tail->setNext(slot.id());
|
||||||
@ -44,6 +47,9 @@ inline void CollectionImpl::appendOne(Slot<VariantData> slot) {
|
|||||||
|
|
||||||
inline void CollectionImpl::appendPair(Slot<VariantData> key,
|
inline void CollectionImpl::appendPair(Slot<VariantData> key,
|
||||||
Slot<VariantData> value) {
|
Slot<VariantData> value) {
|
||||||
|
ARDUINOJSON_ASSERT(data_ != nullptr);
|
||||||
|
ARDUINOJSON_ASSERT(resources_ != nullptr);
|
||||||
|
|
||||||
key->setNext(value.id());
|
key->setNext(value.id());
|
||||||
|
|
||||||
if (data_->tail != NULL_SLOT) {
|
if (data_->tail != NULL_SLOT) {
|
||||||
|
@ -47,6 +47,10 @@ inline void ObjectImpl::removeMember(TAdaptedString key) {
|
|||||||
|
|
||||||
template <typename TAdaptedString>
|
template <typename TAdaptedString>
|
||||||
inline VariantData* ObjectImpl::addMember(TAdaptedString key) {
|
inline VariantData* ObjectImpl::addMember(TAdaptedString key) {
|
||||||
|
if (!data_)
|
||||||
|
return nullptr;
|
||||||
|
ARDUINOJSON_ASSERT(resources_ != nullptr);
|
||||||
|
|
||||||
auto keySlot = resources_->allocVariant();
|
auto keySlot = resources_->allocVariant();
|
||||||
if (!keySlot)
|
if (!keySlot)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -64,6 +68,10 @@ inline VariantData* ObjectImpl::addMember(TAdaptedString key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline VariantData* ObjectImpl::addPair(VariantData** value) {
|
inline VariantData* ObjectImpl::addPair(VariantData** value) {
|
||||||
|
if (!data_)
|
||||||
|
return nullptr;
|
||||||
|
ARDUINOJSON_ASSERT(resources_ != nullptr);
|
||||||
|
|
||||||
auto keySlot = resources_->allocVariant();
|
auto keySlot = resources_->allocVariant();
|
||||||
if (!keySlot)
|
if (!keySlot)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
Reference in New Issue
Block a user