Skip to content

Commit ce37bc7

Browse files
committed
Again, add more consts
1 parent 17002c0 commit ce37bc7

File tree

8 files changed

+58
-58
lines changed

8 files changed

+58
-58
lines changed

src/output-pgsql.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void output_pgsql_t::pgsql_out_way(osmium::Way const &way, taglist_t *tags,
7171
if (m_enable_way_area) {
7272
double const area = calculate_area(
7373
get_options()->reproject_area, geom, projected_geom);
74-
util::double_to_buffer tmp{area};
74+
util::double_to_buffer const tmp{area};
7575
tags->set("way_area", tmp.c_str());
7676
}
7777
m_tables[t_poly]->write_row(way.id(), *tags, wkb);
@@ -293,7 +293,7 @@ void output_pgsql_t::pgsql_process_relation(osmium::Relation const &rel)
293293
if (m_enable_way_area) {
294294
double const area = calculate_area(
295295
get_options()->reproject_area, sgeom, projected_geom);
296-
util::double_to_buffer tmp{area};
296+
util::double_to_buffer const tmp{area};
297297
outtags.set("way_area", tmp.c_str());
298298
}
299299
m_tables[t_poly]->write_row(-rel.id(), outtags, wkb);

tests/test-expire-from-geometry.cpp

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ TEST_CASE("expire null geometry does nothing", "[NoDB]")
3030

3131
SECTION("geom")
3232
{
33-
geom::geometry_t geom{};
33+
geom::geometry_t const geom{};
3434
et.from_geometry(geom);
3535
}
3636

@@ -48,13 +48,13 @@ TEST_CASE("expire point at tile boundary", "[NoDB]")
4848
{
4949
expire_tiles et{zoom, 20000, defproj};
5050

51-
geom::point_t pt{0.0, 0.0};
51+
geom::point_t const pt{0.0, 0.0};
5252

5353
SECTION("point") { et.from_geometry(pt); }
5454

5555
SECTION("geom")
5656
{
57-
geom::geometry_t geom{pt};
57+
geom::geometry_t const geom{pt};
5858
et.from_geometry(geom);
5959
}
6060

@@ -77,13 +77,13 @@ TEST_CASE("expire point away from tile boundary", "[NoDB]")
7777
{
7878
expire_tiles et{zoom, 20000, defproj};
7979

80-
geom::point_t pt{5000.0, 5000.0};
80+
geom::point_t const pt{5000.0, 5000.0};
8181

8282
SECTION("point") { et.from_geometry(pt); }
8383

8484
SECTION("geom")
8585
{
86-
geom::geometry_t geom{pt};
86+
geom::geometry_t const geom{pt};
8787
et.from_geometry(geom);
8888
}
8989

@@ -105,14 +105,14 @@ TEST_CASE("expire linestring away from tile boundary", "[NoDB]")
105105

106106
SECTION("line")
107107
{
108-
geom::linestring_t line{{5000.0, 4000.0}, {5100.0, 4200.0}};
108+
geom::linestring_t const line{{5000.0, 4000.0}, {5100.0, 4200.0}};
109109
et.from_geometry(line);
110110
}
111111

112112
SECTION("geom")
113113
{
114114
geom::linestring_t line{{5000.0, 4000.0}, {5100.0, 4200.0}};
115-
geom::geometry_t geom{std::move(line)};
115+
geom::geometry_t const geom{std::move(line)};
116116
et.from_geometry(geom);
117117
}
118118

@@ -135,14 +135,14 @@ TEST_CASE("expire linestring crossing tile boundary", "[NoDB]")
135135

136136
SECTION("line")
137137
{
138-
geom::linestring_t line{{5000.0, 5000.0}, {5000.0, 15000.0}};
138+
geom::linestring_t const line{{5000.0, 5000.0}, {5000.0, 15000.0}};
139139
et.from_geometry(line);
140140
}
141141

142142
SECTION("geom")
143143
{
144144
geom::linestring_t line{{5000.0, 5000.0}, {5000.0, 15000.0}};
145-
geom::geometry_t geom{std::move(line)};
145+
geom::geometry_t const geom{std::move(line)};
146146
et.from_geometry(geom);
147147
}
148148

@@ -166,11 +166,11 @@ TEST_CASE("expire small polygon", "[NoDB]")
166166

167167
SECTION("polygon")
168168
{
169-
geom::polygon_t poly{{{5000.0, 5000.0},
170-
{5100.0, 5000.0},
171-
{5100.0, 5100.0},
172-
{5000.0, 5100.0},
173-
{5000.0, 5000.0}}};
169+
geom::polygon_t const poly{{{5000.0, 5000.0},
170+
{5100.0, 5000.0},
171+
{5100.0, 5100.0},
172+
{5000.0, 5100.0},
173+
{5000.0, 5000.0}}};
174174
et.from_geometry(poly);
175175
}
176176

@@ -181,7 +181,7 @@ TEST_CASE("expire small polygon", "[NoDB]")
181181
{5100.0, 5100.0},
182182
{5000.0, 5100.0},
183183
{5000.0, 5000.0}}};
184-
geom::geometry_t geom{std::move(poly)};
184+
geom::geometry_t const geom{std::move(poly)};
185185
et.from_geometry(geom);
186186
}
187187

