diff --git a/Cereal/Cereal/src/Array.h b/Cereal/Cereal/src/Array.h index d1abeca..e059b44 100644 --- a/Cereal/Cereal/src/Array.h +++ b/Cereal/Cereal/src/Array.h @@ -108,8 +108,7 @@ namespace Cereal { else s = size; - for (unsigned int i = 0; i < s; i++) - buffer.writeBytes(data[i]); + buffer.copy(data, s); return true; } diff --git a/Cereal/Cereal/src/Buffer.h b/Cereal/Cereal/src/Buffer.h index 47c6831..3f97f67 100644 --- a/Cereal/Cereal/src/Buffer.h +++ b/Cereal/Cereal/src/Buffer.h @@ -166,6 +166,15 @@ namespace Cereal { return true; } + bool copy(byte* data, unsigned int size) + { + memcpy((byte*)start + offset, data, size); + + offset += size; + + return true; + } + void shrink() { byte* temp = new byte[offset]; diff --git a/Sandbox/Sandbox.cpp b/Sandbox/Sandbox.cpp index 0ef1b2f..bdc1029 100644 --- a/Sandbox/Sandbox.cpp +++ b/Sandbox/Sandbox.cpp @@ -110,7 +110,7 @@ void testCereal64() void testRead() { Cereal::Buffer buffer(0); - bool ret = buffer.readFile("C:\\Users\\marci\\Documents\\Visual Studio 2015\\Projects\\Cereal\\Debug\\test-out.db"); + bool ret = buffer.readFile("test-out.db"); PT_ASSERT(ret == true); Cereal::Header* header = new Cereal::Header;