From 8b3f807a0ae953cbd0e7342adb7b3895833291c9 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Thu, 17 Oct 2024 20:47:13 +0200 Subject: [PATCH] [warnings] fix format warnings --- channels/audin/client/oss/audin_oss.c | 5 +++++ channels/printer/client/cups/printer_cups.c | 2 +- channels/printer/client/printer_main.c | 2 +- channels/rdpsnd/client/alsa/rdpsnd_alsa.c | 2 ++ channels/rdpsnd/client/oss/rdpsnd_oss.c | 2 ++ channels/rdpsnd/client/rdpsnd_main.c | 2 +- channels/rdpsnd/server/rdpsnd_main.c | 2 ++ client/SDL/SDL2/sdl_disp.cpp | 6 +++--- client/SDL/SDL3/sdl_disp.cpp | 6 +++--- client/SDL/SDL3/sdl_monitor.cpp | 2 +- client/Wayland/wlf_disp.c | 2 +- client/X11/xf_client.c | 2 +- client/common/cmdline.c | 2 +- libfreerdp/codec/audio.c | 4 ++-- libfreerdp/common/assistance.c | 15 +++++---------- libfreerdp/core/gateway/http.c | 2 +- 16 files changed, 32 insertions(+), 26 deletions(-) diff --git a/channels/audin/client/oss/audin_oss.c b/channels/audin/client/oss/audin_oss.c index 2da93a148..be9ad9bba 100644 --- a/channels/audin/client/oss/audin_oss.c +++ b/channels/audin/client/oss/audin_oss.c @@ -85,8 +85,13 @@ static UINT32 audin_oss_get_format(const AUDIO_FORMAT* format) case 16: return AFMT_S16_LE; + + default: + break; } + break; + default: break; } diff --git a/channels/printer/client/cups/printer_cups.c b/channels/printer/client/cups/printer_cups.c index b61ad1723..af51a0211 100644 --- a/channels/printer/client/cups/printer_cups.c +++ b/channels/printer/client/cups/printer_cups.c @@ -112,7 +112,7 @@ static void printer_cups_get_printjob_name(char* buf, size_t size, size_t id) WINPR_ASSERT(buf); WINPR_ASSERT(size > 0); - (void)sprintf_s(buf, size - 1, "FreeRDP Print %04d-%02d-%02d %02d-%02d-%02d - Job %" PRIdz, + (void)sprintf_s(buf, size - 1, "FreeRDP Print %04d-%02d-%02d %02d-%02d-%02d - Job %" PRIuz, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, id); } diff --git a/channels/printer/client/printer_main.c b/channels/printer/client/printer_main.c index 6f434f5d4..4bb61a0a9 100644 --- a/channels/printer/client/printer_main.c +++ b/channels/printer/client/printer_main.c @@ -972,7 +972,7 @@ static UINT printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrint if (!printer_dev->device.data) goto error_out; - (void)sprintf_s(printer_dev->port, sizeof(printer_dev->port), "PRN%" PRIdz, printer->id); + (void)sprintf_s(printer_dev->port, sizeof(printer_dev->port), "PRN%" PRIuz, printer->id); printer_dev->device.type = RDPDR_DTYP_PRINT; printer_dev->device.name = printer_dev->port; printer_dev->device.IRPRequest = printer_irp_request; diff --git a/channels/rdpsnd/client/alsa/rdpsnd_alsa.c b/channels/rdpsnd/client/alsa/rdpsnd_alsa.c index 40432cc4b..da7ad31ca 100644 --- a/channels/rdpsnd/client/alsa/rdpsnd_alsa.c +++ b/channels/rdpsnd/client/alsa/rdpsnd_alsa.c @@ -338,6 +338,8 @@ static BOOL rdpsnd_alsa_format_supported(rdpsndDevicePlugin* device, const AUDIO return TRUE; } + break; + default: break; } diff --git a/channels/rdpsnd/client/oss/rdpsnd_oss.c b/channels/rdpsnd/client/oss/rdpsnd_oss.c index 3696f7b86..f10803b4d 100644 --- a/channels/rdpsnd/client/oss/rdpsnd_oss.c +++ b/channels/rdpsnd/client/oss/rdpsnd_oss.c @@ -85,6 +85,8 @@ static int rdpsnd_oss_get_format(const AUDIO_FORMAT* format) return AFMT_S16_LE; } + break; + default: break; } diff --git a/channels/rdpsnd/client/rdpsnd_main.c b/channels/rdpsnd/client/rdpsnd_main.c index bebeff366..ec2ee0efe 100644 --- a/channels/rdpsnd/client/rdpsnd_main.c +++ b/channels/rdpsnd/client/rdpsnd_main.c @@ -390,7 +390,7 @@ static BOOL rdpsnd_apply_volume(rdpsndPlugin* rdpsnd) return TRUE; } -static BOOL rdpsnd_ensure_device_is_open(rdpsndPlugin* rdpsnd, UINT32 wFormatNo, +static BOOL rdpsnd_ensure_device_is_open(rdpsndPlugin* rdpsnd, UINT16 wFormatNo, const AUDIO_FORMAT* format) { if (!rdpsnd) diff --git a/channels/rdpsnd/server/rdpsnd_main.c b/channels/rdpsnd/server/rdpsnd_main.c index e3682a10b..32e560e09 100644 --- a/channels/rdpsnd/server/rdpsnd_main.c +++ b/channels/rdpsnd/server/rdpsnd_main.c @@ -391,6 +391,8 @@ static UINT rdpsnd_server_select_format(RdpsndServerContext* context, UINT16 cli if (context->priv->out_frames < bs) context->priv->out_frames = bs; + break; + default: break; } diff --git a/client/SDL/SDL2/sdl_disp.cpp b/client/SDL/SDL2/sdl_disp.cpp index 126902935..4599677ac 100644 --- a/client/SDL/SDL2/sdl_disp.cpp +++ b/client/SDL/SDL2/sdl_disp.cpp @@ -319,14 +319,14 @@ BOOL sdlDispContext::handle_display_event(const SDL_DisplayEvent* ev) { #if SDL_VERSION_ATLEAST(2, 0, 14) case SDL_DISPLAYEVENT_CONNECTED: - SDL_Log("A new display with id %d was connected", ev->display); + SDL_Log("A new display with id %u was connected", ev->display); return TRUE; case SDL_DISPLAYEVENT_DISCONNECTED: - SDL_Log("The display with id %d was disconnected", ev->display); + SDL_Log("The display with id %u was disconnected", ev->display); return TRUE; #endif case SDL_DISPLAYEVENT_ORIENTATION: - SDL_Log("The orientation of display with id %d was changed", ev->display); + SDL_Log("The orientation of display with id %u was changed", ev->display); return TRUE; default: return TRUE; diff --git a/client/SDL/SDL3/sdl_disp.cpp b/client/SDL/SDL3/sdl_disp.cpp index 50b7a910f..eb4addf60 100644 --- a/client/SDL/SDL3/sdl_disp.cpp +++ b/client/SDL/SDL3/sdl_disp.cpp @@ -317,13 +317,13 @@ BOOL sdlDispContext::handle_display_event(const SDL_DisplayEvent* ev) switch (ev->type) { case SDL_EVENT_DISPLAY_ADDED: - SDL_Log("A new display with id %d was connected", ev->displayID); + SDL_Log("A new display with id %u was connected", ev->displayID); return TRUE; case SDL_EVENT_DISPLAY_REMOVED: - SDL_Log("The display with id %d was disconnected", ev->displayID); + SDL_Log("The display with id %u was disconnected", ev->displayID); return TRUE; case SDL_EVENT_DISPLAY_ORIENTATION: - SDL_Log("The orientation of display with id %d was changed", ev->displayID); + SDL_Log("The orientation of display with id %u was changed", ev->displayID); return TRUE; default: return TRUE; diff --git a/client/SDL/SDL3/sdl_monitor.cpp b/client/SDL/SDL3/sdl_monitor.cpp index adba22fe7..b55898fa0 100644 --- a/client/SDL/SDL3/sdl_monitor.cpp +++ b/client/SDL/SDL3/sdl_monitor.cpp @@ -73,7 +73,7 @@ int sdl_list_monitors(SdlContext* sdl) if (brc != 0) continue; - printf(" %s [%d] [%s] %dx%d\t+%d+%d\n", (i == 0) ? "*" : " ", id, name, rect.w, rect.h, + printf(" %s [%u] [%s] %dx%d\t+%d+%d\n", (i == 0) ? "*" : " ", id, name, rect.w, rect.h, rect.x, rect.y); } SDL_free(ids); diff --git a/client/Wayland/wlf_disp.c b/client/Wayland/wlf_disp.c index 0d8767581..ca593f3bd 100644 --- a/client/Wayland/wlf_disp.c +++ b/client/Wayland/wlf_disp.c @@ -447,7 +447,7 @@ int wlf_list_monitors(wlfContext* wlc) UwacOutputGetPosition(monitor, &pos); UwacOutputGetResolution(monitor, &resolution); - printf(" %s [%d] %dx%d\t+%d+%d\n", (i == 0) ? "*" : " ", i, resolution.width, + printf(" %s [%u] %dx%d\t+%d+%d\n", (i == 0) ? "*" : " ", i, resolution.width, resolution.height, pos.x, pos.y); } diff --git a/client/X11/xf_client.c b/client/X11/xf_client.c index 70ba5b0cc..eb67283a4 100644 --- a/client/X11/xf_client.c +++ b/client/X11/xf_client.c @@ -546,7 +546,7 @@ static char* xf_window_get_title(rdpSettings* settings) if (!port) (void)sprintf_s(windowTitle, size, "%s %s", prefix, name); else - (void)sprintf_s(windowTitle, size, "%s %s:%i", prefix, name, + (void)sprintf_s(windowTitle, size, "%s %s:%" PRIu32, prefix, name, freerdp_settings_get_uint32(settings, FreeRDP_ServerPort)); return windowTitle; diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 0162dd300..0e5ffe390 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -1726,7 +1726,7 @@ static void freerdp_client_print_tune_list(const rdpSettings* settings) freerdp_settings_get_int16(settings, (FreeRDP_Settings_Keys_Int16)x)); break; case RDP_SETTINGS_TYPE_UINT32: - printf("%" PRIuz "\t%50s\tUINT32\t%" PRIu32 "\n", x, name, + printf("%" PRIdz "\t%50s\tUINT32\t%" PRIu32 "\n", x, name, freerdp_settings_get_uint32(settings, (FreeRDP_Settings_Keys_UInt32)x)); break; case RDP_SETTINGS_TYPE_INT32: diff --git a/libfreerdp/codec/audio.c b/libfreerdp/codec/audio.c index b59837803..69bd42fcb 100644 --- a/libfreerdp/codec/audio.c +++ b/libfreerdp/codec/audio.c @@ -111,9 +111,9 @@ const char* audio_format_get_tag_string(UINT16 wFormatTag) case WAVE_FORMAT_AAC_MS: return "WAVE_FORMAT_AAC_MS"; + default: + return "WAVE_FORMAT_UNKNOWN"; } - - return "WAVE_FORMAT_UNKNOWN"; } void audio_format_print(wLog* log, DWORD level, const AUDIO_FORMAT* format) diff --git a/libfreerdp/common/assistance.c b/libfreerdp/common/assistance.c index cb52beb63..e0a368758 100644 --- a/libfreerdp/common/assistance.c +++ b/libfreerdp/common/assistance.c @@ -785,23 +785,18 @@ out_fail: char* freerdp_assistance_construct_expert_blob(const char* name, const char* pass) { - size_t size = 0; - size_t nameLength = 0; - size_t passLength = 0; - char* ExpertBlob = NULL; - if (!name || !pass) return NULL; - nameLength = strlen(name) + strlen("NAME="); - passLength = strlen(pass) + strlen("PASS="); - size = nameLength + passLength + 64; - ExpertBlob = (char*)calloc(1, size); + const size_t nameLength = strlen(name) + strlen("NAME="); + const size_t passLength = strlen(pass) + strlen("PASS="); + const size_t size = nameLength + passLength + 64; + char* ExpertBlob = (char*)calloc(1, size); if (!ExpertBlob) return NULL; - (void)sprintf_s(ExpertBlob, size, "%" PRIdz ";NAME=%s%" PRIdz ";PASS=%s", nameLength, name, + (void)sprintf_s(ExpertBlob, size, "%" PRIuz ";NAME=%s%" PRIuz ";PASS=%s", nameLength, name, passLength, pass); return ExpertBlob; } diff --git a/libfreerdp/core/gateway/http.c b/libfreerdp/core/gateway/http.c index ac1212ede..2d4ce0b79 100644 --- a/libfreerdp/core/gateway/http.c +++ b/libfreerdp/core/gateway/http.c @@ -588,7 +588,7 @@ static BOOL http_encode_body_line(wStream* s, const char* param, const char* val static BOOL http_encode_content_length_line(wStream* s, size_t ContentLength) { - return http_encode_print(s, "Content-Length: %" PRIdz "\r\n", ContentLength); + return http_encode_print(s, "Content-Length: %" PRIuz "\r\n", ContentLength); } static BOOL http_encode_header_line(wStream* s, const char* Method, const char* URI)