From e07b133e5af965f2687ffe759d8bba3d00924e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Sat, 23 Mar 2019 10:30:26 +0100 Subject: [PATCH] Another curl version-dependent feature thing Seriously, who thought doubles were a good idea? --- src/client/http/Request.h | 12 +++++++----- src/client/http/RequestManager.cpp | 8 ++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/client/http/Request.h b/src/client/http/Request.h index eef40544e..24afd0bd2 100644 --- a/src/client/http/Request.h +++ b/src/client/http/Request.h @@ -6,12 +6,14 @@ #include "common/tpt-thread.h" #include #include "common/String.h" -#undef GetUserName // pthreads (included by curl) defines this, breaks stuff +#undef GetUserName // pthreads defines this, breaks stuff -#ifdef CURL_AT_LEAST_VERSION -# if CURL_AT_LEAST_VERSION(7, 56, 0) -# define REQUEST_USE_CURL_MIMEPOST -# endif +#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 55, 0) +# define REQUEST_USE_CURL_OFFSET_T +#endif + +#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 56, 0) +# define REQUEST_USE_CURL_MIMEPOST #endif namespace http diff --git a/src/client/http/RequestManager.cpp b/src/client/http/RequestManager.cpp index b8cc5a841..f8bd9790e 100644 --- a/src/client/http/RequestManager.cpp +++ b/src/client/http/RequestManager.cpp @@ -173,8 +173,16 @@ namespace http { if (multi && request->easy) { +#ifdef REQUEST_USE_CURL_OFFSET_T curl_easy_getinfo(request->easy, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &request->rm_total); curl_easy_getinfo(request->easy, CURLINFO_SIZE_DOWNLOAD_T, &request->rm_done); +#else + double total, done; + curl_easy_getinfo(request->easy, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &total); + curl_easy_getinfo(request->easy, CURLINFO_SIZE_DOWNLOAD, &done); + request->rm_total = (curl_off_t)total; + request->rm_done = (curl_off_t)done; +#endif } if (request->status) {