Fix build warnings

This commit is contained in:
Lactozilla 2024-02-04 20:22:27 -03:00
parent e7e54ef28c
commit 9b33d5c808
2 changed files with 9 additions and 5 deletions

View file

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

View file

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