From ff55299029bf97579f60a1c3c18d044b97c88796 Mon Sep 17 00:00:00 2001 From: vng Date: Fri, 22 Jun 2012 18:06:23 -0700 Subject: [PATCH] Minor performance fixes. --- storage/country.cpp | 13 ++++++++++--- storage/country_decl.cpp | 3 +-- storage/country_decl.hpp | 2 +- storage/country_info.cpp | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/storage/country.cpp b/storage/country.cpp index 02618a3b00..054b66bcef 100644 --- a/storage/country.cpp +++ b/storage/country.cpp @@ -29,14 +29,21 @@ uint32_t CountryFile::GetFileSize() const return 0; } -struct CountryBoundsCalculator +class CountryBoundsCalculator { m2::RectD & m_bounds; - CountryBoundsCalculator(m2::RectD & bounds) : m_bounds(bounds) {} + Platform & m_platform; + +public: + CountryBoundsCalculator(m2::RectD & bounds) + : m_bounds(bounds), m_platform(GetPlatform()) + { + } + void operator()(CountryFile const & file) { feature::DataHeader h; - LoadMapHeader(GetPlatform().GetReader(file.GetFileWithExt()), h); + LoadMapHeader(m_platform.GetReader(file.GetFileWithExt()), h); m_bounds.Add(h.GetBounds()); } }; diff --git a/storage/country_decl.cpp b/storage/country_decl.cpp index 099191775c..534acd784c 100644 --- a/storage/country_decl.cpp +++ b/storage/country_decl.cpp @@ -1,7 +1,7 @@ #include "country_decl.hpp" -string storage::CountryInfo::FileName2FullName(string fName) +void storage::CountryInfo::FileName2FullName(string & fName) { size_t const i = fName.find('_'); if (i != string::npos) @@ -10,7 +10,6 @@ string storage::CountryInfo::FileName2FullName(string fName) fName[i] = ','; fName.insert(i+1, " "); } - return fName; } void storage::CountryInfo::FullName2GroupAndMap(string const & fName, string & group, string & map) diff --git a/storage/country_decl.hpp b/storage/country_decl.hpp index e0d154bb87..18316f6650 100644 --- a/storage/country_decl.hpp +++ b/storage/country_decl.hpp @@ -30,7 +30,7 @@ namespace storage bool IsNotEmpty() const { return !m_flag.empty(); } - static string FileName2FullName(string fName); + static void FileName2FullName(string & fName); static void FullName2GroupAndMap(string const & fName, string & group, string & map); }; } diff --git a/storage/country_info.cpp b/storage/country_info.cpp index a9e59c2fb1..a475debf17 100644 --- a/storage/country_info.cpp +++ b/storage/country_info.cpp @@ -108,7 +108,7 @@ namespace storage if (info.m_name.empty()) info.m_name = id; - info.m_name = CountryInfo::FileName2FullName(info.m_name); + CountryInfo::FileName2FullName(info.m_name); } void CountryInfoGetter::CalcUSALimitRect(m2::RectD rects[3]) const