From 8ff401cde1ce5ffc248c587a97b2e76ec86e396d Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 8 Jul 2024 17:23:43 +0200 Subject: [PATCH] Xext: xres: 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/xres.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/Xext/xres.c b/Xext/xres.c index da2249baad..c6997142ae 100644 --- a/Xext/xres.c +++ b/Xext/xres.c @@ -201,7 +201,7 @@ ProcXResQueryVersion(ClientPtr client) static int ProcXResQueryClients(ClientPtr client) { - REQUEST_SIZE_MATCH(xXResQueryClientsReq); + X_REQUEST_HEAD_STRUCT(xXResQueryClientsReq); x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE }; @@ -256,11 +256,8 @@ resourceTypeAtom(int i) static int ProcXResQueryClientResources(ClientPtr client) { - REQUEST(xXResQueryClientResourcesReq); - REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq); - - if (client->swapped) - swapl(&stuff->xid); + X_REQUEST_HEAD_STRUCT(xXResQueryClientResourcesReq); + X_REQUEST_FIELD_CARD32(xid); ClientPtr resClient = dixClientForXID(stuff->xid); @@ -319,11 +316,8 @@ ResFindResourcePixmaps(void *value, XID id, RESTYPE type, void *cdata) static int ProcXResQueryClientPixmapBytes(ClientPtr client) { - REQUEST(xXResQueryClientPixmapBytesReq); - REQUEST_SIZE_MATCH(xXResQueryClientPixmapBytesReq); - - if (client->swapped) - swapl(&stuff->xid); + X_REQUEST_HEAD_STRUCT(xXResQueryClientPixmapBytesReq); + X_REQUEST_FIELD_CARD32(xid); ClientPtr owner = dixClientForXID(stuff->xid); if ((!owner) || @@ -507,11 +501,8 @@ ConstructClientIds(ClientPtr client, static int ProcXResQueryClientIds (ClientPtr client) { - REQUEST(xXResQueryClientIdsReq); - REQUEST_AT_LEAST_SIZE(xXResQueryClientIdsReq); - - if (client->swapped) - swapl(&stuff->numSpecs); + X_REQUEST_HEAD_AT_LEAST(xXResQueryClientIdsReq); + X_REQUEST_FIELD_CARD32(numSpecs); REQUEST_FIXED_SIZE(xXResQueryClientIdsReq, (uint64_t)stuff->numSpecs * sizeof(xXResClientIdSpec)); @@ -878,12 +869,8 @@ ConstructResourceBytes(XID aboutClient, static int ProcXResQueryResourceBytes (ClientPtr client) { - REQUEST(xXResQueryResourceBytesReq); - REQUEST_AT_LEAST_SIZE(xXResQueryResourceBytesReq); - - if (client->swapped) { - swapl(&stuff->numSpecs); - } + X_REQUEST_HEAD_AT_LEAST(xXResQueryResourceBytesReq); + X_REQUEST_FIELD_CARD32(numSpecs); REQUEST_FIXED_SIZE(xXResQueryResourceBytesReq, ((uint64_t)stuff->numSpecs) * sizeof(xXResResourceIdSpec));