From 16a991d75b6cbb23d312f3c782ce0054ea0cddd0 Mon Sep 17 00:00:00 2001 From: Yuri Gorshenin Date: Thu, 7 Jul 2016 14:13:08 +0300 Subject: [PATCH] Style fixes. --- generator/routing_generator.cpp | 3 +-- map/address_finder.cpp | 2 +- map/framework.cpp | 13 ++++++------- map/framework.hpp | 2 +- .../routing_integration_tests/bicycle_turn_test.cpp | 1 - search/ranker.cpp | 2 +- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/generator/routing_generator.cpp b/generator/routing_generator.cpp index 796bb878c8..8d1f345726 100644 --- a/generator/routing_generator.cpp +++ b/generator/routing_generator.cpp @@ -323,8 +323,7 @@ void BuildRoutingIndex(string const & baseDir, string const & countryName, strin Index::FeaturesLoaderGuard loader(index, p.first); if (!loader.GetFeatureByIndex(fID, ft)) { - LOG(LWARNING, - ("Can't read feature for way:", seg.wayId, "probably map is damaged or deleted.")); + LOG(LWARNING, ("Can't read feature with id:", fID, "for way:", seg.wayId)); continue; } diff --git a/map/address_finder.cpp b/map/address_finder.cpp index a10a431f55..825dce4609 100644 --- a/map/address_finder.cpp +++ b/map/address_finder.cpp @@ -479,7 +479,7 @@ search::AddressInfo Framework::GetAddressInfoAtPoint(m2::PointD const & pt) cons search::AddressInfo Framework::GetFeatureAddressInfo(FeatureID const & fid) const { FeatureType ft; - if (!GetFeatureByID(fid, true /* parse */, ft)) + if (!GetFeatureByID(fid, ft)) return {}; return GetFeatureAddressInfo(ft); } diff --git a/map/framework.cpp b/map/framework.cpp index 467e116b27..6a570172ad 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1350,7 +1350,7 @@ void Framework::LoadSearchResultMetadata(search::Result & res) const // TODO @yunikkk refactor to format search result metadata accordingly with place_page::Info FeatureType ft; - if (!GetFeatureByID(id, true /* parse */, ft)) + if (!GetFeatureByID(id, ft)) return; search::ProcessMetadata(ft, res.m_metadata); @@ -1900,7 +1900,7 @@ unique_ptr Framework::GetFeatureAtPoint(m2::PointD const & mercator return poi ? move(poi) : (area ? move(area) : move(line)); } -bool Framework::GetFeatureByID(FeatureID const & fid, bool parse, FeatureType & ft) const +bool Framework::GetFeatureByID(FeatureID const & fid, FeatureType & ft) const { ASSERT(fid.IsValid(), ()); @@ -1908,8 +1908,7 @@ bool Framework::GetFeatureByID(FeatureID const & fid, bool parse, FeatureType & if (!guard.GetFeatureByIndex(fid.m_index, ft)) return false; - if (parse) - ft.ParseEverything(); + ft.ParseEverything(); return true; } @@ -2616,7 +2615,7 @@ bool Framework::ParseEditorDebugCommand(search::SearchParams const & params) FeatureID const & fid = edit.first; FeatureType ft; - if (!GetFeatureByID(fid, true /* parse */, ft)) + if (!GetFeatureByID(fid, ft)) { LOG(LERROR, ("Feature can't be loaded:", fid)); return true; @@ -2806,7 +2805,7 @@ bool Framework::GetEditableMapObject(FeatureID const & fid, osm::EditableMapObje return false; FeatureType ft; - if (!GetFeatureByID(fid, true /* parse */, ft)) + if (!GetFeatureByID(fid, ft)) return false; emo.SetFromFeatureType(ft); @@ -2967,7 +2966,7 @@ void Framework::DeleteFeature(FeatureID const & fid) const // TODO(AlexZ): Use FeatureID in the editor interface. FeatureType ft; - if (!GetFeatureByID(fid, true /* parse */, ft)) + if (!GetFeatureByID(fid, ft)) return; osm::Editor::Instance().DeleteFeature(ft); diff --git a/map/framework.hpp b/map/framework.hpp index 6581a3da4b..c411734a1b 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -541,7 +541,7 @@ public: /// Set parse to false if you don't need all feature fields ready. /// TODO(AlexZ): Refactor code which uses this method to get rid of it. /// FeatureType instances shoud not be used outside ForEach* core methods. - WARN_UNUSED_RESULT bool GetFeatureByID(FeatureID const & fid, bool parse, FeatureType & ft) const; + WARN_UNUSED_RESULT bool GetFeatureByID(FeatureID const & fid, FeatureType & ft) const; void MemoryWarning(); void EnterBackground(); diff --git a/routing/routing_integration_tests/bicycle_turn_test.cpp b/routing/routing_integration_tests/bicycle_turn_test.cpp index 08a15d256c..88fa24532d 100644 --- a/routing/routing_integration_tests/bicycle_turn_test.cpp +++ b/routing/routing_integration_tests/bicycle_turn_test.cpp @@ -59,7 +59,6 @@ UNIT_TEST(RussiaMoscowSevTushinoParkBicycleOnePointTurnTest) TRouteResult const routeResult = integration::CalculateRoute(integration::GetBicycleComponents(), point, {0.0, 0.0}, point); - Route const & route = *routeResult.first; IRouter::ResultCode const result = routeResult.second; TEST_EQUAL(result, IRouter::IRouter::RouteNotFound, ()); } diff --git a/search/ranker.cpp b/search/ranker.cpp index 2b06104917..2062ee3842 100644 --- a/search/ranker.cpp +++ b/search/ranker.cpp @@ -256,7 +256,7 @@ public: string name; string country; - if (LoadFeature(res1.GetId(), ft, center, name, country)) + if (!LoadFeature(res1.GetId(), ft, center, name, country)) return unique_ptr(); auto res2 = make_unique(ft, &res1, center, m_ranker.m_params.m_position /* pivot */,