swaprep.c revision 6747b715
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 2505b261ecSmrg 2605b261ecSmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. 2705b261ecSmrg 2805b261ecSmrg All Rights Reserved 2905b261ecSmrg 3005b261ecSmrgPermission to use, copy, modify, and distribute this software and its 3105b261ecSmrgdocumentation for any purpose and without fee is hereby granted, 3205b261ecSmrgprovided that the above copyright notice appear in all copies and that 3305b261ecSmrgboth that copyright notice and this permission notice appear in 3405b261ecSmrgsupporting documentation, and that the name of Digital not be 3505b261ecSmrgused in advertising or publicity pertaining to distribution of the 3605b261ecSmrgsoftware without specific, written prior permission. 3705b261ecSmrg 3805b261ecSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 3905b261ecSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 4005b261ecSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 4105b261ecSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 4205b261ecSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 4305b261ecSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 4405b261ecSmrgSOFTWARE. 4505b261ecSmrg 4605b261ecSmrg********************************************************/ 4705b261ecSmrg 4805b261ecSmrg 4905b261ecSmrg#ifdef HAVE_DIX_CONFIG_H 5005b261ecSmrg#include <dix-config.h> 5105b261ecSmrg#endif 5205b261ecSmrg 5305b261ecSmrg#include <X11/X.h> 5405b261ecSmrg#include <X11/Xproto.h> 5505b261ecSmrg#include "misc.h" 5605b261ecSmrg#include "dixstruct.h" 5705b261ecSmrg#include <X11/fonts/fontstruct.h> 5805b261ecSmrg#include "scrnintstr.h" 5905b261ecSmrg#include "swaprep.h" 6005b261ecSmrg#include "globals.h" 6105b261ecSmrg 6205b261ecSmrgstatic void SwapFontInfo(xQueryFontReply *pr); 6305b261ecSmrg 6405b261ecSmrgstatic void SwapCharInfo(xCharInfo *pInfo); 6505b261ecSmrg 6605b261ecSmrgstatic void SwapFont(xQueryFontReply *pr, Bool hasGlyphs); 6705b261ecSmrg 6805b261ecSmrg/** 6905b261ecSmrg * Thanks to Jack Palevich for testing and subsequently rewriting all this 7005b261ecSmrg * 7105b261ecSmrg * \param size size in bytes 7205b261ecSmrg */ 736747b715Smrgvoid 7405b261ecSmrgSwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) 7505b261ecSmrg{ 7605b261ecSmrg int i; 7705b261ecSmrg char n; 7805b261ecSmrg 7905b261ecSmrg size >>= 2; 8005b261ecSmrg for(i = 0; i < size; i++) 8105b261ecSmrg /* brackets are mandatory here, because "swapl" macro expands 8205b261ecSmrg to several statements */ 8305b261ecSmrg { 8405b261ecSmrg swapl(&pbuf[i], n); 8505b261ecSmrg } 8605b261ecSmrg (void)WriteToClient(pClient, size << 2, (char *) pbuf); 8705b261ecSmrg} 8805b261ecSmrg 8905b261ecSmrg/** 9005b261ecSmrg * 9105b261ecSmrg * \param size size in bytes 9205b261ecSmrg */ 936747b715Smrgvoid 9405b261ecSmrgCopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) 9505b261ecSmrg{ 9605b261ecSmrg int bufsize = size; 9705b261ecSmrg CARD32 *pbufT; 9805b261ecSmrg CARD32 *from, *to, *fromLast, *toLast; 9905b261ecSmrg CARD32 tmpbuf[1]; 10005b261ecSmrg 10105b261ecSmrg /* Allocate as big a buffer as we can... */ 1026747b715Smrg while (!(pbufT = malloc(bufsize))) 10305b261ecSmrg { 10405b261ecSmrg bufsize >>= 1; 10505b261ecSmrg if (bufsize == 4) 10605b261ecSmrg { 10705b261ecSmrg pbufT = tmpbuf; 10805b261ecSmrg break; 10905b261ecSmrg } 11005b261ecSmrg } 11105b261ecSmrg 11205b261ecSmrg /* convert lengths from # of bytes to # of longs */ 11305b261ecSmrg size >>= 2; 11405b261ecSmrg bufsize >>= 2; 11505b261ecSmrg 11605b261ecSmrg from = pbuf; 11705b261ecSmrg fromLast = from + size; 11805b261ecSmrg while (from < fromLast) { 11905b261ecSmrg int nbytes; 12005b261ecSmrg to = pbufT; 12105b261ecSmrg toLast = to + min (bufsize, fromLast - from); 12205b261ecSmrg nbytes = (toLast - to) << 2; 12305b261ecSmrg while (to < toLast) { 12405b261ecSmrg /* can't write "cpswapl(*from++, *to++)" because cpswapl is a macro 12505b261ecSmrg that evaulates its args more than once */ 12605b261ecSmrg cpswapl(*from, *to); 12705b261ecSmrg from++; 12805b261ecSmrg to++; 12905b261ecSmrg } 13005b261ecSmrg (void)WriteToClient (pClient, nbytes, (char *) pbufT); 13105b261ecSmrg } 13205b261ecSmrg 13305b261ecSmrg if (pbufT != tmpbuf) 1346747b715Smrg free(pbufT); 13505b261ecSmrg} 13605b261ecSmrg 13705b261ecSmrg/** 13805b261ecSmrg * 13905b261ecSmrg * \param size size in bytes 14005b261ecSmrg */ 14105b261ecSmrgvoid 14205b261ecSmrgCopySwap16Write(ClientPtr pClient, int size, short *pbuf) 14305b261ecSmrg{ 14405b261ecSmrg int bufsize = size; 14505b261ecSmrg short *pbufT; 14605b261ecSmrg short *from, *to, *fromLast, *toLast; 14705b261ecSmrg short tmpbuf[2]; 14805b261ecSmrg 14905b261ecSmrg /* Allocate as big a buffer as we can... */ 1506747b715Smrg while (!(pbufT = malloc(bufsize))) 15105b261ecSmrg { 15205b261ecSmrg bufsize >>= 1; 15305b261ecSmrg if (bufsize == 4) 15405b261ecSmrg { 15505b261ecSmrg pbufT = tmpbuf; 15605b261ecSmrg break; 15705b261ecSmrg } 15805b261ecSmrg } 15905b261ecSmrg 16005b261ecSmrg /* convert lengths from # of bytes to # of shorts */ 16105b261ecSmrg size >>= 1; 16205b261ecSmrg bufsize >>= 1; 16305b261ecSmrg 16405b261ecSmrg from = pbuf; 16505b261ecSmrg fromLast = from + size; 16605b261ecSmrg while (from < fromLast) { 16705b261ecSmrg int nbytes; 16805b261ecSmrg to = pbufT; 16905b261ecSmrg toLast = to + min (bufsize, fromLast - from); 17005b261ecSmrg nbytes = (toLast - to) << 1; 17105b261ecSmrg while (to < toLast) { 17205b261ecSmrg /* can't write "cpswaps(*from++, *to++)" because cpswaps is a macro 17305b261ecSmrg that evaulates its args more than once */ 17405b261ecSmrg cpswaps(*from, *to); 17505b261ecSmrg from++; 17605b261ecSmrg to++; 17705b261ecSmrg } 17805b261ecSmrg (void)WriteToClient (pClient, nbytes, (char *) pbufT); 17905b261ecSmrg } 18005b261ecSmrg 18105b261ecSmrg if (pbufT != tmpbuf) 1826747b715Smrg free(pbufT); 18305b261ecSmrg} 18405b261ecSmrg 18505b261ecSmrg 18605b261ecSmrg/* Extra-small reply */ 18705b261ecSmrgvoid 18805b261ecSmrgSGenericReply(ClientPtr pClient, int size, xGenericReply *pRep) 18905b261ecSmrg{ 19005b261ecSmrg char n; 19105b261ecSmrg 19205b261ecSmrg swaps(&pRep->sequenceNumber, n); 19305b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 19405b261ecSmrg} 19505b261ecSmrg 19605b261ecSmrg/* Extra-large reply */ 19705b261ecSmrgvoid 19805b261ecSmrgSGetWindowAttributesReply(ClientPtr pClient, int size, 19905b261ecSmrg xGetWindowAttributesReply *pRep) 20005b261ecSmrg{ 20105b261ecSmrg char n; 20205b261ecSmrg 20305b261ecSmrg swaps(&pRep->sequenceNumber, n); 20405b261ecSmrg swapl(&pRep->length, n); 20505b261ecSmrg swapl(&pRep->visualID, n); 20605b261ecSmrg swaps(&pRep->class, n); 20705b261ecSmrg swapl(&pRep->backingBitPlanes, n); 20805b261ecSmrg swapl(&pRep->backingPixel, n); 20905b261ecSmrg swapl(&pRep->colormap, n); 21005b261ecSmrg swapl(&pRep->allEventMasks, n); 21105b261ecSmrg swapl(&pRep->yourEventMask, n); 21205b261ecSmrg swaps(&pRep->doNotPropagateMask, n); 21305b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 21405b261ecSmrg} 21505b261ecSmrg 21605b261ecSmrgvoid 21705b261ecSmrgSGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply *pRep) 21805b261ecSmrg{ 21905b261ecSmrg char n; 22005b261ecSmrg 22105b261ecSmrg swaps(&pRep->sequenceNumber, n); 22205b261ecSmrg swapl(&pRep->root, n); 22305b261ecSmrg swaps(&pRep->x, n); 22405b261ecSmrg swaps(&pRep->y, n); 22505b261ecSmrg swaps(&pRep->width, n); 22605b261ecSmrg swaps(&pRep->height, n); 22705b261ecSmrg swaps(&pRep->borderWidth, n); 22805b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 22905b261ecSmrg} 23005b261ecSmrg 23105b261ecSmrgvoid 23205b261ecSmrgSQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply *pRep) 23305b261ecSmrg{ 23405b261ecSmrg char n; 23505b261ecSmrg 23605b261ecSmrg swaps(&pRep->sequenceNumber, n); 23705b261ecSmrg swapl(&pRep->length, n); 23805b261ecSmrg swapl(&pRep->root, n); 23905b261ecSmrg swapl(&pRep->parent, n); 24005b261ecSmrg swaps(&pRep->nChildren, n); 24105b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 24205b261ecSmrg} 24305b261ecSmrg 24405b261ecSmrgvoid 24505b261ecSmrgSInternAtomReply(ClientPtr pClient, int size, xInternAtomReply *pRep) 24605b261ecSmrg{ 24705b261ecSmrg char n; 24805b261ecSmrg 24905b261ecSmrg swaps(&pRep->sequenceNumber, n); 25005b261ecSmrg swapl(&pRep->atom, n); 25105b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 25205b261ecSmrg} 25305b261ecSmrg 25405b261ecSmrgvoid 25505b261ecSmrgSGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply *pRep) 25605b261ecSmrg{ 25705b261ecSmrg char n; 25805b261ecSmrg 25905b261ecSmrg swaps(&pRep->sequenceNumber, n); 26005b261ecSmrg swapl(&pRep->length, n); 26105b261ecSmrg swaps(&pRep->nameLength, n); 26205b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 26305b261ecSmrg} 26405b261ecSmrg 26505b261ecSmrg 26605b261ecSmrgvoid 26705b261ecSmrgSGetPropertyReply(ClientPtr pClient, int size, xGetPropertyReply *pRep) 26805b261ecSmrg{ 26905b261ecSmrg char n; 27005b261ecSmrg 27105b261ecSmrg swaps(&pRep->sequenceNumber, n); 27205b261ecSmrg swapl(&pRep->length, n); 27305b261ecSmrg swapl(&pRep->propertyType, n); 27405b261ecSmrg swapl(&pRep->bytesAfter, n); 27505b261ecSmrg swapl(&pRep->nItems, n); 27605b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 27705b261ecSmrg} 27805b261ecSmrg 27905b261ecSmrgvoid 28005b261ecSmrgSListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply *pRep) 28105b261ecSmrg{ 28205b261ecSmrg char n; 28305b261ecSmrg 28405b261ecSmrg swaps(&pRep->sequenceNumber, n); 28505b261ecSmrg swapl(&pRep->length, n); 28605b261ecSmrg swaps(&pRep->nProperties, n); 28705b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 28805b261ecSmrg} 28905b261ecSmrg 29005b261ecSmrgvoid 29105b261ecSmrgSGetSelectionOwnerReply(ClientPtr pClient, int size, 29205b261ecSmrg xGetSelectionOwnerReply *pRep) 29305b261ecSmrg{ 29405b261ecSmrg char n; 29505b261ecSmrg 29605b261ecSmrg swaps(&pRep->sequenceNumber, n); 29705b261ecSmrg swapl(&pRep->owner, n); 29805b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 29905b261ecSmrg} 30005b261ecSmrg 30105b261ecSmrg 30205b261ecSmrgvoid 30305b261ecSmrgSQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply *pRep) 30405b261ecSmrg{ 30505b261ecSmrg char n; 30605b261ecSmrg 30705b261ecSmrg swaps(&pRep->sequenceNumber, n); 30805b261ecSmrg swapl(&pRep->root, n); 30905b261ecSmrg swapl(&pRep->child, n); 31005b261ecSmrg swaps(&pRep->rootX, n); 31105b261ecSmrg swaps(&pRep->rootY, n); 31205b261ecSmrg swaps(&pRep->winX, n); 31305b261ecSmrg swaps(&pRep->winY, n); 31405b261ecSmrg swaps(&pRep->mask, n); 31505b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 31605b261ecSmrg} 31705b261ecSmrg 31805b261ecSmrgstatic void 31905b261ecSmrgSwapTimecoord(xTimecoord* pCoord) 32005b261ecSmrg{ 32105b261ecSmrg char n; 32205b261ecSmrg 32305b261ecSmrg swapl(&pCoord->time, n); 32405b261ecSmrg swaps(&pCoord->x, n); 32505b261ecSmrg swaps(&pCoord->y, n); 32605b261ecSmrg} 32705b261ecSmrg 32805b261ecSmrgvoid 32905b261ecSmrgSwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord *pRep) 33005b261ecSmrg{ 33105b261ecSmrg int i, n; 33205b261ecSmrg xTimecoord *pRepT; 33305b261ecSmrg 33405b261ecSmrg n = size / sizeof(xTimecoord); 33505b261ecSmrg pRepT = pRep; 33605b261ecSmrg for(i = 0; i < n; i++) 33705b261ecSmrg { 33805b261ecSmrg SwapTimecoord(pRepT); 33905b261ecSmrg pRepT++; 34005b261ecSmrg } 34105b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 34205b261ecSmrg 34305b261ecSmrg} 34405b261ecSmrgvoid 34505b261ecSmrgSGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply *pRep) 34605b261ecSmrg{ 34705b261ecSmrg char n; 34805b261ecSmrg 34905b261ecSmrg swaps(&pRep->sequenceNumber, n); 35005b261ecSmrg swapl(&pRep->length, n); 35105b261ecSmrg swapl(&pRep->nEvents, n); 35205b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 35305b261ecSmrg} 35405b261ecSmrg 35505b261ecSmrgvoid 35605b261ecSmrgSTranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply *pRep) 35705b261ecSmrg{ 35805b261ecSmrg char n; 35905b261ecSmrg 36005b261ecSmrg swaps(&pRep->sequenceNumber, n); 36105b261ecSmrg swapl(&pRep->child, n); 36205b261ecSmrg swaps(&pRep->dstX, n); 36305b261ecSmrg swaps(&pRep->dstY, n); 36405b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 36505b261ecSmrg} 36605b261ecSmrg 36705b261ecSmrgvoid 36805b261ecSmrgSGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply *pRep) 36905b261ecSmrg{ 37005b261ecSmrg char n; 37105b261ecSmrg 37205b261ecSmrg swaps(&pRep->sequenceNumber, n); 37305b261ecSmrg swapl(&pRep->focus, n); 37405b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 37505b261ecSmrg} 37605b261ecSmrg 37705b261ecSmrg/* extra long reply */ 37805b261ecSmrgvoid 37905b261ecSmrgSQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply *pRep) 38005b261ecSmrg{ 38105b261ecSmrg char n; 38205b261ecSmrg 38305b261ecSmrg swaps(&pRep->sequenceNumber, n); 38405b261ecSmrg swapl(&pRep->length, n); 38505b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 38605b261ecSmrg} 38705b261ecSmrg 38805b261ecSmrgstatic void 38905b261ecSmrgSwapCharInfo(xCharInfo *pInfo) 39005b261ecSmrg{ 39105b261ecSmrg char n; 39205b261ecSmrg 39305b261ecSmrg swaps(&pInfo->leftSideBearing, n); 39405b261ecSmrg swaps(&pInfo->rightSideBearing, n); 39505b261ecSmrg swaps(&pInfo->characterWidth, n); 39605b261ecSmrg swaps(&pInfo->ascent, n); 39705b261ecSmrg swaps(&pInfo->descent, n); 39805b261ecSmrg swaps(&pInfo->attributes, n); 39905b261ecSmrg} 40005b261ecSmrg 40105b261ecSmrgstatic void 40205b261ecSmrgSwapFontInfo(xQueryFontReply *pr) 40305b261ecSmrg{ 40405b261ecSmrg char n; 40505b261ecSmrg 40605b261ecSmrg swaps(&pr->minCharOrByte2, n); 40705b261ecSmrg swaps(&pr->maxCharOrByte2, n); 40805b261ecSmrg swaps(&pr->defaultChar, n); 40905b261ecSmrg swaps(&pr->nFontProps, n); 41005b261ecSmrg swaps(&pr->fontAscent, n); 41105b261ecSmrg swaps(&pr->fontDescent, n); 41205b261ecSmrg SwapCharInfo( &pr->minBounds); 41305b261ecSmrg SwapCharInfo( &pr->maxBounds); 41405b261ecSmrg swapl(&pr->nCharInfos, n); 41505b261ecSmrg} 41605b261ecSmrg 41705b261ecSmrgstatic void 41805b261ecSmrgSwapFont(xQueryFontReply *pr, Bool hasGlyphs) 41905b261ecSmrg{ 42005b261ecSmrg unsigned i; 42105b261ecSmrg xCharInfo * pxci; 42205b261ecSmrg unsigned nchars, nprops; 42305b261ecSmrg char *pby; 42405b261ecSmrg char n; 42505b261ecSmrg 42605b261ecSmrg swaps(&pr->sequenceNumber, n); 42705b261ecSmrg swapl(&pr->length, n); 42805b261ecSmrg nchars = pr->nCharInfos; 42905b261ecSmrg nprops = pr->nFontProps; 43005b261ecSmrg SwapFontInfo(pr); 43105b261ecSmrg pby = (char *) &pr[1]; 43205b261ecSmrg /* Font properties are an atom and either an int32 or a CARD32, so 43305b261ecSmrg * they are always 2 4 byte values */ 43405b261ecSmrg for(i = 0; i < nprops; i++) 43505b261ecSmrg { 43605b261ecSmrg swapl(pby, n); 43705b261ecSmrg pby += 4; 43805b261ecSmrg swapl(pby, n); 43905b261ecSmrg pby += 4; 44005b261ecSmrg } 44105b261ecSmrg if (hasGlyphs) 44205b261ecSmrg { 44305b261ecSmrg pxci = (xCharInfo *)pby; 44405b261ecSmrg for(i = 0; i< nchars; i++, pxci++) 44505b261ecSmrg SwapCharInfo(pxci); 44605b261ecSmrg } 44705b261ecSmrg} 44805b261ecSmrg 44905b261ecSmrgvoid 45005b261ecSmrgSQueryFontReply(ClientPtr pClient, int size, xQueryFontReply *pRep) 45105b261ecSmrg{ 45205b261ecSmrg SwapFont(pRep, TRUE); 45305b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 45405b261ecSmrg} 45505b261ecSmrg 45605b261ecSmrgvoid 45705b261ecSmrgSQueryTextExtentsReply(ClientPtr pClient, int size, xQueryTextExtentsReply *pRep) 45805b261ecSmrg{ 45905b261ecSmrg char n; 46005b261ecSmrg 46105b261ecSmrg swaps(&pRep->sequenceNumber, n); 46205b261ecSmrg swaps(&pRep->fontAscent, n); 46305b261ecSmrg swaps(&pRep->fontDescent, n); 46405b261ecSmrg swaps(&pRep->overallAscent, n); 46505b261ecSmrg swaps(&pRep->overallDescent, n); 46605b261ecSmrg swapl(&pRep->overallWidth, n); 46705b261ecSmrg swapl(&pRep->overallLeft, n); 46805b261ecSmrg swapl(&pRep->overallRight, n); 46905b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 47005b261ecSmrg} 47105b261ecSmrg 47205b261ecSmrgvoid 47305b261ecSmrgSListFontsReply(ClientPtr pClient, int size, xListFontsReply *pRep) 47405b261ecSmrg{ 47505b261ecSmrg char n; 47605b261ecSmrg 47705b261ecSmrg swaps(&pRep->sequenceNumber, n); 47805b261ecSmrg swapl(&pRep->length, n); 47905b261ecSmrg swaps(&pRep->nFonts, n); 48005b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 48105b261ecSmrg} 48205b261ecSmrg 48305b261ecSmrgvoid 48405b261ecSmrgSListFontsWithInfoReply(ClientPtr pClient, int size, 48505b261ecSmrg xListFontsWithInfoReply *pRep) 48605b261ecSmrg{ 48705b261ecSmrg SwapFont((xQueryFontReply *)pRep, FALSE); 48805b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 48905b261ecSmrg} 49005b261ecSmrg 49105b261ecSmrgvoid 49205b261ecSmrgSGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply *pRep) 49305b261ecSmrg{ 49405b261ecSmrg char n; 49505b261ecSmrg 49605b261ecSmrg swaps(&pRep->sequenceNumber, n); 49705b261ecSmrg swapl(&pRep->length, n); 49805b261ecSmrg swaps(&pRep->nPaths, n); 49905b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 50005b261ecSmrg} 50105b261ecSmrg 50205b261ecSmrgvoid 50305b261ecSmrgSGetImageReply(ClientPtr pClient, int size, xGetImageReply *pRep) 50405b261ecSmrg{ 50505b261ecSmrg char n; 50605b261ecSmrg 50705b261ecSmrg swaps(&pRep->sequenceNumber, n); 50805b261ecSmrg swapl(&pRep->length, n); 50905b261ecSmrg swapl(&pRep->visual, n); 51005b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 51105b261ecSmrg /* Fortunately, image doesn't need swapping */ 51205b261ecSmrg} 51305b261ecSmrg 51405b261ecSmrgvoid 51505b261ecSmrgSListInstalledColormapsReply(ClientPtr pClient, int size, 51605b261ecSmrg xListInstalledColormapsReply *pRep) 51705b261ecSmrg{ 51805b261ecSmrg char n; 51905b261ecSmrg 52005b261ecSmrg swaps(&pRep->sequenceNumber, n); 52105b261ecSmrg swapl(&pRep->length, n); 52205b261ecSmrg swaps(&pRep->nColormaps, n); 52305b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 52405b261ecSmrg} 52505b261ecSmrg 52605b261ecSmrgvoid 5276747b715SmrgSAllocColorReply(ClientPtr pClient, int size, xAllocColorReply *pRep) 52805b261ecSmrg{ 52905b261ecSmrg char n; 53005b261ecSmrg 53105b261ecSmrg swaps(&pRep->sequenceNumber, n); 53205b261ecSmrg swaps(&pRep->red, n); 53305b261ecSmrg swaps(&pRep->green, n); 53405b261ecSmrg swaps(&pRep->blue, n); 53505b261ecSmrg swapl(&pRep->pixel, n); 53605b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 53705b261ecSmrg} 53805b261ecSmrg 53905b261ecSmrgvoid 54005b261ecSmrgSAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply *pRep) 54105b261ecSmrg{ 54205b261ecSmrg char n; 54305b261ecSmrg 54405b261ecSmrg swaps(&pRep->sequenceNumber, n); 54505b261ecSmrg swapl(&pRep->pixel, n); 54605b261ecSmrg swaps(&pRep->exactRed, n); 54705b261ecSmrg swaps(&pRep->exactGreen, n); 54805b261ecSmrg swaps(&pRep->exactBlue, n); 54905b261ecSmrg swaps(&pRep->screenRed, n); 55005b261ecSmrg swaps(&pRep->screenGreen, n); 55105b261ecSmrg swaps(&pRep->screenBlue, n); 55205b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 55305b261ecSmrg} 55405b261ecSmrg 55505b261ecSmrgvoid 55605b261ecSmrgSAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply *pRep) 55705b261ecSmrg{ 55805b261ecSmrg char n; 55905b261ecSmrg 56005b261ecSmrg swaps(&pRep->sequenceNumber, n); 56105b261ecSmrg swapl(&pRep->length, n); 56205b261ecSmrg swaps(&pRep->nPixels, n); 56305b261ecSmrg swaps(&pRep->nMasks, n); 56405b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 56505b261ecSmrg} 56605b261ecSmrg 56705b261ecSmrg 56805b261ecSmrgvoid 56905b261ecSmrgSAllocColorPlanesReply(ClientPtr pClient, int size, xAllocColorPlanesReply *pRep) 57005b261ecSmrg{ 57105b261ecSmrg char n; 57205b261ecSmrg 57305b261ecSmrg swaps(&pRep->sequenceNumber, n); 57405b261ecSmrg swapl(&pRep->length, n); 57505b261ecSmrg swaps(&pRep->nPixels, n); 57605b261ecSmrg swapl(&pRep->redMask, n); 57705b261ecSmrg swapl(&pRep->greenMask, n); 57805b261ecSmrg swapl(&pRep->blueMask, n); 57905b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 58005b261ecSmrg} 58105b261ecSmrg 58205b261ecSmrgstatic void 58305b261ecSmrgSwapRGB(xrgb *prgb) 58405b261ecSmrg{ 58505b261ecSmrg char n; 58605b261ecSmrg 58705b261ecSmrg swaps(&prgb->red, n); 58805b261ecSmrg swaps(&prgb->green, n); 58905b261ecSmrg swaps(&prgb->blue, n); 59005b261ecSmrg} 59105b261ecSmrg 59205b261ecSmrgvoid 59305b261ecSmrgSQColorsExtend(ClientPtr pClient, int size, xrgb *prgb) 59405b261ecSmrg{ 59505b261ecSmrg int i, n; 59605b261ecSmrg xrgb *prgbT; 59705b261ecSmrg 59805b261ecSmrg n = size / sizeof(xrgb); 59905b261ecSmrg prgbT = prgb; 60005b261ecSmrg for(i = 0; i < n; i++) 60105b261ecSmrg { 60205b261ecSmrg SwapRGB(prgbT); 60305b261ecSmrg prgbT++; 60405b261ecSmrg } 60505b261ecSmrg (void)WriteToClient(pClient, size, (char *) prgb); 60605b261ecSmrg} 60705b261ecSmrg 60805b261ecSmrgvoid 60905b261ecSmrgSQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply* pRep) 61005b261ecSmrg{ 61105b261ecSmrg char n; 61205b261ecSmrg 61305b261ecSmrg swaps(&pRep->sequenceNumber, n); 61405b261ecSmrg swapl(&pRep->length, n); 61505b261ecSmrg swaps(&pRep->nColors, n); 61605b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 61705b261ecSmrg} 61805b261ecSmrg 61905b261ecSmrgvoid 62005b261ecSmrgSLookupColorReply(ClientPtr pClient, int size, xLookupColorReply *pRep) 62105b261ecSmrg{ 62205b261ecSmrg char n; 62305b261ecSmrg 62405b261ecSmrg swaps(&pRep->sequenceNumber, n); 62505b261ecSmrg swaps(&pRep->exactRed, n); 62605b261ecSmrg swaps(&pRep->exactGreen, n); 62705b261ecSmrg swaps(&pRep->exactBlue, n); 62805b261ecSmrg swaps(&pRep->screenRed, n); 62905b261ecSmrg swaps(&pRep->screenGreen, n); 63005b261ecSmrg swaps(&pRep->screenBlue, n); 63105b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 63205b261ecSmrg} 63305b261ecSmrg 63405b261ecSmrgvoid 63505b261ecSmrgSQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply *pRep) 63605b261ecSmrg{ 63705b261ecSmrg char n; 63805b261ecSmrg 63905b261ecSmrg swaps(&pRep->sequenceNumber, n); 64005b261ecSmrg swaps(&pRep->width, n); 64105b261ecSmrg swaps(&pRep->height, n); 64205b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 64305b261ecSmrg} 64405b261ecSmrg 64505b261ecSmrgvoid 64605b261ecSmrgSListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply *pRep) 64705b261ecSmrg{ 64805b261ecSmrg char n; 64905b261ecSmrg 65005b261ecSmrg swaps(&pRep->sequenceNumber, n); 65105b261ecSmrg swapl(&pRep->length, n); 65205b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 65305b261ecSmrg} 65405b261ecSmrg 65505b261ecSmrgvoid 65605b261ecSmrgSGetKeyboardMappingReply(ClientPtr pClient, int size, 65705b261ecSmrg xGetKeyboardMappingReply *pRep) 65805b261ecSmrg{ 65905b261ecSmrg char n; 66005b261ecSmrg 66105b261ecSmrg swaps(&pRep->sequenceNumber, n); 66205b261ecSmrg swapl(&pRep->length, n); 66305b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 66405b261ecSmrg} 66505b261ecSmrg 66605b261ecSmrgvoid 66705b261ecSmrgSGetPointerMappingReply(ClientPtr pClient, int size, 66805b261ecSmrg xGetPointerMappingReply *pRep) 66905b261ecSmrg{ 67005b261ecSmrg char n; 67105b261ecSmrg 67205b261ecSmrg swaps(&pRep->sequenceNumber, n); 67305b261ecSmrg swapl(&pRep->length, n); 67405b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 67505b261ecSmrg} 67605b261ecSmrg 67705b261ecSmrgvoid 67805b261ecSmrgSGetModifierMappingReply(ClientPtr pClient, int size, 67905b261ecSmrg xGetModifierMappingReply *pRep) 68005b261ecSmrg{ 68105b261ecSmrg char n; 68205b261ecSmrg 68305b261ecSmrg swaps(&pRep->sequenceNumber, n); 68405b261ecSmrg swapl(&pRep->length, n); 68505b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 68605b261ecSmrg} 68705b261ecSmrg 68805b261ecSmrgvoid 68905b261ecSmrgSGetKeyboardControlReply(ClientPtr pClient, int size, xGetKeyboardControlReply *pRep) 69005b261ecSmrg{ 69105b261ecSmrg char n; 69205b261ecSmrg 69305b261ecSmrg swaps(&pRep->sequenceNumber, n); 69405b261ecSmrg swapl(&pRep->length, n); 69505b261ecSmrg swapl(&pRep->ledMask, n); 69605b261ecSmrg swaps(&pRep->bellPitch, n); 69705b261ecSmrg swaps(&pRep->bellDuration, n); 69805b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 69905b261ecSmrg} 70005b261ecSmrg 70105b261ecSmrgvoid 70205b261ecSmrgSGetPointerControlReply(ClientPtr pClient, int size, xGetPointerControlReply *pRep) 70305b261ecSmrg{ 70405b261ecSmrg char n; 70505b261ecSmrg 70605b261ecSmrg swaps(&pRep->sequenceNumber, n); 70705b261ecSmrg swaps(&pRep->accelNumerator, n); 70805b261ecSmrg swaps(&pRep->accelDenominator, n); 70905b261ecSmrg swaps(&pRep->threshold, n); 71005b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 71105b261ecSmrg} 71205b261ecSmrg 71305b261ecSmrgvoid 71405b261ecSmrgSGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply *pRep) 71505b261ecSmrg{ 71605b261ecSmrg char n; 71705b261ecSmrg 71805b261ecSmrg swaps(&pRep->sequenceNumber, n); 71905b261ecSmrg swaps(&pRep->timeout, n); 72005b261ecSmrg swaps(&pRep->interval, n); 72105b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 72205b261ecSmrg} 72305b261ecSmrg 72405b261ecSmrgvoid 72505b261ecSmrgSLHostsExtend(ClientPtr pClient, int size, char *buf) 72605b261ecSmrg{ 72705b261ecSmrg char *bufT = buf; 72805b261ecSmrg char *endbuf = buf + size; 72905b261ecSmrg while (bufT < endbuf) { 73005b261ecSmrg xHostEntry *host = (xHostEntry *) bufT; 73105b261ecSmrg int len = host->length; 73205b261ecSmrg char n; 73305b261ecSmrg swaps (&host->length, n); 7346747b715Smrg bufT += sizeof (xHostEntry) + pad_to_int32(len); 73505b261ecSmrg } 73605b261ecSmrg (void)WriteToClient (pClient, size, buf); 73705b261ecSmrg} 73805b261ecSmrg 73905b261ecSmrgvoid 74005b261ecSmrgSListHostsReply(ClientPtr pClient, int size, xListHostsReply *pRep) 74105b261ecSmrg{ 74205b261ecSmrg char n; 74305b261ecSmrg 74405b261ecSmrg swaps(&pRep->sequenceNumber, n); 74505b261ecSmrg swapl(&pRep->length, n); 74605b261ecSmrg swaps(&pRep->nHosts, n); 74705b261ecSmrg (void)WriteToClient(pClient, size, (char *) pRep); 74805b261ecSmrg} 74905b261ecSmrg 75005b261ecSmrg 75105b261ecSmrg 75205b261ecSmrgvoid 75305b261ecSmrgSErrorEvent(xError *from, xError *to) 75405b261ecSmrg{ 75505b261ecSmrg to->type = X_Error; 75605b261ecSmrg to->errorCode = from->errorCode; 75705b261ecSmrg cpswaps(from->sequenceNumber, to->sequenceNumber); 75805b261ecSmrg cpswapl(from->resourceID, to->resourceID); 75905b261ecSmrg cpswaps(from->minorCode, to->minorCode); 76005b261ecSmrg to->majorCode = from->majorCode; 76105b261ecSmrg} 76205b261ecSmrg 76305b261ecSmrgvoid 76405b261ecSmrgSKeyButtonPtrEvent(xEvent *from, xEvent *to) 76505b261ecSmrg{ 76605b261ecSmrg to->u.u.type = from->u.u.type; 76705b261ecSmrg to->u.u.detail = from->u.u.detail; 76805b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 76905b261ecSmrg cpswapl(from->u.keyButtonPointer.time, 77005b261ecSmrg to->u.keyButtonPointer.time); 77105b261ecSmrg cpswapl(from->u.keyButtonPointer.root, 77205b261ecSmrg to->u.keyButtonPointer.root); 77305b261ecSmrg cpswapl(from->u.keyButtonPointer.event, 77405b261ecSmrg to->u.keyButtonPointer.event); 77505b261ecSmrg cpswapl(from->u.keyButtonPointer.child, 77605b261ecSmrg to->u.keyButtonPointer.child); 77705b261ecSmrg cpswaps(from->u.keyButtonPointer.rootX, 77805b261ecSmrg to->u.keyButtonPointer.rootX); 77905b261ecSmrg cpswaps(from->u.keyButtonPointer.rootY, 78005b261ecSmrg to->u.keyButtonPointer.rootY); 78105b261ecSmrg cpswaps(from->u.keyButtonPointer.eventX, 78205b261ecSmrg to->u.keyButtonPointer.eventX); 78305b261ecSmrg cpswaps(from->u.keyButtonPointer.eventY, 78405b261ecSmrg to->u.keyButtonPointer.eventY); 78505b261ecSmrg cpswaps(from->u.keyButtonPointer.state, 78605b261ecSmrg to->u.keyButtonPointer.state); 78705b261ecSmrg to->u.keyButtonPointer.sameScreen = 78805b261ecSmrg from->u.keyButtonPointer.sameScreen; 78905b261ecSmrg} 79005b261ecSmrg 79105b261ecSmrgvoid 79205b261ecSmrgSEnterLeaveEvent(xEvent *from, xEvent *to) 79305b261ecSmrg{ 79405b261ecSmrg to->u.u.type = from->u.u.type; 79505b261ecSmrg to->u.u.detail = from->u.u.detail; 79605b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 79705b261ecSmrg cpswapl(from->u.enterLeave.time, to->u.enterLeave.time); 79805b261ecSmrg cpswapl(from->u.enterLeave.root, to->u.enterLeave.root); 79905b261ecSmrg cpswapl(from->u.enterLeave.event, to->u.enterLeave.event); 80005b261ecSmrg cpswapl(from->u.enterLeave.child, to->u.enterLeave.child); 80105b261ecSmrg cpswaps(from->u.enterLeave.rootX, to->u.enterLeave.rootX); 80205b261ecSmrg cpswaps(from->u.enterLeave.rootY, to->u.enterLeave.rootY); 80305b261ecSmrg cpswaps(from->u.enterLeave.eventX, to->u.enterLeave.eventX); 80405b261ecSmrg cpswaps(from->u.enterLeave.eventY, to->u.enterLeave.eventY); 80505b261ecSmrg cpswaps(from->u.enterLeave.state, to->u.enterLeave.state); 80605b261ecSmrg to->u.enterLeave.mode = from->u.enterLeave.mode; 80705b261ecSmrg to->u.enterLeave.flags = from->u.enterLeave.flags; 80805b261ecSmrg} 80905b261ecSmrg 81005b261ecSmrgvoid 81105b261ecSmrgSFocusEvent(xEvent *from, xEvent *to) 81205b261ecSmrg{ 81305b261ecSmrg to->u.u.type = from->u.u.type; 81405b261ecSmrg to->u.u.detail = from->u.u.detail; 81505b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 81605b261ecSmrg cpswapl(from->u.focus.window, to->u.focus.window); 81705b261ecSmrg to->u.focus.mode = from->u.focus.mode; 81805b261ecSmrg} 81905b261ecSmrg 82005b261ecSmrgvoid 82105b261ecSmrgSExposeEvent(xEvent *from, xEvent *to) 82205b261ecSmrg{ 82305b261ecSmrg to->u.u.type = from->u.u.type; 82405b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 82505b261ecSmrg cpswapl(from->u.expose.window, to->u.expose.window); 82605b261ecSmrg cpswaps(from->u.expose.x, to->u.expose.x); 82705b261ecSmrg cpswaps(from->u.expose.y, to->u.expose.y); 82805b261ecSmrg cpswaps(from->u.expose.width, to->u.expose.width); 82905b261ecSmrg cpswaps(from->u.expose.height, to->u.expose.height); 83005b261ecSmrg cpswaps(from->u.expose.count, to->u.expose.count); 83105b261ecSmrg} 83205b261ecSmrg 83305b261ecSmrgvoid 83405b261ecSmrgSGraphicsExposureEvent(xEvent *from, xEvent *to) 83505b261ecSmrg{ 83605b261ecSmrg to->u.u.type = from->u.u.type; 83705b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 83805b261ecSmrg cpswapl(from->u.graphicsExposure.drawable, 83905b261ecSmrg to->u.graphicsExposure.drawable); 84005b261ecSmrg cpswaps(from->u.graphicsExposure.x, 84105b261ecSmrg to->u.graphicsExposure.x); 84205b261ecSmrg cpswaps(from->u.graphicsExposure.y, 84305b261ecSmrg to->u.graphicsExposure.y); 84405b261ecSmrg cpswaps(from->u.graphicsExposure.width, 84505b261ecSmrg to->u.graphicsExposure.width); 84605b261ecSmrg cpswaps(from->u.graphicsExposure.height, 84705b261ecSmrg to->u.graphicsExposure.height); 84805b261ecSmrg cpswaps(from->u.graphicsExposure.minorEvent, 84905b261ecSmrg to->u.graphicsExposure.minorEvent); 85005b261ecSmrg cpswaps(from->u.graphicsExposure.count, 85105b261ecSmrg to->u.graphicsExposure.count); 85205b261ecSmrg to->u.graphicsExposure.majorEvent = 85305b261ecSmrg from->u.graphicsExposure.majorEvent; 85405b261ecSmrg} 85505b261ecSmrg 85605b261ecSmrgvoid 85705b261ecSmrgSNoExposureEvent(xEvent *from, xEvent *to) 85805b261ecSmrg{ 85905b261ecSmrg to->u.u.type = from->u.u.type; 86005b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 86105b261ecSmrg cpswapl(from->u.noExposure.drawable, to->u.noExposure.drawable); 86205b261ecSmrg cpswaps(from->u.noExposure.minorEvent, to->u.noExposure.minorEvent); 86305b261ecSmrg to->u.noExposure.majorEvent = from->u.noExposure.majorEvent; 86405b261ecSmrg} 86505b261ecSmrg 86605b261ecSmrgvoid 86705b261ecSmrgSVisibilityEvent(xEvent *from, xEvent *to) 86805b261ecSmrg{ 86905b261ecSmrg to->u.u.type = from->u.u.type; 87005b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 87105b261ecSmrg cpswapl(from->u.visibility.window, to->u.visibility.window); 87205b261ecSmrg to->u.visibility.state = from->u.visibility.state; 87305b261ecSmrg} 87405b261ecSmrg 87505b261ecSmrgvoid 87605b261ecSmrgSCreateNotifyEvent(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.createNotify.window, to->u.createNotify.window); 88105b261ecSmrg cpswapl(from->u.createNotify.parent, to->u.createNotify.parent); 88205b261ecSmrg cpswaps(from->u.createNotify.x, to->u.createNotify.x); 88305b261ecSmrg cpswaps(from->u.createNotify.y, to->u.createNotify.y); 88405b261ecSmrg cpswaps(from->u.createNotify.width, to->u.createNotify.width); 88505b261ecSmrg cpswaps(from->u.createNotify.height, to->u.createNotify.height); 88605b261ecSmrg cpswaps(from->u.createNotify.borderWidth, 88705b261ecSmrg to->u.createNotify.borderWidth); 88805b261ecSmrg to->u.createNotify.override = from->u.createNotify.override; 88905b261ecSmrg} 89005b261ecSmrg 89105b261ecSmrgvoid 89205b261ecSmrgSDestroyNotifyEvent(xEvent *from, xEvent *to) 89305b261ecSmrg{ 89405b261ecSmrg to->u.u.type = from->u.u.type; 89505b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 89605b261ecSmrg cpswapl(from->u.destroyNotify.event, to->u.destroyNotify.event); 89705b261ecSmrg cpswapl(from->u.destroyNotify.window, to->u.destroyNotify.window); 89805b261ecSmrg} 89905b261ecSmrg 90005b261ecSmrgvoid 90105b261ecSmrgSUnmapNotifyEvent(xEvent *from, xEvent *to) 90205b261ecSmrg{ 90305b261ecSmrg to->u.u.type = from->u.u.type; 90405b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 90505b261ecSmrg cpswapl(from->u.unmapNotify.event, to->u.unmapNotify.event); 90605b261ecSmrg cpswapl(from->u.unmapNotify.window, to->u.unmapNotify.window); 90705b261ecSmrg to->u.unmapNotify.fromConfigure = from->u.unmapNotify.fromConfigure; 90805b261ecSmrg} 90905b261ecSmrg 91005b261ecSmrgvoid 91105b261ecSmrgSMapNotifyEvent(xEvent *from, xEvent *to) 91205b261ecSmrg{ 91305b261ecSmrg to->u.u.type = from->u.u.type; 91405b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 91505b261ecSmrg cpswapl(from->u.mapNotify.event, to->u.mapNotify.event); 91605b261ecSmrg cpswapl(from->u.mapNotify.window, to->u.mapNotify.window); 91705b261ecSmrg to->u.mapNotify.override = from->u.mapNotify.override; 91805b261ecSmrg} 91905b261ecSmrg 92005b261ecSmrgvoid 92105b261ecSmrgSMapRequestEvent(xEvent *from, xEvent *to) 92205b261ecSmrg{ 92305b261ecSmrg to->u.u.type = from->u.u.type; 92405b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 92505b261ecSmrg cpswapl(from->u.mapRequest.parent, to->u.mapRequest.parent); 92605b261ecSmrg cpswapl(from->u.mapRequest.window, to->u.mapRequest.window); 92705b261ecSmrg} 92805b261ecSmrg 92905b261ecSmrgvoid 93005b261ecSmrgSReparentEvent(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.reparent.event, to->u.reparent.event); 93505b261ecSmrg cpswapl(from->u.reparent.window, to->u.reparent.window); 93605b261ecSmrg cpswapl(from->u.reparent.parent, to->u.reparent.parent); 93705b261ecSmrg cpswaps(from->u.reparent.x, to->u.reparent.x); 93805b261ecSmrg cpswaps(from->u.reparent.y, to->u.reparent.y); 93905b261ecSmrg to->u.reparent.override = from->u.reparent.override; 94005b261ecSmrg} 94105b261ecSmrg 94205b261ecSmrgvoid 94305b261ecSmrgSConfigureNotifyEvent(xEvent *from, xEvent *to) 94405b261ecSmrg{ 94505b261ecSmrg to->u.u.type = from->u.u.type; 94605b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 94705b261ecSmrg cpswapl(from->u.configureNotify.event, 94805b261ecSmrg to->u.configureNotify.event); 94905b261ecSmrg cpswapl(from->u.configureNotify.window, 95005b261ecSmrg to->u.configureNotify.window); 95105b261ecSmrg cpswapl(from->u.configureNotify.aboveSibling, 95205b261ecSmrg to->u.configureNotify.aboveSibling); 95305b261ecSmrg cpswaps(from->u.configureNotify.x, to->u.configureNotify.x); 95405b261ecSmrg cpswaps(from->u.configureNotify.y, to->u.configureNotify.y); 95505b261ecSmrg cpswaps(from->u.configureNotify.width, to->u.configureNotify.width); 95605b261ecSmrg cpswaps(from->u.configureNotify.height, 95705b261ecSmrg to->u.configureNotify.height); 95805b261ecSmrg cpswaps(from->u.configureNotify.borderWidth, 95905b261ecSmrg to->u.configureNotify.borderWidth); 96005b261ecSmrg to->u.configureNotify.override = from->u.configureNotify.override; 96105b261ecSmrg} 96205b261ecSmrg 96305b261ecSmrgvoid 96405b261ecSmrgSConfigureRequestEvent(xEvent *from, xEvent *to) 96505b261ecSmrg{ 96605b261ecSmrg to->u.u.type = from->u.u.type; 96705b261ecSmrg to->u.u.detail = from->u.u.detail; /* actually stack-mode */ 96805b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 96905b261ecSmrg cpswapl(from->u.configureRequest.parent, 97005b261ecSmrg to->u.configureRequest.parent); 97105b261ecSmrg cpswapl(from->u.configureRequest.window, 97205b261ecSmrg to->u.configureRequest.window); 97305b261ecSmrg cpswapl(from->u.configureRequest.sibling, 97405b261ecSmrg to->u.configureRequest.sibling); 97505b261ecSmrg cpswaps(from->u.configureRequest.x, to->u.configureRequest.x); 97605b261ecSmrg cpswaps(from->u.configureRequest.y, to->u.configureRequest.y); 97705b261ecSmrg cpswaps(from->u.configureRequest.width, 97805b261ecSmrg to->u.configureRequest.width); 97905b261ecSmrg cpswaps(from->u.configureRequest.height, 98005b261ecSmrg to->u.configureRequest.height); 98105b261ecSmrg cpswaps(from->u.configureRequest.borderWidth, 98205b261ecSmrg to->u.configureRequest.borderWidth); 98305b261ecSmrg cpswaps(from->u.configureRequest.valueMask, 98405b261ecSmrg to->u.configureRequest.valueMask); 98505b261ecSmrg} 98605b261ecSmrg 98705b261ecSmrg 98805b261ecSmrgvoid 98905b261ecSmrgSGravityEvent(xEvent *from, xEvent *to) 99005b261ecSmrg{ 99105b261ecSmrg to->u.u.type = from->u.u.type; 99205b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 99305b261ecSmrg cpswapl(from->u.gravity.event, to->u.gravity.event); 99405b261ecSmrg cpswapl(from->u.gravity.window, to->u.gravity.window); 99505b261ecSmrg cpswaps(from->u.gravity.x, to->u.gravity.x); 99605b261ecSmrg cpswaps(from->u.gravity.y, to->u.gravity.y); 99705b261ecSmrg} 99805b261ecSmrg 99905b261ecSmrgvoid 100005b261ecSmrgSResizeRequestEvent(xEvent *from, xEvent *to) 100105b261ecSmrg{ 100205b261ecSmrg to->u.u.type = from->u.u.type; 100305b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 100405b261ecSmrg cpswapl(from->u.resizeRequest.window, to->u.resizeRequest.window); 100505b261ecSmrg cpswaps(from->u.resizeRequest.width, to->u.resizeRequest.width); 100605b261ecSmrg cpswaps(from->u.resizeRequest.height, to->u.resizeRequest.height); 100705b261ecSmrg} 100805b261ecSmrg 100905b261ecSmrgvoid 101005b261ecSmrgSCirculateEvent(xEvent *from, xEvent *to) 101105b261ecSmrg{ 101205b261ecSmrg to->u.u.type = from->u.u.type; 101305b261ecSmrg to->u.u.detail = from->u.u.detail; 101405b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 101505b261ecSmrg cpswapl(from->u.circulate.event, to->u.circulate.event); 101605b261ecSmrg cpswapl(from->u.circulate.window, to->u.circulate.window); 101705b261ecSmrg cpswapl(from->u.circulate.parent, to->u.circulate.parent); 101805b261ecSmrg to->u.circulate.place = from->u.circulate.place; 101905b261ecSmrg} 102005b261ecSmrg 102105b261ecSmrgvoid 102205b261ecSmrgSPropertyEvent(xEvent *from, xEvent *to) 102305b261ecSmrg{ 102405b261ecSmrg to->u.u.type = from->u.u.type; 102505b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 102605b261ecSmrg cpswapl(from->u.property.window, to->u.property.window); 102705b261ecSmrg cpswapl(from->u.property.atom, to->u.property.atom); 102805b261ecSmrg cpswapl(from->u.property.time, to->u.property.time); 102905b261ecSmrg to->u.property.state = from->u.property.state; 103005b261ecSmrg} 103105b261ecSmrg 103205b261ecSmrgvoid 103305b261ecSmrgSSelectionClearEvent(xEvent *from, xEvent *to) 103405b261ecSmrg{ 103505b261ecSmrg to->u.u.type = from->u.u.type; 103605b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 103705b261ecSmrg cpswapl(from->u.selectionClear.time, to->u.selectionClear.time); 103805b261ecSmrg cpswapl(from->u.selectionClear.window, to->u.selectionClear.window); 103905b261ecSmrg cpswapl(from->u.selectionClear.atom, to->u.selectionClear.atom); 104005b261ecSmrg} 104105b261ecSmrg 104205b261ecSmrgvoid 104305b261ecSmrgSSelectionRequestEvent(xEvent *from, xEvent *to) 104405b261ecSmrg{ 104505b261ecSmrg to->u.u.type = from->u.u.type; 104605b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 104705b261ecSmrg cpswapl(from->u.selectionRequest.time, to->u.selectionRequest.time); 104805b261ecSmrg cpswapl(from->u.selectionRequest.owner, 104905b261ecSmrg to->u.selectionRequest.owner); 105005b261ecSmrg cpswapl(from->u.selectionRequest.requestor, 105105b261ecSmrg to->u.selectionRequest.requestor); 105205b261ecSmrg cpswapl(from->u.selectionRequest.selection, 105305b261ecSmrg to->u.selectionRequest.selection); 105405b261ecSmrg cpswapl(from->u.selectionRequest.target, 105505b261ecSmrg to->u.selectionRequest.target); 105605b261ecSmrg cpswapl(from->u.selectionRequest.property, 105705b261ecSmrg to->u.selectionRequest.property); 105805b261ecSmrg} 105905b261ecSmrg 106005b261ecSmrgvoid 106105b261ecSmrgSSelectionNotifyEvent(xEvent *from, xEvent *to) 106205b261ecSmrg{ 106305b261ecSmrg to->u.u.type = from->u.u.type; 106405b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 106505b261ecSmrg cpswapl(from->u.selectionNotify.time, to->u.selectionNotify.time); 106605b261ecSmrg cpswapl(from->u.selectionNotify.requestor, 106705b261ecSmrg to->u.selectionNotify.requestor); 106805b261ecSmrg cpswapl(from->u.selectionNotify.selection, 106905b261ecSmrg to->u.selectionNotify.selection); 107005b261ecSmrg cpswapl(from->u.selectionNotify.target, 107105b261ecSmrg to->u.selectionNotify.target); 107205b261ecSmrg cpswapl(from->u.selectionNotify.property, 107305b261ecSmrg to->u.selectionNotify.property); 107405b261ecSmrg} 107505b261ecSmrg 107605b261ecSmrgvoid 107705b261ecSmrgSColormapEvent(xEvent *from, xEvent *to) 107805b261ecSmrg{ 107905b261ecSmrg to->u.u.type = from->u.u.type; 108005b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 108105b261ecSmrg cpswapl(from->u.colormap.window, to->u.colormap.window); 108205b261ecSmrg cpswapl(from->u.colormap.colormap, to->u.colormap.colormap); 108305b261ecSmrg to->u.colormap.new = from->u.colormap.new; 108405b261ecSmrg to->u.colormap.state = from->u.colormap.state; 108505b261ecSmrg} 108605b261ecSmrg 108705b261ecSmrgvoid 108805b261ecSmrgSMappingEvent(xEvent *from, xEvent *to) 108905b261ecSmrg{ 109005b261ecSmrg to->u.u.type = from->u.u.type; 109105b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 109205b261ecSmrg to->u.mappingNotify.request = from->u.mappingNotify.request; 109305b261ecSmrg to->u.mappingNotify.firstKeyCode = 109405b261ecSmrg from->u.mappingNotify.firstKeyCode; 109505b261ecSmrg to->u.mappingNotify.count = from->u.mappingNotify.count; 109605b261ecSmrg} 109705b261ecSmrg 109805b261ecSmrgvoid 109905b261ecSmrgSClientMessageEvent(xEvent *from, xEvent *to) 110005b261ecSmrg{ 110105b261ecSmrg to->u.u.type = from->u.u.type; 110205b261ecSmrg to->u.u.detail = from->u.u.detail; /* actually format */ 110305b261ecSmrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 110405b261ecSmrg cpswapl(from->u.clientMessage.window, to->u.clientMessage.window); 110505b261ecSmrg cpswapl(from->u.clientMessage.u.l.type, 110605b261ecSmrg to->u.clientMessage.u.l.type); 110705b261ecSmrg switch (from->u.u.detail) { 110805b261ecSmrg case 8: 110905b261ecSmrg memmove(to->u.clientMessage.u.b.bytes, 111005b261ecSmrg from->u.clientMessage.u.b.bytes,20); 111105b261ecSmrg break; 111205b261ecSmrg case 16: 111305b261ecSmrg cpswaps(from->u.clientMessage.u.s.shorts0, 111405b261ecSmrg to->u.clientMessage.u.s.shorts0); 111505b261ecSmrg cpswaps(from->u.clientMessage.u.s.shorts1, 111605b261ecSmrg to->u.clientMessage.u.s.shorts1); 111705b261ecSmrg cpswaps(from->u.clientMessage.u.s.shorts2, 111805b261ecSmrg to->u.clientMessage.u.s.shorts2); 111905b261ecSmrg cpswaps(from->u.clientMessage.u.s.shorts3, 112005b261ecSmrg to->u.clientMessage.u.s.shorts3); 112105b261ecSmrg cpswaps(from->u.clientMessage.u.s.shorts4, 112205b261ecSmrg to->u.clientMessage.u.s.shorts4); 112305b261ecSmrg cpswaps(from->u.clientMessage.u.s.shorts5, 112405b261ecSmrg to->u.clientMessage.u.s.shorts5); 112505b261ecSmrg cpswaps(from->u.clientMessage.u.s.shorts6, 112605b261ecSmrg to->u.clientMessage.u.s.shorts6); 112705b261ecSmrg cpswaps(from->u.clientMessage.u.s.shorts7, 112805b261ecSmrg to->u.clientMessage.u.s.shorts7); 112905b261ecSmrg cpswaps(from->u.clientMessage.u.s.shorts8, 113005b261ecSmrg to->u.clientMessage.u.s.shorts8); 113105b261ecSmrg cpswaps(from->u.clientMessage.u.s.shorts9, 113205b261ecSmrg to->u.clientMessage.u.s.shorts9); 113305b261ecSmrg break; 113405b261ecSmrg case 32: 113505b261ecSmrg cpswapl(from->u.clientMessage.u.l.longs0, 113605b261ecSmrg to->u.clientMessage.u.l.longs0); 113705b261ecSmrg cpswapl(from->u.clientMessage.u.l.longs1, 113805b261ecSmrg to->u.clientMessage.u.l.longs1); 113905b261ecSmrg cpswapl(from->u.clientMessage.u.l.longs2, 114005b261ecSmrg to->u.clientMessage.u.l.longs2); 114105b261ecSmrg cpswapl(from->u.clientMessage.u.l.longs3, 114205b261ecSmrg to->u.clientMessage.u.l.longs3); 114305b261ecSmrg cpswapl(from->u.clientMessage.u.l.longs4, 114405b261ecSmrg to->u.clientMessage.u.l.longs4); 114505b261ecSmrg break; 114605b261ecSmrg } 114705b261ecSmrg} 114805b261ecSmrg 114905b261ecSmrgvoid 115005b261ecSmrgSKeymapNotifyEvent(xEvent *from, xEvent *to) 115105b261ecSmrg{ 115205b261ecSmrg /* Keymap notify events are special; they have no 115305b261ecSmrg sequence number field, and contain entirely 8-bit data */ 115405b261ecSmrg *to = *from; 115505b261ecSmrg} 115605b261ecSmrg 115705b261ecSmrgstatic void 115805b261ecSmrgSwapConnSetup(xConnSetup *pConnSetup, xConnSetup *pConnSetupT) 115905b261ecSmrg{ 116005b261ecSmrg cpswapl(pConnSetup->release, pConnSetupT->release); 116105b261ecSmrg cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase); 116205b261ecSmrg cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask); 116305b261ecSmrg cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize); 116405b261ecSmrg cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor); 116505b261ecSmrg cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize); 116605b261ecSmrg pConnSetupT->minKeyCode = pConnSetup->minKeyCode; 116705b261ecSmrg pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode; 116805b261ecSmrg pConnSetupT->numRoots = pConnSetup->numRoots; 116905b261ecSmrg pConnSetupT->numFormats = pConnSetup->numFormats; 117005b261ecSmrg pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder; 117105b261ecSmrg pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder; 117205b261ecSmrg pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit; 117305b261ecSmrg pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad; 117405b261ecSmrg} 117505b261ecSmrg 117605b261ecSmrgstatic void 117705b261ecSmrgSwapWinRoot(xWindowRoot *pRoot, xWindowRoot *pRootT) 117805b261ecSmrg{ 117905b261ecSmrg cpswapl(pRoot->windowId, pRootT->windowId); 118005b261ecSmrg cpswapl(pRoot->defaultColormap, pRootT->defaultColormap); 118105b261ecSmrg cpswapl(pRoot->whitePixel, pRootT->whitePixel); 118205b261ecSmrg cpswapl(pRoot->blackPixel, pRootT->blackPixel); 118305b261ecSmrg cpswapl(pRoot->currentInputMask, pRootT->currentInputMask); 118405b261ecSmrg cpswaps(pRoot->pixWidth, pRootT->pixWidth); 118505b261ecSmrg cpswaps(pRoot->pixHeight, pRootT->pixHeight); 118605b261ecSmrg cpswaps(pRoot->mmWidth, pRootT->mmWidth); 118705b261ecSmrg cpswaps(pRoot->mmHeight, pRootT->mmHeight); 118805b261ecSmrg cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps); 118905b261ecSmrg cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps); 119005b261ecSmrg cpswapl(pRoot->rootVisualID, pRootT->rootVisualID); 119105b261ecSmrg pRootT->backingStore = pRoot->backingStore; 119205b261ecSmrg pRootT->saveUnders = pRoot->saveUnders; 119305b261ecSmrg pRootT->rootDepth = pRoot->rootDepth; 119405b261ecSmrg pRootT->nDepths = pRoot->nDepths; 119505b261ecSmrg} 119605b261ecSmrg 119705b261ecSmrgstatic void 119805b261ecSmrgSwapVisual(xVisualType *pVis, xVisualType *pVisT) 119905b261ecSmrg{ 120005b261ecSmrg cpswapl(pVis->visualID, pVisT->visualID); 120105b261ecSmrg pVisT->class = pVis->class; 120205b261ecSmrg pVisT->bitsPerRGB = pVis->bitsPerRGB; 120305b261ecSmrg cpswaps(pVis->colormapEntries, pVisT->colormapEntries); 120405b261ecSmrg cpswapl(pVis->redMask, pVisT->redMask); 120505b261ecSmrg cpswapl(pVis->greenMask, pVisT->greenMask); 120605b261ecSmrg cpswapl(pVis->blueMask, pVisT->blueMask); 120705b261ecSmrg} 120805b261ecSmrg 12096747b715Smrgvoid 121005b261ecSmrgSwapConnSetupInfo( 121105b261ecSmrg char *pInfo, 121205b261ecSmrg char *pInfoT 121305b261ecSmrg) 121405b261ecSmrg{ 121505b261ecSmrg int i, j, k; 121605b261ecSmrg xConnSetup *pConnSetup = (xConnSetup *)pInfo; 121705b261ecSmrg xDepth *depth; 121805b261ecSmrg xWindowRoot *root; 121905b261ecSmrg 122005b261ecSmrg SwapConnSetup(pConnSetup, (xConnSetup *)pInfoT); 122105b261ecSmrg pInfo += sizeof(xConnSetup); 122205b261ecSmrg pInfoT += sizeof(xConnSetup); 122305b261ecSmrg 122405b261ecSmrg /* Copy the vendor string */ 12256747b715Smrg i = pad_to_int32(pConnSetup->nbytesVendor); 122605b261ecSmrg memcpy(pInfoT, pInfo, i); 122705b261ecSmrg pInfo += i; 122805b261ecSmrg pInfoT += i; 122905b261ecSmrg 123005b261ecSmrg /* The Pixmap formats don't need to be swapped, just copied. */ 123105b261ecSmrg i = sizeof(xPixmapFormat) * pConnSetup->numFormats; 123205b261ecSmrg memcpy(pInfoT, pInfo, i); 123305b261ecSmrg pInfo += i; 123405b261ecSmrg pInfoT += i; 123505b261ecSmrg 123605b261ecSmrg for(i = 0; i < pConnSetup->numRoots; i++) 123705b261ecSmrg { 123805b261ecSmrg root = (xWindowRoot*)pInfo; 123905b261ecSmrg SwapWinRoot(root, (xWindowRoot *)pInfoT); 124005b261ecSmrg pInfo += sizeof(xWindowRoot); 124105b261ecSmrg pInfoT += sizeof(xWindowRoot); 124205b261ecSmrg 124305b261ecSmrg for(j = 0; j < root->nDepths; j++) 124405b261ecSmrg { 124505b261ecSmrg depth = (xDepth*)pInfo; 124605b261ecSmrg ((xDepth *)pInfoT)->depth = depth->depth; 124705b261ecSmrg cpswaps(depth->nVisuals, ((xDepth *)pInfoT)->nVisuals); 124805b261ecSmrg pInfo += sizeof(xDepth); 124905b261ecSmrg pInfoT += sizeof(xDepth); 125005b261ecSmrg for(k = 0; k < depth->nVisuals; k++) 125105b261ecSmrg { 125205b261ecSmrg SwapVisual((xVisualType *)pInfo, (xVisualType *)pInfoT); 125305b261ecSmrg pInfo += sizeof(xVisualType); 125405b261ecSmrg pInfoT += sizeof(xVisualType); 125505b261ecSmrg } 125605b261ecSmrg } 125705b261ecSmrg } 125805b261ecSmrg} 125905b261ecSmrg 126005b261ecSmrgvoid 126105b261ecSmrgWriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) 126205b261ecSmrg{ 126305b261ecSmrg char *pInfoTBase; 126405b261ecSmrg 12656747b715Smrg pInfoTBase = malloc(size); 126605b261ecSmrg if (!pInfoTBase) 126705b261ecSmrg { 126805b261ecSmrg pClient->noClientException = -1; 126905b261ecSmrg return; 127005b261ecSmrg } 127105b261ecSmrg SwapConnSetupInfo(pInfo, pInfoTBase); 127205b261ecSmrg (void)WriteToClient(pClient, (int)size, (char *) pInfoTBase); 12736747b715Smrg free(pInfoTBase); 127405b261ecSmrg} 127505b261ecSmrg 12766747b715Smrgvoid 127705b261ecSmrgSwapConnSetupPrefix(xConnSetupPrefix *pcspFrom, xConnSetupPrefix *pcspTo) 127805b261ecSmrg{ 127905b261ecSmrg pcspTo->success = pcspFrom->success; 128005b261ecSmrg pcspTo->lengthReason = pcspFrom->lengthReason; 128105b261ecSmrg cpswaps(pcspFrom->majorVersion, pcspTo->majorVersion); 128205b261ecSmrg cpswaps(pcspFrom->minorVersion, pcspTo->minorVersion); 128305b261ecSmrg cpswaps(pcspFrom->length, pcspTo->length); 128405b261ecSmrg} 128505b261ecSmrg 128605b261ecSmrgvoid 128705b261ecSmrgWriteSConnSetupPrefix(ClientPtr pClient, xConnSetupPrefix *pcsp) 128805b261ecSmrg{ 128905b261ecSmrg xConnSetupPrefix cspT; 129005b261ecSmrg 129105b261ecSmrg SwapConnSetupPrefix(pcsp, &cspT); 129205b261ecSmrg (void)WriteToClient(pClient, sizeof(cspT), (char *) &cspT); 129305b261ecSmrg} 12946747b715Smrg 12956747b715Smrg/* 12966747b715Smrg * Dummy entry for ReplySwapVector[] 12976747b715Smrg */ 12986747b715Smrg 12996747b715Smrgvoid 13006747b715SmrgReplyNotSwappd( 13016747b715Smrg ClientPtr pClient , 13026747b715Smrg int size , 13036747b715Smrg void * pbuf 13046747b715Smrg ) 13056747b715Smrg{ 13066747b715Smrg FatalError("Not implemented"); 13076747b715Smrg} 13086747b715Smrg 1309