@@ -208,11 +208,11 @@ TEST_CASE("expire large polygon as bbox", "[NoDB]")
208208

209209
SECTION("polygon")
210210
{
211-
geom::polygon_t poly{{{5000.0, 5000.0},
212-
{25000.0, 5000.0},
213-
{25000.0, 25000.0},
214-
{5000.0, 25000.0},
215-
{5000.0, 5000.0}}};
211+
geom::polygon_t const poly{{{5000.0, 5000.0},
212+
{25000.0, 5000.0},
213+
{25000.0, 25000.0},
214+
{5000.0, 25000.0},
215+
{5000.0, 5000.0}}};
216216
et.from_geometry(poly);
217217
}
218218

@@ -223,7 +223,7 @@ TEST_CASE("expire large polygon as bbox", "[NoDB]")
223223
{25000.0, 25000.0},
224224
{5000.0, 25000.0},
225225
{5000.0, 5000.0}}};
226-
geom::geometry_t geom{std::move(poly)};
226+
geom::geometry_t const geom{std::move(poly)};
227227
et.from_geometry(geom);
228228
}
229229

@@ -260,21 +260,21 @@ TEST_CASE("expire large polygon as boundary", "[NoDB]")
260260

261261
SECTION("polygon")
262262
{
263-
geom::polygon_t poly{{{5000.0, 5000.0},
264-
{25000.0, 5000.0},
265-
{25000.0, 25000.0},
266-
{5000.0, 25000.0},
267-
{5000.0, 5000.0}}};
263+
geom::polygon_t const poly{{{5000.0, 5000.0},
264+
{25000.0, 5000.0},
265+
{25000.0, 25000.0},
266+
{5000.0, 25000.0},
267+
{5000.0, 5000.0}}};
268268
et.from_geometry(poly);
269269
}
270270

271271
SECTION("polygon boundary")
272272
{
273-
geom::polygon_t poly{{{5000.0, 5000.0},
274-
{25000.0, 5000.0},
275-
{25000.0, 25000.0},
276-
{5000.0, 25000.0},
277-
{5000.0, 5000.0}}};
273+
geom::polygon_t const poly{{{5000.0, 5000.0},
274+
{25000.0, 5000.0},
275+
{25000.0, 25000.0},
276+
{5000.0, 25000.0},
277+
{5000.0, 5000.0}}};
278278
et.from_polygon_boundary(poly);
279279
}
280280

@@ -285,7 +285,7 @@ TEST_CASE("expire large polygon as boundary", "[NoDB]")
285285
{25000.0, 25000.0},
286286
{5000.0, 25000.0},
287287
{5000.0, 5000.0}}};
288-
geom::geometry_t geom{std::move(poly)};
288+
geom::geometry_t const geom{std::move(poly)};
289289
et.from_geometry(geom);
290290
}
291291

@@ -335,7 +335,7 @@ TEST_CASE("expire multipoint geometry", "[NoDB]")
335335
geom::multipoint_t mpt;
336336
mpt.add_geometry(std::move(p1));
337337
mpt.add_geometry(std::move(p2));
338-
geom::geometry_t geom{std::move(mpt)};
338+
geom::geometry_t const geom{std::move(mpt)};
339339
et.from_geometry(geom);
340340
}
341341

@@ -372,7 +372,7 @@ TEST_CASE("expire multilinestring geometry", "[NoDB]")
372372

