summaryrefslogtreecommitdiff
path: root/libs/libcurl/src/progress.c
diff options
context:
space:
mode:
Diffstat (limited to 'libs/libcurl/src/progress.c')
-rw-r--r--libs/libcurl/src/progress.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/libs/libcurl/src/progress.c b/libs/libcurl/src/progress.c
index 22ffea73d4..dd0cfc1d00 100644
--- a/libs/libcurl/src/progress.c
+++ b/libs/libcurl/src/progress.c
@@ -174,7 +174,7 @@ void Curl_pgrsTimeWas(struct Curl_easy *data, timerid timer,
case TIMER_STARTSINGLE:
/* This is set at the start of each single transfer */
data->progress.t_startsingle = timestamp;
- data->progress.is_t_startransfer_set = false;
+ data->progress.is_t_startransfer_set = FALSE;
break;
case TIMER_POSTQUEUE:
/* Set when the transfer starts (after potentially having been brought
@@ -211,7 +211,7 @@ void Curl_pgrsTimeWas(struct Curl_easy *data, timerid timer,
return;
}
else {
- data->progress.is_t_startransfer_set = true;
+ data->progress.is_t_startransfer_set = TRUE;
break;
}
case TIMER_POSTRANSFER:
@@ -249,7 +249,7 @@ void Curl_pgrsStartNow(struct Curl_easy *data)
{
data->progress.speeder_c = 0; /* reset the progress meter display */
data->progress.start = Curl_now();
- data->progress.is_t_startransfer_set = false;
+ data->progress.is_t_startransfer_set = FALSE;
data->progress.ul.limit.start = data->progress.start;
data->progress.dl.limit.start = data->progress.start;
data->progress.ul.limit.start_size = 0;
@@ -381,6 +381,11 @@ void Curl_pgrsSetUploadSize(struct Curl_easy *data, curl_off_t size)
}
}
+void Curl_pgrsEarlyData(struct Curl_easy *data, curl_off_t sent)
+{
+ data->progress.earlydata_sent = sent;
+}
+
/* returns the average speed in bytes / second */
static curl_off_t trspeed(curl_off_t size, /* number of bytes */
curl_off_t us) /* microseconds */
@@ -428,7 +433,7 @@ static bool progress_calc(struct Curl_easy *data, struct curltime now)
array. With N_ENTRIES filled in, we have about N_ENTRIES-1 seconds of
transfer. Imagine, after one second we have filled in two entries,
after two seconds we have filled in three entries etc. */
- countindex = ((p->speeder_c >= CURR_TIME)? CURR_TIME:p->speeder_c) - 1;
+ countindex = ((p->speeder_c >= CURR_TIME) ? CURR_TIME : p->speeder_c) - 1;
/* first of all, we do not do this if there is no counted seconds yet */
if(countindex) {
@@ -439,7 +444,7 @@ static bool progress_calc(struct Curl_easy *data, struct curltime now)
/* Get the index position to compare with the 'nowindex' position.
Get the oldest entry possible. While we have less than CURR_TIME
entries, the first entry will remain the oldest. */
- checkindex = (p->speeder_c >= CURR_TIME)? p->speeder_c%CURR_TIME:0;
+ checkindex = (p->speeder_c >= CURR_TIME) ? p->speeder_c%CURR_TIME : 0;
/* Figure out the exact time for the time span */
span_ms = Curl_timediff(now, p->speeder_time[checkindex]);
@@ -530,14 +535,14 @@ static void progress_meter(struct Curl_easy *data)
/* Since both happen at the same time, total expected duration is max. */
total_estm.secs = CURLMAX(ul_estm.secs, dl_estm.secs);
/* create the three time strings */
- time2str(time_left, total_estm.secs > 0?(total_estm.secs - cur_secs):0);
+ time2str(time_left, total_estm.secs > 0 ? (total_estm.secs - cur_secs) : 0);
time2str(time_total, total_estm.secs);
time2str(time_spent, cur_secs);
/* Get the total amount of data expected to get transferred */
total_expected_size =
- ((p->flags & PGRS_UL_SIZE_KNOWN)? p->ul.total_size:p->ul.cur_size) +
- ((p->flags & PGRS_DL_SIZE_KNOWN)? p->dl.total_size:p->dl.cur_size);
+ ((p->flags & PGRS_UL_SIZE_KNOWN) ? p->ul.total_size : p->ul.cur_size) +
+ ((p->flags & PGRS_DL_SIZE_KNOWN) ? p->dl.total_size : p->dl.cur_size);
/* We have transferred this much so far */
total_cur_size = p->dl.cur_size + p->ul.cur_size;
@@ -583,13 +588,13 @@ static int pgrsupdate(struct Curl_easy *data, bool showprogress)
if(data->set.fxferinfo) {
int result;
/* There is a callback set, call that */
- Curl_set_in_callback(data, true);
+ Curl_set_in_callback(data, TRUE);
result = data->set.fxferinfo(data->set.progress_client,
data->progress.dl.total_size,
data->progress.dl.cur_size,
data->progress.ul.total_size,
data->progress.ul.cur_size);
- Curl_set_in_callback(data, false);
+ Curl_set_in_callback(data, FALSE);
if(result != CURL_PROGRESSFUNC_CONTINUE) {
if(result)
failf(data, "Callback aborted");
@@ -599,13 +604,13 @@ static int pgrsupdate(struct Curl_easy *data, bool showprogress)
else if(data->set.fprogress) {
int result;
/* The older deprecated callback is set, call that */
- Curl_set_in_callback(data, true);
+ Curl_set_in_callback(data, TRUE);
result = data->set.fprogress(data->set.progress_client,
(double)data->progress.dl.total_size,
(double)data->progress.dl.cur_size,
(double)data->progress.ul.total_size,
(double)data->progress.ul.cur_size);
- Curl_set_in_callback(data, false);
+ Curl_set_in_callback(data, FALSE);
if(result != CURL_PROGRESSFUNC_CONTINUE) {
if(result)
failf(data, "Callback aborted");