1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

avoid division by zero

This commit is contained in:
Yang Tse 2009-11-05 15:00:28 +00:00
parent 257f2376d5
commit 3f56d12830

View File

@ -377,7 +377,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
if(data->progress.size_ul > CURL_OFF_T_C(10000)) if(data->progress.size_ul > CURL_OFF_T_C(10000))
ulpercen = data->progress.uploaded / ulpercen = data->progress.uploaded /
(data->progress.size_ul/CURL_OFF_T_C(100)); (data->progress.size_ul/CURL_OFF_T_C(100));
else else if(data->progress.size_ul > CURL_OFF_T_C(0))
ulpercen = (data->progress.uploaded*100) / ulpercen = (data->progress.uploaded*100) /
data->progress.size_ul; data->progress.size_ul;
} }
@ -390,7 +390,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
if(data->progress.size_dl > CURL_OFF_T_C(10000)) if(data->progress.size_dl > CURL_OFF_T_C(10000))
dlpercen = data->progress.downloaded / dlpercen = data->progress.downloaded /
(data->progress.size_dl/CURL_OFF_T_C(100)); (data->progress.size_dl/CURL_OFF_T_C(100));
else else if(data->progress.size_dl > CURL_OFF_T_C(0))
dlpercen = (data->progress.downloaded*100) / dlpercen = (data->progress.downloaded*100) /
data->progress.size_dl; data->progress.size_dl;
} }
@ -418,7 +418,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
if(total_expected_transfer > CURL_OFF_T_C(10000)) if(total_expected_transfer > CURL_OFF_T_C(10000))
total_percen = total_transfer / total_percen = total_transfer /
(total_expected_transfer/CURL_OFF_T_C(100)); (total_expected_transfer/CURL_OFF_T_C(100));
else if(total_expected_transfer > 0) else if(total_expected_transfer > CURL_OFF_T_C(0))
total_percen = (total_transfer*100) / total_expected_transfer; total_percen = (total_transfer*100) / total_expected_transfer;
fprintf(data->set.err, fprintf(data->set.err,