swaprep.c revision ed6184df
105b261ecSmrg/************************************************************
205b261ecSmrg
305b261ecSmrgCopyright 1987, 1998  The Open Group
405b261ecSmrg
505b261ecSmrgPermission to use, copy, modify, distribute, and sell this software and its
605b261ecSmrgdocumentation for any purpose is hereby granted without fee, provided that
705b261ecSmrgthe above copyright notice appear in all copies and that both that
805b261ecSmrgcopyright notice and this permission notice appear in supporting
905b261ecSmrgdocumentation.
1005b261ecSmrg
1105b261ecSmrgThe above copyright notice and this permission notice shall be included in
1205b261ecSmrgall copies or substantial portions of the Software.
1305b261ecSmrg
1405b261ecSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1505b261ecSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1605b261ecSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
1705b261ecSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
1805b261ecSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1905b261ecSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2005b261ecSmrg
2105b261ecSmrgExcept as contained in this notice, the name of The Open Group shall not be
2205b261ecSmrgused in advertising or otherwise to promote the sale, use or other dealings
2305b261ecSmrgin this Software without prior written authorization from The Open Group.
2405b261ecSmrg
2505b261ecSmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
2605b261ecSmrg
2705b261ecSmrg                        All Rights Reserved
2805b261ecSmrg
2935c4bbdfSmrgPermission to use, copy, modify, and distribute this software and its
3035c4bbdfSmrgdocumentation for any purpose and without fee is hereby granted,
3105b261ecSmrgprovided that the above copyright notice appear in all copies and that
3235c4bbdfSmrgboth that copyright notice and this permission notice appear in
3305b261ecSmrgsupporting documentation, and that the name of Digital not be
3405b261ecSmrgused in advertising or publicity pertaining to distribution of the
3535c4bbdfSmrgsoftware without specific, written prior permission.
3605b261ecSmrg
3705b261ecSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
3805b261ecSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
3905b261ecSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
4005b261ecSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
4105b261ecSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
4205b261ecSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
4305b261ecSmrgSOFTWARE.
4405b261ecSmrg
4505b261ecSmrg********************************************************/
4605b261ecSmrg
4705b261ecSmrg#ifdef HAVE_DIX_CONFIG_H
4805b261ecSmrg#include <dix-config.h>
4905b261ecSmrg#endif
5005b261ecSmrg
5105b261ecSmrg#include <X11/X.h>
5205b261ecSmrg#include <X11/Xproto.h>
5305b261ecSmrg#include "misc.h"
5405b261ecSmrg#include "dixstruct.h"
5505b261ecSmrg#include <X11/fonts/fontstruct.h>
5605b261ecSmrg#include "scrnintstr.h"
5705b261ecSmrg#include "swaprep.h"
5805b261ecSmrg#include "globals.h"
5905b261ecSmrg
6035c4bbdfSmrgstatic void SwapFontInfo(xQueryFontReply * pr);
6105b261ecSmrg
6235c4bbdfSmrgstatic void SwapCharInfo(xCharInfo * pInfo);
6305b261ecSmrg
6435c4bbdfSmrgstatic void SwapFont(xQueryFontReply * pr, Bool hasGlyphs);
6505b261ecSmrg
6605b261ecSmrg/**
6705b261ecSmrg * Thanks to Jack Palevich for testing and subsequently rewriting all this
6805b261ecSmrg *
6905b261ecSmrg *  \param size size in bytes
7005b261ecSmrg */
711b5d61b8Smrgvoid _X_COLD
7205b261ecSmrgSwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
7305b261ecSmrg{
7405b261ecSmrg    int i;
7505b261ecSmrg
7605b261ecSmrg    size >>= 2;
7735c4bbdfSmrg    for (i = 0; i < size; i++)
7835c4bbdfSmrg        /* brackets are mandatory here, because "swapl" macro expands
7935c4bbdfSmrg           to several statements */
8035c4bbdfSmrg    {
8135c4bbdfSmrg        swapl(&pbuf[i]);
8205b261ecSmrg    }
8335c4bbdfSmrg    WriteToClient(pClient, size << 2, pbuf);
8405b261ecSmrg}
8505b261ecSmrg
8605b261ecSmrg/**
8705b261ecSmrg *
8805b261ecSmrg * \param size size in bytes
8905b261ecSmrg */
901b5d61b8Smrgvoid _X_COLD
9105b261ecSmrgCopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf)
9205b261ecSmrg{
9305b261ecSmrg    int bufsize = size;
9405b261ecSmrg    CARD32 *pbufT;
9505b261ecSmrg    CARD32 *from, *to, *fromLast, *toLast;
9605b261ecSmrg    CARD32 tmpbuf[1];
9735c4bbdfSmrg
9805b261ecSmrg    /* Allocate as big a buffer as we can... */
9935c4bbdfSmrg    while (!(pbufT = malloc(bufsize))) {
10005b261ecSmrg        bufsize >>= 1;
10135c4bbdfSmrg        if (bufsize == 4) {
10235c4bbdfSmrg            pbufT = tmpbuf;
10335c4bbdfSmrg            break;
10435c4bbdfSmrg        }
10505b261ecSmrg    }
10635c4bbdfSmrg
10705b261ecSmrg    /* convert lengths from # of bytes to # of longs */
10805b261ecSmrg    size >>= 2;
10905b261ecSmrg    bufsize >>= 2;
11005b261ecSmrg
11105b261ecSmrg    from = pbuf;
11205b261ecSmrg    fromLast = from + size;
11305b261ecSmrg    while (from < fromLast) {
11435c4bbdfSmrg        int nbytes;
11535c4bbdfSmrg
11605b261ecSmrg        to = pbufT;
11735c4bbdfSmrg        toLast = to + min(bufsize, fromLast - from);
11805b261ecSmrg        nbytes = (toLast - to) << 2;
11905b261ecSmrg        while (to < toLast) {
12005b261ecSmrg            /* can't write "cpswapl(*from++, *to++)" because cpswapl is a macro
121ed6184dfSmrg               that evaluates its args more than once */
12235c4bbdfSmrg            cpswapl(*from, *to);
12305b261ecSmrg            from++;
12405b261ecSmrg            to++;
12535c4bbdfSmrg        }
12635c4bbdfSmrg        WriteToClient(pClient, nbytes, pbufT);
12735c4bbdfSmrg    }
12805b261ecSmrg
12905b261ecSmrg    if (pbufT != tmpbuf)
13035c4bbdfSmrg        free(pbufT);
13105b261ecSmrg}
13205b261ecSmrg
13305b261ecSmrg/**
13405b261ecSmrg *
13505b261ecSmrg * \param size size in bytes
13605b261ecSmrg */
1371b5d61b8Smrgvoid _X_COLD
13805b261ecSmrgCopySwap16Write(ClientPtr pClient, int size, short *pbuf)
13905b261ecSmrg{
14005b261ecSmrg    int bufsize = size;
14105b261ecSmrg    short *pbufT;
14205b261ecSmrg    short *from, *to, *fromLast, *toLast;
14305b261ecSmrg    short tmpbuf[2];
14435c4bbdfSmrg
14505b261ecSmrg    /* Allocate as big a buffer as we can... */
14635c4bbdfSmrg    while (!(pbufT = malloc(bufsize))) {
14705b261ecSmrg        bufsize >>= 1;
14835c4bbdfSmrg        if (bufsize == 4) {
14935c4bbdfSmrg            pbufT = tmpbuf;
15035c4bbdfSmrg            break;
15135c4bbdfSmrg        }
15205b261ecSmrg    }
15335c4bbdfSmrg
15405b261ecSmrg    /* convert lengths from # of bytes to # of shorts */
15505b261ecSmrg    size >>= 1;
15605b261ecSmrg    bufsize >>= 1;
15705b261ecSmrg
15805b261ecSmrg    from = pbuf;
15905b261ecSmrg    fromLast = from + size;
16005b261ecSmrg    while (from < fromLast) {
16135c4bbdfSmrg        int nbytes;
16235c4bbdfSmrg
16305b261ecSmrg        to = pbufT;
16435c4bbdfSmrg        toLast = to + min(bufsize, fromLast - from);
16505b261ecSmrg        nbytes = (toLast - to) << 1;
16605b261ecSmrg        while (to < toLast) {
16705b261ecSmrg            /* can't write "cpswaps(*from++, *to++)" because cpswaps is a macro
168ed6184dfSmrg               that evaluates its args more than once */
16935c4bbdfSmrg            cpswaps(*from, *to);
17005b261ecSmrg            from++;
17105b261ecSmrg            to++;
17235c4bbdfSmrg        }
17335c4bbdfSmrg        WriteToClient(pClient, nbytes, pbufT);
17435c4bbdfSmrg    }
17505b261ecSmrg
17605b261ecSmrg    if (pbufT != tmpbuf)
17735c4bbdfSmrg        free(pbufT);
17805b261ecSmrg}
17905b261ecSmrg
18005b261ecSmrg/* Extra-small reply */
1811b5d61b8Smrgvoid _X_COLD
18235c4bbdfSmrgSGenericReply(ClientPtr pClient, int size, xGenericReply * pRep)
18305b261ecSmrg{
18435c4bbdfSmrg    swaps(&pRep->sequenceNumber);
18535c4bbdfSmrg    WriteToClient(pClient, size, pRep);
18605b261ecSmrg}
18705b261ecSmrg
18805b261ecSmrg/* Extra-large reply */
1891b5d61b8Smrgvoid _X_COLD
19005b261ecSmrgSGetWindowAttributesReply(ClientPtr pClient, int size,
19135c4bbdfSmrg                          xGetWindowAttributesReply * pRep)
19205b261ecSmrg{
19335c4bbdfSmrg    swaps(&pRep->sequenceNumber);
19435c4bbdfSmrg    swapl(&pRep->length);
19535c4bbdfSmrg    swapl(&pRep->visualID);
19635c4bbdfSmrg    swaps(&pRep->class);
19735c4bbdfSmrg    swapl(&pRep->backingBitPlanes);
19835c4bbdfSmrg    swapl(&pRep->backingPixel);
19935c4bbdfSmrg    swapl(&pRep->colormap);
20035c4bbdfSmrg    swapl(&pRep->allEventMasks);
20135c4bbdfSmrg    swapl(&pRep->yourEventMask);
20235c4bbdfSmrg    swaps(&pRep->doNotPropagateMask);
20335c4bbdfSmrg    WriteToClient(pClient, size, pRep);
20405b261ecSmrg}
20505b261ecSmrg
2061b5d61b8Smrgvoid _X_COLD
20735c4bbdfSmrgSGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply * pRep)
20805b261ecSmrg{
20935c4bbdfSmrg    swaps(&pRep->sequenceNumber);
21035c4bbdfSmrg    swapl(&pRep->root);
21135c4bbdfSmrg    swaps(&pRep->x);
21235c4bbdfSmrg    swaps(&pRep->y);
21335c4bbdfSmrg    swaps(&pRep->width);
21435c4bbdfSmrg    swaps(&pRep->height);
21535c4bbdfSmrg    swaps(&pRep->borderWidth);
21635c4bbdfSmrg    WriteToClient(pClient, size, pRep);
21705b261ecSmrg}
21805b261ecSmrg
2191b5d61b8Smrgvoid _X_COLD
22035c4bbdfSmrgSQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply * pRep)
22105b261ecSmrg{
22235c4bbdfSmrg    swaps(&pRep->sequenceNumber);
22335c4bbdfSmrg    swapl(&pRep->length);
22435c4bbdfSmrg    swapl(&pRep->root);
22535c4bbdfSmrg    swapl(&pRep->parent);
22635c4bbdfSmrg    swaps(&pRep->nChildren);
22735c4bbdfSmrg    WriteToClient(pClient, size, pRep);
22805b261ecSmrg}
22905b261ecSmrg
2301b5d61b8Smrgvoid _X_COLD
23135c4bbdfSmrgSInternAtomReply(ClientPtr pClient, int size, xInternAtomReply * pRep)
23205b261ecSmrg{
23335c4bbdfSmrg    swaps(&pRep->sequenceNumber);
23435c4bbdfSmrg    swapl(&pRep->atom);
23535c4bbdfSmrg    WriteToClient(pClient, size, pRep);
23605b261ecSmrg}
23705b261ecSmrg
2381b5d61b8Smrgvoid _X_COLD
23935c4bbdfSmrgSGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply * pRep)
24005b261ecSmrg{
24135c4bbdfSmrg    swaps(&pRep->sequenceNumber);
24235c4bbdfSmrg    swapl(&pRep->length);
24335c4bbdfSmrg    swaps(&pRep->nameLength);
24435c4bbdfSmrg    WriteToClient(pClient, size, pRep);
24505b261ecSmrg}
24605b261ecSmrg
2471b5d61b8Smrgvoid _X_COLD
24835c4bbdfSmrgSGetPropertyReply(ClientPtr pClient, int size, xGetPropertyReply * pRep)
24905b261ecSmrg{
25035c4bbdfSmrg    swaps(&pRep->sequenceNumber);
25135c4bbdfSmrg    swapl(&pRep->length);
25235c4bbdfSmrg    swapl(&pRep->propertyType);
25335c4bbdfSmrg    swapl(&pRep->bytesAfter);
25435c4bbdfSmrg    swapl(&pRep->nItems);
25535c4bbdfSmrg    WriteToClient(pClient, size, pRep);
25605b261ecSmrg}
25705b261ecSmrg
2581b5d61b8Smrgvoid _X_COLD
25935c4bbdfSmrgSListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply * pRep)
26005b261ecSmrg{
26135c4bbdfSmrg    swaps(&pRep->sequenceNumber);
26235c4bbdfSmrg    swapl(&pRep->length);
26335c4bbdfSmrg    swaps(&pRep->nProperties);
26435c4bbdfSmrg    WriteToClient(pClient, size, pRep);
26505b261ecSmrg}
26605b261ecSmrg
2671b5d61b8Smrgvoid _X_COLD
26805b261ecSmrgSGetSelectionOwnerReply(ClientPtr pClient, int size,
26935c4bbdfSmrg                        xGetSelectionOwnerReply * pRep)
27005b261ecSmrg{
27135c4bbdfSmrg    swaps(&pRep->sequenceNumber);
27235c4bbdfSmrg    swapl(&pRep->owner);
27335c4bbdfSmrg    WriteToClient(pClient, size, pRep);
27405b261ecSmrg}
27505b261ecSmrg
2761b5d61b8Smrgvoid _X_COLD
27735c4bbdfSmrgSQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply * pRep)
27805b261ecSmrg{
27935c4bbdfSmrg    swaps(&pRep->sequenceNumber);
28035c4bbdfSmrg    swapl(&pRep->root);
28135c4bbdfSmrg    swapl(&pRep->child);
28235c4bbdfSmrg    swaps(&pRep->rootX);
28335c4bbdfSmrg    swaps(&pRep->rootY);
28435c4bbdfSmrg    swaps(&pRep->winX);
28535c4bbdfSmrg    swaps(&pRep->winY);
28635c4bbdfSmrg    swaps(&pRep->mask);
28735c4bbdfSmrg    WriteToClient(pClient, size, pRep);
28805b261ecSmrg}
28905b261ecSmrg
2901b5d61b8Smrgstatic void _X_COLD
29135c4bbdfSmrgSwapTimecoord(xTimecoord * pCoord)
29205b261ecSmrg{
29335c4bbdfSmrg    swapl(&pCoord->time);
29435c4bbdfSmrg    swaps(&pCoord->x);
29535c4bbdfSmrg    swaps(&pCoord->y);
29605b261ecSmrg}
29705b261ecSmrg
2981b5d61b8Smrgvoid _X_COLD
29935c4bbdfSmrgSwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord * pRep)
30005b261ecSmrg{
30135c4bbdfSmrg    int i, n;
30235c4bbdfSmrg    xTimecoord *pRepT;
30305b261ecSmrg
30405b261ecSmrg    n = size / sizeof(xTimecoord);
30505b261ecSmrg    pRepT = pRep;
30635c4bbdfSmrg    for (i = 0; i < n; i++) {
30735c4bbdfSmrg        SwapTimecoord(pRepT);
30835c4bbdfSmrg        pRepT++;
30905b261ecSmrg    }
31035c4bbdfSmrg    WriteToClient(pClient, size, pRep);
31105b261ecSmrg
31205b261ecSmrg}
31335c4bbdfSmrg
3141b5d61b8Smrgvoid _X_COLD
31535c4bbdfSmrgSGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply * pRep)
31605b261ecSmrg{
31735c4bbdfSmrg    swaps(&pRep->sequenceNumber);
31835c4bbdfSmrg    swapl(&pRep->length);
31935c4bbdfSmrg    swapl(&pRep->nEvents);
32035c4bbdfSmrg    WriteToClient(pClient, size, pRep);
32105b261ecSmrg}
32205b261ecSmrg
3231b5d61b8Smrgvoid _X_COLD
32435c4bbdfSmrgSTranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply * pRep)
32505b261ecSmrg{
32635c4bbdfSmrg    swaps(&pRep->sequenceNumber);
32735c4bbdfSmrg    swapl(&pRep->child);
32835c4bbdfSmrg    swaps(&pRep->dstX);
32935c4bbdfSmrg    swaps(&pRep->dstY);
33035c4bbdfSmrg    WriteToClient(pClient, size, pRep);
33105b261ecSmrg}
33205b261ecSmrg
3331b5d61b8Smrgvoid _X_COLD
33435c4bbdfSmrgSGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply * pRep)
33505b261ecSmrg{
33635c4bbdfSmrg    swaps(&pRep->sequenceNumber);
33735c4bbdfSmrg    swapl(&pRep->focus);
33835c4bbdfSmrg    WriteToClient(pClient, size, pRep);
33905b261ecSmrg}
34005b261ecSmrg
34105b261ecSmrg/* extra long reply */
3421b5d61b8Smrgvoid _X_COLD
34335c4bbdfSmrgSQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply * pRep)
34405b261ecSmrg{
34535c4bbdfSmrg    swaps(&pRep->sequenceNumber);
34635c4bbdfSmrg    swapl(&pRep->length);
34735c4bbdfSmrg    WriteToClient(pClient, size, pRep);
34805b261ecSmrg}
34905b261ecSmrg
3501b5d61b8Smrgstatic void _X_COLD
35135c4bbdfSmrgSwapCharInfo(xCharInfo * pInfo)
35205b261ecSmrg{
35335c4bbdfSmrg    swaps(&pInfo->leftSideBearing);
35435c4bbdfSmrg    swaps(&pInfo->rightSideBearing);
35535c4bbdfSmrg    swaps(&pInfo->characterWidth);
35635c4bbdfSmrg    swaps(&pInfo->ascent);
35735c4bbdfSmrg    swaps(&pInfo->descent);
35835c4bbdfSmrg    swaps(&pInfo->attributes);
35905b261ecSmrg}
36005b261ecSmrg
3611b5d61b8Smrgstatic void _X_COLD
36235c4bbdfSmrgSwapFontInfo(xQueryFontReply * pr)
36305b261ecSmrg{
36435c4bbdfSmrg    swaps(&pr->minCharOrByte2);
36535c4bbdfSmrg    swaps(&pr->maxCharOrByte2);
36635c4bbdfSmrg    swaps(&pr->defaultChar);
36735c4bbdfSmrg    swaps(&pr->nFontProps);
36835c4bbdfSmrg    swaps(&pr->fontAscent);
36935c4bbdfSmrg    swaps(&pr->fontDescent);
37035c4bbdfSmrg    SwapCharInfo(&pr->minBounds);
37135c4bbdfSmrg    SwapCharInfo(&pr->maxBounds);
37235c4bbdfSmrg    swapl(&pr->nCharInfos);
37305b261ecSmrg}
37405b261ecSmrg
3751b5d61b8Smrgstatic void _X_COLD
37635c4bbdfSmrgSwapFont(xQueryFontReply * pr, Bool hasGlyphs)
37705b261ecSmrg{
37835c4bbdfSmrg    unsigned i;
37935c4bbdfSmrg    xCharInfo *pxci;
38035c4bbdfSmrg    unsigned nchars, nprops;
38135c4bbdfSmrg    char *pby;
38205b261ecSmrg
38335c4bbdfSmrg    swaps(&pr->sequenceNumber);
38435c4bbdfSmrg    swapl(&pr->length);
38505b261ecSmrg    nchars = pr->nCharInfos;
38605b261ecSmrg    nprops = pr->nFontProps;
38705b261ecSmrg    SwapFontInfo(pr);
38805b261ecSmrg    pby = (char *) &pr[1];
38905b261ecSmrg    /* Font properties are an atom and either an int32 or a CARD32, so
39005b261ecSmrg     * they are always 2 4 byte values */
39135c4bbdfSmrg    for (i = 0; i < nprops; i++) {
39235c4bbdfSmrg        swapl((int *) pby);
39335c4bbdfSmrg        pby += 4;
39435c4bbdfSmrg        swapl((int *) pby);
39535c4bbdfSmrg        pby += 4;
39605b261ecSmrg    }
39735c4bbdfSmrg    if (hasGlyphs) {
39835c4bbdfSmrg        pxci = (xCharInfo *) pby;
39935c4bbdfSmrg        for (i = 0; i < nchars; i++, pxci++)
40035c4bbdfSmrg            SwapCharInfo(pxci);
40105b261ecSmrg    }
40205b261ecSmrg}
40305b261ecSmrg
4041b5d61b8Smrgvoid _X_COLD
40535c4bbdfSmrgSQueryFontReply(ClientPtr pClient, int size, xQueryFontReply * pRep)
40605b261ecSmrg{
40705b261ecSmrg    SwapFont(pRep, TRUE);
40835c4bbdfSmrg    WriteToClient(pClient, size, pRep);
40905b261ecSmrg}
41005b261ecSmrg
4111b5d61b8Smrgvoid _X_COLD
41235c4bbdfSmrgSQueryTextExtentsReply(ClientPtr pClient, int size,
41335c4bbdfSmrg                       xQueryTextExtentsReply * pRep)
41405b261ecSmrg{
41535c4bbdfSmrg    swaps(&pRep->sequenceNumber);
41635c4bbdfSmrg    swaps(&pRep->fontAscent);
41735c4bbdfSmrg    swaps(&pRep->fontDescent);
41835c4bbdfSmrg    swaps(&pRep->overallAscent);
41935c4bbdfSmrg    swaps(&pRep->overallDescent);
42035c4bbdfSmrg    swapl(&pRep->overallWidth);
42135c4bbdfSmrg    swapl(&pRep->overallLeft);
42235c4bbdfSmrg    swapl(&pRep->overallRight);
42335c4bbdfSmrg    WriteToClient(pClient, size, pRep);
42405b261ecSmrg}
42505b261ecSmrg
4261b5d61b8Smrgvoid _X_COLD
42735c4bbdfSmrgSListFontsReply(ClientPtr pClient, int size, xListFontsReply * pRep)
42805b261ecSmrg{
42935c4bbdfSmrg    swaps(&pRep->sequenceNumber);
43035c4bbdfSmrg    swapl(&pRep->length);
43135c4bbdfSmrg    swaps(&pRep->nFonts);
43235c4bbdfSmrg    WriteToClient(pClient, size, pRep);
43305b261ecSmrg}
43405b261ecSmrg
4351b5d61b8Smrgvoid _X_COLD
43605b261ecSmrgSListFontsWithInfoReply(ClientPtr pClient, int size,
43735c4bbdfSmrg                        xListFontsWithInfoReply * pRep)
43805b261ecSmrg{
43935c4bbdfSmrg    SwapFont((xQueryFontReply *) pRep, FALSE);
44035c4bbdfSmrg    WriteToClient(pClient, size, pRep);
44105b261ecSmrg}
44205b261ecSmrg
4431b5d61b8Smrgvoid _X_COLD
44435c4bbdfSmrgSGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply * pRep)
44505b261ecSmrg{
44635c4bbdfSmrg    swaps(&pRep->sequenceNumber);
44735c4bbdfSmrg    swapl(&pRep->length);
44835c4bbdfSmrg    swaps(&pRep->nPaths);
44935c4bbdfSmrg    WriteToClient(pClient, size, pRep);
45005b261ecSmrg}
45105b261ecSmrg
4521b5d61b8Smrgvoid _X_COLD
45335c4bbdfSmrgSGetImageReply(ClientPtr pClient, int size, xGetImageReply * pRep)
45405b261ecSmrg{
45535c4bbdfSmrg    swaps(&pRep->sequenceNumber);
45635c4bbdfSmrg    swapl(&pRep->length);
45735c4bbdfSmrg    swapl(&pRep->visual);
45835c4bbdfSmrg    WriteToClient(pClient, size, pRep);
45905b261ecSmrg    /* Fortunately, image doesn't need swapping */
46005b261ecSmrg}
46105b261ecSmrg
4621b5d61b8Smrgvoid _X_COLD
46305b261ecSmrgSListInstalledColormapsReply(ClientPtr pClient, int size,
46435c4bbdfSmrg                             xListInstalledColormapsReply * pRep)
46505b261ecSmrg{
46635c4bbdfSmrg    swaps(&pRep->sequenceNumber);
46735c4bbdfSmrg    swapl(&pRep->length);
46835c4bbdfSmrg    swaps(&pRep->nColormaps);
46935c4bbdfSmrg    WriteToClient(pClient, size, pRep);
47005b261ecSmrg}
47105b261ecSmrg
4721b5d61b8Smrgvoid _X_COLD
47335c4bbdfSmrgSAllocColorReply(ClientPtr pClient, int size, xAllocColorReply * pRep)
47405b261ecSmrg{
47535c4bbdfSmrg    swaps(&pRep->sequenceNumber);
47635c4bbdfSmrg    swaps(&pRep->red);
47735c4bbdfSmrg    swaps(&pRep->green);
47835c4bbdfSmrg    swaps(&pRep->blue);
47935c4bbdfSmrg    swapl(&pRep->pixel);
48035c4bbdfSmrg    WriteToClient(pClient, size, pRep);
48105b261ecSmrg}
48205b261ecSmrg
4831b5d61b8Smrgvoid _X_COLD
48435c4bbdfSmrgSAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply * pRep)
48505b261ecSmrg{
48635c4bbdfSmrg    swaps(&pRep->sequenceNumber);
48735c4bbdfSmrg    swapl(&pRep->pixel);
48835c4bbdfSmrg    swaps(&pRep->exactRed);
48935c4bbdfSmrg    swaps(&pRep->exactGreen);
49035c4bbdfSmrg    swaps(&pRep->exactBlue);
49135c4bbdfSmrg    swaps(&pRep->screenRed);
49235c4bbdfSmrg    swaps(&pRep->screenGreen);
49335c4bbdfSmrg    swaps(&pRep->screenBlue);
49435c4bbdfSmrg    WriteToClient(pClient, size, pRep);
49505b261ecSmrg}
49605b261ecSmrg
4971b5d61b8Smrgvoid _X_COLD
49835c4bbdfSmrgSAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply * pRep)
49905b261ecSmrg{
50035c4bbdfSmrg    swaps(&pRep->sequenceNumber);
50135c4bbdfSmrg    swapl(&pRep->length);
50235c4bbdfSmrg    swaps(&pRep->nPixels);
50335c4bbdfSmrg    swaps(&pRep->nMasks);
50435c4bbdfSmrg    WriteToClient(pClient, size, pRep);
50505b261ecSmrg}
50605b261ecSmrg
5071b5d61b8Smrgvoid _X_COLD
50835c4bbdfSmrgSAllocColorPlanesReply(ClientPtr pClient, int size,
50935c4bbdfSmrg                       xAllocColorPlanesReply * pRep)
51005b261ecSmrg{
51135c4bbdfSmrg    swaps(&pRep->sequenceNumber);
51235c4bbdfSmrg    swapl(&pRep->length);
51335c4bbdfSmrg    swaps(&pRep->nPixels);
51435c4bbdfSmrg    swapl(&pRep->redMask);
51535c4bbdfSmrg    swapl(&pRep->greenMask);
51635c4bbdfSmrg    swapl(&pRep->blueMask);
51735c4bbdfSmrg    WriteToClient(pClient, size, pRep);
51805b261ecSmrg}
51905b261ecSmrg
5201b5d61b8Smrgstatic void _X_COLD
52135c4bbdfSmrgSwapRGB(xrgb * prgb)
52205b261ecSmrg{
52335c4bbdfSmrg    swaps(&prgb->red);
52435c4bbdfSmrg    swaps(&prgb->green);
52535c4bbdfSmrg    swaps(&prgb->blue);
52605b261ecSmrg}
52705b261ecSmrg
5281b5d61b8Smrgvoid _X_COLD
52935c4bbdfSmrgSQColorsExtend(ClientPtr pClient, int size, xrgb * prgb)
53005b261ecSmrg{
53135c4bbdfSmrg    int i, n;
53235c4bbdfSmrg    xrgb *prgbT;
53305b261ecSmrg
53405b261ecSmrg    n = size / sizeof(xrgb);
53505b261ecSmrg    prgbT = prgb;
53635c4bbdfSmrg    for (i = 0; i < n; i++) {
53735c4bbdfSmrg        SwapRGB(prgbT);
53835c4bbdfSmrg        prgbT++;
53905b261ecSmrg    }
54035c4bbdfSmrg    WriteToClient(pClient, size, prgb);
54105b261ecSmrg}
54205b261ecSmrg
5431b5d61b8Smrgvoid _X_COLD
54435c4bbdfSmrgSQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply * pRep)
54505b261ecSmrg{
54635c4bbdfSmrg    swaps(&pRep->sequenceNumber);
54735c4bbdfSmrg    swapl(&pRep->length);
54835c4bbdfSmrg    swaps(&pRep->nColors);
54935c4bbdfSmrg    WriteToClient(pClient, size, pRep);
55005b261ecSmrg}
55105b261ecSmrg
5521b5d61b8Smrgvoid _X_COLD
55335c4bbdfSmrgSLookupColorReply(ClientPtr pClient, int size, xLookupColorReply * pRep)
55405b261ecSmrg{
55535c4bbdfSmrg    swaps(&pRep->sequenceNumber);
55635c4bbdfSmrg    swaps(&pRep->exactRed);
55735c4bbdfSmrg    swaps(&pRep->exactGreen);
55835c4bbdfSmrg    swaps(&pRep->exactBlue);
55935c4bbdfSmrg    swaps(&pRep->screenRed);
56035c4bbdfSmrg    swaps(&pRep->screenGreen);
56135c4bbdfSmrg    swaps(&pRep->screenBlue);
56235c4bbdfSmrg    WriteToClient(pClient, size, pRep);
56305b261ecSmrg}
56405b261ecSmrg
5651b5d61b8Smrgvoid _X_COLD
56635c4bbdfSmrgSQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply * pRep)
56705b261ecSmrg{
56835c4bbdfSmrg    swaps(&pRep->sequenceNumber);
56935c4bbdfSmrg    swaps(&pRep->width);
57035c4bbdfSmrg    swaps(&pRep->height);
57135c4bbdfSmrg    WriteToClient(pClient, size, pRep);
57205b261ecSmrg}
57305b261ecSmrg
5741b5d61b8Smrgvoid _X_COLD
57535c4bbdfSmrgSListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply * pRep)
57605b261ecSmrg{
57735c4bbdfSmrg    swaps(&pRep->sequenceNumber);
57835c4bbdfSmrg    swapl(&pRep->length);
57935c4bbdfSmrg    WriteToClient(pClient, size, pRep);
58005b261ecSmrg}
58105b261ecSmrg
5821b5d61b8Smrgvoid _X_COLD
58305b261ecSmrgSGetKeyboardMappingReply(ClientPtr pClient, int size,
58435c4bbdfSmrg                         xGetKeyboardMappingReply * pRep)
58505b261ecSmrg{
58635c4bbdfSmrg    swaps(&pRep->sequenceNumber);
58735c4bbdfSmrg    swapl(&pRep->length);
58835c4bbdfSmrg    WriteToClient(pClient, size, pRep);
58905b261ecSmrg}
59005b261ecSmrg
5911b5d61b8Smrgvoid _X_COLD
59205b261ecSmrgSGetPointerMappingReply(ClientPtr pClient, int size,
59335c4bbdfSmrg                        xGetPointerMappingReply * pRep)
59405b261ecSmrg{
59535c4bbdfSmrg    swaps(&pRep->sequenceNumber);
59635c4bbdfSmrg    swapl(&pRep->length);
59735c4bbdfSmrg    WriteToClient(pClient, size, pRep);
59805b261ecSmrg}
59905b261ecSmrg
6001b5d61b8Smrgvoid _X_COLD
60105b261ecSmrgSGetModifierMappingReply(ClientPtr pClient, int size,
60235c4bbdfSmrg                         xGetModifierMappingReply * pRep)
60305b261ecSmrg{
60435c4bbdfSmrg    swaps(&pRep->sequenceNumber);
60535c4bbdfSmrg    swapl(&pRep->length);
60635c4bbdfSmrg    WriteToClient(pClient, size, pRep);
60705b261ecSmrg}
60805b261ecSmrg
6091b5d61b8Smrgvoid _X_COLD
61035c4bbdfSmrgSGetKeyboardControlReply(ClientPtr pClient, int size,
61135c4bbdfSmrg                         xGetKeyboardControlReply * pRep)
61205b261ecSmrg{
61335c4bbdfSmrg    swaps(&pRep->sequenceNumber);
61435c4bbdfSmrg    swapl(&pRep->length);
61535c4bbdfSmrg    swapl(&pRep->ledMask);
61635c4bbdfSmrg    swaps(&pRep->bellPitch);
61735c4bbdfSmrg    swaps(&pRep->bellDuration);
61835c4bbdfSmrg    WriteToClient(pClient, size, pRep);
61905b261ecSmrg}
62005b261ecSmrg
6211b5d61b8Smrgvoid _X_COLD
62235c4bbdfSmrgSGetPointerControlReply(ClientPtr pClient, int size,
62335c4bbdfSmrg                        xGetPointerControlReply * pRep)
62405b261ecSmrg{
62535c4bbdfSmrg    swaps(&pRep->sequenceNumber);
62635c4bbdfSmrg    swaps(&pRep->accelNumerator);
62735c4bbdfSmrg    swaps(&pRep->accelDenominator);
62835c4bbdfSmrg    swaps(&pRep->threshold);
62935c4bbdfSmrg    WriteToClient(pClient, size, pRep);
63005b261ecSmrg}
63105b261ecSmrg
6321b5d61b8Smrgvoid _X_COLD
63335c4bbdfSmrgSGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply * pRep)
63405b261ecSmrg{
63535c4bbdfSmrg    swaps(&pRep->sequenceNumber);
63635c4bbdfSmrg    swaps(&pRep->timeout);
63735c4bbdfSmrg    swaps(&pRep->interval);
63835c4bbdfSmrg    WriteToClient(pClient, size, pRep);
63905b261ecSmrg}
64005b261ecSmrg
6411b5d61b8Smrgvoid _X_COLD
64205b261ecSmrgSLHostsExtend(ClientPtr pClient, int size, char *buf)
64305b261ecSmrg{
64405b261ecSmrg    char *bufT = buf;
64505b261ecSmrg    char *endbuf = buf + size;
64635c4bbdfSmrg
64705b261ecSmrg    while (bufT < endbuf) {
64835c4bbdfSmrg        xHostEntry *host = (xHostEntry *) bufT;
64935c4bbdfSmrg        int len = host->length;
65035c4bbdfSmrg
65135c4bbdfSmrg        swaps(&host->length);
65235c4bbdfSmrg        bufT += sizeof(xHostEntry) + pad_to_int32(len);
65335c4bbdfSmrg    }
65435c4bbdfSmrg    WriteToClient(pClient, size, buf);
65505b261ecSmrg}
65605b261ecSmrg
6571b5d61b8Smrgvoid _X_COLD
65835c4bbdfSmrgSListHostsReply(ClientPtr pClient, int size, xListHostsReply * pRep)
65905b261ecSmrg{
66035c4bbdfSmrg    swaps(&pRep->sequenceNumber);
66135c4bbdfSmrg    swapl(&pRep->length);
66235c4bbdfSmrg    swaps(&pRep->nHosts);
66335c4bbdfSmrg    WriteToClient(pClient, size, pRep);
66405b261ecSmrg}
66505b261ecSmrg
6661b5d61b8Smrgvoid _X_COLD
66735c4bbdfSmrgSErrorEvent(xError * from, xError * to)
66805b261ecSmrg{
66905b261ecSmrg    to->type = X_Error;
67005b261ecSmrg    to->errorCode = from->errorCode;
67105b261ecSmrg    cpswaps(from->sequenceNumber, to->sequenceNumber);
67205b261ecSmrg    cpswapl(from->resourceID, to->resourceID);
67305b261ecSmrg    cpswaps(from->minorCode, to->minorCode);
67405b261ecSmrg    to->majorCode = from->majorCode;
67505b261ecSmrg}
67605b261ecSmrg
6771b5d61b8Smrgvoid _X_COLD
67805b261ecSmrgSKeyButtonPtrEvent(xEvent *from, xEvent *to)
67905b261ecSmrg{
68005b261ecSmrg    to->u.u.type = from->u.u.type;
68105b261ecSmrg    to->u.u.detail = from->u.u.detail;
68205b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
68335c4bbdfSmrg    cpswapl(from->u.keyButtonPointer.time, to->u.keyButtonPointer.time);
68435c4bbdfSmrg    cpswapl(from->u.keyButtonPointer.root, to->u.keyButtonPointer.root);
68535c4bbdfSmrg    cpswapl(from->u.keyButtonPointer.event, to->u.keyButtonPointer.event);
68635c4bbdfSmrg    cpswapl(from->u.keyButtonPointer.child, to->u.keyButtonPointer.child);
68735c4bbdfSmrg    cpswaps(from->u.keyButtonPointer.rootX, to->u.keyButtonPointer.rootX);
68835c4bbdfSmrg    cpswaps(from->u.keyButtonPointer.rootY, to->u.keyButtonPointer.rootY);
68935c4bbdfSmrg    cpswaps(from->u.keyButtonPointer.eventX, to->u.keyButtonPointer.eventX);
69035c4bbdfSmrg    cpswaps(from->u.keyButtonPointer.eventY, to->u.keyButtonPointer.eventY);
69135c4bbdfSmrg    cpswaps(from->u.keyButtonPointer.state, to->u.keyButtonPointer.state);
69235c4bbdfSmrg    to->u.keyButtonPointer.sameScreen = from->u.keyButtonPointer.sameScreen;
69305b261ecSmrg}
69405b261ecSmrg
6951b5d61b8Smrgvoid _X_COLD
69605b261ecSmrgSEnterLeaveEvent(xEvent *from, xEvent *to)
69705b261ecSmrg{
69805b261ecSmrg    to->u.u.type = from->u.u.type;
69905b261ecSmrg    to->u.u.detail = from->u.u.detail;
70005b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
70105b261ecSmrg    cpswapl(from->u.enterLeave.time, to->u.enterLeave.time);
70205b261ecSmrg    cpswapl(from->u.enterLeave.root, to->u.enterLeave.root);
70305b261ecSmrg    cpswapl(from->u.enterLeave.event, to->u.enterLeave.event);
70405b261ecSmrg    cpswapl(from->u.enterLeave.child, to->u.enterLeave.child);
70505b261ecSmrg    cpswaps(from->u.enterLeave.rootX, to->u.enterLeave.rootX);
70605b261ecSmrg    cpswaps(from->u.enterLeave.rootY, to->u.enterLeave.rootY);
70705b261ecSmrg    cpswaps(from->u.enterLeave.eventX, to->u.enterLeave.eventX);
70805b261ecSmrg    cpswaps(from->u.enterLeave.eventY, to->u.enterLeave.eventY);
70905b261ecSmrg    cpswaps(from->u.enterLeave.state, to->u.enterLeave.state);
71005b261ecSmrg    to->u.enterLeave.mode = from->u.enterLeave.mode;
71105b261ecSmrg    to->u.enterLeave.flags = from->u.enterLeave.flags;
71205b261ecSmrg}
71305b261ecSmrg
7141b5d61b8Smrgvoid _X_COLD
71505b261ecSmrgSFocusEvent(xEvent *from, xEvent *to)
71605b261ecSmrg{
71705b261ecSmrg    to->u.u.type = from->u.u.type;
71805b261ecSmrg    to->u.u.detail = from->u.u.detail;
71905b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
72005b261ecSmrg    cpswapl(from->u.focus.window, to->u.focus.window);
72105b261ecSmrg    to->u.focus.mode = from->u.focus.mode;
72205b261ecSmrg}
72305b261ecSmrg
7241b5d61b8Smrgvoid _X_COLD
72505b261ecSmrgSExposeEvent(xEvent *from, xEvent *to)
72605b261ecSmrg{
72705b261ecSmrg    to->u.u.type = from->u.u.type;
72805b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
72905b261ecSmrg    cpswapl(from->u.expose.window, to->u.expose.window);
73005b261ecSmrg    cpswaps(from->u.expose.x, to->u.expose.x);
73105b261ecSmrg    cpswaps(from->u.expose.y, to->u.expose.y);
73205b261ecSmrg    cpswaps(from->u.expose.width, to->u.expose.width);
73305b261ecSmrg    cpswaps(from->u.expose.height, to->u.expose.height);
73405b261ecSmrg    cpswaps(from->u.expose.count, to->u.expose.count);
73505b261ecSmrg}
73605b261ecSmrg
7371b5d61b8Smrgvoid _X_COLD
73805b261ecSmrgSGraphicsExposureEvent(xEvent *from, xEvent *to)
73905b261ecSmrg{
74005b261ecSmrg    to->u.u.type = from->u.u.type;
74105b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
74235c4bbdfSmrg    cpswapl(from->u.graphicsExposure.drawable, to->u.graphicsExposure.drawable);
74335c4bbdfSmrg    cpswaps(from->u.graphicsExposure.x, to->u.graphicsExposure.x);
74435c4bbdfSmrg    cpswaps(from->u.graphicsExposure.y, to->u.graphicsExposure.y);
74535c4bbdfSmrg    cpswaps(from->u.graphicsExposure.width, to->u.graphicsExposure.width);
74635c4bbdfSmrg    cpswaps(from->u.graphicsExposure.height, to->u.graphicsExposure.height);
74705b261ecSmrg    cpswaps(from->u.graphicsExposure.minorEvent,
74835c4bbdfSmrg            to->u.graphicsExposure.minorEvent);
74935c4bbdfSmrg    cpswaps(from->u.graphicsExposure.count, to->u.graphicsExposure.count);
75035c4bbdfSmrg    to->u.graphicsExposure.majorEvent = from->u.graphicsExposure.majorEvent;
75105b261ecSmrg}
75205b261ecSmrg
7531b5d61b8Smrgvoid _X_COLD
75405b261ecSmrgSNoExposureEvent(xEvent *from, xEvent *to)
75505b261ecSmrg{
75605b261ecSmrg    to->u.u.type = from->u.u.type;
75705b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
75805b261ecSmrg    cpswapl(from->u.noExposure.drawable, to->u.noExposure.drawable);
75905b261ecSmrg    cpswaps(from->u.noExposure.minorEvent, to->u.noExposure.minorEvent);
76005b261ecSmrg    to->u.noExposure.majorEvent = from->u.noExposure.majorEvent;
76105b261ecSmrg}
76205b261ecSmrg
7631b5d61b8Smrgvoid _X_COLD
76405b261ecSmrgSVisibilityEvent(xEvent *from, xEvent *to)
76505b261ecSmrg{
76605b261ecSmrg    to->u.u.type = from->u.u.type;
76705b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
76805b261ecSmrg    cpswapl(from->u.visibility.window, to->u.visibility.window);
76905b261ecSmrg    to->u.visibility.state = from->u.visibility.state;
77005b261ecSmrg}
77105b261ecSmrg
7721b5d61b8Smrgvoid _X_COLD
77305b261ecSmrgSCreateNotifyEvent(xEvent *from, xEvent *to)
77405b261ecSmrg{
77505b261ecSmrg    to->u.u.type = from->u.u.type;
77605b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
77705b261ecSmrg    cpswapl(from->u.createNotify.window, to->u.createNotify.window);
77805b261ecSmrg    cpswapl(from->u.createNotify.parent, to->u.createNotify.parent);
77905b261ecSmrg    cpswaps(from->u.createNotify.x, to->u.createNotify.x);
78005b261ecSmrg    cpswaps(from->u.createNotify.y, to->u.createNotify.y);
78105b261ecSmrg    cpswaps(from->u.createNotify.width, to->u.createNotify.width);
78205b261ecSmrg    cpswaps(from->u.createNotify.height, to->u.createNotify.height);
78335c4bbdfSmrg    cpswaps(from->u.createNotify.borderWidth, to->u.createNotify.borderWidth);
78405b261ecSmrg    to->u.createNotify.override = from->u.createNotify.override;
78505b261ecSmrg}
78605b261ecSmrg
7871b5d61b8Smrgvoid _X_COLD
78805b261ecSmrgSDestroyNotifyEvent(xEvent *from, xEvent *to)
78905b261ecSmrg{
79005b261ecSmrg    to->u.u.type = from->u.u.type;
79105b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
79205b261ecSmrg    cpswapl(from->u.destroyNotify.event, to->u.destroyNotify.event);
79305b261ecSmrg    cpswapl(from->u.destroyNotify.window, to->u.destroyNotify.window);
79405b261ecSmrg}
79505b261ecSmrg
7961b5d61b8Smrgvoid _X_COLD
79705b261ecSmrgSUnmapNotifyEvent(xEvent *from, xEvent *to)
79805b261ecSmrg{
79905b261ecSmrg    to->u.u.type = from->u.u.type;
80005b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
80105b261ecSmrg    cpswapl(from->u.unmapNotify.event, to->u.unmapNotify.event);
80205b261ecSmrg    cpswapl(from->u.unmapNotify.window, to->u.unmapNotify.window);
80305b261ecSmrg    to->u.unmapNotify.fromConfigure = from->u.unmapNotify.fromConfigure;
80405b261ecSmrg}
80505b261ecSmrg
8061b5d61b8Smrgvoid _X_COLD
80705b261ecSmrgSMapNotifyEvent(xEvent *from, xEvent *to)
80805b261ecSmrg{
80905b261ecSmrg    to->u.u.type = from->u.u.type;
81005b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
81105b261ecSmrg    cpswapl(from->u.mapNotify.event, to->u.mapNotify.event);
81205b261ecSmrg    cpswapl(from->u.mapNotify.window, to->u.mapNotify.window);
81305b261ecSmrg    to->u.mapNotify.override = from->u.mapNotify.override;
81405b261ecSmrg}
81505b261ecSmrg
8161b5d61b8Smrgvoid _X_COLD
81705b261ecSmrgSMapRequestEvent(xEvent *from, xEvent *to)
81805b261ecSmrg{
81905b261ecSmrg    to->u.u.type = from->u.u.type;
82005b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
82105b261ecSmrg    cpswapl(from->u.mapRequest.parent, to->u.mapRequest.parent);
82205b261ecSmrg    cpswapl(from->u.mapRequest.window, to->u.mapRequest.window);
82305b261ecSmrg}
82405b261ecSmrg
8251b5d61b8Smrgvoid _X_COLD
82605b261ecSmrgSReparentEvent(xEvent *from, xEvent *to)
82705b261ecSmrg{
82805b261ecSmrg    to->u.u.type = from->u.u.type;
82905b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
83005b261ecSmrg    cpswapl(from->u.reparent.event, to->u.reparent.event);
83105b261ecSmrg    cpswapl(from->u.reparent.window, to->u.reparent.window);
83205b261ecSmrg    cpswapl(from->u.reparent.parent, to->u.reparent.parent);
83305b261ecSmrg    cpswaps(from->u.reparent.x, to->u.reparent.x);
83405b261ecSmrg    cpswaps(from->u.reparent.y, to->u.reparent.y);
83505b261ecSmrg    to->u.reparent.override = from->u.reparent.override;
83605b261ecSmrg}
83705b261ecSmrg
8381b5d61b8Smrgvoid _X_COLD
83905b261ecSmrgSConfigureNotifyEvent(xEvent *from, xEvent *to)
84005b261ecSmrg{
84105b261ecSmrg    to->u.u.type = from->u.u.type;
84205b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
84335c4bbdfSmrg    cpswapl(from->u.configureNotify.event, to->u.configureNotify.event);
84435c4bbdfSmrg    cpswapl(from->u.configureNotify.window, to->u.configureNotify.window);
84505b261ecSmrg    cpswapl(from->u.configureNotify.aboveSibling,
84635c4bbdfSmrg            to->u.configureNotify.aboveSibling);
84705b261ecSmrg    cpswaps(from->u.configureNotify.x, to->u.configureNotify.x);
84805b261ecSmrg    cpswaps(from->u.configureNotify.y, to->u.configureNotify.y);
84905b261ecSmrg    cpswaps(from->u.configureNotify.width, to->u.configureNotify.width);
85035c4bbdfSmrg    cpswaps(from->u.configureNotify.height, to->u.configureNotify.height);
85105b261ecSmrg    cpswaps(from->u.configureNotify.borderWidth,
85235c4bbdfSmrg            to->u.configureNotify.borderWidth);
85305b261ecSmrg    to->u.configureNotify.override = from->u.configureNotify.override;
85405b261ecSmrg}
85505b261ecSmrg
8561b5d61b8Smrgvoid _X_COLD
85705b261ecSmrgSConfigureRequestEvent(xEvent *from, xEvent *to)
85805b261ecSmrg{
85905b261ecSmrg    to->u.u.type = from->u.u.type;
86005b261ecSmrg    to->u.u.detail = from->u.u.detail;  /* actually stack-mode */
86105b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
86235c4bbdfSmrg    cpswapl(from->u.configureRequest.parent, to->u.configureRequest.parent);
86335c4bbdfSmrg    cpswapl(from->u.configureRequest.window, to->u.configureRequest.window);
86435c4bbdfSmrg    cpswapl(from->u.configureRequest.sibling, to->u.configureRequest.sibling);
86505b261ecSmrg    cpswaps(from->u.configureRequest.x, to->u.configureRequest.x);
86605b261ecSmrg    cpswaps(from->u.configureRequest.y, to->u.configureRequest.y);
86735c4bbdfSmrg    cpswaps(from->u.configureRequest.width, to->u.configureRequest.width);
86835c4bbdfSmrg    cpswaps(from->u.configureRequest.height, to->u.configureRequest.height);
86905b261ecSmrg    cpswaps(from->u.configureRequest.borderWidth,
87035c4bbdfSmrg            to->u.configureRequest.borderWidth);
87105b261ecSmrg    cpswaps(from->u.configureRequest.valueMask,
87235c4bbdfSmrg            to->u.configureRequest.valueMask);
87305b261ecSmrg}
87405b261ecSmrg
8751b5d61b8Smrgvoid _X_COLD
87605b261ecSmrgSGravityEvent(xEvent *from, xEvent *to)
87705b261ecSmrg{
87805b261ecSmrg    to->u.u.type = from->u.u.type;
87905b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
88005b261ecSmrg    cpswapl(from->u.gravity.event, to->u.gravity.event);
88105b261ecSmrg    cpswapl(from->u.gravity.window, to->u.gravity.window);
88205b261ecSmrg    cpswaps(from->u.gravity.x, to->u.gravity.x);
88305b261ecSmrg    cpswaps(from->u.gravity.y, to->u.gravity.y);
88405b261ecSmrg}
88505b261ecSmrg
8861b5d61b8Smrgvoid _X_COLD
88705b261ecSmrgSResizeRequestEvent(xEvent *from, xEvent *to)
88805b261ecSmrg{
88905b261ecSmrg    to->u.u.type = from->u.u.type;
89005b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
89105b261ecSmrg    cpswapl(from->u.resizeRequest.window, to->u.resizeRequest.window);
89205b261ecSmrg    cpswaps(from->u.resizeRequest.width, to->u.resizeRequest.width);
89305b261ecSmrg    cpswaps(from->u.resizeRequest.height, to->u.resizeRequest.height);
89405b261ecSmrg}
89505b261ecSmrg
8961b5d61b8Smrgvoid _X_COLD
89705b261ecSmrgSCirculateEvent(xEvent *from, xEvent *to)
89805b261ecSmrg{
89905b261ecSmrg    to->u.u.type = from->u.u.type;
90005b261ecSmrg    to->u.u.detail = from->u.u.detail;
90105b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
90205b261ecSmrg    cpswapl(from->u.circulate.event, to->u.circulate.event);
90305b261ecSmrg    cpswapl(from->u.circulate.window, to->u.circulate.window);
90405b261ecSmrg    cpswapl(from->u.circulate.parent, to->u.circulate.parent);
90505b261ecSmrg    to->u.circulate.place = from->u.circulate.place;
90605b261ecSmrg}
90705b261ecSmrg
9081b5d61b8Smrgvoid _X_COLD
90905b261ecSmrgSPropertyEvent(xEvent *from, xEvent *to)
91005b261ecSmrg{
91105b261ecSmrg    to->u.u.type = from->u.u.type;
91205b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
91305b261ecSmrg    cpswapl(from->u.property.window, to->u.property.window);
91405b261ecSmrg    cpswapl(from->u.property.atom, to->u.property.atom);
91505b261ecSmrg    cpswapl(from->u.property.time, to->u.property.time);
91605b261ecSmrg    to->u.property.state = from->u.property.state;
91705b261ecSmrg}
91805b261ecSmrg
9191b5d61b8Smrgvoid _X_COLD
92005b261ecSmrgSSelectionClearEvent(xEvent *from, xEvent *to)
92105b261ecSmrg{
92205b261ecSmrg    to->u.u.type = from->u.u.type;
92305b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
92405b261ecSmrg    cpswapl(from->u.selectionClear.time, to->u.selectionClear.time);
92505b261ecSmrg    cpswapl(from->u.selectionClear.window, to->u.selectionClear.window);
92605b261ecSmrg    cpswapl(from->u.selectionClear.atom, to->u.selectionClear.atom);
92705b261ecSmrg}
92805b261ecSmrg
9291b5d61b8Smrgvoid _X_COLD
93005b261ecSmrgSSelectionRequestEvent(xEvent *from, xEvent *to)
93105b261ecSmrg{
93205b261ecSmrg    to->u.u.type = from->u.u.type;
93305b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
93405b261ecSmrg    cpswapl(from->u.selectionRequest.time, to->u.selectionRequest.time);
93535c4bbdfSmrg    cpswapl(from->u.selectionRequest.owner, to->u.selectionRequest.owner);
93605b261ecSmrg    cpswapl(from->u.selectionRequest.requestor,
93735c4bbdfSmrg            to->u.selectionRequest.requestor);
93805b261ecSmrg    cpswapl(from->u.selectionRequest.selection,
93935c4bbdfSmrg            to->u.selectionRequest.selection);
94035c4bbdfSmrg    cpswapl(from->u.selectionRequest.target, to->u.selectionRequest.target);
94135c4bbdfSmrg    cpswapl(from->u.selectionRequest.property, to->u.selectionRequest.property);
94205b261ecSmrg}
94305b261ecSmrg
9441b5d61b8Smrgvoid _X_COLD
94505b261ecSmrgSSelectionNotifyEvent(xEvent *from, xEvent *to)
94605b261ecSmrg{
94705b261ecSmrg    to->u.u.type = from->u.u.type;
94805b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
94905b261ecSmrg    cpswapl(from->u.selectionNotify.time, to->u.selectionNotify.time);
95035c4bbdfSmrg    cpswapl(from->u.selectionNotify.requestor, to->u.selectionNotify.requestor);
95135c4bbdfSmrg    cpswapl(from->u.selectionNotify.selection, to->u.selectionNotify.selection);
95235c4bbdfSmrg    cpswapl(from->u.selectionNotify.target, to->u.selectionNotify.target);
95335c4bbdfSmrg    cpswapl(from->u.selectionNotify.property, to->u.selectionNotify.property);
95405b261ecSmrg}
95505b261ecSmrg
9561b5d61b8Smrgvoid _X_COLD
95705b261ecSmrgSColormapEvent(xEvent *from, xEvent *to)
95805b261ecSmrg{
95905b261ecSmrg    to->u.u.type = from->u.u.type;
96005b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
96105b261ecSmrg    cpswapl(from->u.colormap.window, to->u.colormap.window);
96205b261ecSmrg    cpswapl(from->u.colormap.colormap, to->u.colormap.colormap);
96305b261ecSmrg    to->u.colormap.new = from->u.colormap.new;
96405b261ecSmrg    to->u.colormap.state = from->u.colormap.state;
96505b261ecSmrg}
96605b261ecSmrg
9671b5d61b8Smrgvoid _X_COLD
96805b261ecSmrgSMappingEvent(xEvent *from, xEvent *to)
96905b261ecSmrg{
97005b261ecSmrg    to->u.u.type = from->u.u.type;
97105b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
97205b261ecSmrg    to->u.mappingNotify.request = from->u.mappingNotify.request;
97335c4bbdfSmrg    to->u.mappingNotify.firstKeyCode = from->u.mappingNotify.firstKeyCode;
97405b261ecSmrg    to->u.mappingNotify.count = from->u.mappingNotify.count;
97505b261ecSmrg}
97605b261ecSmrg
9771b5d61b8Smrgvoid _X_COLD
97805b261ecSmrgSClientMessageEvent(xEvent *from, xEvent *to)
97905b261ecSmrg{
98005b261ecSmrg    to->u.u.type = from->u.u.type;
98105b261ecSmrg    to->u.u.detail = from->u.u.detail;  /* actually format */
98205b261ecSmrg    cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
98305b261ecSmrg    cpswapl(from->u.clientMessage.window, to->u.clientMessage.window);
98435c4bbdfSmrg    cpswapl(from->u.clientMessage.u.l.type, to->u.clientMessage.u.l.type);
98505b261ecSmrg    switch (from->u.u.detail) {
98635c4bbdfSmrg    case 8:
98735c4bbdfSmrg        memmove(to->u.clientMessage.u.b.bytes,
98835c4bbdfSmrg                from->u.clientMessage.u.b.bytes, 20);
98935c4bbdfSmrg        break;
99035c4bbdfSmrg    case 16:
99135c4bbdfSmrg        cpswaps(from->u.clientMessage.u.s.shorts0,
99235c4bbdfSmrg                to->u.clientMessage.u.s.shorts0);
99335c4bbdfSmrg        cpswaps(from->u.clientMessage.u.s.shorts1,
99435c4bbdfSmrg                to->u.clientMessage.u.s.shorts1);
99535c4bbdfSmrg        cpswaps(from->u.clientMessage.u.s.shorts2,
99635c4bbdfSmrg                to->u.clientMessage.u.s.shorts2);
99735c4bbdfSmrg        cpswaps(from->u.clientMessage.u.s.shorts3,
99835c4bbdfSmrg                to->u.clientMessage.u.s.shorts3);
99935c4bbdfSmrg        cpswaps(from->u.clientMessage.u.s.shorts4,
100035c4bbdfSmrg                to->u.clientMessage.u.s.shorts4);
100135c4bbdfSmrg        cpswaps(from->u.clientMessage.u.s.shorts5,
100235c4bbdfSmrg                to->u.clientMessage.u.s.shorts5);
100335c4bbdfSmrg        cpswaps(from->u.clientMessage.u.s.shorts6,
100435c4bbdfSmrg                to->u.clientMessage.u.s.shorts6);
100535c4bbdfSmrg        cpswaps(from->u.clientMessage.u.s.shorts7,
100635c4bbdfSmrg                to->u.clientMessage.u.s.shorts7);
100735c4bbdfSmrg        cpswaps(from->u.clientMessage.u.s.shorts8,
100835c4bbdfSmrg                to->u.clientMessage.u.s.shorts8);
100935c4bbdfSmrg        cpswaps(from->u.clientMessage.u.s.shorts9,
101035c4bbdfSmrg                to->u.clientMessage.u.s.shorts9);
101135c4bbdfSmrg        break;
101235c4bbdfSmrg    case 32:
101335c4bbdfSmrg        cpswapl(from->u.clientMessage.u.l.longs0,
101435c4bbdfSmrg                to->u.clientMessage.u.l.longs0);
101535c4bbdfSmrg        cpswapl(from->u.clientMessage.u.l.longs1,
101635c4bbdfSmrg                to->u.clientMessage.u.l.longs1);
101735c4bbdfSmrg        cpswapl(from->u.clientMessage.u.l.longs2,
101835c4bbdfSmrg                to->u.clientMessage.u.l.longs2);
101935c4bbdfSmrg        cpswapl(from->u.clientMessage.u.l.longs3,
102035c4bbdfSmrg                to->u.clientMessage.u.l.longs3);
102135c4bbdfSmrg        cpswapl(from->u.clientMessage.u.l.longs4,
102235c4bbdfSmrg                to->u.clientMessage.u.l.longs4);
102335c4bbdfSmrg        break;
102435c4bbdfSmrg    }
102505b261ecSmrg}
102605b261ecSmrg
10271b5d61b8Smrgvoid _X_COLD
102805b261ecSmrgSKeymapNotifyEvent(xEvent *from, xEvent *to)
102905b261ecSmrg{
103005b261ecSmrg    /* Keymap notify events are special; they have no
103105b261ecSmrg       sequence number field, and contain entirely 8-bit data */
103205b261ecSmrg    *to = *from;
103305b261ecSmrg}
103405b261ecSmrg
10351b5d61b8Smrgstatic void _X_COLD
103635c4bbdfSmrgSwapConnSetup(xConnSetup * pConnSetup, xConnSetup * pConnSetupT)
103705b261ecSmrg{
103805b261ecSmrg    cpswapl(pConnSetup->release, pConnSetupT->release);
103905b261ecSmrg    cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase);
104005b261ecSmrg    cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask);
104105b261ecSmrg    cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize);
104205b261ecSmrg    cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor);
104305b261ecSmrg    cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize);
104405b261ecSmrg    pConnSetupT->minKeyCode = pConnSetup->minKeyCode;
104505b261ecSmrg    pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode;
104605b261ecSmrg    pConnSetupT->numRoots = pConnSetup->numRoots;
104705b261ecSmrg    pConnSetupT->numFormats = pConnSetup->numFormats;
104805b261ecSmrg    pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder;
104905b261ecSmrg    pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder;
105005b261ecSmrg    pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit;
105105b261ecSmrg    pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad;
105205b261ecSmrg}
105305b261ecSmrg
10541b5d61b8Smrgstatic void _X_COLD
105535c4bbdfSmrgSwapWinRoot(xWindowRoot * pRoot, xWindowRoot * pRootT)
105605b261ecSmrg{
105705b261ecSmrg    cpswapl(pRoot->windowId, pRootT->windowId);
105805b261ecSmrg    cpswapl(pRoot->defaultColormap, pRootT->defaultColormap);
105905b261ecSmrg    cpswapl(pRoot->whitePixel, pRootT->whitePixel);
106005b261ecSmrg    cpswapl(pRoot->blackPixel, pRootT->blackPixel);
106105b261ecSmrg    cpswapl(pRoot->currentInputMask, pRootT->currentInputMask);
106205b261ecSmrg    cpswaps(pRoot->pixWidth, pRootT->pixWidth);
106305b261ecSmrg    cpswaps(pRoot->pixHeight, pRootT->pixHeight);
106405b261ecSmrg    cpswaps(pRoot->mmWidth, pRootT->mmWidth);
106505b261ecSmrg    cpswaps(pRoot->mmHeight, pRootT->mmHeight);
106605b261ecSmrg    cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps);
106705b261ecSmrg    cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps);
106805b261ecSmrg    cpswapl(pRoot->rootVisualID, pRootT->rootVisualID);
106905b261ecSmrg    pRootT->backingStore = pRoot->backingStore;
107005b261ecSmrg    pRootT->saveUnders = pRoot->saveUnders;
107105b261ecSmrg    pRootT->rootDepth = pRoot->rootDepth;
107205b261ecSmrg    pRootT->nDepths = pRoot->nDepths;
107305b261ecSmrg}
107405b261ecSmrg
10751b5d61b8Smrgstatic void _X_COLD
107635c4bbdfSmrgSwapVisual(xVisualType * pVis, xVisualType * pVisT)
107705b261ecSmrg{
107805b261ecSmrg    cpswapl(pVis->visualID, pVisT->visualID);
107905b261ecSmrg    pVisT->class = pVis->class;
108005b261ecSmrg    pVisT->bitsPerRGB = pVis->bitsPerRGB;
108105b261ecSmrg    cpswaps(pVis->colormapEntries, pVisT->colormapEntries);
108205b261ecSmrg    cpswapl(pVis->redMask, pVisT->redMask);
108305b261ecSmrg    cpswapl(pVis->greenMask, pVisT->greenMask);
108405b261ecSmrg    cpswapl(pVis->blueMask, pVisT->blueMask);
108505b261ecSmrg}
108605b261ecSmrg
10871b5d61b8Smrgvoid _X_COLD
108835c4bbdfSmrgSwapConnSetupInfo(char *pInfo, char *pInfoT)
108905b261ecSmrg{
109035c4bbdfSmrg    int i, j, k;
109135c4bbdfSmrg    xConnSetup *pConnSetup = (xConnSetup *) pInfo;
109235c4bbdfSmrg    xDepth *depth;
109305b261ecSmrg    xWindowRoot *root;
109405b261ecSmrg
109535c4bbdfSmrg    SwapConnSetup(pConnSetup, (xConnSetup *) pInfoT);
109605b261ecSmrg    pInfo += sizeof(xConnSetup);
109705b261ecSmrg    pInfoT += sizeof(xConnSetup);
109805b261ecSmrg
109905b261ecSmrg    /* Copy the vendor string */
11006747b715Smrg    i = pad_to_int32(pConnSetup->nbytesVendor);
110105b261ecSmrg    memcpy(pInfoT, pInfo, i);
110205b261ecSmrg    pInfo += i;
110305b261ecSmrg    pInfoT += i;
110405b261ecSmrg
110505b261ecSmrg    /* The Pixmap formats don't need to be swapped, just copied. */
110605b261ecSmrg    i = sizeof(xPixmapFormat) * pConnSetup->numFormats;
110705b261ecSmrg    memcpy(pInfoT, pInfo, i);
110805b261ecSmrg    pInfo += i;
110905b261ecSmrg    pInfoT += i;
111005b261ecSmrg
111135c4bbdfSmrg    for (i = 0; i < pConnSetup->numRoots; i++) {
111235c4bbdfSmrg        root = (xWindowRoot *) pInfo;
111335c4bbdfSmrg        SwapWinRoot(root, (xWindowRoot *) pInfoT);
111435c4bbdfSmrg        pInfo += sizeof(xWindowRoot);
111535c4bbdfSmrg        pInfoT += sizeof(xWindowRoot);
111635c4bbdfSmrg
111735c4bbdfSmrg        for (j = 0; j < root->nDepths; j++) {
111835c4bbdfSmrg            depth = (xDepth *) pInfo;
111935c4bbdfSmrg            ((xDepth *) pInfoT)->depth = depth->depth;
112035c4bbdfSmrg            cpswaps(depth->nVisuals, ((xDepth *) pInfoT)->nVisuals);
112135c4bbdfSmrg            pInfo += sizeof(xDepth);
112235c4bbdfSmrg            pInfoT += sizeof(xDepth);
112335c4bbdfSmrg            for (k = 0; k < depth->nVisuals; k++) {
112435c4bbdfSmrg                SwapVisual((xVisualType *) pInfo, (xVisualType *) pInfoT);
112535c4bbdfSmrg                pInfo += sizeof(xVisualType);
112635c4bbdfSmrg                pInfoT += sizeof(xVisualType);
112735c4bbdfSmrg            }
112835c4bbdfSmrg        }
112905b261ecSmrg    }
113005b261ecSmrg}
113105b261ecSmrg
11321b5d61b8Smrgvoid _X_COLD
113305b261ecSmrgWriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo)
113405b261ecSmrg{
113535c4bbdfSmrg    char *pInfoTBase;
113605b261ecSmrg
11376747b715Smrg    pInfoTBase = malloc(size);
113835c4bbdfSmrg    if (!pInfoTBase) {
113935c4bbdfSmrg        pClient->noClientException = -1;
114035c4bbdfSmrg        return;
114105b261ecSmrg    }
114205b261ecSmrg    SwapConnSetupInfo(pInfo, pInfoTBase);
114335c4bbdfSmrg    WriteToClient(pClient, (int) size, pInfoTBase);
11446747b715Smrg    free(pInfoTBase);
114505b261ecSmrg}
114605b261ecSmrg
11471b5d61b8Smrgvoid _X_COLD
114835c4bbdfSmrgSwapConnSetupPrefix(xConnSetupPrefix * pcspFrom, xConnSetupPrefix * pcspTo)
114905b261ecSmrg{
115005b261ecSmrg    pcspTo->success = pcspFrom->success;
115105b261ecSmrg    pcspTo->lengthReason = pcspFrom->lengthReason;
115205b261ecSmrg    cpswaps(pcspFrom->majorVersion, pcspTo->majorVersion);
115305b261ecSmrg    cpswaps(pcspFrom->minorVersion, pcspTo->minorVersion);
115405b261ecSmrg    cpswaps(pcspFrom->length, pcspTo->length);
115505b261ecSmrg}
115605b261ecSmrg
11571b5d61b8Smrgvoid _X_COLD
115835c4bbdfSmrgWriteSConnSetupPrefix(ClientPtr pClient, xConnSetupPrefix * pcsp)
115905b261ecSmrg{
116035c4bbdfSmrg    xConnSetupPrefix cspT;
116105b261ecSmrg
116205b261ecSmrg    SwapConnSetupPrefix(pcsp, &cspT);
116335c4bbdfSmrg    WriteToClient(pClient, sizeof(cspT), &cspT);
116405b261ecSmrg}
11656747b715Smrg
11666747b715Smrg/*
11676747b715Smrg * Dummy entry for ReplySwapVector[]
11686747b715Smrg */
11696747b715Smrg
11701b5d61b8Smrgvoid _X_COLD
117135c4bbdfSmrgReplyNotSwappd(ClientPtr pClient, int size, void *pbuf)
11726747b715Smrg{
11736747b715Smrg    FatalError("Not implemented");
11746747b715Smrg}
1175