Skip to content

Commit c157131

Browse files
authored
Merge pull request #2047 from joto/clang-tidy-cleanup
Clang tidy cleanup
2 parents 72e28b8 + 1c2a425 commit c157131

File tree

4 files changed

+21
-27
lines changed

4 files changed

+21
-27
lines changed

src/gen/osm2pgsql-gen.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ void genproc_t::run()
595595
}
596596
}
597597

598+
// NOLINTNEXTLINE(bugprone-exception-escape)
598599
int main(int argc, char *argv[])
599600
{
600601
try {

src/osm2pgsql.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ static void check_and_set_style(options_t *options)
348348
}
349349
}
350350

351+
// NOLINTNEXTLINE(bugprone-exception-escape)
351352
int main(int argc, char *argv[])
352353
{
353354
try {
@@ -404,6 +405,9 @@ int main(int argc, char *argv[])
404405
} catch (std::exception const &e) {
405406
log_error("{}", e.what());
406407
return 1;
408+
} catch (...) {
409+
log_error("Unknown exception.");
410+
return 1;
407411
}
408412

409413
return 0;

src/tagtransform-lua.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ bool lua_tagtransform_t::filter_tags(osmium::OSMObject const &o, bool *polygon,
110110
lua_pushstring(lua_state(), t.key.c_str());
111111
lua_pushstring(lua_state(), t.value.c_str());
112112
lua_rawset(lua_state(), -3);
113+
++sz;
113114
}
114-
sz += tags.size();
115115
}
116116

117117
lua_pushinteger(lua_state(), sz);

tests/test-expire-from-geometry.cpp

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -390,13 +390,6 @@ TEST_CASE("expire multilinestring geometry", "[NoDB]")
390390
et.from_geometry(geom, expire_config);
391391
}
392392

393-
SECTION("geom with check")
394-
{
395-
geom::geometry_t geom{std::move(ml)};
396-
geom.set_srid(3857);
397-
et.from_geometry_if_3857(geom, expire_config);
398-
}
399-
400393
auto const tiles = et.get_tiles();
401394
REQUIRE(tiles.size() == 3);
402395
CHECK(tile_t::from_quadkey(tiles[0], zoom) == tile_t{zoom, 2049, 2046});
@@ -440,13 +433,6 @@ TEST_CASE("expire multipolygon geometry", "[NoDB]")
440433
et.from_geometry(geom, expire_config);
441434
}
442435

443-
SECTION("geom with check")
444-
{
445-
geom::geometry_t geom{std::move(mp)};
446-
geom.set_srid(3857);
447-
et.from_geometry_if_3857(geom, expire_config);
448-
}
449-
450436
auto const tiles = et.get_tiles();
451437
REQUIRE(tiles.size() == 17);
452438

@@ -476,18 +462,8 @@ TEST_CASE("expire geometry collection", "[NoDB]")
476462
collection.add_geometry(geom::geometry_t{
477463
geom::linestring_t{{15000.0, 15000.0}, {25000.0, 15000.0}}});
478464

479-
SECTION("geom")
480-
{
481-
geom::geometry_t const geom{std::move(collection)};
482-
et.from_geometry(geom, expire_config);
483-
}
484-
485-
SECTION("geom with check")
486-
{
487-
geom::geometry_t geom{std::move(collection)};
488-
geom.set_srid(3857);
489-
et.from_geometry_if_3857(geom, expire_config);
490-
}
465+
geom::geometry_t const geom{std::move(collection)};
466+
et.from_geometry(geom, expire_config);
491467

492468
auto const tiles = et.get_tiles();
493469
REQUIRE(tiles.size() == 6);
@@ -499,6 +475,19 @@ TEST_CASE("expire geometry collection", "[NoDB]")
499475
CHECK(tile_t::from_quadkey(tiles[5], zoom) == tile_t{zoom, 2048, 2048});
500476
}
501477

478+
TEST_CASE("expire works if in 3857", "[NoDB]")
479+
{
480+
expire_config_t const expire_config;
481+
expire_tiles et{zoom, defproj};
482+
483+
geom::geometry_t geom{geom::point_t{0.0, 0.0}};
484+
geom.set_srid(3857);
485+
et.from_geometry_if_3857(geom, expire_config);
486+
487+
auto const tiles = et.get_tiles();
488+
REQUIRE(tiles.size() == 4);
489+
}
490+
502491
TEST_CASE("expire doesn't do anything if not in 3857", "[NoDB]")
503492
{
504493
expire_config_t const expire_config;

0 commit comments

Comments
 (0)