aboutsummaryrefslogtreecommitdiff
path: root/src/serializerbinary.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/serializerbinary.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/serializerbinary.cpp b/src/serializerbinary.cpp
index 53e469f..4b741ae 100644
--- a/src/serializerbinary.cpp
+++ b/src/serializerbinary.cpp
@@ -1,4 +1,5 @@
1#include "serializerbinary.h" 1#include "serializerbinary.h"
2#include "serializable.h"
2 3
3SerializerBinary::SerializerBinary(FILE *fhFile, bool bLoading): 4SerializerBinary::SerializerBinary(FILE *fhFile, bool bLoading):
4 Serializer(bLoading), 5 Serializer(bLoading),
@@ -35,7 +36,7 @@ void SerializerBinary::close()
35 } 36 }
36} 37}
37 38
38void SerializerBinary::write(void * pData, int32_t nSize) 39void SerializerBinary::write(const void * pData, int32_t nSize)
39{ 40{
40 fwrite(pData, nSize, 1, fhFile); 41 fwrite(pData, nSize, 1, fhFile);
41} 42}
@@ -62,7 +63,6 @@ Serializer &SerializerBinary::operator<<(int16_t p)
62} 63}
63Serializer &SerializerBinary::operator<<(int32_t p) 64Serializer &SerializerBinary::operator<<(int32_t p)
64{ 65{
65 printf("int: %d, size: %d\n", p, sizeof(p));
66 fwrite(&p, sizeof(p), 1, fhFile); 66 fwrite(&p, sizeof(p), 1, fhFile);
67 return *this; 67 return *this;
68} 68}
@@ -109,9 +109,7 @@ Serializer &SerializerBinary::operator<<(long double p)
109 109
110Serializer &SerializerBinary::operator>>(bool &p) 110Serializer &SerializerBinary::operator>>(bool &p)
111{ 111{
112 bool bTmp; 112 fread(&p, sizeof(p), 1, fhFile);
113 fread(&bTmp, sizeof(p), 1, fhFile);
114 p = bTmp;
115 return *this; 113 return *this;
116} 114}
117Serializer &SerializerBinary::operator>>(int8_t &p) 115Serializer &SerializerBinary::operator>>(int8_t &p)
@@ -126,9 +124,7 @@ Serializer &SerializerBinary::operator>>(int16_t &p)
126} 124}
127Serializer &SerializerBinary::operator>>(int32_t &p) 125Serializer &SerializerBinary::operator>>(int32_t &p)
128{ 126{
129 printf("reding before: %d", p);
130 fread(&p, sizeof(p), 1, fhFile); 127 fread(&p, sizeof(p), 1, fhFile);
131 printf(" after: %d\n", p);
132 return *this; 128 return *this;
133} 129}
134Serializer &SerializerBinary::operator>>(int64_t &p) 130Serializer &SerializerBinary::operator>>(int64_t &p)