From 6beb0eeea17cd6cc71cb69737ac63861a8f18d4e Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Fri, 29 Aug 2014 23:48:03 +0200 Subject: Ensure progress.size_dl/progress.size_ul are always >= 0 Historically the default "unknown" value for progress.size_dl and progress.size_ul has been zero, since these values are initialized implicitly by the calloc that allocates the curl handle that these variables are a part of. Users of curl that install progress callbacks may expect these values to always be >= 0. Currently it is possible for progress.size_dl and progress.size_ul to by set to a value of -1, if Curl_pgrsSetDownloadSize() or Curl_pgrsSetUploadSize() are passed a "size" of -1 (which a few places currently do, and a following patch will add more). So lets update Curl_pgrsSetDownloadSize() and Curl_pgrsSetUploadSize() so they make sure that these variables always contain a value that is >= 0. Updates test579 and test599. Signed-off-by: Brandon Casey --- tests/data/test579 | 11 +++++------ tests/data/test599 | 6 ++++-- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'tests/data') diff --git a/tests/data/test579 b/tests/data/test579 index adbb3dd22..e352e3d60 100644 --- a/tests/data/test579 +++ b/tests/data/test579 @@ -77,12 +77,11 @@ http://%HOSTIP:%HTTPPORT/579 log/ip579 Progress callback called with UL 0 out of 0 -Progress callback called with UL 0 out of -1 -Progress callback called with UL 8 out of -1 -Progress callback called with UL 16 out of -1 -Progress callback called with UL 26 out of -1 -Progress callback called with UL 61 out of -1 -Progress callback called with UL 66 out of -1 +Progress callback called with UL 8 out of 0 +Progress callback called with UL 16 out of 0 +Progress callback called with UL 26 out of 0 +Progress callback called with UL 61 out of 0 +Progress callback called with UL 66 out of 0 diff --git a/tests/data/test599 b/tests/data/test599 index c57fe5c91..9ce8b234c 100644 --- a/tests/data/test599 +++ b/tests/data/test599 @@ -71,13 +71,15 @@ lib599 HTTP GET with progress callback and redirects changing content sizes -http://%HOSTIP:%HTTPPORT/599 +http://%HOSTIP:%HTTPPORT/599 log/ip599 # # Verify data after the test has been "shot" - + +CL: -1 + -- cgit v1.2.3