aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/randr/rrmode.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/randr/rrmode.c')
-rw-r--r--xorg-server/randr/rrmode.c46
1 files changed, 9 insertions, 37 deletions
diff --git a/xorg-server/randr/rrmode.c b/xorg-server/randr/rrmode.c
index 2fa440385..9642ddae3 100644
--- a/xorg-server/randr/rrmode.c
+++ b/xorg-server/randr/rrmode.c
@@ -288,7 +288,7 @@ ProcRRCreateMode (ClientPtr client)
RRModePtr mode;
REQUEST_AT_LEAST_SIZE (xRRCreateModeReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -297,10 +297,10 @@ ProcRRCreateMode (ClientPtr client)
modeInfo = &stuff->modeInfo;
name = (char *) (stuff + 1);
- units_after = (stuff->length - (sizeof (xRRCreateModeReq) >> 2));
+ units_after = (stuff->length - bytes_to_int32(sizeof (xRRCreateModeReq)));
/* check to make sure requested name fits within the data provided */
- if ((int) (modeInfo->nameLength + 3) >> 2 > units_after)
+ if (bytes_to_int32(modeInfo->nameLength) > units_after)
return BadLength;
mode = RRModeCreateUser (pScreen, modeInfo, name, &error);
@@ -332,12 +332,8 @@ ProcRRDestroyMode (ClientPtr client)
RRModePtr mode;
REQUEST_SIZE_MATCH(xRRDestroyModeReq);
- mode = LookupIDByType (stuff->mode, RRModeType);
- if (!mode)
- {
- client->errorValue = stuff->mode;
- return RRErrorBase + BadRRMode;
- }
+ VERIFY_RR_MODE(stuff->mode, mode, DixDestroyAccess);
+
if (!mode->userScreen)
return BadMatch;
if (mode->refcnt > 1)
@@ -354,20 +350,8 @@ ProcRRAddOutputMode (ClientPtr client)
RROutputPtr output;
REQUEST_SIZE_MATCH(xRRAddOutputModeReq);
- output = LookupOutput(client, stuff->output, DixReadAccess);
-
- if (!output)
- {
- client->errorValue = stuff->output;
- return RRErrorBase + BadRROutput;
- }
-
- mode = LookupIDByType (stuff->mode, RRModeType);
- if (!mode)
- {
- client->errorValue = stuff->mode;
- return RRErrorBase + BadRRMode;
- }
+ VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
+ VERIFY_RR_MODE(stuff->mode, mode, DixUseAccess);
return RROutputAddUserMode (output, mode);
}
@@ -380,20 +364,8 @@ ProcRRDeleteOutputMode (ClientPtr client)
RROutputPtr output;
REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq);
- output = LookupOutput(client, stuff->output, DixReadAccess);
-
- if (!output)
- {
- client->errorValue = stuff->output;
- return RRErrorBase + BadRROutput;
- }
-
- mode = LookupIDByType (stuff->mode, RRModeType);
- if (!mode)
- {
- client->errorValue = stuff->mode;
- return RRErrorBase + BadRRMode;
- }
+ VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
+ VERIFY_RR_MODE(stuff->mode, mode, DixUseAccess);
return RROutputDeleteUserMode (output, mode);
}