summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 {