From 4efd0a9f77d2ee713443f9b61fb7828af0eb4c42 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 31 Dec 2022 07:59:39 +0100 Subject: [PATCH] lib/curl/Easy: use CURLINFO_CONTENT_LENGTH_DOWNLOAD_T CURLINFO_CONTENT_LENGTH_DOWNLOAD is deprecated and is ugly because it uses floating point. --- src/lib/curl/Easy.hxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/curl/Easy.hxx b/src/lib/curl/Easy.hxx index 8a434b719..84b434e32 100644 --- a/src/lib/curl/Easy.hxx +++ b/src/lib/curl/Easy.hxx @@ -199,10 +199,10 @@ public: * Returns the response body's size, or -1 if that is unknown. */ [[gnu::pure]] - int64_t GetContentLength() const noexcept { - double value; - return GetInfo(CURLINFO_CONTENT_LENGTH_DOWNLOAD, &value) - ? (int64_t)value + curl_off_t GetContentLength() const noexcept { + curl_off_t value; + return GetInfo(CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &value) + ? value : -1; }