mirror of
https://github.com/moparisthebest/curl
synced 2025-03-11 15:50:48 -04:00
hm, avoid division by zero more carefully with that new percentage math
This commit is contained in:
parent
6bdcfecbcf
commit
9cf04dff6a
@ -360,7 +360,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
|
|||||||
|
|
||||||
/* Figure out the estimated time of arrival for the upload */
|
/* Figure out the estimated time of arrival for the upload */
|
||||||
if((data->progress.flags & PGRS_UL_SIZE_KNOWN) &&
|
if((data->progress.flags & PGRS_UL_SIZE_KNOWN) &&
|
||||||
(data->progress.ulspeed > 0)) {
|
(data->progress.ulspeed > 100)) {
|
||||||
ulestimate = (long)(data->progress.size_ul / data->progress.ulspeed);
|
ulestimate = (long)(data->progress.size_ul / data->progress.ulspeed);
|
||||||
ulpercen = (long)(100*(data->progress.uploaded/100) /
|
ulpercen = (long)(100*(data->progress.uploaded/100) /
|
||||||
(data->progress.size_ul/100) );
|
(data->progress.size_ul/100) );
|
||||||
@ -368,7 +368,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
|
|||||||
|
|
||||||
/* ... and the download */
|
/* ... and the download */
|
||||||
if((data->progress.flags & PGRS_DL_SIZE_KNOWN) &&
|
if((data->progress.flags & PGRS_DL_SIZE_KNOWN) &&
|
||||||
(data->progress.dlspeed > 0)) {
|
(data->progress.dlspeed > 100)) {
|
||||||
dlestimate = (long)(data->progress.size_dl / data->progress.dlspeed);
|
dlestimate = (long)(data->progress.size_dl / data->progress.dlspeed);
|
||||||
dlpercen = (long)(100*(data->progress.downloaded/100) /
|
dlpercen = (long)(100*(data->progress.downloaded/100) /
|
||||||
(data->progress.size_dl/100));
|
(data->progress.size_dl/100));
|
||||||
@ -394,7 +394,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
|
|||||||
total_transfer = data->progress.downloaded + data->progress.uploaded;
|
total_transfer = data->progress.downloaded + data->progress.uploaded;
|
||||||
|
|
||||||
/* Get the percentage of data transfered so far */
|
/* Get the percentage of data transfered so far */
|
||||||
if(total_expected_transfer > 0)
|
if(total_expected_transfer > 100)
|
||||||
total_percen=(int)(100*(total_transfer/100) /
|
total_percen=(int)(100*(total_transfer/100) /
|
||||||
(total_expected_transfer/100) );
|
(total_expected_transfer/100) );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user