diff options
author | Maxim Pimenov <m@maps.me> | 2019-05-20 17:47:33 +0300 |
---|---|---|
committer | Maxim Pimenov <m@maps.me> | 2019-05-20 17:53:16 +0300 |
commit | b4f84e419740a20a68f779bed67cde4fe72fdee0 (patch) | |
tree | e3a082bbdea01c8e2475138637ff6bac7e97e436 /generator | |
parent | 020e73b851fb78365723a8679e4c76cb26fb10d9 (diff) |
Fixed some warnings.
Diffstat (limited to 'generator')
-rw-r--r-- | generator/altitude_generator.cpp | 4 | ||||
-rw-r--r-- | generator/booking_quality_check/booking_addr_match.cpp | 4 | ||||
-rw-r--r-- | generator/borders_loader.cpp | 2 | ||||
-rw-r--r-- | generator/coastlines_generator.cpp | 2 | ||||
-rw-r--r-- | generator/feature_segments_checker/feature_segments_checker.cpp | 14 | ||||
-rw-r--r-- | generator/generator_tests/altitude_test.cpp | 2 | ||||
-rw-r--r-- | generator/generator_tests/regions_tests.cpp | 18 | ||||
-rw-r--r-- | generator/locality_sorter.cpp | 2 | ||||
-rw-r--r-- | generator/mwm_diff/diff.cpp | 1 | ||||
-rw-r--r-- | generator/osm2type.cpp | 4 | ||||
-rw-r--r-- | generator/road_access_generator.cpp | 2 | ||||
-rw-r--r-- | generator/search_index_builder.cpp | 13 | ||||
-rw-r--r-- | generator/srtm_parser.cpp | 2 |
13 files changed, 34 insertions, 36 deletions
diff --git a/generator/altitude_generator.cpp b/generator/altitude_generator.cpp index a74c46bd37..1fe85994db 100644 --- a/generator/altitude_generator.cpp +++ b/generator/altitude_generator.cpp @@ -45,7 +45,7 @@ using namespace routing; class SrtmGetter : public AltitudeGetter { public: - SrtmGetter(std::string const & srtmDir) : m_srtmManager(srtmDir) {} + explicit SrtmGetter(std::string const & srtmDir) : m_srtmManager(srtmDir) {} // AltitudeGetter overrides: feature::TAltitude GetAltitude(m2::PointD const & p) override @@ -74,7 +74,7 @@ public: using TFeatureAltitudes = std::vector<FeatureAltitude>; - Processor(AltitudeGetter & altitudeGetter) + explicit Processor(AltitudeGetter & altitudeGetter) : m_altitudeGetter(altitudeGetter), m_minAltitude(kInvalidAltitude) { } diff --git a/generator/booking_quality_check/booking_addr_match.cpp b/generator/booking_quality_check/booking_addr_match.cpp index 82883ca39a..adec07b707 100644 --- a/generator/booking_quality_check/booking_addr_match.cpp +++ b/generator/booking_quality_check/booking_addr_match.cpp @@ -53,12 +53,8 @@ int main(int argc, char * argv[]) Platform & platform = GetPlatform(); - std::string countriesFile = COUNTRIES_FILE; if (!FLAGS_user_resource_path.empty()) - { platform.SetResourceDir(FLAGS_user_resource_path); - countriesFile = base::JoinPath(FLAGS_user_resource_path, COUNTRIES_FILE); - } if (!FLAGS_data_path.empty()) { diff --git a/generator/borders_loader.cpp b/generator/borders_loader.cpp index 283040081b..3d5888db6d 100644 --- a/generator/borders_loader.cpp +++ b/generator/borders_loader.cpp @@ -41,7 +41,7 @@ class PolygonLoader CountriesContainer & m_countries; public: - PolygonLoader(CountriesContainer & countries) : m_countries(countries) {} + explicit PolygonLoader(CountriesContainer & countries) : m_countries(countries) {} void operator()(string const & name, vector<m2::RegionD> const & borders) { diff --git a/generator/coastlines_generator.cpp b/generator/coastlines_generator.cpp index 6ee42e5096..7ebda8c57e 100644 --- a/generator/coastlines_generator.cpp +++ b/generator/coastlines_generator.cpp @@ -166,7 +166,7 @@ class DoDifference vector<m2::PointD> m_points; public: - DoDifference(RegionT const & rgn) + explicit DoDifference(RegionT const & rgn) { m_res.push_back(rgn); m_src = rgn.GetRect(); diff --git a/generator/feature_segments_checker/feature_segments_checker.cpp b/generator/feature_segments_checker/feature_segments_checker.cpp index a17c8724df..607c5cf31c 100644 --- a/generator/feature_segments_checker/feature_segments_checker.cpp +++ b/generator/feature_segments_checker/feature_segments_checker.cpp @@ -52,8 +52,10 @@ int32_t Coord2RoughCoord(double d) struct RoughPoint { - RoughPoint(m2::PointD const & point) - : x(Coord2RoughCoord(point.x)), y(Coord2RoughCoord(point.y)) {} + explicit RoughPoint(m2::PointD const & point) + : x(Coord2RoughCoord(point.x)), y(Coord2RoughCoord(point.y)) + { + } int32_t x; int32_t y; @@ -154,8 +156,12 @@ public: TAltitude m_minAltitude = kInvalidAltitude; TAltitude m_maxAltitude = kInvalidAltitude; - Processor(generator::SrtmTileManager & manager) - : m_srtmManager(manager), m_roadCount(0), m_emptyRoadCount(0), m_roadPointCount(0), m_notRoadCount(0) + explicit Processor(generator::SrtmTileManager & manager) + : m_srtmManager(manager) + , m_roadCount(0) + , m_emptyRoadCount(0) + , m_roadPointCount(0) + , m_notRoadCount(0) { } diff --git a/generator/generator_tests/altitude_test.cpp b/generator/generator_tests/altitude_test.cpp index 8d97dd968b..d36d7a7bce 100644 --- a/generator/generator_tests/altitude_test.cpp +++ b/generator/generator_tests/altitude_test.cpp @@ -72,7 +72,7 @@ class MockAltitudeGetter : public AltitudeGetter public: using TMockAltitudes = map<m2::PointI, TAltitude>; - MockAltitudeGetter(vector<TPoint3DList> const & roads) + explicit MockAltitudeGetter(vector<TPoint3DList> const & roads) { for (TPoint3DList const & geom3D : roads) { diff --git a/generator/generator_tests/regions_tests.cpp b/generator/generator_tests/regions_tests.cpp index f62f206ca9..b4dd3314e6 100644 --- a/generator/generator_tests/regions_tests.cpp +++ b/generator/generator_tests/regions_tests.cpp @@ -163,7 +163,7 @@ public: } }; -bool ExistsName(std::vector<std::string> const & coll, std::string const name) +bool NameExists(std::vector<std::string> const & coll, std::string const & name) { auto const end = std::end(coll); return std::find(std::begin(coll), end, name) != end; @@ -208,13 +208,13 @@ UNIT_TEST(RegionsBuilderTest_GetCountryTrees) }); }); - TEST(ExistsName(bankOfNames, "Country_2"), ()); - TEST(ExistsName(bankOfNames, "Country_2Country_2_Region_8"), ()); + TEST(NameExists(bankOfNames, "Country_2"), ()); + TEST(NameExists(bankOfNames, "Country_2Country_2_Region_8"), ()); - TEST(ExistsName(bankOfNames, "Country_1"), ()); - TEST(ExistsName(bankOfNames, "Country_1Country_1_Region_3"), ()); - TEST(ExistsName(bankOfNames, "Country_1Country_1_Region_4"), ()); - TEST(ExistsName(bankOfNames, "Country_1Country_1_Region_5"), ()); - TEST(ExistsName(bankOfNames, "Country_1Country_1_Region_5Country_1_Region_5_Subregion_6"), ()); - TEST(ExistsName(bankOfNames, "Country_1Country_1_Region_5Country_1_Region_5_Subregion_7"), ()); + TEST(NameExists(bankOfNames, "Country_1"), ()); + TEST(NameExists(bankOfNames, "Country_1Country_1_Region_3"), ()); + TEST(NameExists(bankOfNames, "Country_1Country_1_Region_4"), ()); + TEST(NameExists(bankOfNames, "Country_1Country_1_Region_5"), ()); + TEST(NameExists(bankOfNames, "Country_1Country_1_Region_5Country_1_Region_5_Subregion_6"), ()); + TEST(NameExists(bankOfNames, "Country_1Country_1_Region_5Country_1_Region_5_Subregion_7"), ()); } diff --git a/generator/locality_sorter.cpp b/generator/locality_sorter.cpp index 6d930373db..533be70db0 100644 --- a/generator/locality_sorter.cpp +++ b/generator/locality_sorter.cpp @@ -38,7 +38,7 @@ namespace class BordersCollector : public FeaturesCollector { public: - BordersCollector(string const & filename) + explicit BordersCollector(string const & filename) : FeaturesCollector(filename + EXTENSION_TMP), m_writer(filename, FileWriter::OP_WRITE_EXISTING) { } diff --git a/generator/mwm_diff/diff.cpp b/generator/mwm_diff/diff.cpp index a3cabdf384..cf8964485a 100644 --- a/generator/mwm_diff/diff.cpp +++ b/generator/mwm_diff/diff.cpp @@ -65,7 +65,6 @@ generator::mwm_diff::DiffApplicationResult ApplyDiffVersion0( diffFileSource.Read(deflatedDiff.data(), deflatedDiff.size()); using Inflate = coding::ZLib::Inflate; - vector<uint8_t> decompressedData; Inflate inflate(Inflate::Format::ZLib); vector<uint8_t> diffBuf; inflate(deflatedDiff.data(), deflatedDiff.size(), back_inserter(diffBuf)); diff --git a/generator/osm2type.cpp b/generator/osm2type.cpp index 6f8ff7fc2e..9c7170aef1 100644 --- a/generator/osm2type.cpp +++ b/generator/osm2type.cpp @@ -111,7 +111,7 @@ Result ForEachTagEx(OsmElement * p, set<int> & skipTags, ToDo && toDo) class NamesExtractor { public: - NamesExtractor(FeatureParams & params) : m_params(params) {} + explicit NamesExtractor(FeatureParams & params) : m_params(params) {} bool GetLangByKey(string const & k, string & lang) { @@ -164,7 +164,7 @@ private: class TagProcessor { public: - TagProcessor(OsmElement * elem) : m_element(elem) {} + explicit TagProcessor(OsmElement * elem) : m_element(elem) {} template <typename Function> struct Rule diff --git a/generator/road_access_generator.cpp b/generator/road_access_generator.cpp index 8c1ce08d5a..311ea82408 100644 --- a/generator/road_access_generator.cpp +++ b/generator/road_access_generator.cpp @@ -142,8 +142,6 @@ bool ParseRoadAccess(string const & roadAccessPath, return false; } - vector<uint32_t> privateRoads; - unordered_map<uint32_t, RoadAccess::Type> featureType[static_cast<size_t>(VehicleType::Count)]; unordered_map<RoadPoint, RoadAccess::Type, RoadPoint::Hash> pointType[static_cast<size_t>(VehicleType::Count)]; diff --git a/generator/search_index_builder.cpp b/generator/search_index_builder.cpp index effd8a4303..298ca3b629 100644 --- a/generator/search_index_builder.cpp +++ b/generator/search_index_builder.cpp @@ -54,10 +54,8 @@ namespace { class SynonymsHolder { - unordered_multimap<string, string> m_map; - public: - SynonymsHolder(string const & fPath) + explicit SynonymsHolder(string const & fPath) { ifstream stream(fPath.c_str()); @@ -80,7 +78,7 @@ public: { strings::Trim(tokens[i]); // synonym should not has any spaces - ASSERT ( tokens[i].find_first_of(" \t") == string::npos, () ); + ASSERT(tokens[i].find_first_of(" \t") == string::npos, ()); m_map.insert(make_pair(tokens[0], tokens[i])); } } @@ -90,15 +88,16 @@ public: template <class ToDo> void ForEach(string const & key, ToDo toDo) const { - using TIter = unordered_multimap<string, string>::const_iterator; - - pair<TIter, TIter> range = m_map.equal_range(key); + auto range = m_map.equal_range(key); while (range.first != range.second) { toDo(range.first->second); ++range.first; } } + +private: + unordered_multimap<string, string> m_map; }; void GetCategoryTypes(CategoriesHolder const & categories, pair<int, int> const & scaleRange, diff --git a/generator/srtm_parser.cpp b/generator/srtm_parser.cpp index 00b5f9e2ab..7ecb577a7c 100644 --- a/generator/srtm_parser.cpp +++ b/generator/srtm_parser.cpp @@ -17,7 +17,7 @@ size_t constexpr kSrtmTileSize = (kArcSecondsInDegree + 1) * (kArcSecondsInDegre struct UnzipMemDelegate : public ZipFileReader::Delegate { - UnzipMemDelegate(std::string & buffer) : m_buffer(buffer), m_completed(false) {} + explicit UnzipMemDelegate(std::string & buffer) : m_buffer(buffer), m_completed(false) {} // ZipFileReader::Delegate overrides: void OnBlockUnzipped(size_t size, char const * data) override { m_buffer.append(data, size); } |