[PATCH 15/18] ephyr: switch to byte counting functions

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


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 hw/kdrive/ephyr/ephyrdriext.c  |   14 +++++++-------
 hw/kdrive/ephyr/ephyrhostglx.c |    2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c
index 6e915ab..adf3143 100644
--- a/hw/kdrive/ephyr/ephyrdriext.c
+++ b/hw/kdrive/ephyr/ephyrdriext.c
@@ -701,8 +701,8 @@ ProcXF86DRIOpenConnection (register ClientPtr client)
     rep.busIdStringLength = 0;
     if (busIdString)
 	rep.busIdStringLength = strlen(busIdString);
-    rep.length = (SIZEOF(xXF86DRIOpenConnectionReply) - SIZEOF(xGenericReply) +
-                  ((rep.busIdStringLength + 3) & ~3)) >> 2;
+    rep.length = num_dwords_for_bytes(SIZEOF(xXF86DRIOpenConnectionReply) - SIZEOF(xGenericReply) +
+                  pad_to_dwords(rep.busIdStringLength));
 
     rep.hSAREALow  = (CARD32)(hSAREA & 0xffffffff);
 #if defined(LONG64) && !defined(__linux__)
@@ -789,9 +789,9 @@ ProcXF86DRIGetClientDriverName (register ClientPtr client)
     rep.clientDriverNameLength = 0;
     if (clientDriverName)
 	rep.clientDriverNameLength = strlen(clientDriverName);
-    rep.length = (SIZEOF(xXF86DRIGetClientDriverNameReply) - 
+    rep.length = num_dwords_for_bytes(SIZEOF(xXF86DRIGetClientDriverNameReply) -
 			SIZEOF(xGenericReply) +
-			((rep.clientDriverNameLength + 3) & ~3)) >> 2;
+			pad_to_dwords(rep.clientDriverNameLength));
 
     WriteToClient(client, 
 	sizeof(xXF86DRIGetClientDriverNameReply), (char *)&rep);
@@ -1235,7 +1235,7 @@ ProcXF86DRIGetDrawableInfo (register ClientPtr client)
     EPHYR_LOG ("num host clip rects:%d\n", (int)rep.numClipRects) ;
     EPHYR_LOG ("num host back clip rects:%d\n", (int)rep.numBackClipRects) ;
 
-    rep.length = ((rep.length + 3) & ~3) >> 2;
+    rep.length = num_dwords_for_bytes(rep.length);
 
     WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *)&rep);
 
@@ -1297,9 +1297,9 @@ ProcXF86DRIGetDeviceInfo (register ClientPtr client)
 
     rep.length = 0;
     if (rep.devPrivateSize) {
-        rep.length = (SIZEOF(xXF86DRIGetDeviceInfoReply) - 
+        rep.length = num_dwords_for_bytes(SIZEOF(xXF86DRIGetDeviceInfoReply) -
                 SIZEOF(xGenericReply) +
-                ((rep.devPrivateSize + 3) & ~3)) >> 2;
+                pad_to_dwords(rep.devPrivateSize));
     }
 
     WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), (char *)&rep);
diff --git a/hw/kdrive/ephyr/ephyrhostglx.c b/hw/kdrive/ephyr/ephyrhostglx.c
index a05bba2..317c9bf 100644
--- a/hw/kdrive/ephyr/ephyrhostglx.c
+++ b/hw/kdrive/ephyr/ephyrhostglx.c
@@ -428,7 +428,7 @@ ephyrHostGLXSendClientInfo (int32_t a_major, int32_t a_minor,
     req->minor = a_minor;
 
     size = strlen (a_extension_list) + 1;
-    req->length += (size + 3) >> 2;
+    req->length += num_dwords_for_bytes(size);
     req->numbytes = size;
     Data (dpy, a_extension_list, size);
 
-- 
1.6.3.rc1.2.g0164.dirty



More information about the xorg-devel mailing list