Skip to content

Commit cf647c1

Browse files
committed
Only start padding with zeros at 10^n
1 parent 7ab8741 commit cf647c1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/osmium/io/detail/debug_output_format.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ namespace osmium {
392392
*m_out += " (open)\n";
393393
}
394394

395-
const int width = static_cast<int>(std::log10(way.nodes().size())) + 1;
395+
const int width = way.nodes().size() <= 1 ? 1 : static_cast<int>(std::log10(way.nodes().size() - 1)) + 1;
396396
int n = 0;
397397
for (const auto& node_ref : way.nodes()) {
398398
write_diff();
@@ -427,7 +427,7 @@ namespace osmium {
427427
output_int(relation.members().size());
428428
*m_out += '\n';
429429

430-
const int width = static_cast<int>(std::log10(relation.members().size())) + 1;
430+
const int width = relation.members().size() <= 1 ? 1 : static_cast<int>(std::log10(relation.members().size() - 1)) + 1;
431431
int n = 0;
432432
for (const auto& member : relation.members()) {
433433
write_diff();
@@ -485,7 +485,7 @@ namespace osmium {
485485
output_int(changeset.num_comments());
486486
*m_out += '\n';
487487

488-
const int width = static_cast<int>(std::log10(changeset.num_comments())) + 1;
488+
const int width = changeset.num_comments() <= 1 ? 1 : static_cast<int>(std::log10(changeset.num_comments() - 1)) + 1;
489489
int n = 0;
490490
for (const auto& comment : changeset.discussion()) {
491491
write_counter(width, n++);

0 commit comments

Comments
 (0)