os: switch to byte counting functions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-07-06 12:25:39 +10:00
parent 86b239ff9c
commit 1d6b71b8d0
2 changed files with 5 additions and 5 deletions

View File

@ -1458,7 +1458,7 @@ GetHosts (
for (host = validhosts; host; host = host->next) for (host = validhosts; host; host = host->next)
{ {
nHosts++; nHosts++;
n += (((host->len + 3) >> 2) << 2) + sizeof(xHostEntry); n += pad_to_int32(host->len) + sizeof(xHostEntry);
} }
if (n) if (n)
{ {
@ -1474,7 +1474,7 @@ GetHosts (
((xHostEntry *)ptr)->length = len; ((xHostEntry *)ptr)->length = len;
ptr += sizeof(xHostEntry); ptr += sizeof(xHostEntry);
acopy (host->addr, ptr, len); acopy (host->addr, ptr, len);
ptr += ((len + 3) >> 2) << 2; ptr += pad_to_int32(len);
} }
} else { } else {
*data = NULL; *data = NULL;

View File

@ -273,7 +273,7 @@ ReadRequestFromClient(ClientPtr client)
if (gotnow < sizeof(xBigReq)) if (gotnow < sizeof(xBigReq))
{ {
/* Still need more data to tell just how big. */ /* Still need more data to tell just how big. */
needed = sizeof(xBigReq) >> 2; /* needed is in CARD32s now */ needed = bytes_to_int32(sizeof(xBigReq)); /* needed is in CARD32s now */
need_header = TRUE; need_header = TRUE;
} }
else else
@ -377,7 +377,7 @@ ReadRequestFromClient(ClientPtr client)
{ {
move_header = TRUE; move_header = TRUE;
if (gotnow < sizeof(xBigReq)) if (gotnow < sizeof(xBigReq))
needed = sizeof(xBigReq) >> 2; needed = bytes_to_int32(sizeof(xBigReq));
else else
needed = get_big_req_len(request, client); needed = get_big_req_len(request, client);
} }
@ -445,7 +445,7 @@ ReadRequestFromClient(ClientPtr client)
oci->bufptr += (sizeof(xBigReq) - sizeof(xReq)); oci->bufptr += (sizeof(xBigReq) - sizeof(xReq));
*(xReq *)oci->bufptr = *request; *(xReq *)oci->bufptr = *request;
oci->lenLastReq -= (sizeof(xBigReq) - sizeof(xReq)); oci->lenLastReq -= (sizeof(xBigReq) - sizeof(xReq));
client->req_len -= (sizeof(xBigReq) - sizeof(xReq)) >> 2; client->req_len -= bytes_to_int32(sizeof(xBigReq) - sizeof(xReq));
} }
client->requestBuffer = (pointer)oci->bufptr; client->requestBuffer = (pointer)oci->bufptr;
#ifdef DEBUG_COMMUNICATION #ifdef DEBUG_COMMUNICATION