summaryrefslogtreecommitdiff
path: root/randr/rrcrtc.c
diff options
context:
space:
mode:
authorJulien Cristau <jcristau@debian.org>2008-08-21 01:32:03 +0200
committerJulien Cristau <jcristau@debian.org>2008-08-21 09:24:02 +0200
commit01264f17925005969c3b71ca945fc1014bcd8c8e (patch)
tree7caeee6cafbbd138380b6c257677a5f54239a90a /randr/rrcrtc.c
parente02f864fdf19a5ab1682336be343c57fdb69ef43 (diff)
Add swapped dispatch for randr 1.2 requests
Diffstat (limited to 'randr/rrcrtc.c')
-rw-r--r--randr/rrcrtc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 7c22437a9..ec65a040e 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -894,6 +894,7 @@ ProcRRGetCrtcGamma (ClientPtr client)
RRCrtcPtr crtc;
int n;
unsigned long len;
+ char *extra;
REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
crtc = LookupCrtc (client, stuff->crtc, DixReadAccess);
@@ -902,6 +903,12 @@ ProcRRGetCrtcGamma (ClientPtr client)
len = crtc->gammaSize * 3 * 2;
+ if (crtc->gammaSize) {
+ extra = xalloc(len);
+ if (!extra)
+ return BadAlloc;
+ }
+
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.length = (len + 3) >> 2;
@@ -914,8 +921,10 @@ ProcRRGetCrtcGamma (ClientPtr client)
WriteToClient (client, sizeof (xRRGetCrtcGammaReply), (char *) &reply);
if (crtc->gammaSize)
{
+ memcpy(extra, crtc->gammaRed, len);
client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write;
- WriteSwappedDataToClient (client, len, (char *) crtc->gammaRed);
+ WriteSwappedDataToClient (client, len, extra);
+ xfree(extra);
}
return client->noClientException;
}