diff --git a/Source/VFS/source/NetFTP/File.cpp b/Source/VFS/source/NetFTP/File.cpp index 19420d052..40550e13a 100644 --- a/Source/VFS/source/NetFTP/File.cpp +++ b/Source/VFS/source/NetFTP/File.cpp @@ -370,7 +370,7 @@ void File::FinishReading() assert(m_Mode == Mode::Read); // tell curl to cancel any going reading if any - m_CURL->prog_func = ^(double, double, double, double) { + m_CURL->prog_func = ^(curl_off_t, curl_off_t, curl_off_t, curl_off_t) { return 1; }; diff --git a/Source/VFS/source/NetFTP/Host.cpp b/Source/VFS/source/NetFTP/Host.cpp index 4f067a3b6..214b21845 100644 --- a/Source/VFS/source/NetFTP/Host.cpp +++ b/Source/VFS/source/NetFTP/Host.cpp @@ -172,7 +172,7 @@ int FTPHost::DownloadListing(CURLInstance *_inst, _inst->EasySetOpt(CURLOPT_WRITEFUNCTION, CURLWriteDataIntoString); _inst->EasySetOpt(CURLOPT_WRITEDATA, &response); _inst->EasySetupProgFunc(); - _inst->prog_func = ^(double, double, double, double) { + _inst->prog_func = ^(curl_off_t, curl_off_t, curl_off_t, curl_off_t) { if( _cancel_checker == nil ) return 0; return _cancel_checker() ? 1 : 0; diff --git a/Source/VFS/source/NetFTP/Internals.cpp b/Source/VFS/source/NetFTP/Internals.cpp index 2ab336ce6..ae1dc22da 100644 --- a/Source/VFS/source/NetFTP/Internals.cpp +++ b/Source/VFS/source/NetFTP/Internals.cpp @@ -273,7 +273,11 @@ CURLMcode CURLInstance::Detach() return e; } -int CURLInstance::ProgressCallback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) +int CURLInstance::ProgressCallback(void *clientp, + curl_off_t dltotal, + curl_off_t dlnow, + curl_off_t ultotal, + curl_off_t ulnow) { CURLInstance *_this = static_cast(clientp); return _this->prog_func ? _this->prog_func(dltotal, dlnow, ultotal, ulnow) : 0; @@ -281,7 +285,7 @@ int CURLInstance::ProgressCallback(void *clientp, double dltotal, double dlnow, void CURLInstance::EasySetupProgFunc() { - EasySetOpt(CURLOPT_PROGRESSFUNCTION, ProgressCallback); + EasySetOpt(CURLOPT_XFERINFOFUNCTION, ProgressCallback); EasySetOpt(CURLOPT_PROGRESSDATA, this); EasySetOpt(CURLOPT_NOPROGRESS, 0); prog_func = nil; @@ -289,7 +293,7 @@ void CURLInstance::EasySetupProgFunc() void CURLInstance::EasyClearProgFunc() { - EasySetOpt(CURLOPT_PROGRESSFUNCTION, nullptr); + EasySetOpt(CURLOPT_XFERINFOFUNCTION, nullptr); EasySetOpt(CURLOPT_PROGRESSDATA, nullptr); EasySetOpt(CURLOPT_NOPROGRESS, 1); prog_func = nil; diff --git a/Source/VFS/source/NetFTP/Internals.h b/Source/VFS/source/NetFTP/Internals.h index 73fb2204f..8e69d269c 100644 --- a/Source/VFS/source/NetFTP/Internals.h +++ b/Source/VFS/source/NetFTP/Internals.h @@ -44,11 +44,12 @@ struct CURLInstance { CURL *curl = nullptr; CURLM *curlm = nullptr; bool attached = false; - int (^prog_func)(double dltotal, double dlnow, double ultotal, double ulnow) = nil; + int (^prog_func)(curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) = nil; std::mutex call_lock; private: - static int ProgressCallback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow); + static int + ProgressCallback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow); }; // ReadBuffer provides an intermediatery storage where CURL can write to so that a File can read from afterwards