From 8c221ef59eb51251c3597bb053d81f1aeb73bddf Mon Sep 17 00:00:00 2001 From: marcizhu Date: Sat, 1 Apr 2017 13:12:22 +0200 Subject: [PATCH] Removed Windows-only functions --- Cereal/Cereal/src/Buffer.h | 4 ++-- Cereal/Cereal/src/Reader.h | 4 ++-- Sandbox/Sandbox.cpp | 25 ++++++++++++++----------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Cereal/Cereal/src/Buffer.h b/Cereal/Cereal/src/Buffer.h index 5ba626e..47c6831 100644 --- a/Cereal/Cereal/src/Buffer.h +++ b/Cereal/Cereal/src/Buffer.h @@ -73,7 +73,7 @@ namespace Cereal { offset += sizeof(float); - memcpy_s(&result, 4, &value, 4); + memcpy(&result, &value, 4); return result; } @@ -92,7 +92,7 @@ namespace Cereal { } double result; - memcpy_s(&result, 4, &value, 4); + memcpy(&result, &value, 4); offset += sizeof(double); diff --git a/Cereal/Cereal/src/Reader.h b/Cereal/Cereal/src/Reader.h index 840d0a9..c9fc536 100644 --- a/Cereal/Cereal/src/Reader.h +++ b/Cereal/Cereal/src/Reader.h @@ -50,7 +50,7 @@ namespace Cereal { float result; - memcpy_s(&result, sizeof(float), &value, sizeof(float)); + memcpy(&result, &value, sizeof(float)); return result; } @@ -69,7 +69,7 @@ namespace Cereal { } double result; - memcpy_s(&result, sizeof(double), &value, sizeof(double)); + memcpy(&result, &value, sizeof(double)); return result; } diff --git a/Sandbox/Sandbox.cpp b/Sandbox/Sandbox.cpp index 63187d6..2ea9103 100644 --- a/Sandbox/Sandbox.cpp +++ b/Sandbox/Sandbox.cpp @@ -69,7 +69,7 @@ std::vector splitString(const std::string& str, char delimiter) int main() { - Cereal::Buffer dest(1024 * 1024 * 10); + /*Cereal::Buffer dest(1024 * 1024 * 10); std::ifstream infile("words.txt", std::ifstream::binary); @@ -128,26 +128,29 @@ int main() printf("OK!\n\nJob done."); - dump(dest.getStart(), dest.getSize()); + dump(dest.getStart(), dest.getSize());*/ - /**Cereal::Buffer dest(0); + Cereal::Buffer dest(0); - dest.readFile("dictionaries.db"); + dest.readFile("test.db"); - Cereal::Database* db = new Cereal::Database; + //Cereal::Database* db = new Cereal::Database; - db->read(dest); + Cereal::Header* header2 = new Cereal::Header(); + header2->read(dest); - //float retf = header2->getDatabase("Second database")->getObject("Test object")->getField("xpos")->getValue(); + //db->read(dest); - //std::string ret = header2->getDatabase("Database name")->getObject("Object name")->getField("Field name")->getValue(); + float retf = header2->getDatabase("Second database")->getObject("Test object")->getField("xpos")->getValue(); - std::vector array = db->getObject("English")->getArray("words")->getArray(); + std::string ret = header2->getDatabase("Database name")->getObject("Object name")->getField("Field name")->getValue(); + + //std::vector array = db->getObject("English")->getArray("words")->getArray(); printf("Done."); - //delete header; - delete db;*/ + delete header2; + //delete db; while (1) { Sleep(1000); }