From 48f59fb0b3a4c6d1069c757f3a7fe0a4200aab68 Mon Sep 17 00:00:00 2001 From: Andrey Chulkov Date: Wed, 27 May 2020 18:12:26 +0300 Subject: [PATCH] fix clang-10 warnings --- src/Dictionaries/PolygonDictionaryImplementations.cpp | 11 +++++------ src/Dictionaries/PolygonDictionaryUtils.cpp | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Dictionaries/PolygonDictionaryImplementations.cpp b/src/Dictionaries/PolygonDictionaryImplementations.cpp index 9108b6873c2..d61b5d5dfdf 100644 --- a/src/Dictionaries/PolygonDictionaryImplementations.cpp +++ b/src/Dictionaries/PolygonDictionaryImplementations.cpp @@ -72,10 +72,10 @@ PolygonDictionaryIndexEach::PolygonDictionaryIndexEach( max_depth(max_depth_) { buckets.reserve(polygons.size()); - for (size_t i = 0; i < polygons.size(); ++i) + for (const auto & polygon : polygons) { std::vector single; - single.emplace_back(polygons[i]); + single.emplace_back(polygon); buckets.emplace_back(single); } } @@ -96,12 +96,11 @@ std::shared_ptr PolygonDictionaryIndexEach::clone() con bool PolygonDictionaryIndexEach::find(const Point & point, size_t & id) const { - auto cell = grid.find(point.x(), point.y()); + const auto * cell = grid.find(point.x(), point.y()); if (cell) { - for (size_t i = 0; i < (cell->polygon_ids).size(); ++i) + for (const auto & candidate : cell->polygon_ids) { - const auto & candidate = (cell->polygon_ids)[i]; size_t unused; if (buckets[candidate].find(point, unused)) { @@ -151,7 +150,7 @@ std::shared_ptr PolygonDictionaryIndexCell::clone() con bool PolygonDictionaryIndexCell::find(const Point & point, size_t & id) const { - auto cell = index.find(point.x(), point.y()); + const auto * cell = index.find(point.x(), point.y()); if (cell) { if (!(cell->corresponding_ids).empty() && cell->index.find(point, id)) diff --git a/src/Dictionaries/PolygonDictionaryUtils.cpp b/src/Dictionaries/PolygonDictionaryUtils.cpp index 4dc7afc9828..fa8abc8a6b8 100644 --- a/src/Dictionaries/PolygonDictionaryUtils.cpp +++ b/src/Dictionaries/PolygonDictionaryUtils.cpp @@ -95,7 +95,7 @@ void SlabsPolygonIndex::indexBuild(const std::vector & polygons) { indexAddRing(polygons[i].outer(), i); - for (auto & inner : polygons[i].inners()) + for (const auto & inner : polygons[i].inners()) indexAddRing(inner, i); }