aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-05-01 14:38:31 +0200
committerdec05eba <0xdec05eba@gmail.com>2018-05-01 14:38:35 +0200
commite85a6b1e7cd8da631fd181d95e4bed7bd95f3386 (patch)
treeef247bcd573104ee8d8164f4eecc27afed10c26c
parente96e47e4d1eb7217a0169013c9968b8eb52bbb4e (diff)
Use sizeof type instead of sizeof object, consistent0.2.1
-rw-r--r--sibs/SafeSerializer.hpp8
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
}