[server,warnings] properly handle function return

This commit is contained in:
Armin Novak
2026-02-16 08:18:27 +01:00
parent f4b0549c5b
commit a1c72a2f85
6 changed files with 54 additions and 22 deletions

View File

@@ -190,7 +190,8 @@ static void test_peer_begin_frame(freerdp_peer* client)
fm.frameAction = SURFACECMD_FRAMEACTION_BEGIN;
fm.frameId = context->frame_id;
WINPR_ASSERT(update->SurfaceFrameMarker);
update->SurfaceFrameMarker(update->context, &fm);
if (!update->SurfaceFrameMarker(update->context, &fm))
WLog_WARN(TAG, "SurfaceFrameMarker failed");
}
static void test_peer_end_frame(freerdp_peer* client)
@@ -210,7 +211,8 @@ static void test_peer_end_frame(freerdp_peer* client)
fm.frameAction = SURFACECMD_FRAMEACTION_END;
fm.frameId = context->frame_id;
WINPR_ASSERT(update->SurfaceFrameMarker);
update->SurfaceFrameMarker(update->context, &fm);
if (!update->SurfaceFrameMarker(update->context, &fm))
WLog_WARN(TAG, "SurfaceFrameMarker failed");
context->frame_id++;
}
@@ -306,8 +308,7 @@ static BOOL test_peer_draw_background(freerdp_peer* client, const RFX_RECT* rect
cmd.bmp.bitmapDataLength = (UINT32)Stream_GetPosition(s);
cmd.bmp.bitmapData = Stream_Buffer(s);
update->SurfaceBits(update->context, &cmd);
ret = TRUE;
ret = update->SurfaceBits(update->context, &cmd);
out:
free(rgb_data);
return ret;
@@ -453,7 +454,10 @@ static void test_send_cursor_update(freerdp_peer* client, UINT32 x, UINT32 y)
rdpUpdate* update = client->context->update;
WINPR_ASSERT(update);
WINPR_ASSERT(update->SurfaceBits);
update->SurfaceBits(update->context, &cmd);
if (!update->SurfaceBits(update->context, &cmd))
{
WLog_WARN(TAG, "update->SurfaceBits failed");
}
context->icon_x = x;
context->icon_y = y;
}
@@ -575,7 +579,8 @@ static BOOL tf_peer_dump_rfx(freerdp_peer* client)
break;
WINPR_ASSERT(update->SurfaceCommand);
update->SurfaceCommand(update->context, s);
if (!update->SurfaceCommand(update->context, s))
break;
WINPR_ASSERT(client->CheckFileDescriptor);
if (client->CheckFileDescriptor(client) != TRUE)
@@ -878,7 +883,8 @@ static BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
return FALSE;
WINPR_ASSERT(update->DesktopResize);
update->DesktopResize(update->context);
if (!update->DesktopResize(update->context))
return FALSE;
tcontext->activated = FALSE;
}
else if (((flags & KBD_FLAGS_RELEASE) == 0) && code == RDP_SCANCODE_KEY_C) /* 'c' key */
@@ -893,7 +899,8 @@ static BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
else if (((flags & KBD_FLAGS_RELEASE) == 0) && code == RDP_SCANCODE_KEY_X) /* 'x' key */
{
WINPR_ASSERT(client->Close);
client->Close(client);
if (!client->Close(client))
return FALSE;
}
else if (((flags & KBD_FLAGS_RELEASE) == 0) && code == RDP_SCANCODE_KEY_R) /* 'r' key */
{

View File

@@ -608,7 +608,8 @@ static DWORD WINAPI pf_server_handle_peer(LPVOID arg)
goto out_free_peer;
WINPR_ASSERT(client->Initialize);
client->Initialize(client);
if (!client->Initialize(client))
goto out_free_peer;
PROXY_LOG_INFO(TAG, ps, "new connection: proxy address: %s, client address: %s",
pdata->config->Host, client->hostname);

View File

@@ -2145,7 +2145,10 @@ static int shadow_client_subsystem_process_message(rdpShadowClient* client, wMes
if ((msg->xPos != client->pointerX) || (msg->yPos != client->pointerY))
{
WINPR_ASSERT(update->pointer);
IFCALL(update->pointer->PointerPosition, context, &pointerPosition);
if (CHANNEL_RC_OK != IFCALLRESULT(CHANNEL_RC_OK,
update->pointer->PointerPosition, context,
&pointerPosition))
return -1;
client->pointerX = msg->xPos;
client->pointerY = msg->yPos;
}
@@ -2178,16 +2181,21 @@ static int shadow_client_subsystem_process_message(rdpShadowClient* client, wMes
if (client->activated)
{
IFCALL(update->pointer->PointerNew, context, &pointerNew);
if (!IFCALLRESULT(TRUE, update->pointer->PointerNew, context, &pointerNew))
return -1;
if (client->server->ShowMouseCursor)
{
IFCALL(update->pointer->PointerCached, context, &pointerCached);
if (!IFCALLRESULT(TRUE, update->pointer->PointerCached, context,
&pointerCached))
return -1;
}
else
{
POINTER_SYSTEM_UPDATE pointer_system = { 0 };
pointer_system.type = SYSPTR_NULL;
IFCALL(update->pointer->PointerSystem, context, &pointer_system);
if (!IFCALLRESULT(TRUE, update->pointer->PointerSystem, context,
&pointer_system))
return -1;
}
}
@@ -2204,8 +2212,10 @@ static int shadow_client_subsystem_process_message(rdpShadowClient* client, wMes
if (client->activated && client->rdpsnd && client->rdpsnd->Activated)
{
client->rdpsnd->src_format = msg->audio_format;
IFCALL(client->rdpsnd->SendSamples, client->rdpsnd, msg->buf, msg->nFrames,
msg->wTimestamp);
if (CHANNEL_RC_OK != IFCALLRESULT(CHANNEL_RC_OK, client->rdpsnd->SendSamples,
client->rdpsnd, msg->buf, msg->nFrames,
msg->wTimestamp))
return -1;
}
break;
@@ -2218,7 +2228,9 @@ static int shadow_client_subsystem_process_message(rdpShadowClient* client, wMes
if (client->activated && client->rdpsnd && client->rdpsnd->Activated)
{
IFCALL(client->rdpsnd->SetVolume, client->rdpsnd, msg->left, msg->right);
if (CHANNEL_RC_OK != IFCALLRESULT(CHANNEL_RC_OK, client->rdpsnd->SetVolume,
client->rdpsnd, msg->left, msg->right))
return -1;
}
break;

View File

@@ -113,7 +113,11 @@ int shadow_client_encomsp_init(rdpShadowClient* client)
encomsp->ChangeParticipantControlLevel = encomsp_change_participant_control_level;
if (client->encomsp)
client->encomsp->Start(client->encomsp);
{
const UINT rc = client->encomsp->Start(client->encomsp);
if (rc != CHANNEL_RC_OK)
return -1;
}
return 1;
}

View File

@@ -40,7 +40,9 @@ static void rdpsnd_activated(RdpsndServerContext* context)
{
if (audio_format_compatible(&context->server_formats[j], &context->client_formats[i]))
{
context->SelectFormat(context, WINPR_ASSERTING_INT_CAST(UINT16, i));
const UINT rc = context->SelectFormat(context, WINPR_ASSERTING_INT_CAST(UINT16, i));
if (rc != CHANNEL_RC_OK)
WLog_WARN(TAG, "SelectFormat failed with %" PRIu32, rc);
return;
}
}
@@ -75,7 +77,8 @@ int shadow_client_rdpsnd_init(rdpShadowClient* client)
rdpsnd->src_format = &rdpsnd->server_formats[0];
rdpsnd->Activated = rdpsnd_activated;
rdpsnd->Initialize(rdpsnd, TRUE);
if (rdpsnd->Initialize(rdpsnd, TRUE) != CHANNEL_RC_OK)
return -1;
return 1;
}

View File

@@ -26,15 +26,20 @@
int shadow_client_remdesk_init(rdpShadowClient* client)
{
RemdeskServerContext* remdesk = NULL;
RemdeskServerContext* remdesk = client->remdesk = remdesk_server_context_new(client->vcm);
if (!remdesk)
return -1;
remdesk = client->remdesk = remdesk_server_context_new(client->vcm);
remdesk->rdpcontext = &client->context;
remdesk->custom = (void*)client;
if (client->remdesk)
client->remdesk->Start(client->remdesk);
{
const UINT rc = client->remdesk->Start(client->remdesk);
if (rc != CHANNEL_RC_OK)
return -1;
}
return 1;
}