summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-02 22:46:05 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-02 22:46:16 +0100
commit81413b5e4cf24ece22c57abf09bf44816ec3bf3a (patch)
treeadb2f464304b9d2d496569227571469ba85575ef /src/net
parente8ec55df9173c588a774f50e71cfd2be77271166 (diff)
downloadmana-81413b5e4cf24ece22c57abf09bf44816ec3bf3a.tar.gz
mana-81413b5e4cf24ece22c57abf09bf44816ec3bf3a.tar.bz2
mana-81413b5e4cf24ece22c57abf09bf44816ec3bf3a.tar.xz
mana-81413b5e4cf24ece22c57abf09bf44816ec3bf3a.zip
Fixed use of deprecated CURLOPT_PROGRESSFUNCTION option
Closes #51
Diffstat (limited to 'src/net')
-rw-r--r--src/net/download.cpp16
-rw-r--r--src/net/download.h7
2 files changed, 13 insertions, 10 deletions
diff --git a/src/net/download.cpp b/src/net/download.cpp
index d15eb18d..38764d8e 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -26,8 +26,6 @@
#include "utils/stringutils.h"
-#include <curl/curl.h>
-
#include <SDL.h>
#include <SDL_thread.h>
@@ -155,19 +153,21 @@ char *Download::getError()
return mError;
}
-int Download::downloadProgress(void *clientp, double dltotal, double dlnow,
- double ultotal, double ulnow)
+int Download::downloadProgress(void *clientp,
+ curl_off_t dltotal, curl_off_t dlnow,
+ curl_off_t ultotal, curl_off_t ulnow)
{
auto *d = reinterpret_cast<Download*>(clientp);
if (d->mOptions.cancel)
{
- return d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_CANCELLED, (size_t) dltotal,
- (size_t) dlnow);
+ return d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_CANCELLED,
+ (size_t) dltotal, (size_t) dlnow);
return -5;
}
- return d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_IDLE, (size_t) dltotal, (size_t) dlnow);
+ return d->mUpdateFunction(d->mPtr, DOWNLOAD_STATUS_IDLE,
+ (size_t) dltotal, (size_t) dlnow);
}
int Download::downloadThread(void *ptr)
@@ -228,7 +228,7 @@ int Download::downloadThread(void *ptr)
curl_easy_setopt(d->mCurl, CURLOPT_ERRORBUFFER, d->mError);
curl_easy_setopt(d->mCurl, CURLOPT_URL, d->mUrl.c_str());
curl_easy_setopt(d->mCurl, CURLOPT_NOPROGRESS, 0);
- curl_easy_setopt(d->mCurl, CURLOPT_PROGRESSFUNCTION, downloadProgress);
+ curl_easy_setopt(d->mCurl, CURLOPT_XFERINFOFUNCTION, downloadProgress);
curl_easy_setopt(d->mCurl, CURLOPT_PROGRESSDATA, ptr);
curl_easy_setopt(d->mCurl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(d->mCurl, CURLOPT_CONNECTTIMEOUT, 15);
diff --git a/src/net/download.h b/src/net/download.h
index b3501363..3e740b62 100644
--- a/src/net/download.h
+++ b/src/net/download.h
@@ -22,6 +22,8 @@
#include <cstdio>
#include <string>
+#include <curl/curl.h>
+
#ifndef NET_DOWNLOAD_H
#define NET_DOWNLOAD_H
@@ -81,8 +83,9 @@ class Download
private:
static int downloadThread(void *ptr);
- static int downloadProgress(void *clientp, double dltotal, double dlnow,
- double ultotal, double ulnow);
+ static int downloadProgress(void *clientp,
+ curl_off_t dltotal, curl_off_t dlnow,
+ curl_off_t ultotal, curl_off_t ulnow);
void *mPtr;
std::string mUrl;
struct {