Skip to content

Commit db3b9ce

Browse files
committed
Use const where possible
(Found by cppcheck)
1 parent 20ec7b9 commit db3b9ce

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

include/osmium/area/assembler_legacy.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ namespace osmium {
7272
*/
7373
class AssemblerLegacy : public detail::BasicAssemblerWithTags {
7474

75-
void add_common_tags(osmium::builder::TagListBuilder& tl_builder, std::set<const osmium::Way*>& ways) const {
75+
void add_common_tags(osmium::builder::TagListBuilder& tl_builder, const std::set<const osmium::Way*>& ways) const {
7676
std::map<std::string, std::size_t> counter;
7777
for (const osmium::Way* way : ways) {
7878
for (const auto& tag : way->tags()) {

include/osmium/area/detail/basic_assembler.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ namespace osmium {
290290
}
291291
}
292292

293-
ProtoRing* find_enclosing_ring(NodeRefSegment* segment) {
293+
ProtoRing* find_enclosing_ring(NodeRefSegment const* segment) {
294294
if (debug()) {
295295
std::cerr << " Looking for ring enclosing " << *segment << "\n";
296296
}
@@ -553,7 +553,7 @@ namespace osmium {
553553
return;
554554
}
555555

556-
std::stable_sort(rings.begin(), rings.end(), [](ProtoRing* a, ProtoRing* b) {
556+
std::stable_sort(rings.begin(), rings.end(), [](ProtoRing const* a, ProtoRing const* b) {
557557
return a->min_segment() < b->min_segment();
558558
});
559559

@@ -824,7 +824,7 @@ namespace osmium {
824824
});
825825

826826
find_inner_outer_complex();
827-
ProtoRing* outer_ring = find_enclosing_ring(ring_min->ring().min_segment());
827+
const ProtoRing* outer_ring = find_enclosing_ring(ring_min->ring().min_segment());
828828
const bool ring_min_is_outer = !outer_ring;
829829
if (debug()) {
830830
std::cerr << " Open ring is " << (ring_min_is_outer ? "outer" : "inner") << " ring\n";
@@ -858,7 +858,7 @@ namespace osmium {
858858
if (!open_ring_its.empty()) {
859859
++m_stats.open_rings;
860860
if (m_config.problem_reporter) {
861-
for (auto& it : open_ring_its) {
861+
for (const auto& it : open_ring_its) {
862862
m_config.problem_reporter->report_ring_not_closed(it->get_node_ref_start(), nullptr);
863863
m_config.problem_reporter->report_ring_not_closed(it->get_node_ref_stop(), nullptr);
864864
}
@@ -912,7 +912,7 @@ namespace osmium {
912912
[this, &location](const slocation& lhs, const slocation& rhs) {
913913
return lhs.location(m_segment_list, location) < rhs.location(m_segment_list, location);
914914
}));
915-
for (auto& loc : locs) {
915+
for (const auto& loc : locs) {
916916
if (!m_segment_list[loc.item].is_done()) {
917917
count_remaining -= add_new_ring_complex(loc);
918918
if (count_remaining == 0) {

include/osmium/area/detail/proto_ring.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ namespace osmium {
195195
}
196196
}
197197

198-
void join_forward(ProtoRing& other) {
198+
void join_forward(const ProtoRing& other) {
199199
m_segments.reserve(m_segments.size() + other.m_segments.size());
200200
for (NodeRefSegment* segment : other.m_segments) {
201201
add_segment_back(segment);

0 commit comments

Comments
 (0)