UI: fix Curl deprecation warnings (#1724)

This commit is contained in:
oltolm 2025-11-18 05:14:59 +01:00 committed by GitHub
parent 5390f9338c
commit f5b19278d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -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);

View file

@ -1,10 +1,12 @@
#pragma once
#include <atomic>
#include <curl/system.h>
#include <thread>
#include <string>
#include <memory>
#include <wx/dialog.h>
#include <wx/timer.h>
#include <wx/gauge.h>
@ -55,6 +57,6 @@ private:
std::unique_ptr<curlDownloadFileState_t> 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);
};