diff --git a/include/osmium/area/detail/basic_assembler.hpp b/include/osmium/area/detail/basic_assembler.hpp index 53f83011..4957fce0 100644 --- a/include/osmium/area/detail/basic_assembler.hpp +++ b/include/osmium/area/detail/basic_assembler.hpp @@ -217,7 +217,7 @@ namespace osmium { } } - for (const osmium::Way* way : ways_in_multiple_rings) { + for (const osmium::Way* way : ways_in_multiple_rings) { // NOLINT(bugprone-nondeterministic-pointer-iteration-order) ++m_stats.ways_in_multiple_rings; if (debug()) { std::cerr << " Way " << way->id() << " is in multiple rings\n"; diff --git a/include/osmium/experimental/flex_reader.hpp b/include/osmium/experimental/flex_reader.hpp index 363b9e41..0e0aa9af 100644 --- a/include/osmium/experimental/flex_reader.hpp +++ b/include/osmium/experimental/flex_reader.hpp @@ -117,7 +117,7 @@ namespace osmium { } void close() { - return m_reader.close(); + m_reader.close(); } bool eof() const { diff --git a/include/osmium/geom/tile.hpp b/include/osmium/geom/tile.hpp index 1f5f1bfb..b4f6c2d1 100644 --- a/include/osmium/geom/tile.hpp +++ b/include/osmium/geom/tile.hpp @@ -47,7 +47,7 @@ namespace osmium { namespace detail { template - inline constexpr const T& clamp(const T& value, const T& min, const T& max) { + inline constexpr const T clamp(const T value, const T min, const T max) { return value < min ? min : (max < value ? max : value); } diff --git a/include/osmium/io/reader_with_progress_bar.hpp b/include/osmium/io/reader_with_progress_bar.hpp index 453f9f6e..2fda7563 100644 --- a/include/osmium/io/reader_with_progress_bar.hpp +++ b/include/osmium/io/reader_with_progress_bar.hpp @@ -91,7 +91,7 @@ namespace osmium { } inline InputIterator end(ReaderWithProgressBar& /*reader*/) { - return InputIterator(); + return {}; } } // namespace io diff --git a/test/data-tests/testdata-multipolygon.cpp b/test/data-tests/testdata-multipolygon.cpp index 1934d14b..bcf25fa6 100644 --- a/test/data-tests/testdata-multipolygon.cpp +++ b/test/data-tests/testdata-multipolygon.cpp @@ -31,6 +31,8 @@ struct less_charptr { using tagmap_type = std::map; +namespace { + tagmap_type create_map(const osmium::TagList& taglist) { tagmap_type map; @@ -41,6 +43,8 @@ tagmap_type create_map(const osmium::TagList& taglist) { return map; } +} // anonymous namespace + class TestHandler : public osmium::handler::Handler { gdalcpp::Layer m_layer_point; diff --git a/test/data-tests/testdata-xml.cpp b/test/data-tests/testdata-xml.cpp index 7cd4d159..1c997e18 100644 --- a/test/data-tests/testdata-xml.cpp +++ b/test/data-tests/testdata-xml.cpp @@ -17,18 +17,20 @@ #include #include -static std::string S_(const char* s) { +namespace { + +std::string S_(const char* s) { return std::string{s}; } // From C++20 we need to handle unicode literals differently #ifdef __cpp_char8_t -static std::string S_(const char8_t* s) { +std::string S_(const char8_t* s) { return std::string{reinterpret_cast(s)}; } #endif -static std::string filename(const char* test_id, const char* suffix = "osm") { +std::string filename(const char* test_id, const char* suffix = "osm") { const char* testdir = getenv("TESTDIR"); if (!testdir) { throw std::runtime_error{"You have to set TESTDIR environment variable before running testdata-xml"}; @@ -56,7 +58,7 @@ struct header_buffer_type { // operations, because they make certain assumptions, for instance that // file contents fit into small buffers. -static std::string read_file(const char* test_id) { +std::string read_file(const char* test_id) { const int fd = osmium::io::detail::open_for_reading(filename(test_id)); assert(fd >= 0); @@ -70,7 +72,7 @@ static std::string read_file(const char* test_id) { return input; } -static std::string read_gz_file(const char* test_id, const char* suffix) { +std::string read_gz_file(const char* test_id, const char* suffix) { const int fd = osmium::io::detail::open_for_reading(filename(test_id, suffix)); assert(fd >= 0); @@ -81,7 +83,7 @@ static std::string read_gz_file(const char* test_id, const char* suffix) { return input; } -static header_buffer_type parse_xml(std::string input) { +header_buffer_type parse_xml(std::string input) { osmium::thread::Pool pool; osmium::io::detail::future_string_queue_type input_queue; osmium::io::detail::future_buffer_queue_type output_queue; @@ -123,7 +125,7 @@ static header_buffer_type parse_xml(std::string input) { return result; } -static header_buffer_type read_xml(const char* test_id) { +header_buffer_type read_xml(const char* test_id) { const std::string input = read_file(test_id); return parse_xml(input); } @@ -141,6 +143,8 @@ void test_fail(const char* xml_file_name, const char* errmsg) { }(), TException); } +} // anonymous namespace + // ============================================= TEST_CASE("Reading OSM XML 100: Direct") { diff --git a/test/t/geom/test_factory_with_projection.cpp b/test/t/geom/test_factory_with_projection.cpp index 3d9923db..226ad9b4 100644 --- a/test/t/geom/test_factory_with_projection.cpp +++ b/test/t/geom/test_factory_with_projection.cpp @@ -6,7 +6,7 @@ #include TEST_CASE("Projection using MercatorProjection class to WKT") { - osmium::geom::WKTFactory factory{2}; + const osmium::geom::WKTFactory factory{2}; const std::string wkt{factory.create_point(osmium::Location{3.2, 4.2})}; REQUIRE(wkt == "POINT(356222.37 467961.14)");