From 0343cad62a893104723097044fe9625ab6c8a0e6 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 8 Jul 2024 15:20:03 +0200 Subject: [PATCH] Xext: xcmisc: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros Use the new macros to make request struct parsing / field swapping much easier. Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/xcmisc.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/Xext/xcmisc.c b/Xext/xcmisc.c index b9a19abd3c..ae1d2d9602 100644 --- a/Xext/xcmisc.c +++ b/Xext/xcmisc.c @@ -48,13 +48,9 @@ from The Open Group. static int ProcXCMiscGetVersion(ClientPtr client) { - REQUEST(xXCMiscGetVersionReq); - REQUEST_SIZE_MATCH(xXCMiscGetVersionReq); - - if (client->swapped) { - swaps(&stuff->majorVersion); - swaps(&stuff->minorVersion); - } + X_REQUEST_HEAD_STRUCT(xXCMiscGetVersionReq); + X_REQUEST_FIELD_CARD16(majorVersion); + X_REQUEST_FIELD_CARD16(minorVersion); xXCMiscGetVersionReply reply = { .majorVersion = XCMiscMajorVersion, @@ -72,7 +68,7 @@ ProcXCMiscGetVersion(ClientPtr client) static int ProcXCMiscGetXIDRange(ClientPtr client) { - REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq); + X_REQUEST_HEAD_STRUCT(xXCMiscGetXIDRangeReq); XID min_id, max_id; GetXIDRange(client->index, FALSE, &min_id, &max_id); @@ -92,11 +88,8 @@ ProcXCMiscGetXIDRange(ClientPtr client) static int ProcXCMiscGetXIDList(ClientPtr client) { - REQUEST(xXCMiscGetXIDListReq); - REQUEST_SIZE_MATCH(xXCMiscGetXIDListReq); - - if (client->swapped) - swapl(&stuff->count); + X_REQUEST_HEAD_STRUCT(xXCMiscGetXIDListReq); + X_REQUEST_FIELD_CARD32(count); if (stuff->count > UINT32_MAX / sizeof(XID)) return BadAlloc;