diff options
Diffstat (limited to 'xorg-server/randr/rrproperty.c')
-rw-r--r-- | xorg-server/randr/rrproperty.c | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/xorg-server/randr/rrproperty.c b/xorg-server/randr/rrproperty.c index 12923a2c7..6187b855f 100644 --- a/xorg-server/randr/rrproperty.c +++ b/xorg-server/randr/rrproperty.c @@ -31,7 +31,8 @@ DeliverPropertyEvent(WindowPtr pWin, void *value) RREventPtr *pHead, pRREvent; ClientPtr client; - pHead = LookupIDByType(pWin->drawable.id, RREventType); + dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id, + RREventType, serverClient, DixReadAccess); if (!pHead) return WT_WALKCHILDREN; @@ -419,10 +420,7 @@ ProcRRListOutputProperties (ClientPtr client) REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq); - output = LookupOutput (client, stuff->output, DixReadAccess); - - if (!output) - return RRErrorBase + BadRROutput; + VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); for (prop = output->properties; prop; prop = prop->next) numProps++; @@ -431,7 +429,7 @@ ProcRRListOutputProperties (ClientPtr client) return(BadAlloc); rep.type = X_Reply; - rep.length = (numProps * sizeof(Atom)) >> 2; + rep.length = bytes_to_int32(numProps * sizeof(Atom)); rep.sequenceNumber = client->sequence; rep.nAtoms = numProps; if (client->swapped) @@ -466,10 +464,7 @@ ProcRRQueryOutputProperty (ClientPtr client) REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq); - output = LookupOutput (client, stuff->output, DixReadAccess); - - if (!output) - return RRErrorBase + BadRROutput; + VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); prop = RRQueryOutputProperty (output, stuff->property); if (!prop) @@ -513,12 +508,9 @@ ProcRRConfigureOutputProperty (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq); - output = LookupOutput (client, stuff->output, DixReadAccess); - - if (!output) - return RRErrorBase + BadRROutput; + VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); - num_valid = stuff->length - (sizeof (xRRConfigureOutputPropertyReq) >> 2); + num_valid = stuff->length - bytes_to_int32(sizeof (xRRConfigureOutputPropertyReq)); return RRConfigureOutputProperty (output, stuff->property, stuff->pending, stuff->range, FALSE, num_valid, @@ -552,15 +544,13 @@ ProcRRChangeOutputProperty (ClientPtr client) return BadValue; } len = stuff->nUnits; - if (len > ((0xffffffff - sizeof(xChangePropertyReq)) >> 2)) + if (len > bytes_to_int32((0xffffffff - sizeof(xChangePropertyReq)))) return BadLength; sizeInBytes = format>>3; totalSize = len * sizeInBytes; REQUEST_FIXED_SIZE(xRRChangeOutputPropertyReq, totalSize); - output = LookupOutput (client, stuff->output, DixWriteAccess); - if (!output) - return RRErrorBase + BadRROutput; + VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); if (!ValidAtom(stuff->property)) { @@ -590,9 +580,7 @@ ProcRRDeleteOutputProperty (ClientPtr client) REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq); UpdateCurrentTime(); - output = LookupOutput (client, stuff->output, DixWriteAccess); - if (!output) - return RRErrorBase + BadRROutput; + VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); if (!ValidAtom(stuff->property)) { @@ -619,11 +607,8 @@ ProcRRGetOutputProperty (ClientPtr client) REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq); if (stuff->delete) UpdateCurrentTime(); - output = LookupOutput (client, stuff->output, - stuff->delete ? DixWriteAccess : - DixReadAccess); - if (!output) - return RRErrorBase + BadRROutput; + VERIFY_RR_OUTPUT(stuff->output, output, + stuff->delete ? DixWriteAccess : DixReadAccess); if (!ValidAtom(stuff->property)) { @@ -723,7 +708,7 @@ ProcRRGetOutputProperty (ClientPtr client) } reply.bytesAfter = n - (ind + len); reply.format = prop_value->format; - reply.length = (len + 3) >> 2; + reply.length = bytes_to_int32(len); if (prop_value->format) reply.nItems = len / (prop_value->format / 8); else |