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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-08 16:11:26 +02:00
parent 9cc70cd9ff
commit fcb1bac94c

View File

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