mirror of
https://github.com/curl/curl.git
synced 2026-07-26 14:17:50 +03:00
Yet another curl_off_t printf format attempt, we now exclude the %-letter from
FORMAT_OFF_T to allow additional options to get specified, like with '"%5" FORMAT_OFF_T'.
This commit is contained in:
parent
9f437269fb
commit
353f764119
7 changed files with 38 additions and 34 deletions
|
|
@ -60,11 +60,11 @@ static char *max5data(double bytes, char *max5)
|
|||
#define ONE_GIGABYTE (1024*1024*1024)
|
||||
|
||||
if(bytes < 100000) {
|
||||
sprintf(max5, "%5Od", (curl_off_t)bytes);
|
||||
sprintf(max5, "%5" FORMAT_OFF_T, (curl_off_t)bytes);
|
||||
return max5;
|
||||
}
|
||||
if(bytes < (10000*ONE_KILOBYTE)) {
|
||||
sprintf(max5, "%4Odk", (curl_off_t)bytes/ONE_KILOBYTE);
|
||||
sprintf(max5, "%4" FORMAT_OFF_T "k", (curl_off_t)bytes/ONE_KILOBYTE);
|
||||
return max5;
|
||||
}
|
||||
if(bytes < (100*ONE_MEGABYTE)) {
|
||||
|
|
@ -74,13 +74,13 @@ static char *max5data(double bytes, char *max5)
|
|||
}
|
||||
#if SIZEOF_CURL_OFF_T > 4
|
||||
if((curl_off_t)bytes < ((curl_off_t)10000*ONE_MEGABYTE)) {
|
||||
sprintf(max5, "%4OdM", (curl_off_t)bytes/ONE_MEGABYTE);
|
||||
sprintf(max5, "%4" FORMAT_OFF_T "M", (curl_off_t)bytes/ONE_MEGABYTE);
|
||||
return max5;
|
||||
}
|
||||
/* 10000 MB - 8589934587 GB !! */
|
||||
sprintf(max5, "%4.1fG", bytes/ONE_GIGABYTE);
|
||||
#else
|
||||
sprintf(max5, "%4OdM", (curl_off_t)bytes/ONE_MEGABYTE);
|
||||
sprintf(max5, "%4" FORMAT_OFF_T "M", (curl_off_t)bytes/ONE_MEGABYTE);
|
||||
#endif
|
||||
|
||||
return max5;
|
||||
|
|
@ -240,7 +240,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
|
|||
if (!data->progress.callback) {
|
||||
if(conn->resume_from)
|
||||
fprintf(data->set.err,
|
||||
"** Resuming transfer from byte position " FORMAT_OFF_T
|
||||
"** Resuming transfer from byte position %" FORMAT_OFF_T
|
||||
"\n",
|
||||
conn->resume_from);
|
||||
fprintf(data->set.err,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue