summaryrefslogtreecommitdiff
path: root/randr
diff options
context:
space:
mode:
authorJoel Bosveld <joel.bosveld@gmail.com>2009-09-08 23:06:00 +0800
committerJoel Bosveld <joel.bosveld@gmail.com>2009-09-08 23:55:13 +0800
commit1ba17340a98a34b40f78442963aa4132e6cfae5c (patch)
treed11d814844e4ad037d146133250b73f28cdb3e31 /randr
parent5e38708c3466129c3e5af40a915c044bb26e083f (diff)
parent1bdc9ec617d357b076c9e69296018bc212d91c7d (diff)
Merge branch 'upstream' (one day I will rebase rather than merge)HEADmaster
Conflicts: test/Makefile.am
Diffstat (limited to 'randr')
-rw-r--r--randr/rrcrtc.c14
-rw-r--r--randr/rrmode.c6
-rw-r--r--randr/rroutput.c8
-rw-r--r--randr/rrproperty.c8
-rw-r--r--randr/rrscreen.c16
-rw-r--r--randr/rrsdispatch.c4
-rw-r--r--randr/rrxinerama.c2
7 files changed, 29 insertions, 29 deletions
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 32a09922b..0e14b36dd 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -775,7 +775,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
int rc, i, j;
REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
- numOutputs = (stuff->length - (SIZEOF (xRRSetCrtcConfigReq) >> 2));
+ numOutputs = (stuff->length - bytes_to_int32(SIZEOF (xRRSetCrtcConfigReq)));
VERIFY_RR_CRTC(stuff->crtc, crtc, DixSetAttrAccess);
@@ -1205,7 +1205,7 @@ ProcRRGetCrtcGamma (ClientPtr client)
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
- reply.length = (len + 3) >> 2;
+ reply.length = bytes_to_int32(len);
reply.size = crtc->gammaSize;
if (client->swapped) {
swaps (&reply.sequenceNumber, n);
@@ -1234,7 +1234,7 @@ ProcRRSetCrtcGamma (ClientPtr client)
REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq);
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
- len = client->req_len - (sizeof (xRRSetCrtcGammaReq) >> 2);
+ len = client->req_len - bytes_to_int32(sizeof (xRRSetCrtcGammaReq));
if (len < (stuff->size * 3 + 1) >> 1)
return BadLength;
@@ -1274,7 +1274,7 @@ ProcRRSetCrtcTransform (ClientPtr client)
filter = (char *) (stuff + 1);
nbytes = stuff->nbytesFilter;
- params = (xFixed *) (filter + ((nbytes + 3) & ~3));
+ params = (xFixed *) (filter + pad_to_int32(nbytes));
nparams = ((xFixed *) stuff + client->req_len) - params;
if (nparams < 0)
return BadLength;
@@ -1295,7 +1295,7 @@ transform_filter_length (RRTransformPtr transform)
return 0;
nbytes = strlen (transform->filter->name);
nparams = transform->nparams;
- return ((nbytes + 3) & ~3) + (nparams * sizeof (xFixed));
+ return pad_to_int32(nbytes) + (nparams * sizeof (xFixed));
}
static int
@@ -1334,7 +1334,7 @@ transform_encode (ClientPtr client, xRenderTransform *wire, PictTransform *pict)
{
xRenderTransform_from_PictTransform (wire, pict);
if (client->swapped)
- SwapLongs ((CARD32 *) wire, sizeof (xRenderTransform) >> 2);
+ SwapLongs ((CARD32 *) wire, bytes_to_int32(sizeof(xRenderTransform)));
}
int
@@ -1363,7 +1363,7 @@ ProcRRGetCrtcTransform (ClientPtr client)
extra = (char *) (reply + 1);
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
- reply->length = (CrtcTransformExtra + nextra) >> 2;
+ reply->length = bytes_to_int32(CrtcTransformExtra + nextra);
reply->hasTransforms = crtc->transforms;
diff --git a/randr/rrmode.c b/randr/rrmode.c
index 2a1007662..9642ddae3 100644
--- a/randr/rrmode.c
+++ b/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);
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 127497eb8..2eff8c183 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -455,7 +455,7 @@ ProcRRGetOutputInfo (ClientPtr client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
- rep.length = OutputInfoExtra >> 2;
+ rep.length = bytes_to_int32(OutputInfoExtra);
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
rep.crtc = output->crtc ? output->crtc->id : None;
rep.mmWidth = output->mmWidth;
@@ -468,14 +468,14 @@ ProcRRGetOutputInfo (ClientPtr client)
rep.nClones = output->numClones;
rep.nameLength = output->nameLength;
- extraLen = ((output->numCrtcs +
+ extraLen = ((output->numCrtcs +
output->numModes + output->numUserModes +
output->numClones +
- ((rep.nameLength + 3) >> 2)) << 2);
+ bytes_to_int32(rep.nameLength)) << 2);
if (extraLen)
{
- rep.length += extraLen >> 2;
+ rep.length += bytes_to_int32(extraLen);
extra = xalloc (extraLen);
if (!extra)
return BadAlloc;
diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 775d9e29f..6187b855f 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -429,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)
@@ -510,7 +510,7 @@ ProcRRConfigureOutputProperty (ClientPtr client)
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,
@@ -544,7 +544,7 @@ 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;
@@ -708,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
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index a919ffdad..630ff5742 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -210,7 +210,7 @@ ProcRRGetScreenSizeRange (ClientPtr client)
int rc;
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -261,7 +261,7 @@ ProcRRSetScreenSize (ClientPtr client)
int i, rc;
REQUEST_SIZE_MATCH(xRRSetScreenSizeReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -331,7 +331,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
CARD8 *names;
REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -381,8 +381,8 @@ rrGetScreenResources(ClientPtr client, Bool query)
rep.length = (pScrPriv->numCrtcs +
pScrPriv->numOutputs +
- num_modes * (SIZEOF(xRRModeInfo) >> 2) +
- ((rep.nbytesNames + 3) >> 2));
+ num_modes * bytes_to_int32(SIZEOF(xRRModeInfo)) +
+ bytes_to_int32(rep.nbytesNames));
extraLen = rep.length << 2;
if (extraLen)
@@ -455,7 +455,7 @@ rrGetScreenResources(ClientPtr client, Bool query)
names += mode->mode.nameLength;
}
xfree (modes);
- assert (((((char *) names - (char *) extra) + 3) >> 2) == rep.length);
+ assert (bytes_to_int32((char *) names - (char *) extra) == rep.length);
}
if (client->swapped) {
@@ -606,7 +606,7 @@ ProcRRGetScreenInfo (ClientPtr client)
RROutputPtr output;
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -726,7 +726,7 @@ ProcRRGetScreenInfo (ClientPtr client)
if (data8 - (CARD8 *) extra != extraLen)
FatalError ("RRGetScreenInfo bad extra len %ld != %ld\n",
(unsigned long)(data8 - (CARD8 *) extra), extraLen);
- rep.length = (extraLen + 3) >> 2;
+ rep.length = bytes_to_int32(extraLen);
}
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
diff --git a/randr/rrsdispatch.c b/randr/rrsdispatch.c
index f6821c309..e16090a41 100644
--- a/randr/rrsdispatch.c
+++ b/randr/rrsdispatch.c
@@ -375,10 +375,10 @@ SProcRRSetCrtcTransform (ClientPtr client)
REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
swaps(&stuff->length, n);
swapl(&stuff->crtc, n);
- SwapLongs((CARD32 *)&stuff->transform, (sizeof(xRenderTransform)) >> 2);
+ SwapLongs((CARD32 *)&stuff->transform, bytes_to_int32(sizeof(xRenderTransform)));
swaps(&stuff->nbytesFilter, n);
filter = (char *)(stuff + 1);
- params = (CARD32 *) (filter + ((stuff->nbytesFilter + 3) & ~3));
+ params = (CARD32 *) (filter + pad_to_int32(stuff->nbytesFilter));
nparams = ((CARD32 *) stuff + client->req_len) - params;
if (nparams < 0)
return BadLength;
diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c
index d81a857e1..97be7c1e6 100644
--- a/randr/rrxinerama.c
+++ b/randr/rrxinerama.c
@@ -313,7 +313,7 @@ ProcRRXineramaQueryScreens(ClientPtr client)
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.number = RRXineramaScreenCount (pScreen);
- rep.length = rep.number * sz_XineramaScreenInfo >> 2;
+ rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
if(client->swapped) {
register int n;
swaps(&rep.sequenceNumber, n);