aboutsummaryrefslogtreecommitdiff
path: root/lib/progress.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-03-10 16:20:33 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-03-10 16:20:33 +0000
commit0d1fc73f2119e1f75f58b32cdc9f9d45fa71ac9c (patch)
treee50750dfe60d0c65b1a2247d6aa165a46d6b47d7 /lib/progress.c
parent50a185356082f800e760ceb932c062bf194145d7 (diff)
Use more curl_off_t variables when doing the progress meter calculations and
argument passing and try to convert to double only when providing data to the external world.
Diffstat (limited to 'lib/progress.c')
-rw-r--r--lib/progress.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/progress.c b/lib/progress.c
index 62e4624f5..d0421ca6c 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -165,17 +165,17 @@ void Curl_pgrsStartNow(struct SessionHandle *data)
data->progress.start = Curl_tvnow();
}
-void Curl_pgrsSetDownloadCounter(struct SessionHandle *data, double size)
+void Curl_pgrsSetDownloadCounter(struct SessionHandle *data, curl_off_t size)
{
data->progress.downloaded = size;
}
-void Curl_pgrsSetUploadCounter(struct SessionHandle *data, double size)
+void Curl_pgrsSetUploadCounter(struct SessionHandle *data, curl_off_t size)
{
data->progress.uploaded = size;
}
-void Curl_pgrsSetDownloadSize(struct SessionHandle *data, double size)
+void Curl_pgrsSetDownloadSize(struct SessionHandle *data, curl_off_t size)
{
data->progress.size_dl = size;
if(size > 0)
@@ -184,7 +184,7 @@ void Curl_pgrsSetDownloadSize(struct SessionHandle *data, double size)
data->progress.flags &= ~PGRS_DL_SIZE_KNOWN;
}
-void Curl_pgrsSetUploadSize(struct SessionHandle *data, double size)
+void Curl_pgrsSetUploadSize(struct SessionHandle *data, curl_off_t size)
{
data->progress.size_ul = size;
if(size > 0)
@@ -211,8 +211,8 @@ int Curl_pgrsUpdate(struct connectdata *conn)
double ulpercen=0;
double total_percen=0;
- double total_transfer;
- double total_expected_transfer;
+ curl_off_t total_transfer;
+ curl_off_t total_expected_transfer;
double timespent;
struct SessionHandle *data = conn->data;
@@ -259,7 +259,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
/* The average download speed this far */
data->progress.dlspeed =
- data->progress.downloaded/(timespent>0.01?timespent:1);
+ data->progress.downloaded/(timespent>0.01?timespent:1.0);
/* The average upload speed this far */
data->progress.ulspeed =
@@ -324,10 +324,10 @@ int Curl_pgrsUpdate(struct connectdata *conn)
/* There's a callback set, so we call that instead of writing
anything ourselves. This really is the way to go. */
result= data->set.fprogress(data->set.progress_client,
- data->progress.size_dl,
- data->progress.downloaded,
- data->progress.size_ul,
- data->progress.uploaded);
+ (double)data->progress.size_dl,
+ (double)data->progress.downloaded,
+ (double)data->progress.size_ul,
+ (double)data->progress.uploaded);
if(result)
failf(data, "Callback aborted");
return result;
@@ -336,15 +336,15 @@ int Curl_pgrsUpdate(struct connectdata *conn)
/* Figure out the estimated time of arrival for the upload */
if((data->progress.flags & PGRS_UL_SIZE_KNOWN) &&
(data->progress.ulspeed > 0)) {
- ulestimate = data->progress.size_ul / data->progress.ulspeed;
- ulpercen = (data->progress.uploaded / data->progress.size_ul)*100;
+ ulestimate = (double)data->progress.size_ul / data->progress.ulspeed;
+ ulpercen = ((double)data->progress.uploaded / data->progress.size_ul)*100;
}
/* ... and the download */
if((data->progress.flags & PGRS_DL_SIZE_KNOWN) &&
(data->progress.dlspeed > 0)) {
- dlestimate = data->progress.size_dl / data->progress.dlspeed;
- dlpercen = (data->progress.downloaded / data->progress.size_dl)*100;
+ dlestimate = (double)data->progress.size_dl / data->progress.dlspeed;
+ dlpercen = ((double)data->progress.downloaded / data->progress.size_dl)*100;
}
/* Now figure out which of them that is slower and use for the for
@@ -378,7 +378,7 @@ int Curl_pgrsUpdate(struct connectdata *conn)
/* Get the percentage of data transfered so far */
if(total_expected_transfer > 0)
- total_percen=(double)(total_transfer/total_expected_transfer)*100;
+ total_percen=((double)total_transfer/total_expected_transfer)*100;
fprintf(data->set.err,
"\r%3d %s %3d %s %3d %s %s %s %s %s %s %s",