From a1456b8eb36f3d6c7f0ea5318dbf914841778941 Mon Sep 17 00:00:00 2001 From: Levente Meszaros Date: Tue, 3 Dec 2024 18:48:33 +0100 Subject: [PATCH] FieldsChunkSerializer: Cosmetics. --- .../common/packet/serializer/FieldsChunkSerializer.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/inet/common/packet/serializer/FieldsChunkSerializer.cc b/src/inet/common/packet/serializer/FieldsChunkSerializer.cc index 0796f444480..648f3997135 100644 --- a/src/inet/common/packet/serializer/FieldsChunkSerializer.cc +++ b/src/inet/common/packet/serializer/FieldsChunkSerializer.cc @@ -15,19 +15,14 @@ namespace inet { void FieldsChunkSerializer::serialize(MemoryOutputStream& stream, const Ptr& chunk, b offset, b length) const { auto fieldsChunk = staticPtrCast(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(), chunk->getChunkLength().get()); - - 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(), chunk->getChunkLength().get()); + stream.writeData(chunkStream.getData(), offset, length == b(-1) ? fieldsChunk->getChunkLength() - offset : length); } const Ptr FieldsChunkSerializer::deserialize(MemoryInputStream& stream, const std::type_info& typeInfo) const