]> granicus.if.org Git - curl/commitdiff
Gisle fixed the percentage to work, I adjusted it slightly to not as easily
authorDaniel Stenberg <daniel@haxx.se>
Wed, 5 May 2004 13:44:44 +0000 (13:44 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 5 May 2004 13:44:44 +0000 (13:44 +0000)
overflow on 32bit filesize-systems

lib/progress.c

index 98c101096f987c2ea58464c77965116db954183f..d93d03f4cc3445399723b3deee6dea0d7b5c52b1 100644 (file)
@@ -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",