Revert "Xext: xf86bigfont: split reply header and payload"

This commit doesn't compile, but wasn't noticed since xf86bigfont
isn't enabled by default, so wasn't being built in our CI builds.
(The ".type = X_Reply;" line needs to end with a , not a ;)

This reverts commit b5a3ac9527.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2053>
This commit is contained in:
Alan Coopersmith 2025-08-10 09:05:19 -07:00
parent 061690c2e6
commit cbe118373d

View file

@ -530,59 +530,60 @@ ProcXF86BigfontQueryFont(ClientPtr client)
{ {
int nfontprops = pFont->info.nprops; int nfontprops = pFont->info.nprops;
int rlength = nfontprops * sizeof(xFontProp) int rlength = sizeof(xXF86BigfontQueryFontReply)
+ nfontprops * sizeof(xFontProp)
+ (nCharInfos > 0 && shmid == -1 + (nCharInfos > 0 && shmid == -1
? nUniqCharInfos * sizeof(xCharInfo) ? nUniqCharInfos * sizeof(xCharInfo)
+ (nCharInfos + 1) / 2 * 2 * sizeof(CARD16) + (nCharInfos + 1) / 2 * 2 * sizeof(CARD16)
: 0); : 0);
xXF86BigfontQueryFontReply *reply = calloc(1, rlength);
char *p;
xXF86BigfontQueryFontReply rep = { if (!reply) {
.type = X_Reply; if (nCharInfos > 0) {
.length = bytes_to_int32(buflength), if (shmid == -1)
.sequenceNumber = client->sequence, free(pIndex2UniqIndex);
.minBounds = pFont->info.ink_minbounds, if (!pDesc)
.maxBounds = pFont->info.ink_maxbounds, free(pCI);
.minCharOrByte2 = pFont->info.firstCol, }
.maxCharOrByte2 = pFont->info.lastCol, return BadAlloc;
.defaultChar = pFont->info.defaultCh, }
.nFontProps = pFont->info.nprops, reply->type = X_Reply;
.drawDirection = pFont->info.drawDirection, reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
.minByte1 = pFont->info.firstRow, reply->sequenceNumber = client->sequence;
.maxByte1 = pFont->info.lastRow, reply->minBounds = pFont->info.ink_minbounds;
.allCharsExist = pFont->info.allExist, reply->maxBounds = pFont->info.ink_maxbounds;
.fontAscent = pFont->info.fontAscent, reply->minCharOrByte2 = pFont->info.firstCol;
.fontDescent = pFont->info.fontDescent, reply->maxCharOrByte2 = pFont->info.lastCol;
.nCharInfos = nCharInfos, reply->defaultChar = pFont->info.defaultCh;
.nUniqCharInfos = nUniqCharInfos, reply->nFontProps = pFont->info.nprops;
.shmid = shmid, reply->drawDirection = pFont->info.drawDirection;
}; reply->minByte1 = pFont->info.firstRow;
reply->maxByte1 = pFont->info.lastRow;
reply->allCharsExist = pFont->info.allExist;
reply->fontAscent = pFont->info.fontAscent;
reply->fontDescent = pFont->info.fontDescent;
reply->nCharInfos = nCharInfos;
reply->nUniqCharInfos = nUniqCharInfos;
reply->shmid = shmid;
reply->shmsegoffset = 0;
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&reply->sequenceNumber);
swapl(&rep.length); swapl(&reply->length);
swapCharInfo(&rep.minBounds); swapCharInfo(&reply->minBounds);
swapCharInfo(&rep.maxBounds); swapCharInfo(&reply->maxBounds);
swaps(&rep.minCharOrByte2); swaps(&reply->minCharOrByte2);
swaps(&rep.maxCharOrByte2); swaps(&reply->maxCharOrByte2);
swaps(&rep.defaultChar); swaps(&reply->defaultChar);
swaps(&rep.nFontProps); swaps(&reply->nFontProps);
swaps(&rep.fontAscent); swaps(&reply->fontAscent);
swaps(&rep.fontDescent); swaps(&reply->fontDescent);
swapl(&rep.nCharInfos); swapl(&reply->nCharInfos);
swapl(&rep.nUniqCharInfos); swapl(&reply->nUniqCharInfos);
swapl(&rep.shmid); swapl(&reply->shmid);
swapl(&rep.shmsegoffset); swapl(&reply->shmsegoffset);
} }
p = (char *) &reply[1];
int rc = Success;
char *buf = calloc(1, rlength);
if (!buf) {
rc = BadAlloc;
goto out;
}
char *p = buf;
{ {
FontPropPtr pFP; FontPropPtr pFP;
xFontProp *prFP; xFontProp *prFP;
@ -618,18 +619,15 @@ ProcXF86BigfontQueryFont(ClientPtr client)
} }
} }
} }
WriteToClient(client, rlength, reply);
WriteToClient(client, sizeof(xXF86BigfontQueryFontReply), &rep); free(reply);
WriteToClient(client, rlength, buf);
free(buf);
out:
if (nCharInfos > 0) { if (nCharInfos > 0) {
if (shmid == -1) if (shmid == -1)
free(pIndex2UniqIndex); free(pIndex2UniqIndex);
if (!pDesc) if (!pDesc)
free(pCI); free(pCI);
} }
return rc; return Success;
} }
} }