diff options
Diffstat (limited to 'src/tool_progress.c')
-rw-r--r-- | src/tool_progress.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/tool_progress.c b/src/tool_progress.c index 31cd56ae4..031f8b8d4 100644 --- a/src/tool_progress.c +++ b/src/tool_progress.c @@ -5,11 +5,11 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms - * are also available at https://curl.haxx.se/docs/copyright.html. + * are also available at https://curl.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is @@ -51,7 +51,7 @@ static char *max5data(curl_off_t bytes, char *max5) CURL_FORMAT_CURL_OFF_T "M", bytes/ONE_MEGABYTE, (bytes%ONE_MEGABYTE) / (ONE_MEGABYTE/CURL_OFF_T_C(10)) ); -#if (CURL_SIZEOF_CURL_OFF_T > 4) +#if (SIZEOF_CURL_OFF_T > 4) else if(bytes < CURL_OFF_T_C(10000) * ONE_MEGABYTE) /* 'XXXXM' is good until we're at 10000MB or above */ @@ -101,6 +101,9 @@ int xferinfo_cb(void *clientp, per->ultotal = ultotal; per->ulnow = ulnow; + if(per->abort) + return 1; + if(config->readbusy) { config->readbusy = FALSE; curl_easy_pause(per->curl, CURLPAUSE_CONT); @@ -227,11 +230,11 @@ bool progress_meter(struct GlobalConfig *global, } if(dlknown && all_dltotal) /* TODO: handle integer overflow */ - msnprintf(dlpercen, sizeof(dlpercen), "%3d", + msnprintf(dlpercen, sizeof(dlpercen), "%3" CURL_FORMAT_CURL_OFF_T, all_dlnow * 100 / all_dltotal); if(ulknown && all_ultotal) /* TODO: handle integer overflow */ - msnprintf(ulpercen, sizeof(ulpercen), "%3d", + msnprintf(ulpercen, sizeof(ulpercen), "%3" CURL_FORMAT_CURL_OFF_T, all_ulnow * 100 / all_ultotal); /* get the transfer speed, the higher of the two */ @@ -318,4 +321,12 @@ void progress_finalize(struct per_transfer *per) /* get the numbers before this transfer goes away */ all_dlalready += per->dlnow; all_ulalready += per->ulnow; + if(!per->dltotal_added) { + all_dltotal += per->dltotal; + per->dltotal_added = TRUE; + } + if(!per->ultotal_added) { + all_ultotal += per->ultotal; + per->ultotal_added = TRUE; + } } |