Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/db-copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void db_deleter_by_id_t::delete_rows(std::string const &table,
fmt::format_to(std::back_inserter(sql),
FMT_STRING("DELETE FROM {} WHERE {} IN ("), table, column);

for (auto id : m_deletables) {
for (auto const id : m_deletables) {
format_to(std::back_inserter(sql), FMT_STRING("{},"), id);
}
sql[sql.size() - 1] = ')';
Expand Down
6 changes: 3 additions & 3 deletions src/expire-tiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ quadkey_list_t expire_tiles::get_tiles()
{
quadkey_list_t tiles;
tiles.reserve(m_dirty_tiles.size());
tiles.assign(m_dirty_tiles.begin(), m_dirty_tiles.end());
tiles.assign(m_dirty_tiles.cbegin(), m_dirty_tiles.cend());
std::sort(tiles.begin(), tiles.end());
m_dirty_tiles.clear();
return tiles;
Expand All @@ -288,8 +288,8 @@ void expire_tiles::merge_and_destroy(expire_tiles *other)
using std::swap;
swap(m_dirty_tiles, other->m_dirty_tiles);
} else {
m_dirty_tiles.insert(other->m_dirty_tiles.begin(),
other->m_dirty_tiles.end());
m_dirty_tiles.insert(other->m_dirty_tiles.cbegin(),
other->m_dirty_tiles.cend());
other->m_dirty_tiles.clear();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/gen/osm2pgsql-gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

namespace {

constexpr std::size_t const MAX_FORCE_SINGLE_THREAD = 4;
constexpr std::size_t MAX_FORCE_SINGLE_THREAD = 4;

struct tile_extent
{
Expand Down
2 changes: 1 addition & 1 deletion src/gen/tracer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class tracer_t
std::size_t num_points() const noexcept { return m_num_points; }

private:
static constexpr auto const BITS_PER_WORD = sizeof(potrace_word) * 8;
static constexpr std::size_t BITS_PER_WORD = sizeof(potrace_word) * 8;

geom::point_t make_point(potrace_dpoint_t const &p) const noexcept;

Expand Down
10 changes: 5 additions & 5 deletions src/geom-area-assembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace geom {

const osmium::area::AssemblerConfig area_config;
osmium::area::AssemblerConfig const area_config;

area_assembler_t::area_assembler_t(osmium::memory::Buffer *buffer)
: osmium::area::detail::BasicAssembler(area_config), m_buffer(buffer)
Expand All @@ -36,7 +36,7 @@ bool area_assembler_t::make_area()
return true;
}

bool area_assembler_t::operator()(const osmium::Way &way)
bool area_assembler_t::operator()(osmium::Way const &way)
{
segment_list().extract_segments_from_way(nullptr, stats().duplicate_nodes,
way);
Expand All @@ -46,10 +46,10 @@ bool area_assembler_t::operator()(const osmium::Way &way)
// Currently the relation is not needed for assembling the area, because
// the roles on the members are ignored. In the future we might want to use
// the roles, so we leave the function signature as it is.
bool area_assembler_t::operator()(const osmium::Relation & /*relation*/,
const osmium::memory::Buffer &ways_buffer)
bool area_assembler_t::operator()(osmium::Relation const & /*relation*/,
osmium::memory::Buffer const &ways_buffer)
{
for (const auto &way : ways_buffer.select<osmium::Way>()) {
for (auto const &way : ways_buffer.select<osmium::Way>()) {
segment_list().extract_segments_from_way(nullptr,
stats().duplicate_nodes, way);
}
Expand Down
6 changes: 3 additions & 3 deletions src/geom-area-assembler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class area_assembler_t : public osmium::area::detail::BasicAssembler
* @returns false if there was some kind of error building the
* area, true otherwise.
*/
bool operator()(const osmium::Way &way);
bool operator()(osmium::Way const &way);

/**
* Assemble an area from the given relation and its member ways
Expand All @@ -44,8 +44,8 @@ class area_assembler_t : public osmium::area::detail::BasicAssembler
* @returns false if there was some kind of error building the
* area, true otherwise.
*/
bool operator()(const osmium::Relation &relation,
const osmium::memory::Buffer &ways_buffer);
bool operator()(osmium::Relation const &relation,
osmium::memory::Buffer const &ways_buffer);

/**
* Access the area that was built last.
Expand Down
6 changes: 3 additions & 3 deletions src/geom-from-osm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void create_polygon(geometry_t *geom, osmium::Way const &way,
}

auto const &area = assembler.get_area();
auto const &ring = *area.begin<osmium::OuterRing>();
auto const &ring = *area.cbegin<osmium::OuterRing>();

fill_point_list(&polygon.outer(), ring);
}
Expand Down Expand Up @@ -169,7 +169,7 @@ void create_multilinestring(geometry_t *geom,
auto ways = buffer.select<osmium::Way>();
if (ways.size() == 1 && !force_multi) {
auto &line = geom->set<linestring_t>();
auto const &way = *ways.begin();
auto const &way = *ways.cbegin();
if (!fill_point_list(&line, way.nodes())) {
geom->reset();
}
Expand Down Expand Up @@ -228,7 +228,7 @@ void create_multipolygon(geometry_t *geom, osmium::Relation const &relation,
}
} else {
auto &polygon = geom->set<polygon_t>();
fill_polygon(&polygon, area, *area.outer_rings().begin());
fill_polygon(&polygon, area, *area.outer_rings().cbegin());
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/geom-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ class without_first

point_list_t::const_iterator begin()
{
assert(m_list->begin() != m_list->end());
return std::next(m_list->begin());
assert(m_list->cbegin() != m_list->cend());
return std::next(m_list->cbegin());
}

point_list_t::const_iterator end() { return m_list->end(); }
Expand Down Expand Up @@ -607,7 +607,7 @@ void line_merge(geometry_t *output, geometry_t const &input)
std::vector<endpoint_t> endpoints;

// ...and a list of connections.
constexpr auto const NOCONN = std::numeric_limits<std::size_t>::max();
constexpr std::size_t NOCONN = std::numeric_limits<std::size_t>::max();

struct connection_t
{
Expand Down
8 changes: 4 additions & 4 deletions src/geom-pole-of-inaccessibility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ auto point_to_polygon_distance(point_t point, polygon_t const &polygon,

struct Cell
{
static constexpr double const SQRT2 = 1.4142135623730951;
static constexpr double SQRT2 = 1.4142135623730951;

Cell(point_t c, double h, polygon_t const &polygon, double stretch)
: center(c), half_size(h),
Expand Down Expand Up @@ -147,7 +147,7 @@ Cell make_centroid_cell(polygon_t const &polygon, double stretch)

} // anonymous namespace

point_t pole_of_inaccessibility(const polygon_t &polygon, double precision,
point_t pole_of_inaccessibility(polygon_t const &polygon, double precision,
double stretch)
{
assert(stretch > 0);
Expand Down Expand Up @@ -225,8 +225,8 @@ point_t pole_of_inaccessibility(const polygon_t &polygon, double precision,
auto const h = cell.half_size / 2.0;
auto const center = cell.center;

for (auto dy : {-h, h}) {
for (auto dx : {-h, h}) {
for (auto const dy : {-h, h}) {
for (auto const dx : {-h, h}) {
Cell const c{point_t{center.x() + dx, center.y() + dy}, h,
polygon, stretch};
if (c.max > best_cell.dist) {
Expand Down
2 changes: 1 addition & 1 deletion src/geom-pole-of-inaccessibility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace geom {
*
* \pre \code stretch > 0 \endcode
*/
point_t pole_of_inaccessibility(const polygon_t &polygon, double precision,
point_t pole_of_inaccessibility(polygon_t const &polygon, double precision,
double stretch = 1.0);

void pole_of_inaccessibility(geometry_t *output, geometry_t const &input,
Expand Down
2 changes: 1 addition & 1 deletion src/geom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class multigeometry_t
using iterator = typename std::vector<GEOM>::iterator;
using value_type = GEOM;

static constexpr bool const FOR_POINT = std::is_same_v<GEOM, point_t>;
static constexpr bool FOR_POINT = std::is_same_v<GEOM, point_t>;

[[nodiscard]] std::size_t num_geometries() const noexcept
{
Expand Down
4 changes: 2 additions & 2 deletions src/hex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ std::string encode_hex(std::string const &in)

namespace {

constexpr std::array<char, 256> const HEX_TABLE = {
constexpr std::array<char, 256> HEX_TABLE = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Expand Down Expand Up @@ -67,7 +67,7 @@ std::string decode_hex(std::string_view hex_string)
wkb.reserve(hex_string.size() / 2);

// NOLINTNEXTLINE(llvm-qualified-auto, readability-qualified-auto)
for (auto hex = hex_string.begin(); hex != hex_string.end();) {
for (auto hex = hex_string.cbegin(); hex != hex_string.cend();) {
unsigned int const c = decode_hex_char(*hex++);
wkb += static_cast<char>((c << 4U) | decode_hex_char(*hex++));
}
Expand Down
2 changes: 1 addition & 1 deletion src/idlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ osmid_t idlist_t::pop_id()
void idlist_t::sort_unique()
{
std::sort(m_list.begin(), m_list.end());
const auto last = std::unique(m_list.begin(), m_list.end());
auto const last = std::unique(m_list.begin(), m_list.end());
m_list.erase(last, m_list.end());
}

Expand Down
12 changes: 6 additions & 6 deletions src/middle-pgsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@

namespace {

void send_id_list(pg_conn_t const &db_connection,
std::string const &table, idlist_t const &ids)
void send_id_list(pg_conn_t const &db_connection, std::string const &table,
idlist_t const &ids)
{
std::string data;
for (auto const id : ids) {
Expand Down Expand Up @@ -171,7 +171,7 @@ class member_list_json_builder
}

static bool number_float(nlohmann::json::number_float_t /*val*/,
const nlohmann::json::string_t & /*s*/)
nlohmann::json::string_t const & /*s*/)
{
return true;
}
Expand Down Expand Up @@ -228,8 +228,8 @@ class member_list_json_builder
static bool end_array() { return true; }

static bool parse_error(std::size_t /*position*/,
const std::string & /*last_token*/,
const nlohmann::json::exception &ex)
std::string const & /*last_token*/,
nlohmann::json::exception const &ex)
{
throw ex;
}
Expand Down Expand Up @@ -1168,7 +1168,7 @@ void middle_pgsql_t::stop()
if (m_options->droptemp) {
// Dropping the tables is fast, so do it synchronously to guarantee
// that the space is freed before creating the other indices.
for (auto &table : m_tables) {
for (auto const &table : m_tables) {
table.drop_table(m_db_connection);
}
} else if (!m_options->append) {
Expand Down
2 changes: 1 addition & 1 deletion src/node-locations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ osmium::Location node_locations_t::get(osmid_t id) const

void node_locations_t::log_stats()
{
constexpr auto const MBYTE = 1024 * 1024;
constexpr auto MBYTE = 1024 * 1024;
log_debug("Node locations cache:");
log_debug(" num locations stored: {}", m_count);
log_debug(" bytes overall: {}MB", used_memory() / MBYTE);
Expand Down
2 changes: 1 addition & 1 deletion src/node-locations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class node_locations_t
* The block size used for internal blocks. The larger the block size
* the less memory is consumed but the more expensive the access is.
*/
static constexpr const std::size_t BLOCK_SIZE = 32;
static constexpr std::size_t BLOCK_SIZE = 32;

bool first_entry_in_block() const noexcept
{
Expand Down
2 changes: 1 addition & 1 deletion src/ordered-index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class ordered_index_t

std::pair<osmid_t, std::size_t> get_internal(osmid_t id) const noexcept;

static constexpr std::size_t const MAX_BLOCK_SIZE = 16UL * 1024UL * 1024UL;
static constexpr std::size_t MAX_BLOCK_SIZE = 16UL * 1024UL * 1024UL;

std::vector<range_entry> m_ranges;
std::size_t m_block_size;
Expand Down
4 changes: 2 additions & 2 deletions src/osm2pgsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void check_and_update_flat_node_file(properties_t *properties,
flat_node_file_from_import);
}
} else {
const auto absolute_path =
auto const absolute_path =
std::filesystem::absolute(
std::filesystem::path{options->flat_node_file})
.string();
Expand Down Expand Up @@ -279,7 +279,7 @@ void check_and_update_style_file(properties_t *properties, options_t *options)
throw std::runtime_error{"Style file from import is empty!?"};
}

const auto absolute_path =
auto const absolute_path =
std::filesystem::absolute(std::filesystem::path{options->style})
.string();

Expand Down
8 changes: 4 additions & 4 deletions src/output-flex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void push_osm_object_to_lua_stack(lua_State *lua_state,
* timestamp, changeset, uid, user). For ways there are 2 more (is_closed,
* nodes), for relations 1 more (members).
*/
constexpr int const MAX_TABLE_SIZE = 10;
constexpr int MAX_TABLE_SIZE = 10;

lua_createtable(lua_state, 0, MAX_TABLE_SIZE);

Expand Down Expand Up @@ -243,7 +243,7 @@ typename CONTAINER::value_type &get_from_idx_param(lua_State *lua_state,

std::size_t get_nodes(middle_query_t const &middle, osmium::Way *way)
{
constexpr std::size_t const MAX_MISSING_NODES = 100;
constexpr std::size_t MAX_MISSING_NODES = 100;
static std::size_t count_missing_nodes = 0;

auto const count = middle.nodes_get_list(&way->nodes());
Expand Down Expand Up @@ -280,7 +280,7 @@ void flush_tables(std::vector<table_connection_t> &table_connections)
void create_expire_tables(std::vector<expire_output_t> const &expire_outputs,
connection_params_t const &connection_params)
{
if (std::all_of(expire_outputs.begin(), expire_outputs.end(),
if (std::all_of(expire_outputs.cbegin(), expire_outputs.cend(),
[](auto const &expire_output) {
return expire_output.table().empty();
})) {
Expand Down Expand Up @@ -1258,7 +1258,7 @@ output_flex_t::output_flex_t(std::shared_ptr<middle_query_t> const &mid,
m_table_connections.emplace_back(&table, m_copy_thread);
}

for (auto &expire_output : *m_expire_outputs) {
for (auto const &expire_output : *m_expire_outputs) {
m_expire_tiles.emplace_back(
expire_output.maxzoom(),
reprojection::create_projection(PROJ_SPHERE_MERC));
Expand Down
2 changes: 1 addition & 1 deletion src/output-pgsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ void output_pgsql_t::delete_from_output_and_expire(osmid_t id)
{
m_tables[t_roads]->delete_row(id);

for (auto table : {t_line, t_poly}) {
for (auto const table : {t_line, t_poly}) {
if (m_expire.enabled()) {
auto const results = m_tables.at(table)->get_wkb(id);
if (expire_from_result(&m_expire, results, m_expire_config) != 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/pgsql.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ class pg_conn_t
// It needs to be large enough to hold all parameters without resizing
// so that pointers into the strings in that vector remain valid
// after new parameters have been added.
constexpr auto const TOTAL_BUFFERS_NEEDED =
constexpr auto TOTAL_BUFFERS_NEEDED =
(0 + ... + buffers_needed<std::decay_t<TArgs>>());

std::vector<std::string> exec_params;
Expand Down
2 changes: 1 addition & 1 deletion src/tagtransform-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct layers_type
bool roads;
};

constexpr std::array<layers_type, 25> const LAYERS = {
constexpr std::array<layers_type, 25> LAYERS = {
{{"proposed", 1, false}, {"construction", 2, false},
{"steps", 10, false}, {"cycleway", 10, false},
{"bridleway", 10, false}, {"footway", 10, false},
Expand Down
2 changes: 1 addition & 1 deletion src/thread-pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class thread_pool_t

}; // class thread_joiner

static constexpr std::size_t const MAX_QUEUE_SIZE = 32;
static constexpr std::size_t MAX_QUEUE_SIZE = 32;

osmium::thread::Queue<osmium::thread::function_wrapper> m_work_queue;
std::vector<std::thread> m_threads;
Expand Down
Loading