Skip to content

Commit ff666c8

Browse files
authored
Merge pull request #2395 from joto/fix-short-varnames
Make various variable names longer and more descriptive
2 parents 9109529 + 8772650 commit ff666c8

File tree

7 files changed

+35
-34
lines changed

7 files changed

+35
-34
lines changed

src/gen/osm2pgsql-gen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,8 @@ class genproc_t
520520
m_connection_params, generalizer, params,
521521
zoom, &tile_list, &mut, n);
522522
}
523-
for (auto &t : threads) {
524-
t.join();
523+
for (auto &thread : threads) {
524+
thread.join();
525525
}
526526
if (error_flag.test_and_set()) {
527527
throw std::runtime_error{

src/geom-functions.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,37 +157,37 @@ class transform_visitor_t
157157

158158
void operator()(multipoint_t const &input) const
159159
{
160-
auto &m = m_output->get<multipoint_t>();
161-
m.reserve(input.num_geometries());
160+
auto &mgeom = m_output->get<multipoint_t>();
161+
mgeom.reserve(input.num_geometries());
162162
for (auto const point : input) {
163-
m.add_geometry(project(point));
163+
mgeom.add_geometry(project(point));
164164
}
165165
}
166166

167167
void operator()(multilinestring_t const &input) const
168168
{
169-
auto &m = m_output->set<multilinestring_t>();
170-
m.reserve(input.num_geometries());
169+
auto &mgeom = m_output->set<multilinestring_t>();
170+
mgeom.reserve(input.num_geometries());
171171
for (auto const &line : input) {
172-
transform_points(&m.add_geometry(), line);
172+
transform_points(&mgeom.add_geometry(), line);
173173
}
174174
}
175175

176176
void operator()(multipolygon_t const &input) const
177177
{
178-
auto &m = m_output->set<multipolygon_t>();
179-
m.reserve(input.num_geometries());
178+
auto &mgeom = m_output->set<multipolygon_t>();
179+
mgeom.reserve(input.num_geometries());
180180
for (auto const &polygon : input) {
181-
transform_polygon(&m.add_geometry(), polygon);
181+
transform_polygon(&mgeom.add_geometry(), polygon);
182182
}
183183
}
184184

185185
void operator()(collection_t const &input) const
186186
{
187-
auto &m = m_output->get<collection_t>();
188-
m.reserve(input.num_geometries());
187+
auto &mgeom = m_output->get<collection_t>();
188+
mgeom.reserve(input.num_geometries());
189189
for (auto const &geom : input) {
190-
auto &new_geom = m.add_geometry();
190+
auto &new_geom = mgeom.add_geometry();
191191
set_to_same_type(&new_geom, geom);
192192
new_geom.set_srid(0);
193193
geom.visit(transform_visitor_t{&new_geom, m_reprojection});

src/geom-pole-of-inaccessibility.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ bool point_to_ring_distance_squared(point_t point, ring_t const &ring,
8888
inside = !inside;
8989
}
9090

91-
double const d =
91+
double const dist_squared =
9292
point_to_segment_distance_squared(point, a, b, stretch);
93-
*min_dist_squared = std::min(d, *min_dist_squared);
93+
*min_dist_squared = std::min(dist_squared, *min_dist_squared);
9494
}
9595

9696
return inside;

src/hex.cpp

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

1616
namespace util {
1717

18-
void encode_hex(std::string const &in, std::string *out)
18+
void encode_hex(std::string const &input, std::string *output)
1919
{
20-
assert(out);
20+
assert(output);
2121

2222
constexpr char const *const LOOKUP_HEX = "0123456789ABCDEF";
2323

24-
for (auto const c : in) {
24+
for (auto const c : input) {
2525
unsigned int const num = static_cast<unsigned char>(c);
26-
(*out) += LOOKUP_HEX[(num >> 4U) & 0xfU];
27-
(*out) += LOOKUP_HEX[num & 0xfU];
26+
(*output) += LOOKUP_HEX[(num >> 4U) & 0xfU];
27+
(*output) += LOOKUP_HEX[num & 0xfU];
2828
}
2929
}
3030

31-
std::string encode_hex(std::string const &in)
31+
std::string encode_hex(std::string const &input)
3232
{
3333
std::string result;
34-
result.reserve(in.size() * 2);
35-
encode_hex(in, &result);
34+
result.reserve(input.size() * 2);
35+
encode_hex(input, &result);
3636
return result;
3737
}
3838

src/pgsql-capabilities.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ namespace {
2020

2121
database_capabilities_t &capabilities() noexcept
2222
{
23-
static database_capabilities_t c;
24-
return c;
23+
static database_capabilities_t capabilities;
24+
return capabilities;
2525
}
2626

2727
} // anonymous namespace

src/pgsql.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323
std::size_t pg_result_t::affected_rows() const noexcept
2424
{
25-
char const *const s = PQcmdTuples(m_result.get());
26-
return std::strtoull(s, nullptr, 10);
25+
char const *const rows_as_string = PQcmdTuples(m_result.get());
26+
return std::strtoull(rows_as_string, nullptr, 10);
2727
}
2828

2929
std::atomic<std::uint32_t> pg_conn_t::connection_id{0};
@@ -153,9 +153,10 @@ void pg_conn_t::copy_send(std::string_view data, std::string_view context) const
153153

154154
log_sql_data("(C{}) Copy data to '{}':\n{}", m_connection_id, context,
155155
data);
156-
int const r = PQputCopyData(m_conn.get(), data.data(), (int)data.size());
156+
int const result =
157+
PQputCopyData(m_conn.get(), data.data(), (int)data.size());
157158

158-
switch (r) {
159+
switch (result) {
159160
case 0: // need to wait for write ready
160161
log_error("{} - COPY unexpectedly busy", context);
161162
break;

src/tile.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
geom::point_t tile_t::to_tile_coords(geom::point_t p,
1313
unsigned int pixel_extent) const noexcept
1414
{
15-
double const f = static_cast<double>(pixel_extent) / extent();
16-
return {(p.x() - xmin()) * f, (p.y() - ymin()) * f};
15+
double const factor = static_cast<double>(pixel_extent) / extent();
16+
return {(p.x() - xmin()) * factor, (p.y() - ymin()) * factor};
1717
}
1818

1919
geom::point_t tile_t::to_world_coords(geom::point_t p,
2020
unsigned int pixel_extent) const noexcept
2121
{
22-
double const f = extent() / static_cast<double>(pixel_extent);
23-
return {p.x() * f + xmin(), p.y() * f + ymin()};
22+
double const factor = extent() / static_cast<double>(pixel_extent);
23+
return {p.x() * factor + xmin(), p.y() * factor + ymin()};
2424
}
2525

2626
geom::point_t tile_t::center() const noexcept

0 commit comments

Comments
 (0)