From f5b19278d1818845b3bf1653bce53d299c4eed5d Mon Sep 17 00:00:00 2001 From: oltolm Date: Tue, 18 Nov 2025 05:14:59 +0100 Subject: [PATCH] UI: fix Curl deprecation warnings (#1724) --- src/gui/wxgui/DownloadGraphicPacksWindow.cpp | 4 ++-- src/gui/wxgui/DownloadGraphicPacksWindow.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/wxgui/DownloadGraphicPacksWindow.cpp b/src/gui/wxgui/DownloadGraphicPacksWindow.cpp index c5de8d89..4a854b38 100644 --- a/src/gui/wxgui/DownloadGraphicPacksWindow.cpp +++ b/src/gui/wxgui/DownloadGraphicPacksWindow.cpp @@ -28,7 +28,7 @@ size_t DownloadGraphicPacksWindow::curlDownloadFile_writeData(void *ptr, size_t return writeSize; } -int DownloadGraphicPacksWindow::progress_callback(curlDownloadFileState_t* downloadState, double dltotal, double dlnow, double ultotal, double ulnow) +int DownloadGraphicPacksWindow::progress_callback(curlDownloadFileState_t* downloadState, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) { if (dltotal > 1.0) downloadState->progress = dlnow / dltotal; @@ -47,7 +47,7 @@ bool DownloadGraphicPacksWindow::curlDownloadFile(const char *url, curlDownloadF curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlDownloadFile_writeData); curl_easy_setopt(curl, CURLOPT_WRITEDATA, downloadState); - curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback); + curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, progress_callback); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, downloadState); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, true); diff --git a/src/gui/wxgui/DownloadGraphicPacksWindow.h b/src/gui/wxgui/DownloadGraphicPacksWindow.h index 860bb267..73101f98 100644 --- a/src/gui/wxgui/DownloadGraphicPacksWindow.h +++ b/src/gui/wxgui/DownloadGraphicPacksWindow.h @@ -1,10 +1,12 @@ #pragma once #include +#include #include #include #include +#include #include #include @@ -55,6 +57,6 @@ private: std::unique_ptr m_downloadState; static size_t curlDownloadFile_writeData(void* ptr, size_t size, size_t nmemb, curlDownloadFileState_t* downloadState); - static int progress_callback(curlDownloadFileState_t* downloadState, double dltotal, double dlnow, double ultotal, double ulnow); + static int progress_callback(curlDownloadFileState_t* downloadState, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow); static bool curlDownloadFile(const char* url, curlDownloadFileState_t* downloadState); };