cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCH] Use -1, not 0, to reset values of progress.size_dl and progress.size_ul

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 29 Aug 2014 00:12:40 +0200 (CEST)

On Wed, 27 Aug 2014, Brandon Casey wrote:

> Instead of passing in 0 to reset the download size and the upload size,
> let's pass in -1. This will make Curl_pgrsSetDownloadSize() and
> Curl_pgrsSetUploadSize() clear their respective "KNOWN" bits in
> progress.flags and will allow curl_easy_getinfo() to return -1 appropriately
> when CURLINFO_CONTENT_LENGTH_DOWNLOAD or CURLINFO_CONTENT_LENGTH_UPLOAD is
> requested.

Thanks what an awesome research and fix!

I only have one little remark here: by also storing -1 in the struct fields
progress.size_dl and progress.size_ul this change alters what the progress
function callbacks send in their 2nd and 4th arguments - and that is probably
an ABI breakage users won't like.

How about changing Curl_pgrsSetDownloadSize() and Curl_pgrsSetUploadSize() to
simply see the value as negative, clear the known flag but then store the
value as 0?

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-08-29