diff options
author | Maxim Pimenov <m@maps.me> | 2016-08-24 13:31:06 +0300 |
---|---|---|
committer | Maxim Pimenov <m@maps.me> | 2016-08-26 15:50:54 +0300 |
commit | a637028bd7cce01eb6581673ecb8e5715eb4d294 (patch) | |
tree | 3e992a6fa476d1bcc314882ae9c1d95cab390728 /storage | |
parent | c27e8abc15b649fb9b5bffce586c90530e5b77d8 (diff) |
Review fixes.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/storage.cpp | 14 | ||||
-rw-r--r-- | storage/storage.hpp | 6 | ||||
-rw-r--r-- | storage/storage_tests/storage_tests.cpp | 2 |
3 files changed, 12 insertions, 10 deletions
diff --git a/storage/storage.cpp b/storage/storage.cpp index 4aad0f9a52..67c15376c2 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -271,7 +271,7 @@ void Storage::RegisterAllLocalMaps() LocalCountryFile const & localFile = *i; string const & name = localFile.GetCountryName(); TCountryId countryId = FindCountryIdByFile(name); - if (IsCoutryIdCountryTreeLeaf(countryId)) + if (IsLeaf(countryId)) RegisterCountryFiles(countryId, localFile.GetDirectory(), localFile.GetVersion()); else RegisterFakeCountryFiles(localFile); @@ -315,20 +315,20 @@ Country const & Storage::CountryByCountryId(TCountryId const & countryId) const return node->Value(); } -bool Storage::IsCoutryIdCountryTreeLeaf(TCountryId const & countryId) const +bool Storage::IsLeaf(TCountryId const & countryId) const { if (!IsCountryIdValid(countryId)) return false; TCountryTreeNode const * const node = m_countries.FindFirst(countryId); - return node != nullptr && node->ChildrenCount() == 0 /* countryId is a leaf. */; + return node != nullptr && node->ChildrenCount() == 0; } -bool Storage::IsCoutryIdCountryTreeInnerNode(TCountryId const & countryId) const +bool Storage::IsInnerNode(TCountryId const & countryId) const { if (!IsCountryIdValid(countryId)) return false; TCountryTreeNode const * const node = m_countries.FindFirst(countryId); - return node != nullptr && node->ChildrenCount() != 0 /* countryId is an inner node. */; + return node != nullptr && node->ChildrenCount() != 0; } TLocalAndRemoteSize Storage::CountrySizeInBytes(TCountryId const & countryId, MapOptions opt) const @@ -362,7 +362,7 @@ Storage::TLocalFilePtr Storage::GetLatestLocalFile(CountryFile const & countryFi ASSERT_THREAD_CHECKER(m_threadChecker, ()); TCountryId const countryId = FindCountryIdByFile(countryFile.GetName()); - if (IsCoutryIdCountryTreeLeaf(countryId)) + if (IsLeaf(countryId)) { TLocalFilePtr localFile = GetLatestLocalFile(countryId); if (localFile) @@ -514,7 +514,7 @@ void Storage::DeleteCustomCountryVersion(LocalCountryFile const & localFile) } TCountryId const countryId = FindCountryIdByFile(countryFile.GetName()); - if (!(IsCoutryIdCountryTreeLeaf(countryId))) + if (!(IsLeaf(countryId))) { LOG(LERROR, ("Removed files for an unknown country:", localFile)); return; diff --git a/storage/storage.hpp b/storage/storage.hpp index d6af12dade..7e3b8e8438 100644 --- a/storage/storage.hpp +++ b/storage/storage.hpp @@ -482,8 +482,10 @@ public: TCountryId FindCountryIdByFile(string const & name) const; - bool IsCoutryIdCountryTreeLeaf(TCountryId const & countryId) const; - bool IsCoutryIdCountryTreeInnerNode(TCountryId const & countryId) const; + // These two functions check whether |countryId| is a leaf + // or an inner node of the country tree. + bool IsLeaf(TCountryId const & countryId) const; + bool IsInnerNode(TCountryId const & countryId) const; TLocalAndRemoteSize CountrySizeInBytes(TCountryId const & countryId, MapOptions opt) const; platform::CountryFile const & GetCountryFile(TCountryId const & countryId) const; diff --git a/storage/storage_tests/storage_tests.cpp b/storage/storage_tests/storage_tests.cpp index fad03a28cb..f098b4b7e3 100644 --- a/storage/storage_tests/storage_tests.cpp +++ b/storage/storage_tests/storage_tests.cpp @@ -261,7 +261,7 @@ public: m_slot = m_storage.Subscribe( bind(&CountryDownloaderChecker::OnCountryStatusChanged, this, _1), bind(&CountryDownloaderChecker::OnCountryDownloadingProgress, this, _1, _2)); - TEST(storage.IsCoutryIdCountryTreeLeaf(countryId), (m_countryFile)); + TEST(storage.IsLeaf(countryId), (m_countryFile)); TEST(!m_transitionList.empty(), (m_countryFile)); } |