373373
SECTION("geom")
374374
{
375-
geom::geometry_t geom{std::move(ml)};
375+
geom::geometry_t const geom{std::move(ml)};
376376
et.from_geometry(geom);
377377
}
378378

@@ -419,7 +419,7 @@ TEST_CASE("expire multipolygon geometry", "[NoDB]")
419419

420420
SECTION("geom")
421421
{
422-
geom::geometry_t geom{std::move(mp)};
422+
geom::geometry_t const geom{std::move(mp)};
423423
et.from_geometry(geom);
424424
}
425425

@@ -460,7 +460,7 @@ TEST_CASE("expire geometry collection", "[NoDB]")
460460

461461
SECTION("geom")
462462
{
463-
geom::geometry_t geom{std::move(collection)};
463+
geom::geometry_t const geom{std::move(collection)};
464464
et.from_geometry(geom);
465465
}
466466

tests/test-geom-multipoints.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
TEST_CASE("multipoint_t with a single point", "[NoDB]")
2222
{
2323
geom::point_t const expected{1, 1};
24-
geom::point_t point = expected;
24+
geom::point_t const point = expected;
2525

2626
geom::geometry_t geom{geom::multipoint_t{}};
2727
auto &mp = geom.get<geom::multipoint_t>();
@@ -41,9 +41,9 @@ TEST_CASE("multipoint_t with a single point", "[NoDB]")
4141

4242
TEST_CASE("multipoint_t with several points", "[NoDB]")
4343
{
44-
geom::point_t p0{1, 1};
45-
geom::point_t p1{2, 1};
46-
geom::point_t p2{3, 1};
44+
geom::point_t const p0{1, 1};
45+
geom::point_t const p1{2, 1};
46+
geom::point_t const p2{3, 1};
4747

4848
geom::geometry_t geom{geom::multipoint_t{}};
4949
auto &mp = geom.get<geom::multipoint_t>();

tests/test-geom-output.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@
1515

1616
TEST_CASE("nullgeom_t output", "[NoDB]")
1717
{
18-
geom::nullgeom_t g;
18+
geom::nullgeom_t const g;
1919
std::stringstream ss1;
2020
ss1 << g;
2121
CHECK(ss1.str() == "NULL");
2222

23-
geom::geometry_t geom;
23+
geom::geometry_t const geom;
2424
std::stringstream ss2;
2525
ss2 << geom;
2626
CHECK(ss2.str() == "NULL(NULL)");
2727
}
2828

2929
TEST_CASE("point_t output", "[NoDB]")
3030
{
31-
geom::point_t g{1, 2};
31+
geom::point_t const g{1, 2};
3232
std::stringstream ss1;
3333
ss1 << g;
3434
CHECK(ss1.str() == "1 2");
3535

36-
geom::geometry_t geom{g};
36+
geom::geometry_t const geom{g};
3737
std::stringstream ss2;
3838
ss2 << geom;
3939
CHECK(ss2.str() == "POINT(1 2)");
@@ -46,7 +46,7 @@ TEST_CASE("linestring_t output", "[NoDB]")
4646
ss1 << g;
4747
CHECK(ss1.str() == "1 2,2 2");
4848

49-
geom::geometry_t geom{std::move(g)};
49+
geom::geometry_t const geom{std::move(g)};
5050
std::stringstream ss2;
5151
ss2 << geom;
5252
CHECK(ss2.str() == "LINESTRING(1 2,2 2)");
@@ -59,7 +59,7 @@ TEST_CASE("polygon_t with no inner rings output", "[NoDB]")
5959
ss1 << g;
6060
CHECK(ss1.str() == "(0 0,1 0,1 1,0 1,0 0)");
6161

62-
geom::geometry_t geom{std::move(g)};
62+
geom::geometry_t const geom{std::move(g)};
6363
std::stringstream ss2;
6464
ss2 << geom;
6565
CHECK(ss2.str() == "POLYGON((0 0,1 0,1 1,0 1,0 0))");
@@ -73,7 +73,7 @@ TEST_CASE("polygon_t with inner ring output", "[NoDB]")
7373
ss1 << g;
7474
CHECK(ss1.str() == "(0 0,3 0,3 3,0 3,0 0),(1 1,1 2,2 2,2 1,1 1)");
7575

76-
geom::geometry_t geom{std::move(g)};
76+
geom::geometry_t const geom{std::move(g)};
7777
std::stringstream ss2;
7878
ss2 << geom;
7979
CHECK(ss2.str() == "POLYGON((0 0,3 0,3 3,0 3,0 0),(1 1,1 2,2 2,2 1,1 1))");
@@ -88,7 +88,7 @@ TEST_CASE("multipoint_t output", "[NoDB]")
8888
ss1 << g;
8989
CHECK(ss1.str() == "(1 2),(4 3)");
9090

91-
geom::geometry_t geom{std::move(g)};
91+
geom::geometry_t const geom{std::move(g)};
9292
std::stringstream ss2;
9393
ss2 << geom;
9494
CHECK(ss2.str() == "MULTIPOINT((1 2),(4 3))");
@@ -103,7 +103,7 @@ TEST_CASE("multilinestring_t output", "[NoDB]")
103103
ss1 << g;
104104
CHECK(ss1.str() == "(1 2,2 2),(4 3,1 1)");
105105

106-
geom::geometry_t geom{std::move(g)};
106+
geom::geometry_t const geom{std::move(g)};
107107
std::stringstream ss2;
108108
ss2 << geom;
109109
CHECK(ss2.str() == "MULTILINESTRING((1 2,2 2),(4 3,1 1))");
@@ -118,7 +118,7 @@ TEST_CASE("multipolygon_t output", "[NoDB]")
118118
ss1 << g;
119119
CHECK(ss1.str() == "((0 0,0 1,1 1)),((2 2,2 3,3 2))");
120120

121-
geom::geometry_t geom{std::move(g)};
121+
geom::geometry_t const geom{std::move(g)};
122122
std::stringstream ss2;
123123
ss2 << geom;
124124
CHECK(ss2.str() == "MULTIPOLYGON(((0 0,0 1,1 1)),((2 2,2 3,3 2)))");
@@ -134,7 +134,7 @@ TEST_CASE("collection_t output", "[NoDB]")
134134
ss1 << g;
135135
CHECK(ss1.str() == "POLYGON((0 0,0 1,1 1)),POINT(2 3)");
136136

137-
geom::geometry_t geom{std::move(g)};
137+
geom::geometry_t const geom{std::move(g)};
138138
std::stringstream ss2;
139139
ss2 << geom;
140140
CHECK(ss2.str() == "GEOMETRYCOLLECTION(POLYGON((0 0,0 1,1 1)),POINT(2 3))");

tests/test-geom-polygons.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ TEST_CASE("geom::polygon_t", "[NoDB]")
5555
REQUIRE(polygon.num_geometries() == 1);
5656
REQUIRE(polygon.inners().size() == 1);
5757

58-
geom::geometry_t geom{std::move(polygon)};
58+
geom::geometry_t const geom{std::move(polygon)};
5959
REQUIRE(dimension(geom) == 2);
6060
REQUIRE(num_geometries(geom) == 1);
6161
REQUIRE(area(geom) == Approx(8.0));

tests/test-middle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ TEMPLATE_TEST_CASE("middle: change nodes in way", "", options_slim_default,
990990
// closed properly.
991991
{
992992
auto mid = std::make_shared<middle_pgsql_t>(thread_pool, &options);
993-
full_dependency_manager_t dependency_manager{mid};
993+
full_dependency_manager_t const dependency_manager{mid};
994994
mid->start();
995995

996996
mid->node(node10);

tests/test-options-parse.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ TEST_CASE("Lua styles", "[NoDB]")
6363
{
6464
#ifdef HAVE_LUA
6565
auto options = opt({"--tag-transform-script", "non_existing.lua"});
66-
export_list exlist;
66+
export_list const exlist;
6767
REQUIRE_THROWS_WITH(tagtransform_t::make_tagtransform(&options, exlist),
6868
Catch::Matchers::Contains("No such file or directory"));
6969
#endif

tests/test-util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818

1919
TEST_CASE("double_to_buffer 0", "[NoDB]")
2020
{
21-
util::double_to_buffer buffer{0.0};
21+
util::double_to_buffer const buffer{0.0};
2222
REQUIRE(std::strcmp(buffer.c_str(), "0") == 0);
2323
}
2424

2525
TEST_CASE("double_to_buffer 3.141", "[NoDB]")
2626
{
27-
util::double_to_buffer buffer{3.141};
27+
util::double_to_buffer const buffer{3.141};
2828
REQUIRE(std::strcmp(buffer.c_str(), "3.141") == 0);
2929
}
3030

0 commit comments

Comments
 (0)