From f883454de362b6f6cebb84fb8692576b8e96fcc0 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 31 Mar 2025 14:29:03 +0200 Subject: [PATCH] (1886) XI: directly write out X_ListInputDevices reply Write out X_ListInputDevices the reply directly (and do the swapping within the request handler) instead of going through separate callback that's having demux the replies again. Signed-off-by: Enrico Weigelt, metux IT consult --- Xi/extinit.c | 4 +--- Xi/listdev.c | 23 +++++++---------------- Xi/listdev.h | 5 ----- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index 405320452..6567bb4e8 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -422,9 +422,7 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) { /* All we look at is the type field */ /* This is common to all replies */ - if (rep->RepType == X_ListInputDevices) - SRepXListInputDevices(client, len, (xListInputDevicesReply *) rep); - else if (rep->RepType == X_OpenDevice) + if (rep->RepType == X_OpenDevice) SRepXOpenDevice(client, len, (xOpenDeviceReply *) rep); else if (rep->RepType == X_SetDeviceMode) SRepXSetDeviceMode(client, len, (xSetDeviceModeReply *) rep); diff --git a/Xi/listdev.c b/Xi/listdev.c index 8d7381893..5be4a8f74 100644 --- a/Xi/listdev.c +++ b/Xi/listdev.c @@ -384,24 +384,15 @@ ProcXListInputDevices(ClientPtr client) } rep.ndevices = numdevs; rep.length = bytes_to_int32(total_length); - WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep); + + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + } + + WriteToClient(client, sizeof(xListInputDevicesReply), &rep); WriteToClient(client, total_length, savbuf); free(savbuf); free(skip); return Success; } - -/*********************************************************************** - * - * This procedure writes the reply for the XListInputDevices function, - * if the client and server have a different byte ordering. - * - */ - -void _X_COLD -SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep) -{ - swaps(&rep->sequenceNumber); - swapl(&rep->length); - WriteToClient(client, size, rep); -} diff --git a/Xi/listdev.h b/Xi/listdev.h index c8f91796d..65a62220d 100644 --- a/Xi/listdev.h +++ b/Xi/listdev.h @@ -35,9 +35,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. int ProcXListInputDevices(ClientPtr /* client */ ); -void SRepXListInputDevices(ClientPtr /* client */ , - int /* size */ , - xListInputDevicesReply * /* rep */ - ); - #endif /* LISTDEV_H */