mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-24 11:02:48 +00:00
Merge branch 'fix-curlopt-deprecated' into 'master'
Fix libcurl deprecation warnings in d_netfil.c See merge request KartKrew/Kart!882
This commit is contained in:
commit
fc6c83577c
1 changed files with 14 additions and 6 deletions
|
|
@ -56,12 +56,20 @@
|
|||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
# if LIBCURL_VERSION_MAJOR >= 7 && LIBCURL_VERSION_MINOR >= 85
|
||||
# define PROTOCOLS_CURLOPT CURLOPT_PROTOCOLS_STR
|
||||
# else
|
||||
# define PROTOCOLS_CURLOPT CURLOPT_PROTOCOLS // deprecated in 7.85.0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Prototypes
|
||||
static boolean AddFileToSendQueue(INT32 node, const char *filename, UINT8 fileid);
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||
int curlprogress_callback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
|
||||
#endif
|
||||
|
||||
// Sender structure
|
||||
|
|
@ -123,8 +131,8 @@ static CURL *http_handle;
|
|||
static CURLM *multi_handle;
|
||||
boolean curl_running = false;
|
||||
boolean curl_failedwebdownload = false;
|
||||
static double curl_dlnow;
|
||||
static double curl_dltotal;
|
||||
static curl_off_t curl_dlnow;
|
||||
static curl_off_t curl_dltotal;
|
||||
static time_t curl_starttime;
|
||||
INT32 curl_transfers = 0;
|
||||
static int curl_runninghandles = 0;
|
||||
|
|
@ -1763,7 +1771,7 @@ size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
|
|||
return written;
|
||||
}
|
||||
|
||||
int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||
int curlprogress_callback(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
|
||||
{
|
||||
(void)clientp;
|
||||
(void)ultotal;
|
||||
|
|
@ -1802,7 +1810,7 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
|||
curl_easy_setopt(http_handle, CURLOPT_URL, va("%s/%s", url, curl_realname));
|
||||
|
||||
// Only allow HTTP and HTTPS
|
||||
curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS);
|
||||
curl_easy_setopt(http_handle, PROTOCOLS_CURLOPT, CURLPROTO_HTTP|CURLPROTO_HTTPS);
|
||||
|
||||
curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("Ring Racers/v%d.%d", VERSION, SUBVERSION)); // Set user agent as some servers won't accept invalid user agents.
|
||||
|
||||
|
|
@ -1826,7 +1834,7 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
|||
curl_easy_setopt(http_handle, CURLOPT_WRITEDATA, curl_curfile->file);
|
||||
curl_easy_setopt(http_handle, CURLOPT_WRITEFUNCTION, curlwrite_data);
|
||||
curl_easy_setopt(http_handle, CURLOPT_NOPROGRESS, 0L);
|
||||
curl_easy_setopt(http_handle, CURLOPT_PROGRESSFUNCTION, curlprogress_callback);
|
||||
curl_easy_setopt(http_handle, CURLOPT_XFERINFOFUNCTION, curlprogress_callback);
|
||||
|
||||
curl_curfile->status = FS_DOWNLOADING;
|
||||
lastfilenum = dfilenum;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue