Use correct swap{l,s} (or none at all for CARD8)

Swapping the wrong size was never caught because swap{l,s} are macros.

It's clear in the case of Xext/xres.c, that the author believed
client_major/minor to be CARD16 from looking at the code in the first
hunk.

v2: dmx.c fixes from Keith.

Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Matt Turner 2011-09-21 17:14:16 -04:00
parent 2c7c520cfe
commit 9edcae78c4
9 changed files with 13 additions and 25 deletions

View File

@ -1443,7 +1443,6 @@ SProcScreenSaverSuspend (ClientPtr client)
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
swapl(&stuff->suspend);
return ProcScreenSaverSuspend (client);
}

View File

@ -28,15 +28,9 @@ ProcXResQueryVersion (ClientPtr client)
{
REQUEST(xXResQueryVersionReq);
xXResQueryVersionReply rep;
CARD16 client_major, client_minor; /* not used */
REQUEST_SIZE_MATCH (xXResQueryVersionReq);
client_major = stuff->client_major;
client_minor = stuff->client_minor;
(void) client_major;
(void) client_minor;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@ -316,8 +310,6 @@ SProcXResQueryVersion (ClientPtr client)
{
REQUEST(xXResQueryVersionReq);
REQUEST_SIZE_MATCH (xXResQueryVersionReq);
swaps(&stuff->client_major);
swaps(&stuff->client_minor);
return ProcXResQueryVersion(client);
}
@ -326,7 +318,7 @@ SProcXResQueryClientResources (ClientPtr client)
{
REQUEST(xXResQueryClientResourcesReq);
REQUEST_SIZE_MATCH (xXResQueryClientResourcesReq);
swaps(&stuff->xid);
swapl(&stuff->xid);
return ProcXResQueryClientResources(client);
}
@ -335,7 +327,7 @@ SProcXResQueryClientPixmapBytes (ClientPtr client)
{
REQUEST(xXResQueryClientPixmapBytesReq);
REQUEST_SIZE_MATCH (xXResQueryClientPixmapBytesReq);
swaps(&stuff->xid);
swapl(&stuff->xid);
return ProcXResQueryClientPixmapBytes(client);
}

View File

@ -127,7 +127,6 @@ static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
if (client->swapped) {
swaps(&c->control);
swaps(&c->length);
swaps(&c->status);
}
}
@ -142,7 +141,6 @@ static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
if (client->swapped) {
swaps(&e->control);
swaps(&e->length);
swaps(&e->enable);
}
}

View File

@ -434,7 +434,7 @@ ProcXIChangeHierarchy(ClientPtr client)
any = (xXIAnyHierarchyChangeInfo*)&stuff[1];
while(stuff->num_changes--)
{
SWAPIF(swapl(&any->type));
SWAPIF(swaps(&any->type));
SWAPIF(swaps(&any->length));
required_len += any->length;

View File

@ -281,7 +281,7 @@ SwapButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info)
swaps(&info->sourceid);
for (i = 0, btn = (Atom*)&info[1]; i < info->num_buttons; i++, btn++)
swaps(btn);
swapl(btn);
swaps(&info->num_buttons);
}

View File

@ -653,10 +653,10 @@ static int ProcDMXGetDesktopAttributes(ClientPtr client)
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.width);
swapl(&rep.height);
swapl(&rep.shiftX);
swapl(&rep.shiftY);
swaps(&rep.width);
swaps(&rep.height);
swaps(&rep.shiftX);
swaps(&rep.shiftY);
}
WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), (char *)&rep);
return Success;
@ -891,7 +891,7 @@ static int SProcDMXForceWindowCreation(ClientPtr client)
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq);
swaps(&stuff->window);
swapl(&stuff->window);
return ProcDMXForceWindowCreation(client);
}

View File

@ -464,7 +464,7 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
swaps(&mdinf.hsyncstart);
swaps(&mdinf.hsyncend);
swaps(&mdinf.htotal);
swaps(&mdinf.hskew);
swapl(&mdinf.hskew);
swaps(&mdinf.vdisplay);
swaps(&mdinf.vsyncstart);
swaps(&mdinf.vsyncend);
@ -1846,7 +1846,7 @@ SProcXF86VidModeSwitchToMode(ClientPtr client)
REQUEST(xXF86VidModeSwitchToModeReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXF86VidModeSwitchToModeReq);
swaps(&stuff->screen);
swapl(&stuff->screen);
return ProcXF86VidModeSwitchToMode(client);
}

View File

@ -1117,7 +1117,7 @@ ProcRRGetPanning (ClientPtr client)
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.timestamp);
swapl(&rep.timestamp);
swaps(&rep.left);
swaps(&rep.top);
swaps(&rep.width);
@ -1197,7 +1197,7 @@ sendReply:
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.newTimestamp);
swapl(&rep.newTimestamp);
}
WriteToClient(client, sizeof(xRRSetPanningReply), (char *)&rep);
return Success;

View File

@ -6190,7 +6190,6 @@ char * str;
swaps(&rep.supported);
swaps(&rep.unsupported);
swaps(&rep.nDeviceLedFBs);
swapl(&rep.type);
}
WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), (char *)&rep);