@@ -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 unsigned delayed_percent_threshold ;
@@ -79,7 +79,7 @@ static int is_foreground_fd(int fd)
7979 return tpgrp < 0 || tpgrp == getpgid (0 );
8080}
8181
82- static int display (struct progress * progress , unsigned n , const char * done )
82+ static int display (struct progress * progress , uint64_t n , const char * done )
8383{
8484 const char * eol , * tp ;
8585
@@ -106,18 +106,19 @@ static int display(struct progress *progress, unsigned n, const char *done)
106106 if (percent != progress -> last_percent || progress_update ) {
107107 progress -> last_percent = percent ;
108108 if (is_foreground_fd (fileno (stderr )) || done ) {
109- fprintf (stderr , "%s: %3u%% (%u/%u)%s%s" ,
110- progress -> title , percent , n ,
111- progress -> total , tp , eol );
109+ fprintf (stderr , "%s: %3u%% (%" PRIuMAX "/%" PRIuMAX ")%s%s" ,
110+ progress -> title , percent ,
111+ (uintmax_t )n , (uintmax_t )progress -> total ,
112+ tp , eol );
112113 fflush (stderr );
113114 }
114115 progress_update = 0 ;
115116 return 1 ;
116117 }
117118 } else if (progress_update ) {
118119 if (is_foreground_fd (fileno (stderr )) || done ) {
119- fprintf (stderr , "%s: %u %s%s" ,
120- progress -> title , n , tp , eol );
120+ fprintf (stderr , "%s: %" PRIuMAX " %s%s" ,
121+ progress -> title , ( uintmax_t ) n , tp , eol );
121122 fflush (stderr );
122123 }
123124 progress_update = 0 ;
@@ -127,7 +128,7 @@ static int display(struct progress *progress, unsigned n, const char *done)
127128 return 0 ;
128129}
129130
130- static void throughput_string (struct strbuf * buf , off_t total ,
131+ static void throughput_string (struct strbuf * buf , uint64_t total ,
131132 unsigned int rate )
132133{
133134 strbuf_reset (buf );
@@ -138,7 +139,7 @@ static void throughput_string(struct strbuf *buf, off_t total,
138139 strbuf_addstr (buf , "/s" );
139140}
140141
141- void display_throughput (struct progress * progress , off_t total )
142+ void display_throughput (struct progress * progress , uint64_t total )
142143{
143144 struct throughput * tp ;
144145 uint64_t now_ns ;
@@ -200,12 +201,12 @@ void display_throughput(struct progress *progress, off_t total)
200201 display (progress , progress -> last_value , NULL );
201202}
202203
203- int display_progress (struct progress * progress , unsigned n )
204+ int display_progress (struct progress * progress , uint64_t n )
204205{
205206 return progress ? display (progress , n , NULL ) : 0 ;
206207}
207208
208- static struct progress * start_progress_delay (const char * title , unsigned total ,
209+ static struct progress * start_progress_delay (const char * title , uint64_t total ,
209210 unsigned percent_threshold , unsigned delay )
210211{
211212 struct progress * progress = malloc (sizeof (* progress ));
@@ -227,12 +228,12 @@ static struct progress *start_progress_delay(const char *title, unsigned total,
227228 return progress ;
228229}
229230
230- struct progress * start_delayed_progress (const char * title , unsigned total )
231+ struct progress * start_delayed_progress (const char * title , uint64_t total )
231232{
232233 return start_progress_delay (title , total , 0 , 2 );
233234}
234235
235- struct progress * start_progress (const char * title , unsigned total )
236+ struct progress * start_progress (const char * title , uint64_t total )
236237{
237238 return start_progress_delay (title , total , 0 , 0 );
238239}
0 commit comments