Skip to content

Commit 338857f

Browse files
zihaooojoto
authored andcommitted
Fix ID comparison in osmium merge to match osmium sort behavior
1 parent d2a89ef commit 338857f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/command_merge.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
3535
#include <osmium/memory/buffer.hpp>
3636
#include <osmium/osm/entity_bits.hpp>
3737
#include <osmium/osm/object.hpp>
38+
#include <osmium/osm/object_comparisons.hpp>
3839
#include <osmium/util/verbose_output.hpp>
3940

4041
#include <boost/program_options.hpp>
@@ -146,10 +147,11 @@ namespace {
146147
return true;
147148
}
148149

149-
if (m_iterator->id() < m_last_id) {
150+
static constexpr osmium::id_order id_cmp{};
151+
if (id_cmp(m_iterator->id(), m_last_id)) {
150152
throw std::runtime_error{"Objects in input file '" + m_name + "' out of order (smaller ids must come first)."};
151153
}
152-
if (m_iterator->id() > m_last_id) {
154+
if (id_cmp(m_last_id, m_iterator->id())) {
153155
m_last_id = m_iterator->id();
154156
m_last_version = m_iterator->version();
155157
return true;

0 commit comments

Comments
 (0)