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/flex-lua-geom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static int geom_centroid(lua_State *lua_state)
static int geom_geometry_n(lua_State *lua_state)
{
auto const *const input_geometry = unpack_geometry(lua_state);
int const index = luaL_checkinteger(lua_state, 2);
auto const index = static_cast<int>(luaL_checkinteger(lua_state, 2));

try {
auto *geom = create_lua_geometry_object(lua_state);
Expand Down Expand Up @@ -216,7 +216,7 @@ static int geom_tostring(lua_State *lua_state)
static int geom_transform(lua_State *lua_state)
{
auto const *const input_geometry = unpack_geometry(lua_state);
int const srid = luaL_checkinteger(lua_state, 2);
auto const srid = static_cast<int>(luaL_checkinteger(lua_state, 2));

try {
if (input_geometry->srid() != 4326) {
Expand Down
2 changes: 1 addition & 1 deletion src/geom-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ void line_merge(geometry_t *output, geometry_t const &input)
std::vector<endpoint_t> endpoints;

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

struct connection_t
{
Expand Down
8 changes: 4 additions & 4 deletions src/node-locations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ osmium::Location node_locations_t::get(osmid_t id) const
for (std::size_t n = 0; n < block_size && begin != end; ++n) {
auto const bid = did.update(
static_cast<int64_t>(protozero::decode_varint(&begin, end)));
int32_t const x = dx.update(
protozero::decode_zigzag64(protozero::decode_varint(&begin, end)));
int32_t const y = dy.update(
protozero::decode_zigzag64(protozero::decode_varint(&begin, end)));
auto const x = static_cast<int32_t>(dx.update(
protozero::decode_zigzag64(protozero::decode_varint(&begin, end))));
auto const y = static_cast<int32_t>(dy.update(
protozero::decode_zigzag64(protozero::decode_varint(&begin, end))));
if (bid == id) {
return osmium::Location{x, y};
}
Expand Down
3 changes: 1 addition & 2 deletions src/progress-display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static double count_per_second(std::size_t count, uint64_t elapsed) noexcept
}

if (elapsed == 0) {
return count;
return static_cast<double>(count);
}

return static_cast<double>(count) / elapsed;
Expand Down Expand Up @@ -115,4 +115,3 @@ uint64_t progress_display_t::overall_time(std::time_t now) const noexcept
{
return static_cast<uint64_t>(now - m_node.start);
}

4 changes: 2 additions & 2 deletions src/tagtransform-lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@ bool lua_tagtransform_t::filter_rel_member_tags(
lua_newtable(lua_state()); /* member roles table */

for (size_t i = 0; i < num_members; ++i) {
lua_pushnumber(lua_state(), i + 1);
lua_pushnumber(lua_state(), static_cast<lua_Number>(i + 1));
lua_pushstring(lua_state(), member_roles[i]);
lua_rawset(lua_state(), -3);
}

lua_pushnumber(lua_state(), num_members);
lua_pushnumber(lua_state(), static_cast<lua_Number>(num_members));

if (lua_pcall(lua_state(), 4, 6, 0)) {
/* lua function failed */
Expand Down
4 changes: 2 additions & 2 deletions src/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ class timer_t
*
* Returns 0 if the elapsed time is 0.
*/
double per_second(double value) const noexcept
double per_second(std::size_t value) const noexcept
{
auto const seconds =
std::chrono::duration_cast<std::chrono::seconds>(m_duration)
.count();
if (seconds == 0) {
return 0.0;
}
return value / static_cast<double>(seconds);
return static_cast<double>(value) / static_cast<double>(seconds);
}

private:
Expand Down
3 changes: 2 additions & 1 deletion src/wkb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ class ewkb_parser_t
{
public:
ewkb_parser_t(char const *it, char const *end)
: m_it(it), m_end(end), m_max_length((end - it) / (sizeof(double) * 2))
: m_it(it), m_end(end),
m_max_length(static_cast<uint32_t>(end - it) / (sizeof(double) * 2))
{}

geom::geometry_t operator()()
Expand Down
4 changes: 2 additions & 2 deletions tests/test-parse-osmium.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ struct counting_output_t : public output_null_t

type_stats_t node, way, relation;
long long sum_ids = 0;
unsigned sum_nds = 0;
unsigned sum_members = 0;
std::size_t sum_nds = 0;
std::size_t sum_members = 0;
};

struct counts_t {
Expand Down