From b970fb01de5980bc4e5c6a51a961bdc6f0b0214f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 29 Jan 2017 01:27:06 +0300 Subject: Fix compilation with old libcurl versions. --- src/gui/windows/whoisonline.cpp | 8 ++++++++ src/net/download.cpp | 18 +++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index b11b957c5..5b9fadb5d 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -73,6 +73,11 @@ #undef malloc #endif // malloc +#ifdef TMWA_SUPPORT +#define CURLVERSION_ATLEAST(a, b, c) \ + LIBCURL_VERSION_NUM >= ((a) * 0xffff + (b) * 0xff + c) +#endif // TMWA_SUPPORT + WhoIsOnline *whoIsOnline = nullptr; namespace @@ -552,7 +557,10 @@ int WhoIsOnline::downloadThread(void *ptr) curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, ptr); + +#if CURLVERSION_ATLEAST(7, 10, 0) curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); +#endif // CURLVERSION_ATLEAST(7, 10, 0) curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 7); curl_easy_setopt(curl, CURLOPT_TIMEOUT, 30); Net::Download::addHeaders(curl); diff --git a/src/net/download.cpp b/src/net/download.cpp index ad66fa121..de19c5440 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -31,10 +31,8 @@ #include -#define CURLVERSION_ATLEAST(a, b, c) ((LIBCURL_VERSION_MAJOR > (a)) || \ - ((LIBCURL_VERSION_MAJOR == (a)) && (LIBCURL_VERSION_MINOR > (b))) || \ - ((LIBCURL_VERSION_MAJOR == (a)) && (LIBCURL_VERSION_MINOR == (b)) && \ - (LIBCURL_VERSION_PATCH >= (c)))) +#define CURLVERSION_ATLEAST(a, b, c) \ + LIBCURL_VERSION_NUM >= ((a) * 0xffff + (b) * 0xff + c) #if defined __native_client__ #include "utils/files.h" @@ -337,7 +335,9 @@ int Download::downloadThread(void *ptr) curl_easy_setopt(d->mCurl, CURLOPT_PROGRESSFUNCTION, &downloadProgress); curl_easy_setopt(d->mCurl, CURLOPT_PROGRESSDATA, ptr); +#if CURLVERSION_ATLEAST(7, 10, 0) curl_easy_setopt(d->mCurl, CURLOPT_NOSIGNAL, 1); +#endif // CURLVERSION_ATLEAST(7, 10, 0) curl_easy_setopt(d->mCurl, CURLOPT_CONNECTTIMEOUT, 30); curl_easy_setopt(d->mCurl, CURLOPT_TIMEOUT, 1800); addHeaders(d->mCurl); @@ -531,16 +531,16 @@ void Download::addProxy(CURL *const curl) #if CURLVERSION_ATLEAST(7, 19, 4) curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP_1_0); #endif // CURLVERSION_ATLEAST(7, 19, 4) - break; case 4: // SOCKS4 +#if CURLVERSION_ATLEAST(7, 10, 0) curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); +#endif // CURLVERSION_ATLEAST(7, 10, 0) break; case 5: // SOCKS4A #if CURLVERSION_ATLEAST(7, 18, 0) curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A); -#else // CURLVERSION_ATLEAST(7, 18, 0) - +#elif CURLVERSION_ATLEAST(7, 10, 0) curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4); #endif // CURLVERSION_ATLEAST(7, 18, 0) @@ -561,7 +561,11 @@ void Download::addProxy(CURL *const curl) } } +#if CURLVERSION_ATLEAST(7, 15, 1) void Download::secureCurl(CURL *const curl) +#else // CURLVERSION_ATLEAST(7, 15, 1) +void Download::secureCurl(CURL *const curl A_UNUSED) +#endif // CURLVERSION_ATLEAST(7, 15, 1) { #if CURLVERSION_ATLEAST(7, 19, 4) curl_easy_setopt(curl, CURLOPT_PROTOCOLS, -- cgit v1.2.3-60-g2f50