From 982e59a94219aee031cafc2eca40e7047872dabd Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Tue, 7 Jun 2022 11:50:28 -0500 Subject: [PATCH] rdp: Stop using deprecated functions The get file descriptor functions are being deprecated and a two step process of getting handles and then getting the descriptors for the handles is being used instead. Signed-off-by: Derek Foreman --- libweston/backend-rdp/rdp.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/libweston/backend-rdp/rdp.c b/libweston/backend-rdp/rdp.c index ff3585e5..8f40e81f 100644 --- a/libweston/backend-rdp/rdp.c +++ b/libweston/backend-rdp/rdp.c @@ -606,18 +606,19 @@ static int rdp_implant_listener(struct rdp_backend *b, freerdp_listener* instance) { int i, fd; - int rcount = 0; - void* rfds[MAX_FREERDP_FDS]; + int handle_count = 0; + HANDLE handles[MAX_FREERDP_FDS]; struct wl_event_loop *loop; - if (!instance->GetFileDescriptor(instance, rfds, &rcount)) { - weston_log("Failed to get FreeRDP file descriptor\n"); + handle_count = instance->GetEventHandles(instance, handles, MAX_FREERDP_FDS); + if (!handle_count) { + weston_log("Failed to get FreeRDP handles\n"); return -1; } loop = wl_display_get_event_loop(b->compositor->wl_display); - for (i = 0; i < rcount; i++) { - fd = (int)(long)(rfds[i]); + for (i = 0; i < handle_count; i++) { + fd = GetEventFileDescriptor(handles[i]); b->listener_events[i] = wl_event_loop_add_fd(loop, fd, WL_EVENT_READABLE, rdp_listener_activity, instance); } @@ -1472,8 +1473,8 @@ xf_suppress_output(rdpContext *context, BYTE allow, const RECTANGLE_16 *area) static int rdp_peer_init(freerdp_peer *client, struct rdp_backend *b) { - int rcount = 0; - void *rfds[MAX_FREERDP_FDS + 1]; /* +1 for WTSVirtualChannelManagerGetFileDescriptor. */ + int handle_count = 0; + HANDLE handles[MAX_FREERDP_FDS + 1]; /* +1 for virtual channel */ int i, fd; struct wl_event_loop *loop; rdpSettings *settings; @@ -1530,8 +1531,9 @@ rdp_peer_init(freerdp_peer *client, struct rdp_backend *b) input->KeyboardEvent = xf_input_keyboard_event; input->UnicodeKeyboardEvent = xf_input_unicode_keyboard_event; - if (!client->GetFileDescriptor(client, rfds, &rcount)) { - weston_log("unable to retrieve client fds\n"); + handle_count = client->GetEventHandles(client, handles, MAX_FREERDP_FDS); + if (!handle_count) { + weston_log("unable to retrieve client handles\n"); goto error_initialize; } @@ -1539,14 +1541,14 @@ rdp_peer_init(freerdp_peer *client, struct rdp_backend *b) WTSRegisterWtsApiFunctionTable(fn); peerCtx->vcm = WTSOpenServerA((LPSTR)peerCtx); if (peerCtx->vcm) { - WTSVirtualChannelManagerGetFileDescriptor(peerCtx->vcm, rfds, &rcount); + handles[handle_count++] = WTSVirtualChannelManagerGetEventHandle(peerCtx->vcm); } else { weston_log("WTSOpenServer is failed! continue without virtual channel.\n"); } loop = wl_display_get_event_loop(b->compositor->wl_display); - for (i = 0; i < rcount; i++) { - fd = (int)(long)(rfds[i]); + for (i = 0; i < handle_count; i++) { + fd = GetEventFileDescriptor(handles[i]); peerCtx->events[i] = wl_event_loop_add_fd(loop, fd, WL_EVENT_READABLE, rdp_client_activity, client);