From 5fd2c1c70af82a8e31e04e046a2ab48191db9df5 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 4 Apr 2025 16:18:56 +0200 Subject: [PATCH] dix: write out X_GetScreenSaver reply directly No need for using a complex callback machinery, if we just move the little pieces of byte-swapping directly into the request handler. Signed-off-by: Enrico Weigelt, metux IT consult --- dix/dispatch.c | 11 ++++++++--- dix/swaprep.c | 9 --------- dix/tables.c | 2 +- include/swaprep.h | 4 ---- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/dix/dispatch.c b/dix/dispatch.c index b03e6405c..d7deddacc 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3299,7 +3299,6 @@ ProcSetScreenSaver(ClientPtr client) int ProcGetScreenSaver(ClientPtr client) { - xGetScreenSaverReply rep; int rc, i; REQUEST_SIZE_MATCH(xReq); @@ -3311,7 +3310,7 @@ ProcGetScreenSaver(ClientPtr client) return rc; } - rep = (xGetScreenSaverReply) { + xGetScreenSaverReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, @@ -3320,7 +3319,13 @@ ProcGetScreenSaver(ClientPtr client) .preferBlanking = ScreenSaverBlanking, .allowExposures = ScreenSaverAllowExposures }; - WriteReplyToClient(client, sizeof(xGetScreenSaverReply), &rep); + + if (client->swapped) { + swaps(&rep.sequenceNumber); + swaps(&rep.timeout); + swaps(&rep.interval); + } + WriteToClient(client, sizeof(rep), &rep); return Success; } diff --git a/dix/swaprep.c b/dix/swaprep.c index a5b159eab..2e90b8aea 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -318,15 +318,6 @@ SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply * pRep) WriteToClient(pClient, size, pRep); } -void _X_COLD -SGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply * pRep) -{ - swaps(&pRep->sequenceNumber); - swaps(&pRep->timeout); - swaps(&pRep->interval); - WriteToClient(pClient, size, pRep); -} - void _X_COLD SLHostsExtend(ClientPtr pClient, int size, char *buf) { diff --git a/dix/tables.c b/dix/tables.c index ef8749517..b91922e8c 100644 --- a/dix/tables.c +++ b/dix/tables.c @@ -823,7 +823,7 @@ ReplySwapPtr ReplySwapVector[256] = { ReplyNotSwappd, /* 105 */ ReplyNotSwappd, ReplyNotSwappd, - (ReplySwapPtr) SGetScreenSaverReply, + ReplyNotSwappd, ReplyNotSwappd, (ReplySwapPtr) SListHostsReply, /* 110 */ ReplyNotSwappd, diff --git a/include/swaprep.h b/include/swaprep.h index 78ce01ba6..32aed61bc 100644 --- a/include/swaprep.h +++ b/include/swaprep.h @@ -72,10 +72,6 @@ extern void SListExtensionsReply(ClientPtr /* pClient */ , int /* size */ , xListExtensionsReply * /* pRep */ ); -extern void SGetScreenSaverReply(ClientPtr /* pClient */ , - int /* size */ , - xGetScreenSaverReply * /* pRep */ ); - extern void SLHostsExtend(ClientPtr /* pClient */ , int /* size */ , char * /* buf */ );