[PATCH 17/18] record: switch to byte counting functions

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


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

diff --git a/record/record.c b/record/record.c
index 3c4bb9e..226914e 100644
--- a/record/record.c
+++ b/record/record.c
@@ -372,7 +372,8 @@ RecordAProtocolElement(RecordContextPtr pContext, ClientPtr pClient,
 
 	replylen = pRep->length;
 	if (recordingClientSwapped) swapl(&replylen, n);
-	replylen += numElemHeaders + (datalen >> 2) + (futurelen >> 2);
+	replylen += numElemHeaders + num_dwords_for_bytes(datalen) +
+            num_dwords_for_bytes(futurelen);
 	if (recordingClientSwapped) swapl(&replylen, n);
 	pRep->length = replylen;
     } /* end if not continued reply */
@@ -480,7 +481,7 @@ RecordABigRequest(RecordContextPtr pContext, ClientPtr client, xReq *stuff)
 			   (pointer)stuff, SIZEOF(xReq), bytesLeft);
 
     /* reinsert the extended length field that was squished out */
-    bigLength = client->req_len + (sizeof(bigLength) >> 2);
+    bigLength = client->req_len + num_dwords_for_bytes(sizeof(bigLength));
     if (client->swapped)
 	swapl(&bigLength, n);
     RecordAProtocolElement(pContext, client, XRecordFromClient,
@@ -2279,8 +2280,8 @@ ProcRecordGetContext(ClientPtr client)
     {
 	rep.nClients += pRCAP->numClients;
 	rep.length += pRCAP->numClients *
-		( (sizeof(xRecordClientInfo) >> 2) +
-		  pri->nRanges * (sizeof(xRecordRange) >> 2));
+		( num_dwords_for_bytes(sizeof(xRecordClientInfo)) +
+		  pri->nRanges * num_dwords_for_bytes(sizeof(xRecordRange)));
     }
 
     /* write the reply header */
@@ -2579,13 +2580,13 @@ SwapCreateRegister(xRecordRegisterClientsReq *stuff)
     swapl(&stuff->nClients, n);
     swapl(&stuff->nRanges, n);
     pClientID = (XID *)&stuff[1];
-    if (stuff->nClients > stuff->length - (sz_xRecordRegisterClientsReq >> 2))
+    if (stuff->nClients > stuff->length - num_dwords_for_bytes(sz_xRecordRegisterClientsReq))
 	return BadLength;
     for (i = 0; i < stuff->nClients; i++, pClientID++)
     {
 	swapl(pClientID, n);
     }
-    if (stuff->nRanges > stuff->length - (sz_xRecordRegisterClientsReq >> 2)
+    if (stuff->nRanges > stuff->length - num_dwords_for_bytes(sz_xRecordRegisterClientsReq)
 	- stuff->nClients)
 	return BadLength;
     RecordSwapRanges((xRecordRange *)pClientID, stuff->nRanges);
-- 
1.6.3.rc1.2.g0164.dirty



More information about the xorg-devel mailing list