[PATCH 12/18] os: switch to byte counting functions

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


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 os/access.c |    4 ++--
 os/io.c     |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/os/access.c b/os/access.c
index 3447876..0b53275 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1458,7 +1458,7 @@ GetHosts (
     for (host = validhosts; host; host = host->next)
     {
 	nHosts++;
-	n += (((host->len + 3) >> 2) << 2) + sizeof(xHostEntry);
+	n += pad_to_dwords(host->len) + sizeof(xHostEntry);
     }
     if (n)
     {
@@ -1474,7 +1474,7 @@ GetHosts (
 	    ((xHostEntry *)ptr)->length = len;
 	    ptr += sizeof(xHostEntry);
 	    acopy (host->addr, ptr, len);
-	    ptr += ((len + 3) >> 2) << 2;
+	    ptr += pad_to_dwords(len);
         }
     } else {
 	*data = NULL;
diff --git a/os/io.c b/os/io.c
index 45e1938..38ece49 100644
--- a/os/io.c
+++ b/os/io.c
@@ -273,7 +273,7 @@ ReadRequestFromClient(ClientPtr client)
 	    if (gotnow < sizeof(xBigReq))
 	    {
 		/* Still need more data to tell just how big. */
-		needed = sizeof(xBigReq) >> 2; /* needed is in CARD32s now */
+		needed = num_dwords_for_bytes(sizeof(xBigReq)); /* needed is in CARD32s now */
 		need_header = TRUE;
 	    }
 	    else
@@ -377,7 +377,7 @@ ReadRequestFromClient(ClientPtr client)
 	    {
 		move_header = TRUE;
 		if (gotnow < sizeof(xBigReq))
-		    needed = sizeof(xBigReq) >> 2;
+		    needed = num_dwords_for_bytes(sizeof(xBigReq));
 		else
 		    needed = get_big_req_len(request, client);
 	    }
@@ -445,7 +445,7 @@ ReadRequestFromClient(ClientPtr client)
 	oci->bufptr += (sizeof(xBigReq) - sizeof(xReq));
 	*(xReq *)oci->bufptr = *request;
 	oci->lenLastReq -= (sizeof(xBigReq) - sizeof(xReq));
-	client->req_len -= (sizeof(xBigReq) - sizeof(xReq)) >> 2;
+	client->req_len -= num_dwords_for_bytes(sizeof(xBigReq) - sizeof(xReq));
     }
     client->requestBuffer = (pointer)oci->bufptr;
 #ifdef DEBUG_COMMUNICATION
-- 
1.6.3.rc1.2.g0164.dirty



More information about the xorg-devel mailing list