@@ -30,8 +30,8 @@ struct throughput {
3030
3131struct progress {
3232 const char * title ;
33- int last_value ;
34- unsigned total ;
33+ uint64_t last_value ;
34+ uint64_t total ;
3535 unsigned last_percent ;
3636 unsigned delay ;
3737 struct throughput * throughput ;
@@ -78,7 +78,7 @@ static int is_foreground_fd(int fd)
7878 return tpgrp < 0 || tpgrp == getpgid (0 );
7979}
8080
81- static int display (struct progress * progress , unsigned n , const char * done )
81+ static int display (struct progress * progress , uint64_t n , const char * done )
8282{
8383 const char * eol , * tp ;
8484
@@ -93,18 +93,19 @@ static int display(struct progress *progress, unsigned n, const char *done)
9393 if (percent != progress -> last_percent || progress_update ) {
9494 progress -> last_percent = percent ;
9595 if (is_foreground_fd (fileno (stderr )) || done ) {
96- fprintf (stderr , "%s: %3u%% (%u/%u)%s%s" ,
97- progress -> title , percent , n ,
98- progress -> total , tp , eol );
96+ fprintf (stderr , "%s: %3u%% (%" PRIuMAX "/%" PRIuMAX ")%s%s" ,
97+ progress -> title , percent ,
98+ (uintmax_t )n , (uintmax_t )progress -> total ,
99+ tp , eol );
99100 fflush (stderr );
100101 }
101102 progress_update = 0 ;
102103 return 1 ;
103104 }
104105 } else if (progress_update ) {
105106 if (is_foreground_fd (fileno (stderr )) || done ) {
106- fprintf (stderr , "%s: %u %s%s" ,
107- progress -> title , n , tp , eol );
107+ fprintf (stderr , "%s: %" PRIuMAX " %s%s" ,
108+ progress -> title , ( uintmax_t ) n , tp , eol );
108109 fflush (stderr );
109110 }
110111 progress_update = 0 ;
@@ -114,7 +115,7 @@ static int display(struct progress *progress, unsigned n, const char *done)
114115 return 0 ;
115116}
116117
117- static void throughput_string (struct strbuf * buf , off_t total ,
118+ static void throughput_string (struct strbuf * buf , uint64_t total ,
118119 unsigned int rate )
119120{
120121 strbuf_reset (buf );
@@ -125,7 +126,7 @@ static void throughput_string(struct strbuf *buf, off_t total,
125126 strbuf_addstr (buf , "/s" );
126127}
127128
128- void display_throughput (struct progress * progress , off_t total )
129+ void display_throughput (struct progress * progress , uint64_t total )
129130{
130131 struct throughput * tp ;
131132 uint64_t now_ns ;
@@ -187,12 +188,12 @@ void display_throughput(struct progress *progress, off_t total)
187188 display (progress , progress -> last_value , NULL );
188189}
189190
190- int display_progress (struct progress * progress , unsigned n )
191+ int display_progress (struct progress * progress , uint64_t n )
191192{
192193 return progress ? display (progress , n , NULL ) : 0 ;
193194}
194195
195- static struct progress * start_progress_delay (const char * title , unsigned total ,
196+ static struct progress * start_progress_delay (const char * title , uint64_t total ,
196197 unsigned delay )
197198{
198199 struct progress * progress = malloc (sizeof (* progress ));
@@ -213,12 +214,12 @@ static struct progress *start_progress_delay(const char *title, unsigned total,
213214 return progress ;
214215}
215216
216- struct progress * start_delayed_progress (const char * title , unsigned total )
217+ struct progress * start_delayed_progress (const char * title , uint64_t total )
217218{
218219 return start_progress_delay (title , total , 2 );
219220}
220221
221- struct progress * start_progress (const char * title , unsigned total )
222+ struct progress * start_progress (const char * title , uint64_t total )
222223{
223224 return start_progress_delay (title , total , 0 );
224225}
0 commit comments