From 43e3b862af5b299febdd0c28d5cce6d006673152 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 21 Jan 2026 16:29:26 +0100 Subject: [PATCH] [warnings] fix initialization skip warnings --- channels/ainput/server/ainput_main.c | 20 +++++++----- client/X11/xf_graphics.c | 12 ++++--- libfreerdp/gdi/gfx.c | 49 +++++++++++++++------------- 3 files changed, 44 insertions(+), 37 deletions(-) diff --git a/channels/ainput/server/ainput_main.c b/channels/ainput/server/ainput_main.c index 0d94ea9d2..e25e5980b 100644 --- a/channels/ainput/server/ainput_main.c +++ b/channels/ainput/server/ainput_main.c @@ -479,17 +479,19 @@ static UINT ainput_process_message(ainput_server* ainput) } Stream_SetLength(s, ActualBytesReturned); - const UINT16 MessageId = Stream_Get_UINT16(s); - - switch (MessageId) { - case MSG_AINPUT_MOUSE: - error = ainput_server_recv_mouse_event(ainput, s); - break; + const UINT16 MessageId = Stream_Get_UINT16(s); - default: - WLog_ERR(TAG, "audin_server_thread_func: unknown MessageId %" PRIu16 "", MessageId); - break; + switch (MessageId) + { + case MSG_AINPUT_MOUSE: + error = ainput_server_recv_mouse_event(ainput, s); + break; + + default: + WLog_ERR(TAG, "audin_server_thread_func: unknown MessageId %" PRIu16 "", MessageId); + break; + } } out: diff --git a/client/X11/xf_graphics.c b/client/X11/xf_graphics.c index 9d432c98b..c61466b1a 100644 --- a/client/X11/xf_graphics.c +++ b/client/X11/xf_graphics.c @@ -303,12 +303,14 @@ static BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer) xpointer->nCursors = 0; xpointer->mCursors = 0; - const size_t size = - 1ull * pointer->height * pointer->width * FreeRDPGetBytesPerPixel(CursorFormat); + { + const size_t size = + 1ull * pointer->height * pointer->width * FreeRDPGetBytesPerPixel(CursorFormat); - xpointer->cursorPixels = (XcursorPixel*)winpr_aligned_malloc(size, 16); - if (!xpointer->cursorPixels) - goto fail; + xpointer->cursorPixels = (XcursorPixel*)winpr_aligned_malloc(size, 16); + if (!xpointer->cursorPixels) + goto fail; + } if (!freerdp_image_copy_from_pointer_data( (BYTE*)xpointer->cursorPixels, CursorFormat, 0, 0, 0, pointer->width, pointer->height, diff --git a/libfreerdp/gdi/gfx.c b/libfreerdp/gdi/gfx.c index 96ce10070..21b9eb6c3 100644 --- a/libfreerdp/gdi/gfx.c +++ b/libfreerdp/gdi/gfx.c @@ -1360,33 +1360,36 @@ static UINT gdi_SurfaceToSurface(RdpgfxClientContext* context, if (!is_rect_valid(rectSrc, surfaceSrc->width, surfaceSrc->height)) goto fail; - const UINT32 nWidth = rectSrc->right - rectSrc->left; - const UINT32 nHeight = rectSrc->bottom - rectSrc->top; - - for (UINT16 index = 0; index < surfaceToSurface->destPtsCount; index++) { - const RDPGFX_POINT16* destPt = &surfaceToSurface->destPts[index]; - const RECTANGLE_16 rect = { destPt->x, destPt->y, - (UINT16)MIN(UINT16_MAX, destPt->x + nWidth), - (UINT16)MIN(UINT16_MAX, destPt->y + nHeight) }; - if (!is_rect_valid(&rect, surfaceDst->width, surfaceDst->height)) - goto fail; + const UINT32 nWidth = rectSrc->right - rectSrc->left; + const UINT32 nHeight = rectSrc->bottom - rectSrc->top; - const UINT32 rwidth = rect.right - rect.left; - const UINT32 rheight = rect.bottom - rect.top; - if (!freerdp_image_copy(surfaceDst->data, surfaceDst->format, surfaceDst->scanline, - destPt->x, destPt->y, rwidth, rheight, surfaceSrc->data, - surfaceSrc->format, surfaceSrc->scanline, rectSrc->left, - rectSrc->top, NULL, FREERDP_FLIP_NONE)) - goto fail; + for (UINT16 index = 0; index < surfaceToSurface->destPtsCount; index++) + { + const RDPGFX_POINT16* destPt = &surfaceToSurface->destPts[index]; + const RECTANGLE_16 rect = { destPt->x, destPt->y, + (UINT16)MIN(UINT16_MAX, destPt->x + nWidth), + (UINT16)MIN(UINT16_MAX, destPt->y + nHeight) }; + if (!is_rect_valid(&rect, surfaceDst->width, surfaceDst->height)) + goto fail; - invalidRect = rect; - region16_union_rect(&surfaceDst->invalidRegion, &surfaceDst->invalidRegion, &invalidRect); - status = IFCALLRESULT(CHANNEL_RC_OK, context->UpdateSurfaceArea, context, - surfaceDst->surfaceId, 1, &invalidRect); + const UINT32 rwidth = rect.right - rect.left; + const UINT32 rheight = rect.bottom - rect.top; + if (!freerdp_image_copy(surfaceDst->data, surfaceDst->format, surfaceDst->scanline, + destPt->x, destPt->y, rwidth, rheight, surfaceSrc->data, + surfaceSrc->format, surfaceSrc->scanline, rectSrc->left, + rectSrc->top, NULL, FREERDP_FLIP_NONE)) + goto fail; - if (status != CHANNEL_RC_OK) - goto fail; + invalidRect = rect; + region16_union_rect(&surfaceDst->invalidRegion, &surfaceDst->invalidRegion, + &invalidRect); + status = IFCALLRESULT(CHANNEL_RC_OK, context->UpdateSurfaceArea, context, + surfaceDst->surfaceId, 1, &invalidRect); + + if (status != CHANNEL_RC_OK) + goto fail; + } } LeaveCriticalSection(&context->mux);