summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-01-29 01:27:06 +0300
committerAndrei Karas <akaras@inbox.ru>2017-01-30 00:30:06 +0300
commitb970fb01de5980bc4e5c6a51a961bdc6f0b0214f (patch)
treec0e8c8805abcf4fc988c44f1dfe5f704912a3670 /src
parent5e4f92cc79c03fdf16628cdde6c03a807a4bb0d4 (diff)
downloadplus-b970fb01de5980bc4e5c6a51a961bdc6f0b0214f.tar.gz
plus-b970fb01de5980bc4e5c6a51a961bdc6f0b0214f.tar.bz2
plus-b970fb01de5980bc4e5c6a51a961bdc6f0b0214f.tar.xz
plus-b970fb01de5980bc4e5c6a51a961bdc6f0b0214f.zip
Fix compilation with old libcurl versions.
Diffstat (limited to 'src')
-rw-r--r--src/gui/windows/whoisonline.cpp8
-rw-r--r--src/net/download.cpp18
2 files changed, 19 insertions, 7 deletions
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 <zlib.h>
-#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,