Skip to content

Commit

Permalink
Removed Windows-only functions
Browse files Browse the repository at this point in the history
  • Loading branch information
marcizhu committed Apr 1, 2017
1 parent 1b6b400 commit 8c221ef
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Cereal/Cereal/src/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace Cereal {

offset += sizeof(float);

memcpy_s(&result, 4, &value, 4);
memcpy(&result, &value, 4);

return result;
}
Expand All @@ -92,7 +92,7 @@ namespace Cereal {
}

double result;
memcpy_s(&result, 4, &value, 4);
memcpy(&result, &value, 4);

offset += sizeof(double);

Expand Down
4 changes: 2 additions & 2 deletions Cereal/Cereal/src/Reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace Cereal {

float result;

memcpy_s(&result, sizeof(float), &value, sizeof(float));
memcpy(&result, &value, sizeof(float));

return result;
}
Expand All @@ -69,7 +69,7 @@ namespace Cereal {
}

double result;
memcpy_s(&result, sizeof(double), &value, sizeof(double));
memcpy(&result, &value, sizeof(double));

return result;
}
Expand Down
25 changes: 14 additions & 11 deletions Sandbox/Sandbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ std::vector<std::string> 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);
Expand Down Expand Up @@ -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<float>();
//db->read(dest);

//std::string ret = header2->getDatabase("Database name")->getObject("Object name")->getField("Field name")->getValue<std::string>();
float retf = header2->getDatabase("Second database")->getObject("Test object")->getField("xpos")->getValue<float>();

std::vector<std::string> array = db->getObject("English")->getArray("words")->getArray<std::string>();
std::string ret = header2->getDatabase("Database name")->getObject("Object name")->getField("Field name")->getValue<std::string>();

//std::vector<std::string> array = db->getObject("English")->getArray("words")->getArray<std::string>();

printf("Done.");

//delete header;
delete db;*/
delete header2;
//delete db;

while (1) { Sleep(1000); }

Expand Down

0 comments on commit 8c221ef

Please sign in to comment.