Skip to content

Commit

Permalink
FieldsChunkSerializer: Cosmetics.
Browse files Browse the repository at this point in the history
  • Loading branch information
levy committed Dec 3, 2024
1 parent eb2111e commit a1456b8
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/inet/common/packet/serializer/FieldsChunkSerializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,14 @@ namespace inet {
void FieldsChunkSerializer::serialize(MemoryOutputStream& stream, const Ptr<const Chunk>& chunk, b offset, b length) const
{
auto fieldsChunk = staticPtrCast<const FieldsChunk>(chunk);
if (length == b(-1))
length = fieldsChunk->getChunkLength() - offset;
auto& chunkStream = fieldsChunk->getSerializedDataForUpdate();
if (chunkStream.getLength() == b(0)) {
chunkStream.setCapacity(fieldsChunk->getChunkLength());
serialize(chunkStream, fieldsChunk);
ChunkSerializer::totalSerializedLength += chunkStream.getLength();
}

CHUNK_CHECK_USAGE(chunkStream.getLength() == fieldsChunk->getChunkLength(), "serialized length is incorrect: serialized=%" PRId64 " bit, chunk=%" PRId64 " bit",
chunkStream.getLength().get<b>(), chunk->getChunkLength().get<b>());

stream.writeData(chunkStream.getData(), offset, length);
CHUNK_CHECK_USAGE(chunkStream.getLength() == fieldsChunk->getChunkLength(), "serialized length is incorrect: serialized=%" PRId64 " bit, chunk=%" PRId64 " bit", chunkStream.getLength().get<b>(), chunk->getChunkLength().get<b>());
stream.writeData(chunkStream.getData(), offset, length == b(-1) ? fieldsChunk->getChunkLength() - offset : length);
}

const Ptr<Chunk> FieldsChunkSerializer::deserialize(MemoryInputStream& stream, const std::type_info& typeInfo) const
Expand Down

0 comments on commit a1456b8

Please sign in to comment.