Re: [PATCH v2 2/4] progress: fix progress meters when dealing with lots of work
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Nov 13, 2017, 21:33 UTC
- Message-ID
- <20171113133316.c10bd360b4af10e572049443@google.com>
- In-Reply-To
- <20171113201600.24878-3-newren@gmail.com>
On Mon, 13 Nov 2017 12:15:58 -0800 Elijah Newren <newren@gmail.com> wrote:
Show 13 quoted lines
> -static int display(struct progress *progress, unsigned n, const char *done)
> +static int display(struct progress *progress, uint64_t n, const char *done)
> {
> const char *eol, *tp;
>
> @@ -106,7 +106,7 @@ static int display(struct progress *progress, unsigned n, const char *done)
> if (percent != progress->last_percent || progress_update) {
> progress->last_percent = percent;
> if (is_foreground_fd(fileno(stderr)) || done) {
> - fprintf(stderr, "%s: %3u%% (%u/%u)%s%s",
> + fprintf(stderr, "%s: %3u%% (%"PRIuMAX"/%"PRIuMAX")%s%s",
> progress->title, percent, n,
> progress->total, tp, eol);I think it would be better to cast the appropriate arguments to uintmax_t - searching through the Git code shows that we do that in several situations. Same for the rest of the diff.