From 15ba83cb200083006907b6d076acf339ee0f75a4 Mon Sep 17 00:00:00 2001 From: Victor Zarubkin Date: Tue, 27 Sep 2016 00:12:28 +0300 Subject: [PATCH] Linux build --- src/reader.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/reader.cpp b/src/reader.cpp index 6baf56b..598b105 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -232,13 +232,23 @@ extern "C" { ::profiler::thread_blocks_tree_t& threaded_trees, bool gather_statistics) { - ::std::ifstream inFile(filename, ::std::fstream::binary); progress.store(0); + + ::std::ifstream inFile(filename, ::std::fstream::binary); if (!inFile.is_open()) return 0; + ::std::stringstream str; + +#ifdef _WIN32 str.set_rdbuf(inFile.rdbuf()); return fillTreesFromStream(progress, str, serialized_blocks, serialized_descriptors, descriptors, blocks, threaded_trees, gather_statistics); +#else + auto oldbuf = str.rdbuf(inFile.rdbuf()); + auto result = fillTreesFromStream(progress, str, serialized_blocks, serialized_descriptors, descriptors, blocks, threaded_trees, gather_statistics); + str.rdbuf(oldbuf); + return result; +#endif } //////////////////////////////////////////////////////////////////////////