From b253ce048560dc02fe17cd75560bdaeb9e84ab4e Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sun, 18 Aug 2024 11:55:25 +0200 Subject: [PATCH] Replace resize + memcpy by insert in serialization --- common/wivrn_serialization.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/wivrn_serialization.h b/common/wivrn_serialization.h index 79ecd22a..d66c3fde 100644 --- a/common/wivrn_serialization.h +++ b/common/wivrn_serialization.h @@ -118,9 +118,8 @@ public: void write(const void * data, size_t size) { - size_t index = buffer.size(); - buffer.resize(index + size); - memcpy(&buffer[index], data, size); + auto d = (uint8_t *)data; + buffer.insert(buffer.end(), d, d + size); std::get(spans.back()) += size; }