From e85a6b1e7cd8da631fd181d95e4bed7bd95f3386 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 1 May 2018 14:38:31 +0200 Subject: Use sizeof type instead of sizeof object, consistent --- sibs/SafeSerializer.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sibs/SafeSerializer.hpp b/sibs/SafeSerializer.hpp index e081585..72ef5a3 100644 --- a/sibs/SafeSerializer.hpp +++ b/sibs/SafeSerializer.hpp @@ -21,7 +21,7 @@ namespace sibs void add(const T &data) { usize offset = buffer.size(); - buffer.resize(buffer.size() + sizeof(data)); + buffer.resize(buffer.size() + sizeof(T)); #ifdef LITTLE_ENDIAN switch(sizeof(T)) { @@ -39,15 +39,15 @@ namespace sibs break; default: { - for(int i = 0; i < sizeof(data); ++i) + for(int i = 0; i < sizeof(T); ++i) { - buffer[offset + i] = ((char*)&data)[sizeof(data) - 1 - i]; + buffer[offset + i] = ((char*)&data)[sizeof(T) - 1 - i]; } break; } } #else - memcpy(&buffer[offset], &data, sizeof(data)); + memcpy(&buffer[offset], &data, sizeof(T)); #endif } -- cgit v1.2.3