diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_cb_prg.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/tool_cb_prg.c b/src/tool_cb_prg.c index e2ee54225..05fe0e636 100644 --- a/src/tool_cb_prg.c +++ b/src/tool_cb_prg.c @@ -125,14 +125,19 @@ int tool_progress_cb(void *clientp, curl_off_t total; curl_off_t point; - /* expected transfer size */ - if((CURL_OFF_T_MAX - bar->initial_size) < (dltotal + ultotal)) + /* Calculate expected transfer size. initial_size can be less than zero + when indicating that we are expecting to get the filesize from the + remote */ + if(bar->initial_size < 0 || + ((CURL_OFF_T_MAX - bar->initial_size) < (dltotal + ultotal))) total = CURL_OFF_T_MAX; else total = dltotal + ultotal + bar->initial_size; - /* we've come this far */ - if((CURL_OFF_T_MAX - bar->initial_size) < (dlnow + ulnow)) + /* Calculate the current progress. initial_size can be less than zero when + indicating that we are expecting to get the filesize from the remote */ + if(bar->initial_size < 0 || + ((CURL_OFF_T_MAX - bar->initial_size) < (dlnow + ulnow))) point = CURL_OFF_T_MAX; else point = dlnow + ulnow + bar->initial_size; |