diff --git a/Cereal/Cereal/src/Array.h b/Cereal/Cereal/src/Array.h index d412edd..792e1b1 100644 --- a/Cereal/Cereal/src/Array.h +++ b/Cereal/Cereal/src/Array.h @@ -139,7 +139,6 @@ namespace Cereal { { data = new byte[count * sizeOf(dataType)]; buffer.copyTo(data, count * sizeOf(dataType)); - buffer.addOffset(count * sizeOf(dataType)); } else { @@ -150,7 +149,6 @@ namespace Cereal { data = new byte[size]; buffer.copyTo(data, size); - buffer.addOffset(size); } } diff --git a/Cereal/Cereal/src/Buffer.h b/Cereal/Cereal/src/Buffer.h index bb20707..72236f7 100644 --- a/Cereal/Cereal/src/Buffer.h +++ b/Cereal/Cereal/src/Buffer.h @@ -149,14 +149,16 @@ namespace Cereal { template<> bool writeBytes(float data) { - unsigned int x = *(unsigned int*)&data; + unsigned int x; + *(unsigned int*)&x = *(unsigned int*)&data; return writeBytes(x); } template<> bool writeBytes(double data) { - unsigned long long x = *(unsigned long long*)&data; + unsigned long long x; + *(unsigned long long*)&x = *(unsigned long long*)&data; return writeBytes(x); } #endif @@ -326,14 +328,16 @@ namespace Cereal { template<> inline bool Buffer::writeBytes(float data) { - unsigned int x = *(unsigned int*)&data; + unsigned int x; + *(unsigned int*)&x = *(unsigned int*)&data; return writeBytes(x); } template<> inline bool Buffer::writeBytes(double data) { - unsigned long long x = *(unsigned long long*)&data; + unsigned long long x; + *(unsigned long long*)&x = *(unsigned long long*)&data; return writeBytes(x); } #endif diff --git a/Cereal/Cereal/src/Reader.h b/Cereal/Cereal/src/Reader.h index 481f3c2..ffac2f0 100644 --- a/Cereal/Cereal/src/Reader.h +++ b/Cereal/Cereal/src/Reader.h @@ -50,7 +50,6 @@ namespace Cereal { } float result; - memcpy(&result, &value, sizeof(float)); return result; @@ -104,7 +103,6 @@ namespace Cereal { } float result; - memcpy(&result, &value, sizeof(float)); return result; diff --git a/Cereal/Cereal/src/Writer.h b/Cereal/Cereal/src/Writer.h index 725c3f0..8865292 100644 --- a/Cereal/Cereal/src/Writer.h +++ b/Cereal/Cereal/src/Writer.h @@ -57,14 +57,16 @@ namespace Cereal { template<> static unsigned int writeBytes(byte* dest, unsigned int pointer, float data) { - unsigned int x = *(unsigned int*)&data; + unsigned int x; + *(unsigned int*)&x = *(unsigned int*)&data; return writeBytes(dest, pointer, x); } template<> static unsigned int writeBytes(byte* dest, unsigned int pointer, double data) { - unsigned long long x = *(unsigned long long*)&data; + unsigned long long x; + *(unsigned long long*)&x = *(unsigned long long*)&data; return writeBytes(dest, pointer, x); } #endif @@ -91,14 +93,16 @@ namespace Cereal { template<> inline unsigned int Writer::writeBytes(byte* dest, unsigned int pointer, float data) { - unsigned int x = *(unsigned int*)&data; + unsigned int x; + *(unsigned int*)&x = *(unsigned int*)&data; return writeBytes(dest, pointer, x); } template<> inline unsigned int Writer::writeBytes(byte* dest, unsigned int pointer, double data) { - unsigned long long x = *(unsigned long long*)&data; + unsigned long long x; + *(unsigned long long*)&x = *(unsigned long long*)&data; return writeBytes(dest, pointer, x); } #endif