mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[warnings,api] fix -Wunused-result
With marking publid API [[nodiscard]] some problematic error checks in the core library were uncovered. This commit addresses these shortcomings.
This commit is contained in:
@@ -1371,11 +1371,13 @@ static DWORD WINAPI xf_handle_pipe(void* arg)
|
||||
}
|
||||
|
||||
void* ctx = WINPR_CAST_CONST_PTR_AWAY(pipe, void*);
|
||||
freerdp_add_signal_cleanup_handler(ctx, cleanup_pipe);
|
||||
if (freerdp_add_signal_cleanup_handler(ctx, cleanup_pipe))
|
||||
{
|
||||
|
||||
xf_process_pipe(context, pipe);
|
||||
xf_process_pipe(context, pipe);
|
||||
|
||||
freerdp_del_signal_cleanup_handler(ctx, cleanup_pipe);
|
||||
freerdp_del_signal_cleanup_handler(ctx, cleanup_pipe);
|
||||
}
|
||||
|
||||
unlink(pipe);
|
||||
return 0;
|
||||
|
||||
@@ -1906,20 +1906,17 @@ static UINT xf_cliprdr_monitor_ready(CliprdrClientContext* context,
|
||||
static UINT xf_cliprdr_server_capabilities(CliprdrClientContext* context,
|
||||
const CLIPRDR_CAPABILITIES* capabilities)
|
||||
{
|
||||
const CLIPRDR_GENERAL_CAPABILITY_SET* generalCaps = NULL;
|
||||
const BYTE* capsPtr = NULL;
|
||||
xfClipboard* clipboard = NULL;
|
||||
|
||||
WINPR_ASSERT(context);
|
||||
WINPR_ASSERT(capabilities);
|
||||
|
||||
clipboard = cliprdr_file_context_get_context(context->custom);
|
||||
xfClipboard* clipboard = cliprdr_file_context_get_context(context->custom);
|
||||
WINPR_ASSERT(clipboard);
|
||||
|
||||
capsPtr = (const BYTE*)capabilities->capabilitySets;
|
||||
const BYTE* capsPtr = (const BYTE*)capabilities->capabilitySets;
|
||||
WINPR_ASSERT(capsPtr);
|
||||
|
||||
cliprdr_file_context_remote_set_flags(clipboard->file, 0);
|
||||
if (!cliprdr_file_context_remote_set_flags(clipboard->file, 0))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
for (UINT32 i = 0; i < capabilities->cCapabilitiesSets; i++)
|
||||
{
|
||||
@@ -1927,9 +1924,11 @@ static UINT xf_cliprdr_server_capabilities(CliprdrClientContext* context,
|
||||
|
||||
if (caps->capabilitySetType == CB_CAPSTYPE_GENERAL)
|
||||
{
|
||||
generalCaps = (const CLIPRDR_GENERAL_CAPABILITY_SET*)caps;
|
||||
const CLIPRDR_GENERAL_CAPABILITY_SET* generalCaps =
|
||||
(const CLIPRDR_GENERAL_CAPABILITY_SET*)caps;
|
||||
|
||||
cliprdr_file_context_remote_set_flags(clipboard->file, generalCaps->generalFlags);
|
||||
if (!cliprdr_file_context_remote_set_flags(clipboard->file, generalCaps->generalFlags))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
capsPtr += caps->capabilitySetLength;
|
||||
@@ -2564,7 +2563,8 @@ xfClipboard* xf_clipboard_new(xfContext* xfc, BOOL relieveFilenameRestriction)
|
||||
const UINT32 uid = ClipboardGetFormatId(clipboard->system, mime_uri_list);
|
||||
if (uid)
|
||||
{
|
||||
cliprdr_file_context_set_locally_available(clipboard->file, TRUE);
|
||||
if (!cliprdr_file_context_set_locally_available(clipboard->file, TRUE))
|
||||
goto fail;
|
||||
clientFormat->atom =
|
||||
Logging_XInternAtom(xfc->log, xfc->display, mime_uri_list, False);
|
||||
clientFormat->localFormat = uid;
|
||||
@@ -2582,7 +2582,8 @@ xfClipboard* xf_clipboard_new(xfContext* xfc, BOOL relieveFilenameRestriction)
|
||||
const UINT32 gid = ClipboardGetFormatId(clipboard->system, mime_gnome_copied_files);
|
||||
if (gid != 0)
|
||||
{
|
||||
cliprdr_file_context_set_locally_available(clipboard->file, TRUE);
|
||||
if (!cliprdr_file_context_set_locally_available(clipboard->file, TRUE))
|
||||
goto fail;
|
||||
clientFormat->atom =
|
||||
Logging_XInternAtom(xfc->log, xfc->display, mime_gnome_copied_files, False);
|
||||
clientFormat->localFormat = gid;
|
||||
@@ -2600,7 +2601,8 @@ xfClipboard* xf_clipboard_new(xfContext* xfc, BOOL relieveFilenameRestriction)
|
||||
const UINT32 mid = ClipboardGetFormatId(clipboard->system, mime_mate_copied_files);
|
||||
if (mid != 0)
|
||||
{
|
||||
cliprdr_file_context_set_locally_available(clipboard->file, TRUE);
|
||||
if (!cliprdr_file_context_set_locally_available(clipboard->file, TRUE))
|
||||
goto fail;
|
||||
clientFormat->atom =
|
||||
Logging_XInternAtom(xfc->log, xfc->display, mime_mate_copied_files, False);
|
||||
clientFormat->localFormat = mid;
|
||||
|
||||
@@ -946,7 +946,10 @@ static BOOL xf_event_MapNotify(xfContext* xfc, const XMapEvent* event, BOOL app)
|
||||
{
|
||||
WINPR_ASSERT(xfc);
|
||||
if (!app)
|
||||
gdi_send_suppress_output(xfc->common.context.gdi, FALSE);
|
||||
{
|
||||
if (!gdi_send_suppress_output(xfc->common.context.gdi, FALSE))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
xfAppWindow* appWindow = xf_AppWindowFromX11Window(xfc, event->window);
|
||||
|
||||
@@ -63,8 +63,9 @@ static UINT xf_OutputUpdate(xfContext* xfc, xfGfxSurface* surface)
|
||||
LogDynAndXSetClipMask(xfc->log, xfc->display, xfc->gc, None);
|
||||
LogDynAndXSetFunction(xfc->log, xfc->display, xfc->gc, GXcopy);
|
||||
LogDynAndXSetFillStyle(xfc->log, xfc->display, xfc->gc, FillSolid);
|
||||
region16_intersect_rect(&(surface->gdi.invalidRegion), &(surface->gdi.invalidRegion),
|
||||
&surfaceRect);
|
||||
if (!region16_intersect_rect(&(surface->gdi.invalidRegion), &(surface->gdi.invalidRegion),
|
||||
&surfaceRect))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
WINPR_ASSERT(surface->gdi.mappedWidth);
|
||||
WINPR_ASSERT(surface->gdi.mappedHeight);
|
||||
@@ -246,8 +247,14 @@ UINT xf_OutputExpose(xfContext* xfc, UINT32 x, UINT32 y, UINT32 width, UINT32 he
|
||||
intersection.top -= surfaceRect.top;
|
||||
intersection.right -= surfaceRect.left;
|
||||
intersection.bottom -= surfaceRect.top;
|
||||
region16_union_rect(&surface->gdi.invalidRegion, &surface->gdi.invalidRegion,
|
||||
&intersection);
|
||||
if (!region16_union_rect(&surface->gdi.invalidRegion, &surface->gdi.invalidRegion,
|
||||
&intersection))
|
||||
{
|
||||
free(pSurfaceIds);
|
||||
LeaveCriticalSection(&context->mux);
|
||||
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -681,7 +681,7 @@ void xf_keyboard_send_key(xfContext* xfc, BOOL down, BOOL repeat, const XKeyEven
|
||||
*/
|
||||
if (down)
|
||||
{
|
||||
(void)freerdp_input_send_keyboard_pause_event(input);
|
||||
freerdp_input_send_keyboard_pause_event(input);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -731,7 +731,7 @@ void xf_keyboard_send_key(xfContext* xfc, BOOL down, BOOL repeat, const XKeyEven
|
||||
if (rdp_scancode == RDP_SCANCODE_UNKNOWN)
|
||||
WLog_ERR(TAG, "Unknown key with X keycode 0x%02" PRIx8 "", event->keycode);
|
||||
else
|
||||
(void)freerdp_input_send_keyboard_event_ex(input, down, repeat, rdp_scancode);
|
||||
freerdp_input_send_keyboard_event_ex(input, down, repeat, rdp_scancode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -741,14 +741,14 @@ void xf_keyboard_send_key(xfContext* xfc, BOOL down, BOOL repeat, const XKeyEven
|
||||
|
||||
WCHAR wbuffer[ARRAYSIZE(buffer)] = { 0 };
|
||||
(void)ConvertUtf8ToWChar(str, wbuffer, rc);
|
||||
(void)freerdp_input_send_unicode_keyboard_event(input, down ? 0 : KBD_FLAGS_RELEASE,
|
||||
wbuffer[0]);
|
||||
freerdp_input_send_unicode_keyboard_event(input, down ? 0 : KBD_FLAGS_RELEASE,
|
||||
wbuffer[0]);
|
||||
}
|
||||
}
|
||||
else if (rdp_scancode == RDP_SCANCODE_UNKNOWN)
|
||||
WLog_ERR(TAG, "Unknown key with X keycode 0x%02" PRIx8 "", event->keycode);
|
||||
else
|
||||
(void)freerdp_input_send_keyboard_event_ex(input, down, repeat, rdp_scancode);
|
||||
freerdp_input_send_keyboard_event_ex(input, down, repeat, rdp_scancode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -308,8 +308,10 @@ BOOL xf_rail_paint_surface(xfContext* xfc, UINT64 windowId, const RECTANGLE_16*
|
||||
|
||||
REGION16 windowInvalidRegion = { 0 };
|
||||
region16_init(&windowInvalidRegion);
|
||||
region16_union_rect(&windowInvalidRegion, &windowInvalidRegion, &windowRect);
|
||||
region16_intersect_rect(&windowInvalidRegion, &windowInvalidRegion, rect);
|
||||
if (!region16_union_rect(&windowInvalidRegion, &windowInvalidRegion, &windowRect))
|
||||
return FALSE;
|
||||
if (!region16_intersect_rect(&windowInvalidRegion, &windowInvalidRegion, rect))
|
||||
return FALSE;
|
||||
|
||||
if (!region16_is_empty(&windowInvalidRegion))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user