From 428855b0dfe01990733501a52d97d9146b35e677 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Tue, 2 Jul 2024 17:51:56 +0200 Subject: [PATCH] Xext: dpms: use REPLY_*() macros for preparing / sending replies Use the new macros for preparing and sending replies to clients. Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/dpms.c | 48 ++++++++++-------------------------------------- 1 file changed, 10 insertions(+), 38 deletions(-) diff --git a/Xext/dpms.c b/Xext/dpms.c index aff847668..ea04ebcbb 100644 --- a/Xext/dpms.c +++ b/Xext/dpms.c @@ -302,20 +302,13 @@ ProcDPMSGetVersion(ClientPtr client) REQUEST_FIELD_CARD16(minorVersion); xDPMSGetVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, .majorVersion = SERVER_DPMS_MAJOR_VERSION, .minorVersion = SERVER_DPMS_MINOR_VERSION }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swaps(&rep.majorVersion); - swaps(&rep.minorVersion); - } - WriteToClient(client, sizeof(xDPMSGetVersionReply), &rep); - return Success; + REPLY_FIELD_CARD16(majorVersion); + REPLY_FIELD_CARD16(minorVersion); + REPLY_SEND_RET_SUCCESS(); } static int @@ -324,17 +317,10 @@ ProcDPMSCapable(ClientPtr client) REQUEST_HEAD_STRUCT(xDPMSCapableReq); xDPMSCapableReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, .capable = TRUE }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - } - WriteToClient(client, sizeof(xDPMSCapableReply), &rep); - return Success; + REPLY_SEND_RET_SUCCESS(); } static int @@ -343,22 +329,15 @@ ProcDPMSGetTimeouts(ClientPtr client) REQUEST_HEAD_STRUCT(xDPMSGetTimeoutsReq); xDPMSGetTimeoutsReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, .standby = DPMSStandbyTime / MILLI_PER_SECOND, .suspend = DPMSSuspendTime / MILLI_PER_SECOND, .off = DPMSOffTime / MILLI_PER_SECOND }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swaps(&rep.standby); - swaps(&rep.suspend); - swaps(&rep.off); - } - WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), &rep); - return Success; + REPLY_FIELD_CARD16(standby); + REPLY_FIELD_CARD16(suspend); + REPLY_FIELD_CARD16(off); + REPLY_SEND_RET_SUCCESS(); } static int @@ -445,19 +424,12 @@ ProcDPMSInfo(ClientPtr client) REQUEST_HEAD_STRUCT(xDPMSInfoReq); xDPMSInfoReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, .power_level = DPMSPowerLevel, .state = DPMSEnabled }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swaps(&rep.power_level); - } - WriteToClient(client, sizeof(xDPMSInfoReply), &rep); - return Success; + REPLY_FIELD_CARD16(power_level); + REPLY_SEND_RET_SUCCESS(); } static int