From 37c5d6bff2f3f5a540015dc706ed3e280de2020f Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 1 Apr 2025 11:19:05 +0200 Subject: [PATCH] XI: directly write out X_GetDeviceModifierMapping reply Write out X_GetDeviceModifierMapping 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 | 5 +---- Xi/getmmap.c | 22 +++++----------------- Xi/getmmap.h | 5 ----- 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/Xi/extinit.c b/Xi/extinit.c index fe1a5778f..6523dcb6f 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -421,10 +421,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_GetDeviceModifierMapping) - SRepXGetDeviceModifierMapping(client, len, - (xGetDeviceModifierMappingReply *) rep); - else if (rep->RepType == X_SetDeviceModifierMapping) + if (rep->RepType == X_SetDeviceModifierMapping) SRepXSetDeviceModifierMapping(client, len, (xSetDeviceModifierMappingReply *) rep); else if (rep->RepType == X_GetDeviceButtonMapping) diff --git a/Xi/getmmap.c b/Xi/getmmap.c index ac75e83a5..dea7f8254 100644 --- a/Xi/getmmap.c +++ b/Xi/getmmap.c @@ -92,26 +92,14 @@ ProcXGetDeviceModifierMapping(ClientPtr client) .length = max_keys_per_mod << 1 }; - WriteReplyToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep); + if (client->swapped) { + swaps(&rep.sequenceNumber); + swapl(&rep.length); + } + WriteToClient(client, sizeof(xGetDeviceModifierMappingReply), &rep); WriteToClient(client, max_keys_per_mod * 8, modkeymap); free(modkeymap); return Success; } - -/*********************************************************************** - * - * This procedure writes the reply for the XGetDeviceModifierMapping function, - * if the client and server have a different byte ordering. - * - */ - -void _X_COLD -SRepXGetDeviceModifierMapping(ClientPtr client, int size, - xGetDeviceModifierMappingReply * rep) -{ - swaps(&rep->sequenceNumber); - swapl(&rep->length); - WriteToClient(client, size, rep); -} diff --git a/Xi/getmmap.h b/Xi/getmmap.h index 7512188ec..feef7c505 100644 --- a/Xi/getmmap.h +++ b/Xi/getmmap.h @@ -33,9 +33,4 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. int ProcXGetDeviceModifierMapping(ClientPtr /* client */ ); -void SRepXGetDeviceModifierMapping(ClientPtr /* client */ , - int /* size */ , - xGetDeviceModifierMappingReply * /* rep */ - ); - #endif /* GETMMAP_H */