aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-05-01 14:38:31 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:16:10 +0200
commit8c486ac721e590b18650abaaa8a69b36dbcba806 (patch)
tree0c0c2b5bdeb6fec1c7de622a77b432a02e9e46bc
parentff9ea15709ba60008f46df9adae747b8c6e71d68 (diff)
Use sizeof type instead of sizeof object, consistent
-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
}