diff --git a/indexer/data_header_reader.cpp b/indexer/data_header_reader.cpp index 3463709b86..badb5303eb 100644 --- a/indexer/data_header_reader.cpp +++ b/indexer/data_header_reader.cpp @@ -18,11 +18,14 @@ namespace feature } uint64_t ReadDataHeader(string const & datFileName, feature::DataHeader & outHeader) + { + return ReadDataHeader(FilesContainerR(datFileName).GetReader(DATA_FILE_TAG), outHeader); + } + + uint64_t ReadDataHeader(FileReader const & reader, feature::DataHeader & outHeader) { try { - FileReader reader = FilesContainerR(datFileName).GetReader(DATA_FILE_TAG); - uint64_t const toSkip = GetSkipHeaderSize(reader); ReaderSource src(reader); diff --git a/indexer/data_header_reader.hpp b/indexer/data_header_reader.hpp index c731d10e57..36c367b17d 100644 --- a/indexer/data_header_reader.hpp +++ b/indexer/data_header_reader.hpp @@ -5,6 +5,7 @@ class Writer; class Reader; +class FileReader; namespace feature { @@ -13,5 +14,7 @@ namespace feature /// @return total header size, which should be skipped for data read, or 0 if error uint64_t GetSkipHeaderSize(Reader const & reader); uint64_t ReadDataHeader(string const & datFileName, feature::DataHeader & outHeader); + + uint64_t ReadDataHeader(FileReader const & reader, feature::DataHeader & outHeader); void WriteDataHeader(Writer & writer, feature::DataHeader const & header); } diff --git a/indexer/indexer_tests/data_header_test.cpp b/indexer/indexer_tests/data_header_test.cpp index 1af83a4bdb..4e33a7694f 100644 --- a/indexer/indexer_tests/data_header_test.cpp +++ b/indexer/indexer_tests/data_header_test.cpp @@ -26,7 +26,7 @@ UNIT_TEST(DataHeaderSerialization) } feature::DataHeader header2; - TEST_GREATER(feature::ReadDataHeader(fileName, header2), 0, ()); + TEST_GREATER(feature::ReadDataHeader(FileReader(fileName), header2), 0, ()); TEST_EQUAL(header1.Bounds(), header2.Bounds(), ()); diff --git a/map/map_tests/map_foreach_test.cpp b/map/map_tests/map_foreach_test.cpp index 3d853d770f..121f1566ae 100644 --- a/map/map_tests/map_foreach_test.cpp +++ b/map/map_tests/map_foreach_test.cpp @@ -233,14 +233,14 @@ namespace UNIT_TEST(IndexForEachTest) { - string const path = GetPlatform().WritablePathForFile("minsk-pass"); + string const path = GetPlatform().WritablePathForFile("minsk-pass" DATA_FILE_EXTENSION); model::FeaturesFetcher src1; src1.InitClassificator(); - src1.AddMap(path + DATA_FILE_EXTENSION); + src1.AddMap(path); feature::DataHeader mapInfo; - TEST_GREATER(feature::ReadDataHeader(path + ".dat", mapInfo), 0, ()); + TEST_GREATER(feature::ReadDataHeader(path, mapInfo), 0, ()); vector rects; rects.push_back(mapInfo.Bounds()); @@ -253,7 +253,7 @@ UNIT_TEST(IndexForEachTest) feature_cont_t v1, v2; for_each_in_rect(src1, v1, r); - file_source_t src2(path + ".dat"); + file_source_t src2(path); for_each_in_rect(src2, v2, r); size_t errInd;