From cf647c16ddcca2a62990bc3173bbcda9fb296152 Mon Sep 17 00:00:00 2001 From: ginnyTheCat Date: Sat, 16 Aug 2025 16:02:19 +0200 Subject: [PATCH] Only start padding with zeros at 10^n --- include/osmium/io/detail/debug_output_format.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/osmium/io/detail/debug_output_format.hpp b/include/osmium/io/detail/debug_output_format.hpp index 9767690e..faff7c5f 100644 --- a/include/osmium/io/detail/debug_output_format.hpp +++ b/include/osmium/io/detail/debug_output_format.hpp @@ -392,7 +392,7 @@ namespace osmium { *m_out += " (open)\n"; } - const int width = static_cast(std::log10(way.nodes().size())) + 1; + const int width = way.nodes().size() <= 1 ? 1 : static_cast(std::log10(way.nodes().size() - 1)) + 1; int n = 0; for (const auto& node_ref : way.nodes()) { write_diff(); @@ -427,7 +427,7 @@ namespace osmium { output_int(relation.members().size()); *m_out += '\n'; - const int width = static_cast(std::log10(relation.members().size())) + 1; + const int width = relation.members().size() <= 1 ? 1 : static_cast(std::log10(relation.members().size() - 1)) + 1; int n = 0; for (const auto& member : relation.members()) { write_diff(); @@ -485,7 +485,7 @@ namespace osmium { output_int(changeset.num_comments()); *m_out += '\n'; - const int width = static_cast(std::log10(changeset.num_comments())) + 1; + const int width = changeset.num_comments() <= 1 ? 1 : static_cast(std::log10(changeset.num_comments() - 1)) + 1; int n = 0; for (const auto& comment : changeset.discussion()) { write_counter(width, n++);