From 7c18e96b4f77b28b1c849af9906ca0c868998ccf Mon Sep 17 00:00:00 2001 From: Yuri Gorshenin Date: Thu, 19 Nov 2015 16:44:05 +0300 Subject: [PATCH] [platform] Do not add/register maps newer than App. --- platform/local_country_file_utils.cpp | 2 +- platform/platform_tests/local_country_file_tests.cpp | 4 ++-- routing/routing_integration_tests/cross_section_tests.cpp | 5 ++++- routing/routing_integration_tests/routing_test_tools.cpp | 5 ++++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/platform/local_country_file_utils.cpp b/platform/local_country_file_utils.cpp index 8098165e5c..4d5f610686 100644 --- a/platform/local_country_file_utils.cpp +++ b/platform/local_country_file_utils.cpp @@ -198,7 +198,7 @@ void FindAllLocalMapsAndCleanup(int64_t latestVersion, vector { string const & subdir = fwt.first; int64_t version; - if (!ParseVersion(subdir, version)) + if (!ParseVersion(subdir, version) || version > latestVersion) continue; string const fullPath = my::JoinFoldersToPath(dir, subdir); diff --git a/platform/platform_tests/local_country_file_tests.cpp b/platform/platform_tests/local_country_file_tests.cpp index 87527a990f..0348851c06 100644 --- a/platform/platform_tests/local_country_file_tests.cpp +++ b/platform/platform_tests/local_country_file_tests.cpp @@ -159,7 +159,7 @@ UNIT_TEST(LocalCountryFile_CleanupMapFiles) // Check FindAllLocalMaps() vector localFiles; - FindAllLocalMapsAndCleanup(-1 /* latestVersion */, localFiles); + FindAllLocalMapsAndCleanup(4 /* latestVersion */, localFiles); TEST(!Contains(localFiles, japanLocalFile), (japanLocalFile, localFiles)); TEST(!Contains(localFiles, brazilLocalFile), (brazilLocalFile, localFiles)); TEST(Contains(localFiles, irelandLocalFile), (irelandLocalFile, localFiles)); @@ -270,7 +270,7 @@ UNIT_TEST(LocalCountryFile_AllLocalFilesLookup) ScopedFile testItalyMapFile(testDir, italyFile, MapOptions::Map, "Italy-map"); vector localFiles; - FindAllLocalMapsAndCleanup(-1 /* latestVersion */, localFiles); + FindAllLocalMapsAndCleanup(10101 /* latestVersion */, localFiles); multiset localFilesSet(localFiles.begin(), localFiles.end()); bool worldFound = false; diff --git a/routing/routing_integration_tests/cross_section_tests.cpp b/routing/routing_integration_tests/cross_section_tests.cpp index 50f17023ba..c00af8013b 100644 --- a/routing/routing_integration_tests/cross_section_tests.cpp +++ b/routing/routing_integration_tests/cross_section_tests.cpp @@ -10,6 +10,8 @@ #include "base/logging.hpp" +#include "std/limits.hpp" + using namespace routing; namespace @@ -18,7 +20,8 @@ UNIT_TEST(CheckCrossSections) { static double constexpr kPointEquality = 0.01; vector localFiles; - platform::FindAllLocalMapsAndCleanup(-1 /* latestVersion */, localFiles); + platform::FindAllLocalMapsAndCleanup(numeric_limits::max() /* latestVersion */, + localFiles); size_t ingoingErrors = 0; size_t outgoingErrors = 0; diff --git a/routing/routing_integration_tests/routing_test_tools.cpp b/routing/routing_integration_tests/routing_test_tools.cpp index e78a32cafd..8ce2f977ff 100644 --- a/routing/routing_integration_tests/routing_test_tools.cpp +++ b/routing/routing_integration_tests/routing_test_tools.cpp @@ -24,6 +24,8 @@ #include "geometry/distance_on_sphere.hpp" +#include "std/limits.hpp" + #include "private.h" #include @@ -159,7 +161,8 @@ namespace integration pl.SetResourceDir(options.m_resourcePath); vector localFiles; - platform::FindAllLocalMapsAndCleanup(-1, localFiles); + platform::FindAllLocalMapsAndCleanup(numeric_limits::max() /* latestVersion */, + localFiles); for (auto & file : localFiles) file.SyncWithDisk(); ASSERT(!localFiles.empty(), ());