[PATCH 13/18] render: switch to byte counting functions

Peter Hutterer peter.hutterer at who-t.net
Wed Jul 8 17:05:11 PDT 2009


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 render/render.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/render/render.c b/render/render.c
index 5622994..ae169b6 100644
--- a/render/render.c
+++ b/render/render.c
@@ -369,7 +369,7 @@ ProcRenderQueryPictFormats (ClientPtr client)
 	return BadAlloc;
     reply->type = X_Reply;
     reply->sequenceNumber = client->sequence;
-    reply->length = (rlength - sizeof(xGenericReply)) >> 2;
+    reply->length = num_dwords_for_bytes(rlength - sizeof(xGenericReply));
     reply->numFormats = nformat;
     reply->numScreens = numScreens;
     reply->numDepths = ndepth;
@@ -537,7 +537,7 @@ ProcRenderQueryPictIndexValues (ClientPtr client)
 
     reply->type = X_Reply;
     reply->sequenceNumber = client->sequence;
-    reply->length = (rlength - sizeof(xGenericReply)) >> 2;
+    reply->length = num_dwords_for_bytes(rlength - sizeof(xGenericReply));
     reply->numIndexValues = num;
 
     values = (xIndexValue *) (reply + 1);
@@ -594,7 +594,7 @@ ProcRenderCreatePicture (ClientPtr client)
 
     if (pFormat->depth != pDrawable->depth)
 	return BadMatch;
-    len = client->req_len - (sizeof(xRenderCreatePictureReq) >> 2);
+    len = client->req_len - num_dwords_for_bytes(sizeof(xRenderCreatePictureReq));
     if (Ones(stuff->mask) != len)
 	return BadLength;
     
@@ -623,7 +623,7 @@ ProcRenderChangePicture (ClientPtr client)
     VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess,
 		    RenderErrBase + BadPicture);
 
-    len = client->req_len - (sizeof(xRenderChangePictureReq) >> 2);
+    len = client->req_len - num_dwords_for_bytes(sizeof(xRenderChangePictureReq));
     if (Ones(stuff->mask) != len)
 	return BadLength;
     
@@ -1235,7 +1235,7 @@ ProcRenderFreeGlyphs (ClientPtr client)
 	client->errorValue = stuff->glyphset;
 	return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc;
     }
-    nglyph = ((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)) >> 2;
+    nglyph = num_dwords_for_bytes((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq));
     gids = (CARD32 *) (stuff + 1);
     while (nglyph-- > 0)
     {
@@ -1735,7 +1735,7 @@ ProcRenderQueryFilters (ClientPtr client)
 	    nbytesName += 1 + strlen (ps->filterAliases[i].alias);
 	nnames = ps->nfilters + ps->nfilterAliases;
     }
-    len = ((nnames + 1) >> 1) + ((nbytesName + 3) >> 2);
+    len = ((nnames + 1) >> 1) + num_dwords_for_bytes(nbytesName);
     total_bytes = sizeof (xRenderQueryFiltersReply) + (len << 2);
     reply = (xRenderQueryFiltersReply *) xalloc (total_bytes);
     if (!reply)
@@ -1827,7 +1827,7 @@ ProcRenderSetPictureFilter (ClientPtr client)
     VERIFY_PICTURE (pPicture, stuff->picture, client, DixSetAttrAccess,
 		    RenderErrBase + BadPicture);
     name = (char *) (stuff + 1);
-    params = (xFixed *) (name + ((stuff->nbytes + 3) & ~3));
+    params = (xFixed *) (name + pad_to_dwords(stuff->nbytes));
     nparams = ((xFixed *) stuff + client->req_len) - params;
     result = SetPictureFilter (pPicture, name, stuff->nbytes, params, nparams);
     return result;
@@ -1849,7 +1849,7 @@ ProcRenderCreateAnimCursor (ClientPtr client)
     LEGAL_NEW_RESOURCE(stuff->cid, client);
     if (client->req_len & 1)
 	return BadLength;
-    ncursor = (client->req_len - (SIZEOF(xRenderCreateAnimCursorReq) >> 2)) >> 1;
+    ncursor = (client->req_len - (num_dwords_for_bytes(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
     cursors = xalloc (ncursor * (sizeof (CursorPtr) + sizeof (CARD32)));
     if (!cursors)
 	return BadAlloc;
-- 
1.6.3.rc1.2.g0164.dirty



More information about the xorg-devel mailing list