Skip to content

Commit e265a43

Browse files
committed
Fix implicit sign conversion in node_locations_t
1 parent ca75c11 commit e265a43

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/node-locations.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ bool node_locations_t::set(osmid_t id, osmium::Location location)
3434
m_index.add(id, m_data.size());
3535
}
3636

37-
protozero::add_varint_to_buffer(&m_data, m_did.update(id));
37+
auto const delta = m_did.update(id);
38+
// Always true because ids in input must be unique and ordered
39+
assert(delta > 0);
40+
protozero::add_varint_to_buffer(&m_data, static_cast<uint64_t>(delta));
41+
3842
protozero::add_varint_to_buffer(
3943
&m_data, protozero::encode_zigzag64(m_dx.update(location.x())));
4044
protozero::add_varint_to_buffer(
@@ -62,7 +66,8 @@ osmium::Location node_locations_t::get(osmid_t id) const
6266
osmium::DeltaDecode<int64_t> dy;
6367

6468
for (std::size_t n = 0; n < block_size && begin != end; ++n) {
65-
auto const bid = did.update(protozero::decode_varint(&begin, end));
69+
auto const bid = did.update(
70+
static_cast<int64_t>(protozero::decode_varint(&begin, end)));
6671
int32_t const x = dx.update(
6772
protozero::decode_zigzag64(protozero::decode_varint(&begin, end)));
6873
int32_t const y = dy.update(

0 commit comments

Comments
 (0)