Revert "randr: ProcRRListOutputProperties(): use SwapShort()/SwapLong()"

This reverts commit e3001b71b3.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2012>
This commit is contained in:
Alan Coopersmith 2025-06-11 13:38:12 -07:00
parent 8650028e59
commit 6a0c430b25

View File

@ -416,6 +416,7 @@ int
ProcRRListOutputProperties(ClientPtr client)
{
REQUEST(xRRListOutputPropertiesReq);
Atom *pAtoms = NULL;
int numProps = 0;
RROutputPtr output;
RRPropertyPtr prop;
@ -426,6 +427,9 @@ ProcRRListOutputProperties(ClientPtr client)
for (prop = output->properties; prop; prop = prop->next)
numProps++;
if (numProps)
if (!(pAtoms = xallocarray(numProps, sizeof(Atom))))
return BadAlloc;
xRRListOutputPropertiesReply rep = {
.type = X_Reply,
@ -438,25 +442,18 @@ ProcRRListOutputProperties(ClientPtr client)
swapl(&rep.length);
swaps(&rep.nAtoms);
}
WriteToClient(client, sizeof(xRRListOutputPropertiesReply), &rep);
Atom* pAtoms = calloc(sizeof(Atom), numProps);
if (numProps) {
if (!pAtoms)
return BadAlloc;
/* Copy property name atoms to reply buffer */
Atom *temppAtoms = pAtoms;
for (prop = output->properties; prop; prop = prop->next)
*temppAtoms++ = prop->propertyName;
if (client->swapped)
SwapLongs(pAtoms, numProps);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
free(pAtoms);
}
WriteToClient(client, sizeof(xRRListOutputPropertiesReply), &rep);
WriteToClient(client, sizeof(Atom) * numProps, pAtoms);
free(pAtoms);
return Success;
}