summaryrefslogtreecommitdiff
path: root/src/net/download.cpp
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/net/download.cpp
parent5e4f92cc79c03fdf16628cdde6c03a807a4bb0d4 (diff)
downloadmanaplus-b970fb01de5980bc4e5c6a51a961bdc6f0b0214f.tar.gz
manaplus-b970fb01de5980bc4e5c6a51a961bdc6f0b0214f.tar.bz2
manaplus-b970fb01de5980bc4e5c6a51a961bdc6f0b0214f.tar.xz
manaplus-b970fb01de5980bc4e5c6a51a961bdc6f0b0214f.zip
Fix compilation with old libcurl versions.
Diffstat (limited to 'src/net/download.cpp')
-rw-r--r--src/net/download.cpp18
1 files changed, 11 insertions, 7 deletions
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,