commit b593496508f3e82abafe91570d78867dcbcae871 from: Christian Weisgerber date: Sat Feb 12 21:48:46 2022 UTC shrink the width of formatted output fields to their expected size Replace FMT_SCALED_STRSIZE with (FMT_SCALED_STRSIZE - 2) as field width when formatting output for printing. FMT_SCALED_STRSIZE includes space for a nul byte and a minus sign. Output values are expected to be always positive here. ok stsp commit - f6027426102430eb80a6df7ce1bf2e31d15cf85d commit + b593496508f3e82abafe91570d78867dcbcae871 blob - 23e3b35d2df3662ccdf58a8fd4544ed6490c1a3c blob + 7d8663fbddd35a7c2dca7773ddeda8f1c7abffa4 --- got/got.c +++ got/got.c @@ -1029,7 +1029,7 @@ fetch_progress(void *arg, const char *message, off_t p if (print_size || print_indexed || print_resolved) printf("\r"); if (print_size) - printf("%*s fetched", FMT_SCALED_STRSIZE, scaled_size); + printf("%*s fetched", FMT_SCALED_STRSIZE - 2, scaled_size); if (print_indexed) printf("; indexing %d%%", p_indexed); if (print_resolved) @@ -7818,10 +7818,10 @@ send_progress(void *arg, off_t packfile_size, int ncom if (print_deltify) printf("; deltify: %d%%", p_deltify); if (print_sent) - printf("; uploading pack: %*s %d%%", FMT_SCALED_STRSIZE, + printf("; uploading pack: %*s %d%%", FMT_SCALED_STRSIZE - 2, scaled_packsize, p_sent); else if (print_written) - printf("; writing pack: %*s %d%%", FMT_SCALED_STRSIZE, + printf("; writing pack: %*s %d%%", FMT_SCALED_STRSIZE - 2, scaled_packsize, p_written); if (print_searching || print_total || print_deltify || print_written || print_sent) { blob - 4a20c98ded30054a59e95d5cd5fc9f422d019da1 blob + 9bf9bdbfc8e7f58c5245c1b799e93299b67d828f --- gotadmin/gotadmin.c +++ gotadmin/gotadmin.c @@ -458,7 +458,7 @@ pack_progress(void *arg, off_t packfile_size, int ncom if (print_deltify) printf("; deltify: %d%%", p_deltify); if (print_written) - printf("; writing pack: %*s %d%%", FMT_SCALED_STRSIZE, + printf("; writing pack: %*s %d%%", FMT_SCALED_STRSIZE - 2, scaled_size, p_written); if (print_searching || print_total || print_deltify || print_written) { @@ -512,7 +512,7 @@ pack_index_progress(void *arg, off_t packfile_size, in if (print_size || print_indexed || print_resolved) printf("\r"); if (print_size) - printf("%*s packed", FMT_SCALED_STRSIZE, scaled_size); + printf("%*s packed", FMT_SCALED_STRSIZE - 2, scaled_size); if (print_indexed) printf("; indexing %d%%", p_indexed); if (print_resolved)