diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-05-01 14:38:31 +0200 |
---|---|---|
committer | dec05eba <0xdec05eba@gmail.com> | 2018-05-01 14:38:35 +0200 |
commit | e85a6b1e7cd8da631fd181d95e4bed7bd95f3386 (patch) | |
tree | ef247bcd573104ee8d8164f4eecc27afed10c26c /sibs/SafeSerializer.hpp | |
parent | e96e47e4d1eb7217a0169013c9968b8eb52bbb4e (diff) |
Use sizeof type instead of sizeof object, consistent0.2.1
Diffstat (limited to 'sibs/SafeSerializer.hpp')
-rw-r--r-- | sibs/SafeSerializer.hpp | 8 |
1 files 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 } |