summaryrefslogtreecommitdiff
path: root/dix/swaprep.c
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2011-08-04 15:35:41 -0400
committerMatt Turner <mattst88@gmail.com>2011-09-21 17:12:04 -0400
commit2c7c520cfe0df30f4bc3adba59d9c62582823bf8 (patch)
treef47282ce2f815acc691cfe188850adf8d6fbfcc3 /dix/swaprep.c
parentc10bad3d3e8ff1b90014770fd470f9c67263e46f (diff)
Use internal temp variable for swap macros
Also, fix whitespace, mainly around swaps(&rep.sequenceNumber) Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'dix/swaprep.c')
-rw-r--r--dix/swaprep.c401
1 files changed, 161 insertions, 240 deletions
diff --git a/dix/swaprep.c b/dix/swaprep.c
index c173411ab..a02333d10 100644
--- a/dix/swaprep.c
+++ b/dix/swaprep.c
@@ -74,14 +74,13 @@ void
Swap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
{
int i;
- char n;
size >>= 2;
for(i = 0; i < size; i++)
/* brackets are mandatory here, because "swapl" macro expands
to several statements */
{
- swapl(&pbuf[i], n);
+ swapl(&pbuf[i]);
}
(void)WriteToClient(pClient, size << 2, (char *) pbuf);
}
@@ -187,9 +186,7 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf)
void
SGenericReply(ClientPtr pClient, int size, xGenericReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
+ swaps(&pRep->sequenceNumber);
(void)WriteToClient(pClient, size, (char *) pRep);
}
@@ -198,67 +195,57 @@ void
SGetWindowAttributesReply(ClientPtr pClient, int size,
xGetWindowAttributesReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swapl(&pRep->visualID, n);
- swaps(&pRep->class, n);
- swapl(&pRep->backingBitPlanes, n);
- swapl(&pRep->backingPixel, n);
- swapl(&pRep->colormap, n);
- swapl(&pRep->allEventMasks, n);
- swapl(&pRep->yourEventMask, n);
- swaps(&pRep->doNotPropagateMask, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swapl(&pRep->visualID);
+ swaps(&pRep->class);
+ swapl(&pRep->backingBitPlanes);
+ swapl(&pRep->backingPixel);
+ swapl(&pRep->colormap);
+ swapl(&pRep->allEventMasks);
+ swapl(&pRep->yourEventMask);
+ swaps(&pRep->doNotPropagateMask);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->root, n);
- swaps(&pRep->x, n);
- swaps(&pRep->y, n);
- swaps(&pRep->width, n);
- swaps(&pRep->height, n);
- swaps(&pRep->borderWidth, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->root);
+ swaps(&pRep->x);
+ swaps(&pRep->y);
+ swaps(&pRep->width);
+ swaps(&pRep->height);
+ swaps(&pRep->borderWidth);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swapl(&pRep->root, n);
- swapl(&pRep->parent, n);
- swaps(&pRep->nChildren, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swapl(&pRep->root);
+ swapl(&pRep->parent);
+ swaps(&pRep->nChildren);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SInternAtomReply(ClientPtr pClient, int size, xInternAtomReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->atom, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->atom);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swaps(&pRep->nameLength, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swaps(&pRep->nameLength);
(void)WriteToClient(pClient, size, (char *) pRep);
}
@@ -266,24 +253,20 @@ SGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply *pRep)
void
SGetPropertyReply(ClientPtr pClient, int size, xGetPropertyReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swapl(&pRep->propertyType, n);
- swapl(&pRep->bytesAfter, n);
- swapl(&pRep->nItems, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swapl(&pRep->propertyType);
+ swapl(&pRep->bytesAfter);
+ swapl(&pRep->nItems);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swaps(&pRep->nProperties, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swaps(&pRep->nProperties);
(void)WriteToClient(pClient, size, (char *) pRep);
}
@@ -291,10 +274,8 @@ void
SGetSelectionOwnerReply(ClientPtr pClient, int size,
xGetSelectionOwnerReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->owner, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->owner);
(void)WriteToClient(pClient, size, (char *) pRep);
}
@@ -302,27 +283,23 @@ SGetSelectionOwnerReply(ClientPtr pClient, int size,
void
SQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->root, n);
- swapl(&pRep->child, n);
- swaps(&pRep->rootX, n);
- swaps(&pRep->rootY, n);
- swaps(&pRep->winX, n);
- swaps(&pRep->winY, n);
- swaps(&pRep->mask, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->root);
+ swapl(&pRep->child);
+ swaps(&pRep->rootX);
+ swaps(&pRep->rootY);
+ swaps(&pRep->winX);
+ swaps(&pRep->winY);
+ swaps(&pRep->mask);
(void)WriteToClient(pClient, size, (char *) pRep);
}
static void
SwapTimecoord(xTimecoord* pCoord)
{
- char n;
-
- swapl(&pCoord->time, n);
- swaps(&pCoord->x, n);
- swaps(&pCoord->y, n);
+ swapl(&pCoord->time);
+ swaps(&pCoord->x);
+ swaps(&pCoord->y);
}
void
@@ -344,33 +321,27 @@ SwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord *pRep)
void
SGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swapl(&pRep->nEvents, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swapl(&pRep->nEvents);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
STranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->child, n);
- swaps(&pRep->dstX, n);
- swaps(&pRep->dstY, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->child);
+ swaps(&pRep->dstX);
+ swaps(&pRep->dstY);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->focus, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->focus);
(void)WriteToClient(pClient, size, (char *) pRep);
}
@@ -378,40 +349,34 @@ SGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply *pRep)
void
SQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
(void)WriteToClient(pClient, size, (char *) pRep);
}
static void
SwapCharInfo(xCharInfo *pInfo)
{
- char n;
-
- swaps(&pInfo->leftSideBearing, n);
- swaps(&pInfo->rightSideBearing, n);
- swaps(&pInfo->characterWidth, n);
- swaps(&pInfo->ascent, n);
- swaps(&pInfo->descent, n);
- swaps(&pInfo->attributes, n);
+ swaps(&pInfo->leftSideBearing);
+ swaps(&pInfo->rightSideBearing);
+ swaps(&pInfo->characterWidth);
+ swaps(&pInfo->ascent);
+ swaps(&pInfo->descent);
+ swaps(&pInfo->attributes);
}
static void
SwapFontInfo(xQueryFontReply *pr)
{
- char n;
-
- swaps(&pr->minCharOrByte2, n);
- swaps(&pr->maxCharOrByte2, n);
- swaps(&pr->defaultChar, n);
- swaps(&pr->nFontProps, n);
- swaps(&pr->fontAscent, n);
- swaps(&pr->fontDescent, n);
+ swaps(&pr->minCharOrByte2);
+ swaps(&pr->maxCharOrByte2);
+ swaps(&pr->defaultChar);
+ swaps(&pr->nFontProps);
+ swaps(&pr->fontAscent);
+ swaps(&pr->fontDescent);
SwapCharInfo( &pr->minBounds);
SwapCharInfo( &pr->maxBounds);
- swapl(&pr->nCharInfos, n);
+ swapl(&pr->nCharInfos);
}
static void
@@ -421,10 +386,9 @@ SwapFont(xQueryFontReply *pr, Bool hasGlyphs)
xCharInfo * pxci;
unsigned nchars, nprops;
char *pby;
- char n;
- swaps(&pr->sequenceNumber, n);
- swapl(&pr->length, n);
+ swaps(&pr->sequenceNumber);
+ swapl(&pr->length);
nchars = pr->nCharInfos;
nprops = pr->nFontProps;
SwapFontInfo(pr);
@@ -433,9 +397,9 @@ SwapFont(xQueryFontReply *pr, Bool hasGlyphs)
* they are always 2 4 byte values */
for(i = 0; i < nprops; i++)
{
- swapl(pby, n);
+ swapl(pby);
pby += 4;
- swapl(pby, n);
+ swapl(pby);
pby += 4;
}
if (hasGlyphs)
@@ -456,27 +420,23 @@ SQueryFontReply(ClientPtr pClient, int size, xQueryFontReply *pRep)
void
SQueryTextExtentsReply(ClientPtr pClient, int size, xQueryTextExtentsReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swaps(&pRep->fontAscent, n);
- swaps(&pRep->fontDescent, n);
- swaps(&pRep->overallAscent, n);
- swaps(&pRep->overallDescent, n);
- swapl(&pRep->overallWidth, n);
- swapl(&pRep->overallLeft, n);
- swapl(&pRep->overallRight, n);
+ swaps(&pRep->sequenceNumber);
+ swaps(&pRep->fontAscent);
+ swaps(&pRep->fontDescent);
+ swaps(&pRep->overallAscent);
+ swaps(&pRep->overallDescent);
+ swapl(&pRep->overallWidth);
+ swapl(&pRep->overallLeft);
+ swapl(&pRep->overallRight);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SListFontsReply(ClientPtr pClient, int size, xListFontsReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swaps(&pRep->nFonts, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swaps(&pRep->nFonts);
(void)WriteToClient(pClient, size, (char *) pRep);
}
@@ -491,22 +451,18 @@ SListFontsWithInfoReply(ClientPtr pClient, int size,
void
SGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swaps(&pRep->nPaths, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swaps(&pRep->nPaths);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SGetImageReply(ClientPtr pClient, int size, xGetImageReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swapl(&pRep->visual, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swapl(&pRep->visual);
(void)WriteToClient(pClient, size, (char *) pRep);
/* Fortunately, image doesn't need swapping */
}
@@ -515,52 +471,44 @@ void
SListInstalledColormapsReply(ClientPtr pClient, int size,
xListInstalledColormapsReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swaps(&pRep->nColormaps, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swaps(&pRep->nColormaps);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SAllocColorReply(ClientPtr pClient, int size, xAllocColorReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swaps(&pRep->red, n);
- swaps(&pRep->green, n);
- swaps(&pRep->blue, n);
- swapl(&pRep->pixel, n);
+ swaps(&pRep->sequenceNumber);
+ swaps(&pRep->red);
+ swaps(&pRep->green);
+ swaps(&pRep->blue);
+ swapl(&pRep->pixel);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->pixel, n);
- swaps(&pRep->exactRed, n);
- swaps(&pRep->exactGreen, n);
- swaps(&pRep->exactBlue, n);
- swaps(&pRep->screenRed, n);
- swaps(&pRep->screenGreen, n);
- swaps(&pRep->screenBlue, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->pixel);
+ swaps(&pRep->exactRed);
+ swaps(&pRep->exactGreen);
+ swaps(&pRep->exactBlue);
+ swaps(&pRep->screenRed);
+ swaps(&pRep->screenGreen);
+ swaps(&pRep->screenBlue);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swaps(&pRep->nPixels, n);
- swaps(&pRep->nMasks, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swaps(&pRep->nPixels);
+ swaps(&pRep->nMasks);
(void)WriteToClient(pClient, size, (char *) pRep);
}
@@ -568,25 +516,21 @@ SAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply *pRep)
void
SAllocColorPlanesReply(ClientPtr pClient, int size, xAllocColorPlanesReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swaps(&pRep->nPixels, n);
- swapl(&pRep->redMask, n);
- swapl(&pRep->greenMask, n);
- swapl(&pRep->blueMask, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swaps(&pRep->nPixels);
+ swapl(&pRep->redMask);
+ swapl(&pRep->greenMask);
+ swapl(&pRep->blueMask);
(void)WriteToClient(pClient, size, (char *) pRep);
}
static void
SwapRGB(xrgb *prgb)
{
- char n;
-
- swaps(&prgb->red, n);
- swaps(&prgb->green, n);
- swaps(&prgb->blue, n);
+ swaps(&prgb->red);
+ swaps(&prgb->green);
+ swaps(&prgb->blue);
}
void
@@ -608,47 +552,39 @@ SQColorsExtend(ClientPtr pClient, int size, xrgb *prgb)
void
SQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply* pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swaps(&pRep->nColors, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swaps(&pRep->nColors);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SLookupColorReply(ClientPtr pClient, int size, xLookupColorReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swaps(&pRep->exactRed, n);
- swaps(&pRep->exactGreen, n);
- swaps(&pRep->exactBlue, n);
- swaps(&pRep->screenRed, n);
- swaps(&pRep->screenGreen, n);
- swaps(&pRep->screenBlue, n);
+ swaps(&pRep->sequenceNumber);
+ swaps(&pRep->exactRed);
+ swaps(&pRep->exactGreen);
+ swaps(&pRep->exactBlue);
+ swaps(&pRep->screenRed);
+ swaps(&pRep->screenGreen);
+ swaps(&pRep->screenBlue);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swaps(&pRep->width, n);
- swaps(&pRep->height, n);
+ swaps(&pRep->sequenceNumber);
+ swaps(&pRep->width);
+ swaps(&pRep->height);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
(void)WriteToClient(pClient, size, (char *) pRep);
}
@@ -656,10 +592,8 @@ void
SGetKeyboardMappingReply(ClientPtr pClient, int size,
xGetKeyboardMappingReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
(void)WriteToClient(pClient, size, (char *) pRep);
}
@@ -667,10 +601,8 @@ void
SGetPointerMappingReply(ClientPtr pClient, int size,
xGetPointerMappingReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
(void)WriteToClient(pClient, size, (char *) pRep);
}
@@ -678,46 +610,38 @@ void
SGetModifierMappingReply(ClientPtr pClient, int size,
xGetModifierMappingReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SGetKeyboardControlReply(ClientPtr pClient, int size, xGetKeyboardControlReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swapl(&pRep->ledMask, n);
- swaps(&pRep->bellPitch, n);
- swaps(&pRep->bellDuration, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swapl(&pRep->ledMask);
+ swaps(&pRep->bellPitch);
+ swaps(&pRep->bellDuration);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SGetPointerControlReply(ClientPtr pClient, int size, xGetPointerControlReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swaps(&pRep->accelNumerator, n);
- swaps(&pRep->accelDenominator, n);
- swaps(&pRep->threshold, n);
+ swaps(&pRep->sequenceNumber);
+ swaps(&pRep->accelNumerator);
+ swaps(&pRep->accelDenominator);
+ swaps(&pRep->threshold);
(void)WriteToClient(pClient, size, (char *) pRep);
}
void
SGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swaps(&pRep->timeout, n);
- swaps(&pRep->interval, n);
+ swaps(&pRep->sequenceNumber);
+ swaps(&pRep->timeout);
+ swaps(&pRep->interval);
(void)WriteToClient(pClient, size, (char *) pRep);
}
@@ -729,8 +653,7 @@ SLHostsExtend(ClientPtr pClient, int size, char *buf)
while (bufT < endbuf) {
xHostEntry *host = (xHostEntry *) bufT;
int len = host->length;
- char n;
- swaps (&host->length, n);
+ swaps(&host->length);
bufT += sizeof (xHostEntry) + pad_to_int32(len);
}
(void)WriteToClient (pClient, size, buf);
@@ -739,11 +662,9 @@ SLHostsExtend(ClientPtr pClient, int size, char *buf)
void
SListHostsReply(ClientPtr pClient, int size, xListHostsReply *pRep)
{
- char n;
-
- swaps(&pRep->sequenceNumber, n);
- swapl(&pRep->length, n);
- swaps(&pRep->nHosts, n);
+ swaps(&pRep->sequenceNumber);
+ swapl(&pRep->length);
+ swaps(&pRep->nHosts);
(void)WriteToClient(pClient, size, (char *) pRep);
}