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