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
4 changes: 2 additions & 2 deletions src/db-copy-mgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ class db_copy_mgr_t
* a column delimiter.
*/
template <typename T>
void add_column(T value)
void add_column(T &&value)
{
add_value(value);
add_value(std::forward<T>(value));
m_current.buffer += '\t';
}

Expand Down
16 changes: 8 additions & 8 deletions src/geom-boost-adaptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ BOOST_GEOMETRY_DETAIL_SPECIALIZE_BOX_TRAITS(::geom::box_t, ::geom::point_t)
template <>
struct indexed_access<::geom::box_t, min_corner, 0>
{
static inline double get(::geom::box_t const &b) { return b.min_x(); }
static inline void set(::geom::box_t &b, double value)
static double get(::geom::box_t const &b) { return b.min_x(); }
static void set(::geom::box_t &b, double value)
{
b.set_min_x(value);
}
Expand All @@ -95,8 +95,8 @@ struct indexed_access<::geom::box_t, min_corner, 0>
template <>
struct indexed_access<::geom::box_t, min_corner, 1>
{
static inline double get(::geom::box_t const &b) { return b.min_y(); }
static inline void set(::geom::box_t &b, double value)
static double get(::geom::box_t const &b) { return b.min_y(); }
static void set(::geom::box_t &b, double value)
{
b.set_min_y(value);
}
Expand All @@ -105,8 +105,8 @@ struct indexed_access<::geom::box_t, min_corner, 1>
template <>
struct indexed_access<::geom::box_t, max_corner, 0>
{
static inline double get(::geom::box_t const &b) { return b.max_x(); }
static inline void set(::geom::box_t &b, double value)
static double get(::geom::box_t const &b) { return b.max_x(); }
static void set(::geom::box_t &b, double value)
{
b.set_max_x(value);
}
Expand All @@ -115,8 +115,8 @@ struct indexed_access<::geom::box_t, max_corner, 0>
template <>
struct indexed_access<::geom::box_t, max_corner, 1>
{
static inline double get(::geom::box_t const &b) { return b.max_y(); }
static inline void set(::geom::box_t &b, double value)
static double get(::geom::box_t const &b) { return b.max_y(); }
static void set(::geom::box_t &b, double value)
{
b.set_max_y(value);
}
Expand Down
4 changes: 2 additions & 2 deletions src/geom-functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ point_t interpolate(point_t p1, point_t p2, double frac) noexcept;
* \pre \code !list.empty() \endcode
*/
template <typename FUNC>
void for_each_segment(point_list_t const &list, FUNC &&func)
void for_each_segment(point_list_t const &list, FUNC const &func)
{
assert(!list.empty());
auto it = list.cbegin();
auto prev = it;
for (++it; it != list.cend(); ++it) {
std::forward<FUNC>(func)(*prev, *it);
func(*prev, *it);
prev = it;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/lua-utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ void luaX_add_table_func(lua_State *lua_state, char const *key,

template <typename COLLECTION, typename FUNC>
void luaX_add_table_array(lua_State *lua_state, char const *key,
COLLECTION const &collection, FUNC &&func)
COLLECTION const &collection, FUNC const &func)
{
lua_pushstring(lua_state, key);
lua_createtable(lua_state, (int)collection.size(), 0);
int n = 0;
for (auto const &member : collection) {
lua_pushinteger(lua_state, ++n);
std::forward<FUNC>(func)(member);
func(member);
lua_rawset(lua_state, -3);
}
lua_rawset(lua_state, -3);
Expand Down Expand Up @@ -99,15 +99,15 @@ bool luaX_is_array(lua_State *lua_state);
* \post Stack is unchanged.
*/
template <typename FUNC>
void luaX_for_each(lua_State *lua_state, FUNC &&func)
void luaX_for_each(lua_State *lua_state, FUNC const &func)
{
assert(lua_istable(lua_state, -1));
lua_pushnil(lua_state);
while (lua_next(lua_state, -2) != 0) {
#ifndef NDEBUG
int const top = lua_gettop(lua_state);
#endif
std::forward<FUNC>(func)();
func();
assert(top == lua_gettop(lua_state));
lua_pop(lua_state, 1);
}
Expand Down
3 changes: 2 additions & 1 deletion src/output-pgsql.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
#include "tagtransform.hpp"

#include <array>
#include <cstdint>
#include <memory>

class output_pgsql_t : public output_t
{
public:
enum table_id
enum table_id : std::uint8_t
{
t_point = 0,
t_line,
Expand Down
2 changes: 2 additions & 0 deletions src/params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class params_t
m_map.insert_or_assign(std::forward<K>(key), value);
}

// NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
template <typename K, typename V,
std::enable_if_t<std::is_integral_v<std::remove_reference_t<V>>,
bool> = true>
Expand All @@ -71,6 +72,7 @@ class params_t
{
m_map.insert_or_assign(std::forward<K>(key), std::string(value));
}
// NOLINTEND(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)

template <typename K>
void remove(K &&key)
Expand Down
11 changes: 6 additions & 5 deletions src/pgsql.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class pg_conn_t
* status code PGRES_COMMAND_OK or PGRES_TUPLES_OK).
*/
template <typename... TArgs>
pg_result_t exec(fmt::format_string<TArgs...> sql, TArgs... params) const
pg_result_t exec(fmt::format_string<TArgs...> sql, TArgs &&...params) const
{
return exec(fmt::format(sql, std::forward<TArgs>(params)...));
}
Expand All @@ -196,7 +196,7 @@ class pg_conn_t
*/
template <typename... TArgs>
void prepare(std::string const &stmt, fmt::format_string<TArgs...> sql,
TArgs... params) const
TArgs &&...params) const
{
std::string const query =
fmt::format(sql, std::forward<TArgs>(params)...);
Expand All @@ -213,7 +213,7 @@ class pg_conn_t
* \throws exception if the command failed.
*/
template <typename... TArgs>
pg_result_t exec_prepared(char const *stmt, TArgs... params) const
pg_result_t exec_prepared(char const *stmt, TArgs &&...params) const
{
return exec_prepared_with_result_format(stmt, false,
std::forward<TArgs>(params)...);
Expand All @@ -229,7 +229,8 @@ class pg_conn_t
* \throws exception if the command failed.
*/
template <typename... TArgs>
pg_result_t exec_prepared_as_binary(char const *stmt, TArgs... params) const
pg_result_t exec_prepared_as_binary(char const *stmt,
TArgs &&...params) const
{
return exec_prepared_with_result_format(stmt, true,
std::forward<TArgs>(params)...);
Expand Down Expand Up @@ -312,7 +313,7 @@ class pg_conn_t
template <typename... TArgs>
pg_result_t exec_prepared_with_result_format(char const *stmt,
bool result_as_binary,
TArgs... params) const
TArgs &&...params) const
{
// We have to convert all non-string parameters into strings and
// store them somewhere. We use the exec_params vector for this.
Expand Down
4 changes: 4 additions & 0 deletions src/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ void table_t::task_wait()
util::human_readable_duration(run_time));
}

// NOLINTBEGIN(google-runtime-int,cert-err34-c)
// This is legacy code which will be removed anyway.

/* Escape data appropriate to the type */
void table_t::escape_type(std::string const &value, ColumnType flags)
{
Expand Down Expand Up @@ -423,6 +426,7 @@ void table_t::escape_type(std::string const &value, ColumnType flags)
break;
}
}
// NOLINTEND(google-runtime-int,cert-err34-c)

pg_result_t table_t::get_wkb(osmid_t id)
{
Expand Down
2 changes: 1 addition & 1 deletion src/taginfo-impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <utility>
#include <vector>

enum column_flags : unsigned int
enum column_flags : unsigned int // NOLINT(performance-enum-size)
{
FLAG_POLYGON = 1, /* For polygon table */
FLAG_LINEAR = 2, /* For lines table */
Expand Down
3 changes: 3 additions & 0 deletions src/taginfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ unsigned get_tag_type(std::string const &tag)

} // anonymous namespace

// NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
// This is legacy code which will be removed anyway.
bool read_style_file(std::string const &filename, export_list *exlist)
{
bool enable_way_area = true;
Expand Down Expand Up @@ -195,3 +197,4 @@ bool read_style_file(std::string const &filename, export_list *exlist)

return enable_way_area;
}
// NOLINTEND(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
9 changes: 4 additions & 5 deletions src/tile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,14 @@ class tile_t
*/
template <class OUTPUT>
std::size_t for_each_tile(quadkey_list_t const &tiles_at_maxzoom,
uint32_t minzoom, uint32_t maxzoom, OUTPUT &&output)
uint32_t minzoom, uint32_t maxzoom,
OUTPUT const &output)
{
assert(minzoom <= maxzoom);

if (minzoom == maxzoom) {
for (auto const quadkey : tiles_at_maxzoom) {
std::forward<OUTPUT>(output)(
tile_t::from_quadkey(quadkey, maxzoom));
output(tile_t::from_quadkey(quadkey, maxzoom));
}
return tiles_at_maxzoom.size();
}
Expand All @@ -309,8 +309,7 @@ std::size_t for_each_tile(quadkey_list_t const &tiles_at_maxzoom,
* the first sibling.
*/
if (qt_current != last_quadkey.down(dz)) {
std::forward<OUTPUT>(output)(
tile_t::from_quadkey(qt_current, maxzoom - dz));
output(tile_t::from_quadkey(qt_current, maxzoom - dz));
++count;
}
}
Expand Down