Revert "randr: ProcRRGetCrtcTransform(): split reply header and payload"

This reverts commit c6f1b8a735.
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-02-27 10:45:01 +01:00
parent 94ddca562a
commit 4132f66be6

View File

@ -1755,6 +1755,8 @@ ProcRRSetCrtcTransform(ClientPtr client)
filter, nbytes, params, nparams);
}
#define CrtcTransformExtra (SIZEOF(xRRGetCrtcTransformReply) - 32)
static int
transform_filter_length(RRTransformPtr transform)
{
@ -1809,9 +1811,11 @@ int
ProcRRGetCrtcTransform(ClientPtr client)
{
REQUEST(xRRGetCrtcTransformReq);
xRRGetCrtcTransformReply *reply;
RRCrtcPtr crtc;
int nextra;
RRTransformPtr current, pending;
char *extra;
REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq);
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
@ -1822,36 +1826,33 @@ ProcRRGetCrtcTransform(ClientPtr client)
nextra = (transform_filter_length(pending) +
transform_filter_length(current));
char *extra_buf = calloc(1, nextra);
if (!extra_buf)
reply = calloc(1, sizeof(xRRGetCrtcTransformReply) + nextra);
if (!reply)
return BadAlloc;
char *extra = extra_buf;
extra = (char *) (reply + 1);
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
reply->length = bytes_to_int32(CrtcTransformExtra + nextra);
xRRGetCrtcTransformReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(sizeof(xRRGetCrtcTransformReply) - sizeof(xReq)),
.hasTransforms = crtc->transforms,
};
reply->hasTransforms = crtc->transforms;
transform_encode(client, &rep.pendingTransform, &pending->transform);
transform_encode(client, &reply->pendingTransform, &pending->transform);
extra += transform_filter_encode(client, extra,
&rep.pendingNbytesFilter,
&rep.pendingNparamsFilter, pending);
&reply->pendingNbytesFilter,
&reply->pendingNparamsFilter, pending);
transform_encode(client, &rep.currentTransform, &current->transform);
transform_encode(client, &reply->currentTransform, &current->transform);
extra += transform_filter_encode(client, extra,
&rep.currentNbytesFilter,
&rep.currentNparamsFilter, current);
&reply->currentNbytesFilter,
&reply->currentNparamsFilter, current);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&reply->sequenceNumber);
swapl(&reply->length);
}
WriteToClient(client, sizeof(xRRGetCrtcTransformReply), &rep);
WriteToClient(client, nextra, extra_buf);
free(extra_buf);
WriteToClient(client, sizeof(xRRGetCrtcTransformReply) + nextra, reply);
free(reply);
return Success;
}