Skip to content

Commit 8887b0e

Browse files
committed
Don't use unchecked array subscript
Makes clang-tidy happy if we use at() and it doesn't cost us much here.
1 parent c029231 commit 8887b0e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/output-pgsql.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,12 @@ void output_pgsql_t::delete_from_output_and_expire(osmid_t id)
352352

353353
for (auto table : {t_line, t_poly}) {
354354
if (m_expire.enabled()) {
355-
auto const results = m_tables[table]->get_wkb(id);
355+
auto const results = m_tables.at(table)->get_wkb(id);
356356
if (expire_from_result(&m_expire, results, m_expire_config) != 0) {
357-
m_tables[table]->delete_row(id);
357+
m_tables.at(table)->delete_row(id);
358358
}
359359
} else {
360-
m_tables[table]->delete_row(id);
360+
m_tables.at(table)->delete_row(id);
361361
}
362362
}
363363
}
@@ -485,7 +485,7 @@ output_pgsql_t::output_pgsql_t(std::shared_ptr<middle_query_t> const &mid,
485485
std::abort(); // should never be here
486486
}
487487

488-
m_tables[i] = std::make_unique<table_t>(
488+
m_tables.at(i) = std::make_unique<table_t>(
489489
name, type, columns, options.hstore_columns,
490490
options.projection->target_srs(), options.append,
491491
options.hstore_mode, copy_thread, options.output_dbschema);
@@ -504,8 +504,8 @@ output_pgsql_t::output_pgsql_t(
504504
{
505505
for (std::size_t i = 0; i < m_tables.size(); ++i) {
506506
//copy constructor will just connect to the already there table
507-
m_tables[i] =
508-
std::make_unique<table_t>(*(other->m_tables[i]), copy_thread);
507+
m_tables.at(i) =
508+
std::make_unique<table_t>(*(other->m_tables.at(i)), copy_thread);
509509
}
510510
}
511511

tests/test-output-pgsql-z_order.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ TEST_CASE("compute Z order")
3333
" ORDER BY z_order DESC"
3434
" LIMIT 1 OFFSET {}",
3535
i);
36-
REQUIRE(expected[i] == conn.result_as_string(sql));
36+
REQUIRE(expected.at(i) == conn.result_as_string(sql));
3737
}
3838

3939
REQUIRE("residential" ==

0 commit comments

Comments
 (0)