mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +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:
@@ -233,7 +233,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event)
|
||||
case SDLK_KP_ENTER:
|
||||
if (event.type == SDL_KEYUP)
|
||||
{
|
||||
freerdp_abort_event(_context);
|
||||
freerdp_abort_connect_context(_context);
|
||||
sdl_push_quit();
|
||||
}
|
||||
break;
|
||||
@@ -269,7 +269,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event)
|
||||
{
|
||||
if (event.type == SDL_MOUSEBUTTONUP)
|
||||
{
|
||||
freerdp_abort_event(_context);
|
||||
freerdp_abort_connect_context(_context);
|
||||
sdl_push_quit();
|
||||
}
|
||||
}
|
||||
@@ -306,7 +306,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event)
|
||||
case SDL_WINDOWEVENT_CLOSE:
|
||||
if (windowID == ev.windowID)
|
||||
{
|
||||
freerdp_abort_event(_context);
|
||||
freerdp_abort_connect_context(_context);
|
||||
sdl_push_quit();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -354,15 +354,13 @@ BOOL sdlDispContext::handle_window_event(const SDL_WindowEvent* ev)
|
||||
{
|
||||
case SDL_WINDOWEVENT_HIDDEN:
|
||||
case SDL_WINDOWEVENT_MINIMIZED:
|
||||
gdi_send_suppress_output(_sdl->context()->gdi, TRUE);
|
||||
return TRUE;
|
||||
return gdi_send_suppress_output(_sdl->context()->gdi, TRUE);
|
||||
|
||||
case SDL_WINDOWEVENT_EXPOSED:
|
||||
case SDL_WINDOWEVENT_SHOWN:
|
||||
case SDL_WINDOWEVENT_MAXIMIZED:
|
||||
case SDL_WINDOWEVENT_RESTORED:
|
||||
gdi_send_suppress_output(_sdl->context()->gdi, FALSE);
|
||||
return TRUE;
|
||||
return gdi_send_suppress_output(_sdl->context()->gdi, FALSE);
|
||||
|
||||
case SDL_WINDOWEVENT_RESIZED:
|
||||
case SDL_WINDOWEVENT_SIZE_CHANGED:
|
||||
|
||||
@@ -846,7 +846,8 @@ static int sdl_run(SdlContext* sdl)
|
||||
SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0");
|
||||
#endif
|
||||
|
||||
freerdp_add_signal_cleanup_handler(sdl->context(), sdl_term_handler);
|
||||
if (!freerdp_add_signal_cleanup_handler(sdl->context(), sdl_term_handler))
|
||||
return -1;
|
||||
|
||||
sdl->initialized.set();
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event)
|
||||
case SDLK_KP_ENTER:
|
||||
if (event.type == SDL_EVENT_KEY_UP)
|
||||
{
|
||||
freerdp_abort_event(_context);
|
||||
freerdp_abort_connect_context(_context);
|
||||
std::ignore = sdl_push_quit();
|
||||
}
|
||||
break;
|
||||
@@ -245,7 +245,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event)
|
||||
{
|
||||
if (event.type == SDL_EVENT_MOUSE_BUTTON_UP)
|
||||
{
|
||||
freerdp_abort_event(_context);
|
||||
freerdp_abort_connect_context(_context);
|
||||
std::ignore = sdl_push_quit();
|
||||
}
|
||||
}
|
||||
@@ -281,7 +281,7 @@ bool SDLConnectionDialog::handle(const SDL_Event& event)
|
||||
case SDL_EVENT_WINDOW_CLOSE_REQUESTED:
|
||||
if (windowID == ev.windowID)
|
||||
{
|
||||
freerdp_abort_event(_context);
|
||||
freerdp_abort_connect_context(_context);
|
||||
std::ignore = sdl_push_quit();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -230,7 +230,8 @@ static UINT wlf_cliprdr_send_client_format_list(wfClipboard* clipboard)
|
||||
.formats = clipboard->clientFormats,
|
||||
.common.msgType = CB_FORMAT_LIST };
|
||||
|
||||
cliprdr_file_context_clear(clipboard->file);
|
||||
if (!cliprdr_file_context_clear(clipboard->file))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
WLog_VRB(TAG, "-------------- client format list [%" PRIu32 "] ------------------",
|
||||
formatList.numFormats);
|
||||
@@ -601,7 +602,8 @@ static UINT wlf_cliprdr_server_format_list(CliprdrClientContext* context,
|
||||
WINPR_ASSERT(clipboard);
|
||||
|
||||
wlf_cliprdr_free_server_formats(clipboard);
|
||||
cliprdr_file_context_clear(clipboard->file);
|
||||
if (!cliprdr_file_context_clear(clipboard->file))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!(clipboard->serverFormats =
|
||||
(CLIPRDR_FORMAT*)calloc(formatList->numFormats, sizeof(CLIPRDR_FORMAT))))
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -988,7 +988,6 @@ BOOL client_cli_present_gateway_message(freerdp* instance, UINT32 type, BOOL isD
|
||||
BOOL isConsentMandatory, size_t length,
|
||||
const WCHAR* message)
|
||||
{
|
||||
int answer = 0;
|
||||
const char* msgType = (type == GATEWAY_MESSAGE_CONSENT) ? "Consent message" : "Service message";
|
||||
|
||||
WINPR_ASSERT(instance);
|
||||
@@ -1018,7 +1017,7 @@ BOOL client_cli_present_gateway_message(freerdp* instance, UINT32 type, BOOL isD
|
||||
{
|
||||
printf("I understand and agree to the terms of this policy (Y/N) \n");
|
||||
(void)fflush(stdout);
|
||||
answer = freerdp_interruptible_getc(instance->context, stdin);
|
||||
const int answer = freerdp_interruptible_getc(instance->context, stdin);
|
||||
|
||||
if ((answer == EOF) || feof(stdin))
|
||||
{
|
||||
@@ -1026,18 +1025,17 @@ BOOL client_cli_present_gateway_message(freerdp* instance, UINT32 type, BOOL isD
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const int confirm = freerdp_interruptible_getc(instance->context, stdin);
|
||||
switch (answer)
|
||||
{
|
||||
case 'y':
|
||||
case 'Y':
|
||||
answer = freerdp_interruptible_getc(instance->context, stdin);
|
||||
if (answer == EOF)
|
||||
if (confirm == EOF)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
|
||||
case 'n':
|
||||
case 'N':
|
||||
(void)freerdp_interruptible_getc(instance->context, stdin);
|
||||
return FALSE;
|
||||
|
||||
default:
|
||||
|
||||
@@ -1184,13 +1184,15 @@ static DWORD WINAPI cliprdr_file_fuse_thread(LPVOID arg)
|
||||
|
||||
if (file->fuse_sess != NULL)
|
||||
{
|
||||
freerdp_add_signal_cleanup_handler(file, fuse_abort);
|
||||
if (0 == fuse_session_mount(file->fuse_sess, file->path))
|
||||
if (freerdp_add_signal_cleanup_handler(file, fuse_abort))
|
||||
{
|
||||
fuse_session_loop(file->fuse_sess);
|
||||
fuse_session_unmount(file->fuse_sess);
|
||||
if (0 == fuse_session_mount(file->fuse_sess, file->path))
|
||||
{
|
||||
fuse_session_loop(file->fuse_sess);
|
||||
fuse_session_unmount(file->fuse_sess);
|
||||
}
|
||||
freerdp_del_signal_cleanup_handler(file, fuse_abort);
|
||||
}
|
||||
freerdp_del_signal_cleanup_handler(file, fuse_abort);
|
||||
|
||||
WLog_Print(file->log, WLOG_DEBUG, "Waiting for FUSE stop sync");
|
||||
if (WaitForSingleObject(file->fuse_stop_sync, INFINITE) == WAIT_FAILED)
|
||||
|
||||
Reference in New Issue
Block a user