mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-31 03:07:35 +02:00
Stop using CollectionIterator
in MsgPackSerializer
This doesn't reduce code size or stack usage, but as least it's consistent with `JsonSerializer`.
This commit is contained in:
@ -59,10 +59,14 @@ class MsgPackSerializer : public VariantDataVisitor<size_t> {
|
|||||||
writeByte(0xDD);
|
writeByte(0xDD);
|
||||||
writeInteger(uint32_t(n));
|
writeInteger(uint32_t(n));
|
||||||
}
|
}
|
||||||
for (auto it = array.createIterator(resources_); !it.done();
|
|
||||||
it.next(resources_)) {
|
auto slotId = array.head();
|
||||||
it->accept(*this);
|
while (slotId != NULL_SLOT) {
|
||||||
|
auto slot = resources_->getSlot(slotId);
|
||||||
|
slot->data()->accept(*this);
|
||||||
|
slotId = slot->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
return bytesWritten();
|
return bytesWritten();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,11 +81,15 @@ class MsgPackSerializer : public VariantDataVisitor<size_t> {
|
|||||||
writeByte(0xDF);
|
writeByte(0xDF);
|
||||||
writeInteger(uint32_t(n));
|
writeInteger(uint32_t(n));
|
||||||
}
|
}
|
||||||
for (auto it = object.createIterator(resources_); !it.done();
|
|
||||||
it.next(resources_)) {
|
auto slotId = object.head();
|
||||||
visit(it.key());
|
while (slotId != NULL_SLOT) {
|
||||||
it->accept(*this);
|
auto slot = resources_->getSlot(slotId);
|
||||||
|
visit(slot->key());
|
||||||
|
slot->data()->accept(*this);
|
||||||
|
slotId = slot->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
return bytesWritten();
|
return bytesWritten();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user