tool_progress: fix percent output of large parallel transfers
When the total transfered amount (upload or download) for parallel transfers was larger than 2^63/100 bytes (81 petabytes) the progress percent counter would show wrong. Closes #16284
This commit is contained in:
parent
cc6b630f13
commit
48df83a30e
@ -216,13 +216,16 @@ bool progress_meter(struct GlobalConfig *global,
|
||||
all_running++;
|
||||
}
|
||||
if(dlknown && all_dltotal)
|
||||
/* TODO: handle integer overflow */
|
||||
msnprintf(dlpercen, sizeof(dlpercen), "%3" CURL_FORMAT_CURL_OFF_T,
|
||||
all_dlnow * 100 / all_dltotal);
|
||||
all_dlnow < (CURL_OFF_T_MAX/100) ?
|
||||
(all_dlnow * 100 / all_dltotal) :
|
||||
(all_dlnow / (all_dltotal/100)));
|
||||
|
||||
if(ulknown && all_ultotal)
|
||||
/* TODO: handle integer overflow */
|
||||
msnprintf(ulpercen, sizeof(ulpercen), "%3" CURL_FORMAT_CURL_OFF_T,
|
||||
all_ulnow * 100 / all_ultotal);
|
||||
all_ulnow < (CURL_OFF_T_MAX/100) ?
|
||||
(all_ulnow * 100 / all_ultotal) :
|
||||
(all_ulnow / (all_ultotal/100)));
|
||||
|
||||
/* get the transfer speed, the higher of the two */
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user