From 9cc70cd9ff412ca05080f13ea2fc7bf7a04a21cd Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 8 Jul 2024 16:11:26 +0200 Subject: [PATCH] Xext: xf86bigfont: 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/xf86bigfont.c | 40 +++++----------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c index 82a212171..ce01a81d0 100644 --- a/Xext/xf86bigfont.c +++ b/Xext/xf86bigfont.c @@ -265,7 +265,7 @@ XF86BigfontResetProc(ExtensionEntry * extEntry) static int ProcXF86BigfontQueryVersion(ClientPtr client) { - REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq); + REQUEST_HEAD_STRUCT(xXF86BigfontQueryVersionReq); xXF86BigfontQueryVersionReply reply = { .type = X_Reply, @@ -314,9 +314,10 @@ swapCharInfo(xCharInfo * pCI) static int ProcXF86BigfontQueryFont(ClientPtr client) { - FontPtr pFont; + REQUEST_HEAD_NO_CHECK(xXF86BigfontQueryFontReq); + REQUEST_FIELD_CARD32(id); - REQUEST(xXF86BigfontQueryFontReq); + FontPtr pFont; CARD32 stuff_flags; xCharInfo *pmax; xCharInfo *pmin; @@ -644,37 +645,6 @@ ProcXF86BigfontDispatch(ClientPtr client) } } -static int _X_COLD -SProcXF86BigfontQueryVersion(ClientPtr client) -{ - REQUEST(xXF86BigfontQueryVersionReq); - return ProcXF86BigfontQueryVersion(client); -} - -static int _X_COLD -SProcXF86BigfontQueryFont(ClientPtr client) -{ - REQUEST(xXF86BigfontQueryFontReq); - REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq); - swapl(&stuff->id); - return ProcXF86BigfontQueryFont(client); -} - -static int _X_COLD -SProcXF86BigfontDispatch(ClientPtr client) -{ - REQUEST(xReq); - - switch (stuff->data) { - case X_XF86BigfontQueryVersion: - return SProcXF86BigfontQueryVersion(client); - case X_XF86BigfontQueryFont: - return SProcXF86BigfontQueryFont(client); - default: - return BadRequest; - } -} - void XFree86BigfontExtensionInit(void) { @@ -682,7 +652,7 @@ XFree86BigfontExtensionInit(void) XF86BigfontNumberEvents, XF86BigfontNumberErrors, ProcXF86BigfontDispatch, - SProcXF86BigfontDispatch, + ProcXF86BigfontDispatch, XF86BigfontResetProc, StandardMinorOpcode)) { #ifdef MITSHM #ifdef MUST_CHECK_FOR_SHM_SYSCALL