From 2638d9d89492ea7e7f3ab41299d5b737f122f32c Mon Sep 17 00:00:00 2001 From: akallabeth Date: Thu, 12 Sep 2024 10:46:17 +0200 Subject: [PATCH] [warnings] fix casts --- client/SDL/SDL2/sdl_monitor.cpp | 4 ++-- client/SDL/SDL3/sdl_monitor.cpp | 4 ++-- libfreerdp/common/assistance.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/SDL/SDL2/sdl_monitor.cpp b/client/SDL/SDL2/sdl_monitor.cpp index 730c1b37b..6b3906341 100644 --- a/client/SDL/SDL2/sdl_monitor.cpp +++ b/client/SDL/SDL2/sdl_monitor.cpp @@ -246,8 +246,8 @@ static BOOL sdl_apply_display_properties(SdlContext* sdl) } } - const float dw = 1.0f * rect.w / scaleRect.w; - const float dh = 1.0f * rect.h / scaleRect.h; + const float dw = 1.0f * static_cast(rect.w) / static_cast(scaleRect.w); + const float dh = 1.0f * static_cast(rect.h) / static_cast(scaleRect.h); hdpi /= dw; vdpi /= dh; } diff --git a/client/SDL/SDL3/sdl_monitor.cpp b/client/SDL/SDL3/sdl_monitor.cpp index 28a660c03..d91be891f 100644 --- a/client/SDL/SDL3/sdl_monitor.cpp +++ b/client/SDL/SDL3/sdl_monitor.cpp @@ -245,8 +245,8 @@ static BOOL sdl_apply_display_properties(SdlContext* sdl) } SDL_free(modes); - const float dw = 1.0f * rect.w / scaleRect.w; - const float dh = 1.0f * rect.h / scaleRect.h; + const float dw = 1.0f * static_cast(rect.w) / static_cast(scaleRect.w); + const float dh = 1.0f * static_cast(rect.h) / static_cast(scaleRect.h); hdpi /= dw; vdpi /= dh; } diff --git a/libfreerdp/common/assistance.c b/libfreerdp/common/assistance.c index d3907dc57..59bfa299a 100644 --- a/libfreerdp/common/assistance.c +++ b/libfreerdp/common/assistance.c @@ -427,7 +427,7 @@ static BOOL freerdp_assistance_parse_attr(const char** opt, size_t* plength, con const int rc = _snprintf(bkey, sizeof(bkey), "%s=\"", key); WINPR_ASSERT(rc > 0); WINPR_ASSERT((size_t)rc < sizeof(bkey)); - if ((rc <= 0) || (rc >= sizeof(bkey))) + if ((rc <= 0) || ((size_t)rc >= sizeof(bkey))) return FALSE; char* p = strstr(tag, bkey); @@ -529,7 +529,7 @@ static char* freerdp_assistance_contains_element(char* input, size_t ilen, const const int rc = _snprintf(bkey, sizeof(bkey), "<%s", key); WINPR_ASSERT(rc > 0); WINPR_ASSERT((size_t)rc < sizeof(bkey)); - if ((rc < 0) || (rc >= sizeof(bkey))) + if ((rc < 0) || ((size_t)rc >= sizeof(bkey))) return NULL; char* tag = strstr(input, bkey); @@ -570,7 +570,7 @@ static char* freerdp_assistance_contains_element(char* input, size_t ilen, const const int erc = _snprintf(ekey, sizeof(ekey), "", key); WINPR_ASSERT(erc > 0); WINPR_ASSERT((size_t)erc < sizeof(ekey)); - if ((erc <= 0) || (erc >= sizeof(ekey))) + if ((erc <= 0) || ((size_t)erc >= sizeof(ekey))) return NULL; const size_t offset = start - tag; dend = end = strrstr(start, ilen - offset, ekey);