From fcb1bac94c54b95a4d2d96ad9cd6d2f35e771091 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 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/xf86bigfont.c | 56 +++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 36 deletions(-) diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c index ce01a81d0..8c1bd6b9d 100644 --- a/Xext/xf86bigfont.c +++ b/Xext/xf86bigfont.c @@ -268,8 +268,6 @@ ProcXF86BigfontQueryVersion(ClientPtr client) REQUEST_HEAD_STRUCT(xXF86BigfontQueryVersionReq); xXF86BigfontQueryVersionReply reply = { - .type = X_Reply, - .sequenceNumber = client->sequence, .majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION, .minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION, .uid = geteuid(), @@ -280,17 +278,12 @@ ProcXF86BigfontQueryVersion(ClientPtr client) ? XF86Bigfont_CAP_LocalShm : 0 #endif }; - if (client->swapped) { - swaps(&reply.sequenceNumber); - swapl(&reply.length); - swaps(&reply.majorVersion); - swaps(&reply.minorVersion); - swapl(&reply.uid); - swapl(&reply.gid); - swapl(&reply.signature); - } - WriteToClient(client, sizeof(xXF86BigfontQueryVersionReply), &reply); - return Success; + REPLY_FIELD_CARD16(&reply.majorVersion); + REPLY_FIELD_CARD16(&reply.minorVersion); + REPLY_FIELD_CARD32(&reply.uid); + REPLY_FIELD_CARD32(&reply.gid); + REPLY_FIELD_CARD32(&reply.signature); + REPLY_SEND_RET_SUCCESS(); } static void @@ -534,9 +527,7 @@ ProcXF86BigfontQueryFont(ClientPtr client) : 0); xXF86BigfontQueryFontReply rep = { - .type = X_Reply; .length = bytes_to_int32(buflength), - .sequenceNumber = client->sequence, .minBounds = pFont->info.ink_minbounds, .maxBounds = pFont->info.ink_maxbounds, .minCharOrByte2 = pFont->info.firstCol, @@ -554,21 +545,20 @@ ProcXF86BigfontQueryFont(ClientPtr client) .shmid = shmid, }; + REPLY_FIELD_CARD16(minCharOrByte2); + REPLY_FIELD_CARD16(maxCharOrByte2); + REPLY_FIELD_CARD16(defaultChar); + REPLY_FIELD_CARD16(nFontProps); + REPLY_FIELD_CARD16(fontAscent); + REPLY_FIELD_CARD16(fontDescent); + REPLY_FIELD_CARD32(nCharInfos); + REPLY_FIELD_CARD32(nUniqCharInfos); + REPLY_FIELD_CARD32(shmid); + REPLY_FIELD_CARD32(shmsegoffset); + if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); swapCharInfo(&rep.minBounds); swapCharInfo(&rep.maxBounds); - swaps(&rep.minCharOrByte2); - swaps(&rep.maxCharOrByte2); - swaps(&rep.defaultChar); - swaps(&rep.nFontProps); - swaps(&rep.fontAscent); - swaps(&rep.fontDescent); - swapl(&rep.nCharInfos); - swapl(&rep.nUniqCharInfos); - swapl(&rep.shmid); - swapl(&rep.shmsegoffset); } int rc = Success; @@ -589,10 +579,7 @@ ProcXF86BigfontQueryFont(ClientPtr client) i < nfontprops; i++, pFP++, prFP++) { prFP->name = pFP->name; prFP->value = pFP->value; - if (client->swapped) { - swapl(&prFP->name); - swapl(&prFP->value); - } + CLIENT_STRUCT_CARD32_2(prFP, name, value); } p = (char *) prFP; } @@ -610,14 +597,11 @@ ProcXF86BigfontQueryFont(ClientPtr client) ps = (CARD16 *) pci; for (j = 0; j < nCharInfos; j++, ps++) { *ps = pIndex2UniqIndex[j]; - if (client->swapped) { - swaps(ps); - } + REPLY_BUF_CARD16(ps, 1); } } - WriteToClient(client, sizeof(xXF86BigfontQueryFontReply), &rep); - WriteToClient(client, rlength, buf); + REPLY_SEND_EXTRA(buf, rlength); free(buf); out: if (nCharInfos > 0) {