From 9b33d5c80888308e0a8752d0e0e5c203b9129d90 Mon Sep 17 00:00:00 2001 From: Lactozilla <jp6781615@gmail.com> Date: Sun, 4 Feb 2024 20:22:27 -0300 Subject: [PATCH] Fix build warnings --- src/netcode/client_connection.c | 2 +- src/netcode/d_netfil.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/netcode/client_connection.c b/src/netcode/client_connection.c index 178ceff63..36ed71826 100644 --- a/src/netcode/client_connection.c +++ b/src/netcode/client_connection.c @@ -634,7 +634,7 @@ static const char *GetPrintableFileSize(UINT64 filesize) if (filesize >= 1024*1024) snprintf(downloadsize, sizeof(downloadsize), "%.2fMiB", (double)filesize / (1024*1024)); else if (filesize < 1024) - snprintf(downloadsize, sizeof(downloadsize), "%luB", filesize); + snprintf(downloadsize, sizeof(downloadsize), "%sB", sizeu1(filesize)); else snprintf(downloadsize, sizeof(downloadsize), "%.2fKiB", (double)filesize / 1024); diff --git a/src/netcode/d_netfil.c b/src/netcode/d_netfil.c index 135e5ed70..03ad8303e 100644 --- a/src/netcode/d_netfil.c +++ b/src/netcode/d_netfil.c @@ -10,6 +10,10 @@ /// \file d_netfil.c /// \brief Transfer a file using HSendPacket. +#ifdef HAVE_CURL +#include <curl/curl.h> +#endif + #include <stdio.h> #include <sys/stat.h> @@ -53,10 +57,6 @@ #include <errno.h> -#ifdef HAVE_CURL -#include <curl/curl.h> -#endif - // Prototypes static boolean AddFileToSendQueue(INT32 node, UINT8 fileid); @@ -1633,7 +1633,11 @@ boolean CURLPrepareFile(const char* url, int dfilenum) curl_easy_setopt(http_handle, CURLOPT_URL, va("%s/%s?md5=%s", url, curl_realname, md5tmp)); // Only allow HTTP and HTTPS +#if (LIBCURL_VERSION_MAJOR <= 7) && (LIBCURL_VERSION_MINOR < 85) + curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS); +#else curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS_STR, "http,https"); +#endif // Set user agent, as some servers won't accept invalid user agents. curl_easy_setopt(http_handle, CURLOPT_USERAGENT, va("Sonic Robo Blast 2/v%d.%d", VERSION, SUBVERSION)); -- GitLab