aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-05-05 13:44:44 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-05-05 13:44:44 +0000
commit3f21fe60fc5d3662fdfd9165470bf8f51231ef94 (patch)
tree99950cc42c03086a0e923767db038e5a8a267a4a /lib
parentb2c290e40e73a8c2b7a0a15a967c1abe4d603382 (diff)
Gisle fixed the percentage to work, I adjusted it slightly to not as easily
overflow on 32bit filesize-systems
Diffstat (limited to 'lib')
-rw-r--r--lib/progress.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/progress.c b/lib/progress.c
index 98c101096..d93d03f4c 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -362,14 +362,16 @@ int Curl_pgrsUpdate(struct connectdata *conn)
if((data->progress.flags & PGRS_UL_SIZE_KNOWN) &&
(data->progress.ulspeed > 0)) {
ulestimate = (long)(data->progress.size_ul / data->progress.ulspeed);
- ulpercen = (long)(data->progress.uploaded / data->progress.size_ul)*100;
+ ulpercen = (long)(100*(data->progress.uploaded/100) /
+ (data->progress.size_ul/100) );
}
/* ... and the download */
if((data->progress.flags & PGRS_DL_SIZE_KNOWN) &&
(data->progress.dlspeed > 0)) {
dlestimate = (long)(data->progress.size_dl / data->progress.dlspeed);
- dlpercen = (long)(data->progress.downloaded / data->progress.size_dl)*100;
+ dlpercen = (long)(100*(data->progress.downloaded/100) /
+ (data->progress.size_dl/100));
}
/* Now figure out which of them that is slower and use for the for
@@ -393,7 +395,8 @@ int Curl_pgrsUpdate(struct connectdata *conn)
/* Get the percentage of data transfered so far */
if(total_expected_transfer > 0)
- total_percen=(int)(total_transfer/total_expected_transfer)*100;
+ total_percen=(int)(100*(total_transfer/100) /
+ (total_expected_transfer/100) );
fprintf(data->set.err,
"\r%3d %s %3d %s %3d %s %s %s %s %s %s %s",