diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-07-06 12:24:27 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-07-14 10:14:01 +1000 |
commit | 86b239ff9c4d01685c357ca2b1ef761d167e3224 (patch) | |
tree | 59ee2462a0132037df8d634644c7c866f98a4266 | |
parent | 7b9e84e320a6f6449fe7bc58a8d6a094ae37b86c (diff) |
randr: switch to byte counting functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | randr/rrcrtc.c | 14 | ||||
-rw-r--r-- | randr/rrmode.c | 4 | ||||
-rw-r--r-- | randr/rroutput.c | 8 | ||||
-rw-r--r-- | randr/rrproperty.c | 8 | ||||
-rw-r--r-- | randr/rrscreen.c | 8 | ||||
-rw-r--r-- | randr/rrsdispatch.c | 4 | ||||
-rw-r--r-- | randr/rrxinerama.c | 2 |
7 files changed, 24 insertions, 24 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..3d053bc66 100644 --- a/randr/rrmode.c +++ b/randr/rrmode.c @@ -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..97b8b96c0 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -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) { @@ -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); |