Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Pimenov <m@maps.me>2019-05-17 13:14:54 +0300
committerTatiana Yan <tatiana.kondakova@gmail.com>2019-05-17 13:33:04 +0300
commit6166203b60decba59b14a733c463988a9f7dc351 (patch)
treeea70391a9b3bfcfa3bf16bb66fdaeb5872b9f981 /storage
parent2b495905b69fda0784e4fbf4ebb07a11cebcc734 (diff)
[storage] [search_quality] Fixed a use-after-free.
Diffstat (limited to 'storage')
-rw-r--r--storage/country.cpp24
-rw-r--r--storage/country.hpp10
-rw-r--r--storage/country_info_getter.cpp4
-rw-r--r--storage/country_info_getter.hpp4
-rw-r--r--storage/storage.cpp4
-rw-r--r--storage/storage.hpp6
6 files changed, 25 insertions, 27 deletions
diff --git a/storage/country.cpp b/storage/country.cpp
index 41bc1df000..99996e67df 100644
--- a/storage/country.cpp
+++ b/storage/country.cpp
@@ -33,17 +33,17 @@ public:
CountryId const & parent) = 0;
virtual void InsertOldMwmMapping(CountryId const & newId, CountryId const & oldId) = 0;
virtual void InsertAffiliation(CountryId const & countryId, string const & affilation) = 0;
- virtual TMappingOldMwm GetMapping() const = 0;
+ virtual OldMwmMapping GetMapping() const = 0;
};
class StoreCountriesSingleMwms : public StoreSingleMwmInterface
{
CountryTree & m_countries;
- TMappingAffiliations & m_affiliations;
- TMappingOldMwm m_idsMapping;
+ Affiliations & m_affiliations;
+ OldMwmMapping m_idsMapping;
public:
- StoreCountriesSingleMwms(CountryTree & countries, TMappingAffiliations & affiliations)
+ StoreCountriesSingleMwms(CountryTree & countries, Affiliations & affiliations)
: m_countries(countries), m_affiliations(affiliations)
{
}
@@ -81,12 +81,12 @@ public:
m_affiliations[affilation].push_back(countryId);
}
- TMappingOldMwm GetMapping() const override { return m_idsMapping; }
+ OldMwmMapping GetMapping() const override { return m_idsMapping; }
};
class StoreFile2InfoSingleMwms : public StoreSingleMwmInterface
{
- TMappingOldMwm m_idsMapping;
+ OldMwmMapping m_idsMapping;
map<string, CountryInfo> & m_file2info;
public:
@@ -106,7 +106,7 @@ public:
string const & /* affilation */) override
{
}
- TMappingOldMwm GetMapping() const override
+ OldMwmMapping GetMapping() const override
{
ASSERT(false, ());
return map<CountryId, CountriesSet>();
@@ -197,7 +197,7 @@ class StoreCountriesTwoComponentMwms : public StoreTwoComponentMwmInterface
CountryTree & m_countries;
public:
- StoreCountriesTwoComponentMwms(CountryTree & countries, TMappingAffiliations & /* affiliations */)
+ StoreCountriesTwoComponentMwms(CountryTree & countries, Affiliations & /* affiliations */)
: m_countries(countries)
{
}
@@ -219,7 +219,7 @@ public:
class StoreFile2InfoTwoComponentMwms : public StoreTwoComponentMwmInterface
{
- TMappingOldMwm m_idsMapping;
+ OldMwmMapping m_idsMapping;
map<string, CountryInfo> & m_file2info;
public:
@@ -302,8 +302,8 @@ bool LoadCountriesTwoComponentMwmsImpl(string const & jsonBuffer,
}
int64_t LoadCountriesFromBuffer(string const & jsonBuffer, CountryTree & countries,
- TMappingAffiliations & affiliations,
- TMappingOldMwm * mapping /* = nullptr */)
+ Affiliations & affiliations,
+ OldMwmMapping * mapping /* = nullptr */)
{
countries.Clear();
affiliations.clear();
@@ -337,7 +337,7 @@ int64_t LoadCountriesFromBuffer(string const & jsonBuffer, CountryTree & countri
}
int64_t LoadCountriesFromFile(string const & path, CountryTree & countries,
- TMappingAffiliations & affiliations, TMappingOldMwm * mapping)
+ Affiliations & affiliations, OldMwmMapping * mapping)
{
string json;
ReaderPtr<Reader>(GetPlatform().GetReader(path)).ReadAsString(json);
diff --git a/storage/country.hpp b/storage/country.hpp
index fc29a23fc8..a181104095 100644
--- a/storage/country.hpp
+++ b/storage/country.hpp
@@ -25,9 +25,9 @@ class SizeUpdater;
namespace storage
{
-using TMappingOldMwm = std::map<CountryId, CountriesSet>;
+using OldMwmMapping = std::map<CountryId, CountriesSet>;
/// Map from key affiliation words into MWM IDs (file names).
-using TMappingAffiliations = std::unordered_map<string, vector<CountryId>>;
+using Affiliations = std::unordered_map<string, vector<CountryId>>;
/// This class keeps all the information about a country in country tree (CountryTree).
/// It is guaranteed that every node represent a unique region has a unique |m_name| in country
@@ -85,11 +85,9 @@ using CountryTreeNode = CountryTree::Node;
/// @return version of country file or -1 if error was encountered
int64_t LoadCountriesFromBuffer(std::string const & buffer, CountryTree & countries,
- TMappingAffiliations & affiliations,
- TMappingOldMwm * mapping = nullptr);
+ Affiliations & affiliations, OldMwmMapping * mapping = nullptr);
int64_t LoadCountriesFromFile(std::string const & path, CountryTree & countries,
- TMappingAffiliations & affiliations,
- TMappingOldMwm * mapping = nullptr);
+ Affiliations & affiliations, OldMwmMapping * mapping = nullptr);
void LoadCountryFile2CountryInfo(std::string const & jsonBuffer,
std::map<std::string, CountryInfo> & id2info, bool & isSingleMwm);
diff --git a/storage/country_info_getter.cpp b/storage/country_info_getter.cpp
index ebdc696195..77bf69e615 100644
--- a/storage/country_info_getter.cpp
+++ b/storage/country_info_getter.cpp
@@ -191,8 +191,8 @@ void CountryInfoGetter::GetMatchedRegions(string const & affiliation, TRegionIdS
regions.push_back(i);
}
}
-
-void CountryInfoGetter::InitAffiliationsInfo(TMappingAffiliations const * affiliations)
+
+void CountryInfoGetter::SetAffiliations(Affiliations const * affiliations)
{
m_affiliations = affiliations;
}
diff --git a/storage/country_info_getter.hpp b/storage/country_info_getter.hpp
index ea964751f8..39ad40e9f0 100644
--- a/storage/country_info_getter.hpp
+++ b/storage/country_info_getter.hpp
@@ -103,7 +103,7 @@ public:
// Clears regions cache.
inline void ClearCaches() const { ClearCachesImpl(); }
- void InitAffiliationsInfo(TMappingAffiliations const * affiliations);
+ void SetAffiliations(Affiliations const * affiliations);
protected:
CountryInfoGetter() : CountryInfoGetterBase(true /* isSingleMwm */ ) {};
@@ -124,7 +124,7 @@ protected:
// Maps all leaf country id (file names) to their indices in m_countries.
std::unordered_map<CountryId, TRegionId> m_countryIndex;
- TMappingAffiliations const * m_affiliations = nullptr;
+ Affiliations const * m_affiliations = nullptr;
// Maps country file name without an extension to a country info.
std::map<std::string, CountryInfo> m_id2info;
diff --git a/storage/storage.cpp b/storage/storage.cpp
index 25c7d5594a..92bce25bff 100644
--- a/storage/storage.cpp
+++ b/storage/storage.cpp
@@ -208,7 +208,7 @@ void Storage::Migrate(CountriesVec const & existedCountries)
Clear();
m_countries.Clear();
- TMappingOldMwm mapping;
+ OldMwmMapping mapping;
LoadCountriesFile(COUNTRIES_FILE, m_dataDir, &mapping);
vector<CountryId> prefetchedMaps;
@@ -747,7 +747,7 @@ CountryId Storage::GetCurrentDownloadingCountryId() const
}
void Storage::LoadCountriesFile(string const & pathToCountriesFile, string const & dataDir,
- TMappingOldMwm * mapping /* = nullptr */)
+ OldMwmMapping * mapping /* = nullptr */)
{
m_dataDir = dataDir;
diff --git a/storage/storage.hpp b/storage/storage.hpp
index 2ef7f808a1..2686f2a308 100644
--- a/storage/storage.hpp
+++ b/storage/storage.hpp
@@ -262,7 +262,7 @@ private:
// It is filled with data of countries.txt (field "affiliations").
// Once filled |m_affiliations| is not changed.
// Note. |m_affiliations| is empty in case of countries_obsolete.txt.
- TMappingAffiliations m_affiliations;
+ Affiliations m_affiliations;
MwmSize m_maxMwmSizeBytes;
@@ -279,7 +279,7 @@ private:
void DownloadNextCountryFromQueue();
void LoadCountriesFile(std::string const & pathToCountriesFile, std::string const & dataDir,
- TMappingOldMwm * mapping = nullptr);
+ OldMwmMapping * mapping = nullptr);
void ReportProgress(CountryId const & countryId, MapFilesDownloader::Progress const & p);
void ReportProgressForHierarchy(CountryId const & countryId,
@@ -467,7 +467,7 @@ public:
/// \return true if updateInfo is filled correctly and false otherwise.
bool GetUpdateInfo(CountryId const & countryId, UpdateInfo & updateInfo) const;
- TMappingAffiliations const & GetAffiliations() const { return m_affiliations; }
+ Affiliations const & GetAffiliations() const { return m_affiliations; }
/// \brief Calls |toDo| for each node for subtree with |root|.
/// For example ForEachInSubtree(GetRootId()) calls |toDo| for every node including