swaprep.c revision 05b261ec
11.1422Sskrll/************************************************************ 21.1Scgd 31.1ScgdCopyright 1987, 1998 The Open Group 41.4Scgd 51.1ScgdPermission to use, copy, modify, distribute, and sell this software and its 61.1Scgddocumentation for any purpose is hereby granted without fee, provided that 71.1Scgdthe above copyright notice appear in all copies and that both that 81.1Scgdcopyright notice and this permission notice appear in supporting 91.1Scgddocumentation. 101.1Scgd 111.1ScgdThe above copyright notice and this permission notice shall be included in 121.1Scgdall copies or substantial portions of the Software. 131.1Scgd 141.1ScgdTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 151.1ScgdIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 161.1ScgdFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 171.1ScgdOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 181.1ScgdAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 191.1ScgdCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 201.1Scgd 211.1ScgdExcept as contained in this notice, the name of The Open Group shall not be 221.1Scgdused in advertising or otherwise to promote the sale, use or other dealings 231.1Scgdin this Software without prior written authorization from The Open Group. 241.1Scgd 251.1Scgd 261.1ScgdCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. 271.1Scgd 281.1Scgd All Rights Reserved 291.1Scgd 301.1ScgdPermission to use, copy, modify, and distribute this software and its 311.1Scgddocumentation for any purpose and without fee is hereby granted, 321.1Scgdprovided that the above copyright notice appear in all copies and that 331.1Scgdboth that copyright notice and this permission notice appear in 341.1Scgdsupporting documentation, and that the name of Digital not be 351.21Sthorpejused in advertising or publicity pertaining to distribution of the 361.133Sfairsoftware without specific, written prior permission. 371.1299Schristos 381.31ScgdDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 391.31ScgdALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 401.609SblymnDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 411.609SblymnANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 421.609SblymnWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 431.609SblymnARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 441.609SblymnSOFTWARE. 451.609Sblymn 461.609Sblymn********************************************************/ 471.21Sthorpej 481.21Sthorpej 491.21Sthorpej#ifdef HAVE_DIX_CONFIG_H 501.974Sjnemeth#include <dix-config.h> 511.974Sjnemeth#endif 521.974Sjnemeth 531.974Sjnemeth#include <X11/X.h> 541.1Scgd#define NEED_REPLIES 551.1Scgd#define NEED_EVENTS 561.1Scgd#include <X11/Xproto.h> 571.448Srjs#include "misc.h" 581.665Sjunyoung#include "dixstruct.h" 591.251Swiz#include <X11/fonts/fontstruct.h> 601.470Spooka#include "scrnintstr.h" 611.24Stls#include "swaprep.h" 621.24Stls#include "globals.h" 631.665Sjunyoung 641.4Scgdstatic void SwapFontInfo(xQueryFontReply *pr); 651.4Scgd 661.4Scgdstatic void SwapCharInfo(xCharInfo *pInfo); 671.4Scgd 681.4Scgdstatic void SwapFont(xQueryFontReply *pr, Bool hasGlyphs); 691.4Scgd 701.4Scgd/** 711.4Scgd * Thanks to Jack Palevich for testing and subsequently rewriting all this 721.4Scgd * 731.4Scgd * \param size size in bytes 741.4Scgd */ 751.24Stls_X_EXPORT void 761.4ScgdSwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) 771.4Scgd{ 781.4Scgd int i; 791.4Scgd char n; 801.665Sjunyoung 811.4Scgd size >>= 2; 821.4Scgd for(i = 0; i < size; i++) 831.4Scgd /* brackets are mandatory here, because "swapl" macro expands 841.4Scgd to several statements */ 851.24Stls { 861.4Scgd swapl(&pbuf[i], n); 871.4Scgd } 881.4Scgd (void)WriteToClient(pClient, size << 2, (char *) pbuf); 891.4Scgd} 901.4Scgd 911.4Scgd/** 921.999Scegger * 931.4Scgd * \param size size in bytes 941.4Scgd */ 951.4Scgd_X_EXPORT void 961.4ScgdCopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) 971.25Sveego{ 981.9Sthorpej int bufsize = size; 991.4Scgd CARD32 *pbufT; 1001.4Scgd CARD32 *from, *to, *fromLast, *toLast; 1011.4Scgd CARD32 tmpbuf[1]; 1021.4Scgd 1031.4Scgd /* Allocate as big a buffer as we can... */ 1041.4Scgd while (!(pbufT = (CARD32 *) ALLOCATE_LOCAL(bufsize))) 1051.4Scgd { 1061.25Sveego bufsize >>= 1; 1071.4Scgd if (bufsize == 4) 1081.4Scgd { 1091.4Scgd pbufT = tmpbuf; 1101.4Scgd break; 1111.4Scgd } 1121.4Scgd } 1131.4Scgd 1141.4Scgd /* convert lengths from # of bytes to # of longs */ 1151.665Sjunyoung size >>= 2; 1161.24Stls bufsize >>= 2; 1171.4Scgd 1181.4Scgd from = pbuf; 1191.4Scgd fromLast = from + size; 1201.4Scgd while (from < fromLast) { 1211.4Scgd int nbytes; 1221.4Scgd to = pbufT; 1231.4Scgd toLast = to + min (bufsize, fromLast - from); 1241.4Scgd nbytes = (toLast - to) << 2; 1251.665Sjunyoung while (to < toLast) { 1261.4Scgd /* can't write "cpswapl(*from++, *to++)" because cpswapl is a macro 1271.4Scgd that evaulates its args more than once */ 1281.4Scgd cpswapl(*from, *to); 1291.577Snisimura from++; 1301.4Scgd to++; 1311.24Stls } 1321.24Stls (void)WriteToClient (pClient, nbytes, (char *) pbufT); 1331.4Scgd } 1341.4Scgd 1351.4Scgd if (pbufT != tmpbuf) 1361.4Scgd DEALLOCATE_LOCAL ((char *) pbufT); 1371.4Scgd} 1381.4Scgd 1391.4Scgd/** 1401.4Scgd * 1411.4Scgd * \param size size in bytes 1421.4Scgd */ 1431.4Scgdvoid 1441.4ScgdCopySwap16Write(ClientPtr pClient, int size, short *pbuf) 1451.4Scgd{ 1461.4Scgd int bufsize = size; 1471.4Scgd short *pbufT; 1481.4Scgd short *from, *to, *fromLast, *toLast; 1491.4Scgd short tmpbuf[2]; 1501.4Scgd 1511.4Scgd /* Allocate as big a buffer as we can... */ 1521.24Stls while (!(pbufT = (short *) ALLOCATE_LOCAL(bufsize))) 1531.4Scgd { 1541.4Scgd bufsize >>= 1; 1551.4Scgd if (bufsize == 4) 1561.4Scgd { 1571.25Sveego pbufT = tmpbuf; 1581.4Scgd break; 1591.4Scgd } 1601.4Scgd } 1611.24Stls 1621.4Scgd /* convert lengths from # of bytes to # of shorts */ 1631.4Scgd size >>= 1; 1641.4Scgd bufsize >>= 1; 1651.4Scgd 1661.4Scgd from = pbuf; 1671.4Scgd fromLast = from + size; 1681.665Sjunyoung while (from < fromLast) { 1691.4Scgd int nbytes; 1701.4Scgd to = pbufT; 1711.4Scgd toLast = to + min (bufsize, fromLast - from); 1721.4Scgd nbytes = (toLast - to) << 1; 1731.794Sgrant while (to < toLast) { 1741.665Sjunyoung /* can't write "cpswaps(*from++, *to++)" because cpswaps is a macro 1751.4Scgd that evaulates its args more than once */ 1761.4Scgd cpswaps(*from, *to); 1771.4Scgd from++; 1781.1014Ssborrill to++; 1791.4Scgd } 1801.4Scgd (void)WriteToClient (pClient, nbytes, (char *) pbufT); 1811.665Sjunyoung } 1821.4Scgd 1831.4Scgd if (pbufT != tmpbuf) 1841.665Sjunyoung DEALLOCATE_LOCAL ((char *) pbufT); 1851.4Scgd} 1861.4Scgd 1871.4Scgd 1881.4Scgd/* Extra-small reply */ 1891.4Scgdvoid 1901.4ScgdSGenericReply(ClientPtr pClient, int size, xGenericReply *pRep) 1911.665Sjunyoung{ 1921.665Sjunyoung char n; 1931.25Sveego 1941.4Scgd swaps(&pRep->sequenceNumber, n); 1951.665Sjunyoung (void)WriteToClient(pClient, size, (char *) pRep); 1961.4Scgd} 1971.4Scgd 1981.4Scgd/* Extra-large reply */ 1991.4Scgdvoid 2001.4ScgdSGetWindowAttributesReply(ClientPtr pClient, int size, 2011.4Scgd xGetWindowAttributesReply *pRep) 2021.4Scgd{ 2031.4Scgd char n; 2041.4Scgd 2051.4Scgd swaps(&pRep->sequenceNumber, n); 2061.4Scgd swapl(&pRep->length, n); 2071.4Scgd swapl(&pRep->visualID, n); 2081.4Scgd swaps(&pRep->class, n); 2091.4Scgd swapl(&pRep->backingBitPlanes, n); 2101.4Scgd swapl(&pRep->backingPixel, n); 2111.4Scgd swapl(&pRep->colormap, n); 2121.4Scgd swapl(&pRep->allEventMasks, n); 2131.4Scgd swapl(&pRep->yourEventMask, n); 2141.4Scgd swaps(&pRep->doNotPropagateMask, n); 2151.4Scgd (void)WriteToClient(pClient, size, (char *) pRep); 2161.4Scgd} 2171.4Scgd 2181.4Scgdvoid 2191.4ScgdSGetGeometryReply(ClientPtr pClient, int size, xGetGeometryReply *pRep) 2201.4Scgd{ 2211.4Scgd char n; 2221.4Scgd 2231.4Scgd swaps(&pRep->sequenceNumber, n); 2241.4Scgd swapl(&pRep->root, n); 2251.4Scgd swaps(&pRep->x, n); 2261.25Sveego swaps(&pRep->y, n); 2271.4Scgd swaps(&pRep->width, n); 2281.4Scgd swaps(&pRep->height, n); 2291.4Scgd swaps(&pRep->borderWidth, n); 2301.251Swiz (void)WriteToClient(pClient, size, (char *) pRep); 2311.4Scgd} 2321.4Scgd 2331.4Scgdvoid 2341.4ScgdSQueryTreeReply(ClientPtr pClient, int size, xQueryTreeReply *pRep) 2351.4Scgd{ 2361.312Ssoren char n; 2371.4Scgd 2381.4Scgd swaps(&pRep->sequenceNumber, n); 2391.4Scgd swapl(&pRep->length, n); 2401.4Scgd swapl(&pRep->root, n); 2411.4Scgd swapl(&pRep->parent, n); 2421.4Scgd swaps(&pRep->nChildren, n); 2431.4Scgd (void)WriteToClient(pClient, size, (char *) pRep); 2441.4Scgd} 2451.4Scgd 2461.4Scgdvoid 2471.4ScgdSInternAtomReply(ClientPtr pClient, int size, xInternAtomReply *pRep) 2481.4Scgd{ 2491.4Scgd char n; 2501.4Scgd 2511.4Scgd swaps(&pRep->sequenceNumber, n); 2521.4Scgd swapl(&pRep->atom, n); 2531.4Scgd (void)WriteToClient(pClient, size, (char *) pRep); 2541.4Scgd} 2551.4Scgd 2561.4Scgdvoid 2571.4ScgdSGetAtomNameReply(ClientPtr pClient, int size, xGetAtomNameReply *pRep) 2581.77Sdante{ 2591.4Scgd char n; 2601.1079Smrg 2611.1079Smrg swaps(&pRep->sequenceNumber, n); 2621.4Scgd swapl(&pRep->length, n); 2631.4Scgd swaps(&pRep->nameLength, n); 2641.4Scgd (void)WriteToClient(pClient, size, (char *) pRep); 2651.4Scgd} 2661.4Scgd 2671.4Scgd 2681.4Scgdvoid 2691.4ScgdSGetPropertyReply(ClientPtr pClient, int size, xGetPropertyReply *pRep) 2701.4Scgd{ 2711.4Scgd char n; 2721.4Scgd 2731.24Stls swaps(&pRep->sequenceNumber, n); 2741.4Scgd swapl(&pRep->length, n); 2751.753Stron swapl(&pRep->propertyType, n); 2761.4Scgd swapl(&pRep->bytesAfter, n); 2771.4Scgd swapl(&pRep->nItems, n); 2781.24Stls (void)WriteToClient(pClient, size, (char *) pRep); 2791.665Sjunyoung} 2801.81Sdrochner 2811.4Scgdvoid 2821.4ScgdSListPropertiesReply(ClientPtr pClient, int size, xListPropertiesReply *pRep) 2831.4Scgd{ 2841.4Scgd char n; 2851.4Scgd 2861.4Scgd swaps(&pRep->sequenceNumber, n); 2871.396Sjunyoung swapl(&pRep->length, n); 2881.4Scgd swaps(&pRep->nProperties, n); 2891.4Scgd (void)WriteToClient(pClient, size, (char *) pRep); 2901.665Sjunyoung} 2911.4Scgd 2921.4Scgdvoid 2931.4ScgdSGetSelectionOwnerReply(ClientPtr pClient, int size, 2941.4Scgd xGetSelectionOwnerReply *pRep) 2951.4Scgd{ 2961.4Scgd char n; 2971.4Scgd 2981.665Sjunyoung swaps(&pRep->sequenceNumber, n); 2991.4Scgd swapl(&pRep->owner, n); 3001.4Scgd (void)WriteToClient(pClient, size, (char *) pRep); 3011.4Scgd} 3021.4Scgd 3031.4Scgd 3041.4Scgdvoid 3051.4ScgdSQueryPointerReply(ClientPtr pClient, int size, xQueryPointerReply *pRep) 3061.4Scgd{ 3071.4Scgd char n; 3081.4Scgd 3091.4Scgd swaps(&pRep->sequenceNumber, n); 3101.4Scgd swapl(&pRep->root, n); 3111.4Scgd swapl(&pRep->child, n); 3121.4Scgd swaps(&pRep->rootX, n); 3131.4Scgd swaps(&pRep->rootY, n); 3141.4Scgd swaps(&pRep->winX, n); 3151.12Scgd swaps(&pRep->winY, n); 3161.4Scgd swaps(&pRep->mask, n); 3171.4Scgd (void)WriteToClient(pClient, size, (char *) pRep); 3181.4Scgd} 3191.25Sveego 3201.4Scgdstatic void 3211.4ScgdSwapTimecoord(xTimecoord* pCoord) 3221.4Scgd{ 3231.4Scgd char n; 3241.4Scgd 3251.4Scgd swapl(&pCoord->time, n); 3261.4Scgd swaps(&pCoord->x, n); 3271.25Sveego swaps(&pCoord->y, n); 3281.4Scgd} 3291.4Scgd 3301.24Stlsvoid 3311.4ScgdSwapTimeCoordWrite(ClientPtr pClient, int size, xTimecoord *pRep) 3321.4Scgd{ 3331.4Scgd int i, n; 3341.4Scgd xTimecoord *pRepT; 3351.4Scgd 3361.4Scgd n = size / sizeof(xTimecoord); 3371.4Scgd pRepT = pRep; 3381.4Scgd for(i = 0; i < n; i++) 3391.4Scgd { 3401.4Scgd SwapTimecoord(pRepT); 3411.4Scgd pRepT++; 3421.4Scgd } 3431.4Scgd (void)WriteToClient(pClient, size, (char *) pRep); 3441.4Scgd 3451.24Stls} 3461.24Stlsvoid 3471.4ScgdSGetMotionEventsReply(ClientPtr pClient, int size, xGetMotionEventsReply *pRep) 3481.4Scgd{ 3491.4Scgd char n; 3501.4Scgd 3511.4Scgd swaps(&pRep->sequenceNumber, n); 3521.4Scgd swapl(&pRep->length, n); 3531.4Scgd swapl(&pRep->nEvents, n); 3541.4Scgd (void)WriteToClient(pClient, size, (char *) pRep); 3551.4Scgd} 3561.4Scgd 3571.4Scgdvoid 3581.4ScgdSTranslateCoordsReply(ClientPtr pClient, int size, xTranslateCoordsReply *pRep) 3591.4Scgd{ 3601.4Scgd char n; 3611.4Scgd 3621.4Scgd swaps(&pRep->sequenceNumber, n); 3631.4Scgd swapl(&pRep->child, n); 3641.4Scgd swaps(&pRep->dstX, n); 3651.4Scgd swaps(&pRep->dstY, n); 3661.4Scgd (void)WriteToClient(pClient, size, (char *) pRep); 3671.4Scgd} 3681.4Scgd 3691.4Scgdvoid 3701.4ScgdSGetInputFocusReply(ClientPtr pClient, int size, xGetInputFocusReply *pRep) 3711.4Scgd{ 3721.4Scgd char n; 3731.4Scgd 3741.4Scgd swaps(&pRep->sequenceNumber, n); 3751.4Scgd swapl(&pRep->focus, n); 3761.4Scgd (void)WriteToClient(pClient, size, (char *) pRep); 3771.4Scgd} 3781.4Scgd 3791.4Scgd/* extra long reply */ 3801.4Scgdvoid 3811.4ScgdSQueryKeymapReply(ClientPtr pClient, int size, xQueryKeymapReply *pRep) 3821.665Sjunyoung{ 3831.4Scgd char n; 3841.775Schs 3851.4Scgd swaps(&pRep->sequenceNumber, n); 3861.4Scgd swapl(&pRep->length, n); 3871.4Scgd (void)WriteToClient(pClient, size, (char *) pRep); 3881.4Scgd} 3891.4Scgd 3901.4Scgdstatic void 3911.4ScgdSwapCharInfo(xCharInfo *pInfo) 3921.4Scgd{ 3931.4Scgd char n; 3941.4Scgd 3951.4Scgd swaps(&pInfo->leftSideBearing, n); 3961.4Scgd swaps(&pInfo->rightSideBearing, n); 3971.4Scgd swaps(&pInfo->characterWidth, n); 3981.4Scgd swaps(&pInfo->ascent, n); 3991.4Scgd swaps(&pInfo->descent, n); 4001.4Scgd swaps(&pInfo->attributes, n); 4011.4Scgd} 4021.4Scgd 4031.665Sjunyoungstatic void 4041.4ScgdSwapFontInfo(xQueryFontReply *pr) 4051.4Scgd{ 4061.269Sad char n; 4071.4Scgd 4081.4Scgd swaps(&pr->minCharOrByte2, n); 4091.4Scgd swaps(&pr->maxCharOrByte2, n); 4101.4Scgd swaps(&pr->defaultChar, n); 4111.4Scgd swaps(&pr->nFontProps, n); 4121.4Scgd swaps(&pr->fontAscent, n); 4131.4Scgd swaps(&pr->fontDescent, n); 4141.24Stls SwapCharInfo( &pr->minBounds); 4151.665Sjunyoung SwapCharInfo( &pr->maxBounds); 4161.24Stls swapl(&pr->nCharInfos, n); 4171.24Stls} 4181.24Stls 4191.24Stlsstatic void 4201.24StlsSwapFont(xQueryFontReply *pr, Bool hasGlyphs) 4211.25Sveego{ 4221.248Ssoren unsigned i; 4231.24Stls xCharInfo * pxci; 4241.24Stls unsigned nchars, nprops; 4251.24Stls char *pby; 4261.24Stls char n; 4271.24Stls 4281.24Stls swaps(&pr->sequenceNumber, n); 4291.24Stls swapl(&pr->length, n); 4301.24Stls nchars = pr->nCharInfos; 4311.24Stls nprops = pr->nFontProps; 4321.24Stls SwapFontInfo(pr); 4331.24Stls pby = (char *) &pr[1]; 4341.25Sveego /* Font properties are an atom and either an int32 or a CARD32, so 4351.24Stls * they are always 2 4 byte values */ 4361.24Stls for(i = 0; i < nprops; i++) 4371.24Stls { 4381.24Stls swapl(pby, n); 4391.141Ssoren pby += 4; 4401.24Stls swapl(pby, n); 4411.12Scgd pby += 4; 4421.24Stls } 4431.399Stsutsui if (hasGlyphs) 4441.24Stls { 4451.24Stls pxci = (xCharInfo *)pby; 4461.24Stls for(i = 0; i< nchars; i++, pxci++) 4471.24Stls SwapCharInfo(pxci); 4481.24Stls } 4491.24Stls} 4501.24Stls 4511.24Stlsvoid 4521.1309SsevanSQueryFontReply(ClientPtr pClient, int size, xQueryFontReply *pRep) 4531.24Stls{ 4541.24Stls SwapFont(pRep, TRUE); 4551.24Stls (void)WriteToClient(pClient, size, (char *) pRep); 4561.25Sveego} 4571.24Stls 4581.24Stlsvoid 4591.24StlsSQueryTextExtentsReply(ClientPtr pClient, int size, xQueryTextExtentsReply *pRep) 4601.24Stls{ 4611.24Stls char n; 4621.24Stls 4631.820Sriz swaps(&pRep->sequenceNumber, n); 4641.24Stls swaps(&pRep->fontAscent, n); 4651.24Stls swaps(&pRep->fontDescent, n); 4661.665Sjunyoung swaps(&pRep->overallAscent, n); 4671.665Sjunyoung swaps(&pRep->overallDescent, n); 4681.24Stls swapl(&pRep->overallWidth, n); 4691.24Stls swapl(&pRep->overallLeft, n); 4701.24Stls swapl(&pRep->overallRight, n); 4711.24Stls (void)WriteToClient(pClient, size, (char *) pRep); 4721.24Stls} 4731.24Stls 4741.24Stlsvoid 4751.25SveegoSListFontsReply(ClientPtr pClient, int size, xListFontsReply *pRep) 4761.24Stls{ 4771.24Stls char n; 4781.24Stls 4791.24Stls swaps(&pRep->sequenceNumber, n); 4801.24Stls swapl(&pRep->length, n); 4811.25Sveego swaps(&pRep->nFonts, n); 4821.25Sveego (void)WriteToClient(pClient, size, (char *) pRep); 4831.255Ssoren} 4841.25Sveego 4851.24Stlsvoid 4861.24StlsSListFontsWithInfoReply(ClientPtr pClient, int size, 4871.24Stls xListFontsWithInfoReply *pRep) 4881.24Stls{ 4891.775Schs SwapFont((xQueryFontReply *)pRep, FALSE); 4901.24Stls (void)WriteToClient(pClient, size, (char *) pRep); 4911.24Stls} 4921.25Sveego 4931.25Sveegovoid 4941.167SrhSGetFontPathReply(ClientPtr pClient, int size, xGetFontPathReply *pRep) 4951.590Schs{ 4961.296Sthorpej char n; 4971.665Sjunyoung 4981.720Schs swaps(&pRep->sequenceNumber, n); 4991.59Sthorpej swapl(&pRep->length, n); 5001.24Stls swaps(&pRep->nPaths, n); 5011.775Schs (void)WriteToClient(pClient, size, (char *) pRep); 5021.16Schristos} 5031.29Skml 5041.665Sjunyoungvoid 5051.71SexplorerSGetImageReply(ClientPtr pClient, int size, xGetImageReply *pRep) 5061.25Sveego{ 5071.423Saugustss char n; 5081.25Sveego 5091.24Stls swaps(&pRep->sequenceNumber, n); 5101.136Saugustss swapl(&pRep->length, n); 5111.665Sjunyoung swapl(&pRep->visual, n); 5121.108Sdrochner (void)WriteToClient(pClient, size, (char *) pRep); 5131.665Sjunyoung /* Fortunately, image doesn't need swapping */ 5141.25Sveego} 5151.24Stls 5161.639Smycroftvoid 5171.105SthorpejSListInstalledColormapsReply(ClientPtr pClient, int size, 5181.24Stls xListInstalledColormapsReply *pRep) 5191.665Sjunyoung{ 5201.363Sichiro char n; 5211.774She 5221.665Sjunyoung swaps(&pRep->sequenceNumber, n); 5231.39Smycroft swapl(&pRep->length, n); 5241.24Stls swaps(&pRep->nColormaps, n); 5251.665Sjunyoung (void)WriteToClient(pClient, size, (char *) pRep); 5261.25Sveego} 5271.152Sthorpej 5281.665Sjunyoungvoid 5291.665SjunyoungSAllocColorReply(pClient, size, pRep) 5301.62Smark ClientPtr pClient; 5311.25Sveego int size; 5321.1254Snonaka xAllocColorReply *pRep; 5331.146Sdrochner{ 5341.191Sbouyer char n; 5351.25Sveego 5361.665Sjunyoung swaps(&pRep->sequenceNumber, n); 5371.1053Smatt swaps(&pRep->red, n); 5381.380Srafal swaps(&pRep->green, n); 5391.1018Sjakllsch swaps(&pRep->blue, n); 5401.165Stsarna swapl(&pRep->pixel, n); 5411.1022Shubertf (void)WriteToClient(pClient, size, (char *) pRep); 5421.153Sthorpej} 5431.610Schs 5441.162Saugustssvoid 5451.665SjunyoungSAllocNamedColorReply(ClientPtr pClient, int size, xAllocNamedColorReply *pRep) 5461.1137Schs{ 5471.169Sis char n; 5481.1044Smsaitoh 5491.665Sjunyoung swaps(&pRep->sequenceNumber, n); 5501.150Sdrochner swapl(&pRep->pixel, n); 5511.775Schs swaps(&pRep->exactRed, n); 5521.327Sthorpej swaps(&pRep->exactGreen, n); 5531.374Ssoren swaps(&pRep->exactBlue, n); 5541.1137Schs swaps(&pRep->screenRed, n); 5551.573Sthorpej swaps(&pRep->screenGreen, n); 5561.773Shamajima swaps(&pRep->screenBlue, n); 5571.548Ssimonb (void)WriteToClient(pClient, size, (char *) pRep); 5581.639Smycroft} 5591.1137Schs 5601.590Schsvoid 5611.158SthorpejSAllocColorCellsReply(ClientPtr pClient, int size, xAllocColorCellsReply *pRep) 5621.665Sjunyoung{ 5631.1037Smsaitoh char n; 5641.665Sjunyoung 5651.1039Smsaitoh swaps(&pRep->sequenceNumber, n); 5661.707Srh swapl(&pRep->length, n); 5671.665Sjunyoung swaps(&pRep->nPixels, n); 5681.665Sjunyoung swaps(&pRep->nMasks, n); 5691.885Sjklos (void)WriteToClient(pClient, size, (char *) pRep); 5701.1249Schristos} 5711.665Sjunyoung 5721.665Sjunyoung 5731.665Sjunyoungvoid 5741.251SwizSAllocColorPlanesReply(ClientPtr pClient, int size, xAllocColorPlanesReply *pRep) 5751.1253Schristos{ 5761.1044Smsaitoh char n; 5771.276Sonoe 5781.665Sjunyoung swaps(&pRep->sequenceNumber, n); 5791.720Schs swapl(&pRep->length, n); 5801.665Sjunyoung swaps(&pRep->nPixels, n); 5811.665Sjunyoung swapl(&pRep->redMask, n); 5821.264Sitojun swapl(&pRep->greenMask, n); 5831.665Sjunyoung swapl(&pRep->blueMask, n); 5841.665Sjunyoung (void)WriteToClient(pClient, size, (char *) pRep); 5851.251Swiz} 5861.132Sdrochner 5871.1254Snonakastatic void 5881.665SjunyoungSwapRGB(xrgb *prgb) 5891.175Skleink{ 5901.1044Smsaitoh char n; 5911.665Sjunyoung 5921.1214Smsaitoh swaps(&prgb->red, n); 5931.1041Smsaitoh swaps(&prgb->green, n); 5941.779Snonaka swaps(&prgb->blue, n); 5951.140Scastor} 5961.555Sjonathan 5971.744Sxtraemevoid 5981.1254SnonakaSQColorsExtend(ClientPtr pClient, int size, xrgb *prgb) 5991.1344Sprlw1{ 6001.605Smatt int i, n; 6011.1255Snonaka xrgb *prgbT; 6021.1254Snonaka 6031.381Saugustss n = size / sizeof(xrgb); 6041.264Sitojun prgbT = prgb; 6051.1254Snonaka for(i = 0; i < n; i++) 6061.665Sjunyoung { 6071.665Sjunyoung SwapRGB(prgbT); 6081.381Saugustss prgbT++; 6091.775Schs } 6101.804Snisimura (void)WriteToClient(pClient, size, (char *) prgb); 6111.1254Snonaka} 6121.1137Schs 6131.602Stlsvoid 6141.443SfvdlSQueryColorsReply(ClientPtr pClient, int size, xQueryColorsReply* pRep) 6151.665Sjunyoung{ 6161.639Smycroft char n; 6171.1343Smsaitoh 6181.355Sdrochner swaps(&pRep->sequenceNumber, n); 6191.672Sjdarrow swapl(&pRep->length, n); 6201.639Smycroft swaps(&pRep->nColors, n); 6211.665Sjunyoung (void)WriteToClient(pClient, size, (char *) pRep); 6221.1032Sjakllsch} 6231.659Saugustss 6241.910Sxtraemevoid 6251.649SraggeSLookupColorReply(ClientPtr pClient, int size, xLookupColorReply *pRep) 6261.1056Sbouyer{ 6271.748Ssekiya char n; 6281.666Sjdarrow 6291.1141Smatt swaps(&pRep->sequenceNumber, n); 6301.1141Smatt swaps(&pRep->exactRed, n); 6311.952Srmind swaps(&pRep->exactGreen, n); 6321.1120Smsaitoh swaps(&pRep->exactBlue, n); 6331.1011Snonaka swaps(&pRep->screenRed, n); 6341.1053Smatt swaps(&pRep->screenGreen, n); 6351.888Stron swaps(&pRep->screenBlue, n); 6361.1018Sjakllsch (void)WriteToClient(pClient, size, (char *) pRep); 6371.1378Smsaitoh} 6381.1310Smsaitoh 6391.1282Smsaitohvoid 6401.1175SmsaitohSQueryBestSizeReply(ClientPtr pClient, int size, xQueryBestSizeReply *pRep) 6411.1249Schristos{ 6421.898Scube char n; 6431.1249Schristos 6441.1018Sjakllsch swaps(&pRep->sequenceNumber, n); 6451.1135Smatt swaps(&pRep->width, n); 6461.1229Smsaitoh swaps(&pRep->height, n); 6471.1254Snonaka (void)WriteToClient(pClient, size, (char *) pRep); 6481.1111Sjakllsch} 6491.1159Ssoren 6501.639Smycroftvoid 6511.1330SnonakaSListExtensionsReply(ClientPtr pClient, int size, xListExtensionsReply *pRep) 6521.1330Snonaka{ 6531.1355Sjmcneill char n; 6541.1395Sryo 6551.1354Sskrll swaps(&pRep->sequenceNumber, n); 6561.639Smycroft swapl(&pRep->length, n); 6571.1413Sjmcneill (void)WriteToClient(pClient, size, (char *) pRep); 6581.1073Smanu} 6591.398Stsutsui 6601.24Stlsvoid 6611.25SveegoSGetKeyboardMappingReply(ClientPtr pClient, int size, 6621.132Sdrochner xGetKeyboardMappingReply *pRep) 6631.1361Smsaitoh{ 6641.1075Smartin char n; 6651.479Skent 6661.266Sthorpej swaps(&pRep->sequenceNumber, n); 6671.59Sthorpej swapl(&pRep->length, n); 6681.25Sveego (void)WriteToClient(pClient, size, (char *) pRep); 6691.665Sjunyoung} 6701.379Saugustss 6711.781Sjmcneillvoid 6721.4ScgdSGetPointerMappingReply(ClientPtr pClient, int size, 6731.25Sveego xGetPointerMappingReply *pRep) 6741.933Scegger{ 6751.25Sveego char n; 6761.1037Smsaitoh 6771.665Sjunyoung swaps(&pRep->sequenceNumber, n); 6781.593Smatt swapl(&pRep->length, n); 6791.1090Smbalmer (void)WriteToClient(pClient, size, (char *) pRep); 6801.4Scgd} 6811.1126Suwe 6821.25Sveegovoid 6831.59SthorpejSGetModifierMappingReply(ClientPtr pClient, int size, 6841.665Sjunyoung xGetModifierMappingReply *pRep) 6851.59Sthorpej{ 6861.4Scgd char n; 6871.81Sdrochner 6881.12Scgd swaps(&pRep->sequenceNumber, n); 6891.305Smsaitoh swapl(&pRep->length, n); 6901.1422Sskrll (void)WriteToClient(pClient, size, (char *) pRep); 6911.1384Smrg} 6921.283Smycroft 6931.665Sjunyoungvoid 6941.25SveegoSGetKeyboardControlReply(ClientPtr pClient, int size, xGetKeyboardControlReply *pRep) 6951.54Scgd{ 6961.1Scgd char n; 6971.1Scgd 6981.769Sdogcow swaps(&pRep->sequenceNumber, n); 6991.1Scgd swapl(&pRep->length, n); 7001.1Scgd swapl(&pRep->ledMask, n); 7011.4Scgd swaps(&pRep->bellPitch, n); 7021.150Sdrochner swaps(&pRep->bellDuration, n); 7031.388Sthorpej (void)WriteToClient(pClient, size, (char *) pRep); 7041.646Smycroft} 7051.565Sbouyer 7061.817Sjnemethvoid 7071.817SjnemethSGetPointerControlReply(ClientPtr pClient, int size, xGetPointerControlReply *pRep) 7081.247Sbillc{ 7091.1261Smsaitoh char n; 7101.639Smycroft 7111.639Smycroft swaps(&pRep->sequenceNumber, n); 7121.639Smycroft swaps(&pRep->accelNumerator, n); 7131.106Sthorpej swaps(&pRep->accelDenominator, n); 7141.106Sthorpej swaps(&pRep->threshold, n); 7151.106Sthorpej (void)WriteToClient(pClient, size, (char *) pRep); 7161.106Sthorpej} 7171.966Smatt 7181.646Smycroftvoid 7191.646SmycroftSGetScreenSaverReply(ClientPtr pClient, int size, xGetScreenSaverReply *pRep) 7201.639Smycroft{ 7211.639Smycroft char n; 7221.639Smycroft 7231.639Smycroft swaps(&pRep->sequenceNumber, n); 7241.639Smycroft swaps(&pRep->timeout, n); 7251.639Smycroft swaps(&pRep->interval, n); 7261.247Sbillc (void)WriteToClient(pClient, size, (char *) pRep); 7271.384Saugustss} 7281.731Schs 7291.817Sjnemethvoid 7301.541SchristosSLHostsExtend(ClientPtr pClient, int size, char *buf) 7311.541Schristos{ 7321.106Sthorpej char *bufT = buf; 7331.106Sthorpej char *endbuf = buf + size; 7341.124Sfvdl while (bufT < endbuf) { 7351.1261Smsaitoh xHostEntry *host = (xHostEntry *) bufT; 7361.1261Smsaitoh int len = host->length; 7371.106Sthorpej char n; 7381.106Sthorpej swaps (&host->length, n); 7391.171Sdrochner bufT += sizeof (xHostEntry) + (((len + 3) >> 2) << 2); 7401.223Sdrochner } 7411.966Smatt (void)WriteToClient (pClient, size, buf); 7421.966Smatt} 7431.631Sjunyoung 7441.631Sjunyoungvoid 7451.106SthorpejSListHostsReply(ClientPtr pClient, int size, xListHostsReply *pRep) 7461.215Sthorpej{ 7471.966Smatt char n; 7481.966Smatt 7491.966Smatt swaps(&pRep->sequenceNumber, n); 7501.966Smatt swapl(&pRep->length, n); 7511.966Smatt swaps(&pRep->nHosts, n); 7521.966Smatt (void)WriteToClient(pClient, size, (char *) pRep); 7531.966Smatt} 7541.966Smatt 7551.4Scgd 7561.252Scgd 7571.67Stronvoid 7581.104StronSErrorEvent(xError *from, xError *to) 7591.129Stron{ 7601.129Stron to->type = X_Error; 7611.357Schris to->errorCode = from->errorCode; 7621.67Stron cpswaps(from->sequenceNumber, to->sequenceNumber); 7631.24Stls cpswapl(from->resourceID, to->resourceID); 7641.252Scgd cpswaps(from->minorCode, to->minorCode); 7651.252Scgd to->majorCode = from->majorCode; 7661.252Scgd} 7671.252Scgd 7681.252Scgdvoid 7691.252ScgdSKeyButtonPtrEvent(xEvent *from, xEvent *to) 7701.273Sthorpej{ 7711.273Sthorpej to->u.u.type = from->u.u.type; 7721.273Sthorpej to->u.u.detail = from->u.u.detail; 7731.1024Smacallan cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 7741.230Sad cpswapl(from->u.keyButtonPointer.time, 7751.230Sad to->u.keyButtonPointer.time); 7761.738Sjdolecek cpswapl(from->u.keyButtonPointer.root, 7771.966Smatt to->u.keyButtonPointer.root); 7781.966Smatt cpswapl(from->u.keyButtonPointer.event, 7791.966Smatt to->u.keyButtonPointer.event); 7801.966Smatt cpswapl(from->u.keyButtonPointer.child, 7811.966Smatt to->u.keyButtonPointer.child); 7821.1099Snjoly cpswaps(from->u.keyButtonPointer.rootX, 7831.24Stls to->u.keyButtonPointer.rootX); 7841.639Smycroft cpswaps(from->u.keyButtonPointer.rootY, 7851.639Smycroft to->u.keyButtonPointer.rootY); 7861.639Smycroft cpswaps(from->u.keyButtonPointer.eventX, 7871.639Smycroft to->u.keyButtonPointer.eventX); 7881.639Smycroft cpswaps(from->u.keyButtonPointer.eventY, 7891.639Smycroft to->u.keyButtonPointer.eventY); 7901.22Sjtk cpswaps(from->u.keyButtonPointer.state, 7911.22Sjtk to->u.keyButtonPointer.state); 7921.966Smatt to->u.keyButtonPointer.sameScreen = 7931.966Smatt from->u.keyButtonPointer.sameScreen; 7941.22Sjtk} 7951.141Ssoren 7961.548Ssimonbvoid 7971.548SsimonbSEnterLeaveEvent(xEvent *from, xEvent *to) 7981.548Ssimonb{ 7991.548Ssimonb to->u.u.type = from->u.u.type; 8001.548Ssimonb to->u.u.detail = from->u.u.detail; 8011.141Ssoren cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 8021.141Ssoren cpswapl(from->u.enterLeave.time, to->u.enterLeave.time); 8031.141Ssoren cpswapl(from->u.enterLeave.root, to->u.enterLeave.root); 8041.141Ssoren cpswapl(from->u.enterLeave.event, to->u.enterLeave.event); 8051.141Ssoren cpswapl(from->u.enterLeave.child, to->u.enterLeave.child); 8061.141Ssoren cpswaps(from->u.enterLeave.rootX, to->u.enterLeave.rootX); 8071.86Stron cpswaps(from->u.enterLeave.rootY, to->u.enterLeave.rootY); 8081.132Sdrochner cpswaps(from->u.enterLeave.eventX, to->u.enterLeave.eventX); 8091.132Sdrochner cpswaps(from->u.enterLeave.eventY, to->u.enterLeave.eventY); 8101.286Sthorpej cpswaps(from->u.enterLeave.state, to->u.enterLeave.state); 8111.132Sdrochner to->u.enterLeave.mode = from->u.enterLeave.mode; 8121.4Scgd to->u.enterLeave.flags = from->u.enterLeave.flags; 8131.24Stls} 8141.4Scgd 8151.1037Smsaitohvoid 8161.1040SmsaitohSFocusEvent(xEvent *from, xEvent *to) 8171.1043Smsaitoh{ 8181.1040Smsaitoh to->u.u.type = from->u.u.type; 8191.1040Smsaitoh to->u.u.detail = from->u.u.detail; 8201.1040Smsaitoh cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 8211.1040Smsaitoh cpswapl(from->u.focus.window, to->u.focus.window); 8221.1037Smsaitoh to->u.focus.mode = from->u.focus.mode; 8231.12Scgd} 8241.541Schristos 8251.541Schristosvoid 8261.24StlsSExposeEvent(xEvent *from, xEvent *to) 8271.24Stls{ 8281.82Smark to->u.u.type = from->u.u.type; 8291.796Sxtraeme cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 8301.82Smark cpswapl(from->u.expose.window, to->u.expose.window); 8311.1004Sdsl cpswaps(from->u.expose.x, to->u.expose.x); 8321.656Saugustss cpswaps(from->u.expose.y, to->u.expose.y); 8331.1137Schs cpswaps(from->u.expose.width, to->u.expose.width); 8341.886Skiyohara cpswaps(from->u.expose.height, to->u.expose.height); 8351.122Sveego cpswaps(from->u.expose.count, to->u.expose.count); 8361.12Scgd} 8371.62Smark 8381.653Saugustssvoid 8391.653SaugustssSGraphicsExposureEvent(xEvent *from, xEvent *to) 8401.297Shubertf{ 8411.1137Schs to->u.u.type = from->u.u.type; 8421.966Smatt cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 8431.1261Smsaitoh cpswapl(from->u.graphicsExposure.drawable, 8441.881Smrg to->u.graphicsExposure.drawable); 8451.1080Smatt cpswaps(from->u.graphicsExposure.x, 8461.341Scjs to->u.graphicsExposure.x); 8471.341Scjs cpswaps(from->u.graphicsExposure.y, 8481.653Saugustss to->u.graphicsExposure.y); 8491.62Smark cpswaps(from->u.graphicsExposure.width, 8501.12Scgd to->u.graphicsExposure.width); 8511.1Scgd cpswaps(from->u.graphicsExposure.height, 8521.1137Schs to->u.graphicsExposure.height); 8531.12Scgd cpswaps(from->u.graphicsExposure.minorEvent, 8541.17Sgibbs to->u.graphicsExposure.minorEvent); 8551.26Schuck cpswaps(from->u.graphicsExposure.count, 8561.26Schuck to->u.graphicsExposure.count); 8571.1261Smsaitoh to->u.graphicsExposure.majorEvent = 8581.17Sgibbs from->u.graphicsExposure.majorEvent; 8591.17Sgibbs} 8601.1261Smsaitoh 8611.12Scgdvoid 8621.12ScgdSNoExposureEvent(xEvent *from, xEvent *to) 8631.12Scgd{ 8641.25Sveego to->u.u.type = from->u.u.type; 8651.12Scgd cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 8661.122Sveego cpswapl(from->u.noExposure.drawable, to->u.noExposure.drawable); 8671.12Scgd cpswaps(from->u.noExposure.minorEvent, to->u.noExposure.minorEvent); 8681.12Scgd to->u.noExposure.majorEvent = from->u.noExposure.majorEvent; 8691.12Scgd} 8701.122Sveego 8711.12Scgdvoid 8721.159ShannkenSVisibilityEvent(xEvent *from, xEvent *to) 8731.77Sdante{ 8741.415Sad to->u.u.type = from->u.u.type; 8751.415Sad cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 8761.415Sad cpswapl(from->u.visibility.window, to->u.visibility.window); 8771.415Sad to->u.visibility.state = from->u.visibility.state; 8781.415Sad} 8791.415Sad 8801.416Smycroftvoid 8811.416SmycroftSCreateNotifyEvent(xEvent *from, xEvent *to) 8821.416Smycroft{ 8831.416Smycroft to->u.u.type = from->u.u.type; 8841.416Smycroft cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 8851.416Smycroft cpswapl(from->u.createNotify.window, to->u.createNotify.window); 8861.416Smycroft cpswapl(from->u.createNotify.parent, to->u.createNotify.parent); 8871.416Smycroft cpswaps(from->u.createNotify.x, to->u.createNotify.x); 8881.416Smycroft cpswaps(from->u.createNotify.y, to->u.createNotify.y); 8891.991Scegger cpswaps(from->u.createNotify.width, to->u.createNotify.width); 8901.991Scegger cpswaps(from->u.createNotify.height, to->u.createNotify.height); 8911.1261Smsaitoh cpswaps(from->u.createNotify.borderWidth, 8921.415Sad to->u.createNotify.borderWidth); 8931.420Sad to->u.createNotify.override = from->u.createNotify.override; 8941.420Sad} 8951.615Sgendalia 8961.702Stronvoid 8971.622SgendaliaSDestroyNotifyEvent(xEvent *from, xEvent *to) 8981.1058Sjmcneill{ 8991.1137Schs to->u.u.type = from->u.u.type; 9001.1137Schs cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 9011.1348Suwe cpswapl(from->u.destroyNotify.event, to->u.destroyNotify.event); 9021.1348Suwe cpswapl(from->u.destroyNotify.window, to->u.destroyNotify.window); 9031.415Sad} 9041.420Sad 9051.415Sadvoid 9061.415SadSUnmapNotifyEvent(xEvent *from, xEvent *to) 9071.415Sad{ 9081.872Schristos to->u.u.type = from->u.u.type; 9091.81Sdrochner cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 9101.132Sdrochner cpswapl(from->u.unmapNotify.event, to->u.unmapNotify.event); 9111.1261Smsaitoh cpswapl(from->u.unmapNotify.window, to->u.unmapNotify.window); 9121.132Sdrochner to->u.unmapNotify.fromConfigure = from->u.unmapNotify.fromConfigure; 9131.132Sdrochner} 9141.153Sthorpej 9151.808Sgdamorevoid 9161.808SgdamoreSMapNotifyEvent(xEvent *from, xEvent *to) 9171.808Sgdamore{ 9181.966Smatt to->u.u.type = from->u.u.type; 9191.644Slukem cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 9201.808Sgdamore cpswapl(from->u.mapNotify.event, to->u.mapNotify.event); 9211.808Sgdamore cpswapl(from->u.mapNotify.window, to->u.mapNotify.window); 9221.153Sthorpej to->u.mapNotify.override = from->u.mapNotify.override; 9231.77Sdante} 9241.77Sdante 9251.77Sdantevoid 9261.77SdanteSMapRequestEvent(xEvent *from, xEvent *to) 9271.83Sdante{ 9281.541Schristos to->u.u.type = from->u.u.type; 9291.541Schristos cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 9301.276Sonoe cpswapl(from->u.mapRequest.parent, to->u.mapRequest.parent); 9311.605Smatt cpswapl(from->u.mapRequest.window, to->u.mapRequest.window); 9321.966Smatt} 9331.605Smatt 9341.276Sonoevoid 9351.641SmycroftSReparentEvent(xEvent *from, xEvent *to) 9361.646Smycroft{ 9371.641Smycroft to->u.u.type = from->u.u.type; 9381.641Smycroft cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 9391.1261Smsaitoh cpswapl(from->u.reparent.event, to->u.reparent.event); 9401.37Sdrochner cpswapl(from->u.reparent.window, to->u.reparent.window); 9411.1137Schs cpswapl(from->u.reparent.parent, to->u.reparent.parent); 9421.1137Schs cpswaps(from->u.reparent.x, to->u.reparent.x); 9431.1137Schs cpswaps(from->u.reparent.y, to->u.reparent.y); 9441.37Sdrochner to->u.reparent.override = from->u.reparent.override; 9451.37Sdrochner} 9461.541Schristos 9471.146Sdrochnervoid 9481.146SdrochnerSConfigureNotifyEvent(xEvent *from, xEvent *to) 9491.642Smycroft{ 9501.642Smycroft to->u.u.type = from->u.u.type; 9511.388Sthorpej cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 9521.388Sthorpej cpswapl(from->u.configureNotify.event, 9531.8Sthorpej to->u.configureNotify.event); 9541.1133Snonaka cpswapl(from->u.configureNotify.window, 9551.1133Snonaka to->u.configureNotify.window); 9561.1133Snonaka cpswapl(from->u.configureNotify.aboveSibling, 9571.443Sfvdl to->u.configureNotify.aboveSibling); 9581.443Sfvdl cpswaps(from->u.configureNotify.x, to->u.configureNotify.x); 9591.453Senami cpswaps(from->u.configureNotify.y, to->u.configureNotify.y); 9601.445Scjs cpswaps(from->u.configureNotify.width, to->u.configureNotify.width); 9611.1151Smsaitoh cpswaps(from->u.configureNotify.height, 9621.443Sfvdl to->u.configureNotify.height); 9631.1355Sjmcneill cpswaps(from->u.configureNotify.borderWidth, 9641.1355Sjmcneill to->u.configureNotify.borderWidth); 9651.1355Sjmcneill to->u.configureNotify.override = from->u.configureNotify.override; 9661.1355Sjmcneill} 9671.1355Sjmcneill 9681.8Sthorpejvoid 9691.1384SmrgSConfigureRequestEvent(xEvent *from, xEvent *to) 9701.1384Smrg{ 9711.1384Smrg to->u.u.type = from->u.u.type; 9721.1384Smrg to->u.u.detail = from->u.u.detail; /* actually stack-mode */ 9731.966Smatt cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 9741.966Smatt cpswapl(from->u.configureRequest.parent, 9751.966Smatt to->u.configureRequest.parent); 9761.966Smatt cpswapl(from->u.configureRequest.window, 9771.966Smatt to->u.configureRequest.window); 9781.966Smatt cpswapl(from->u.configureRequest.sibling, 9791.966Smatt to->u.configureRequest.sibling); 9801.966Smatt cpswaps(from->u.configureRequest.x, to->u.configureRequest.x); 9811.966Smatt cpswaps(from->u.configureRequest.y, to->u.configureRequest.y); 9821.966Smatt cpswaps(from->u.configureRequest.width, 9831.1384Smrg to->u.configureRequest.width); 9841.1384Smrg cpswaps(from->u.configureRequest.height, 9851.1384Smrg to->u.configureRequest.height); 9861.1384Smrg cpswaps(from->u.configureRequest.borderWidth, 9871.1384Smrg to->u.configureRequest.borderWidth); 9881.1384Smrg cpswaps(from->u.configureRequest.valueMask, 9891.1384Smrg to->u.configureRequest.valueMask); 9901.1384Smrg} 9911.1384Smrg 9921.1384Smrg 9931.1384Smrgvoid 9941.1384SmrgSGravityEvent(xEvent *from, xEvent *to) 9951.1384Smrg{ 9961.1384Smrg to->u.u.type = from->u.u.type; 9971.1289Snonaka cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 9981.1384Smrg cpswapl(from->u.gravity.event, to->u.gravity.event); 9991.1384Smrg cpswapl(from->u.gravity.window, to->u.gravity.window); 10001.1384Smrg cpswaps(from->u.gravity.x, to->u.gravity.x); 10011.1384Smrg cpswaps(from->u.gravity.y, to->u.gravity.y); 10021.1384Smrg} 10031.1384Smrg 10041.1384Smrgvoid 10051.1289SnonakaSResizeRequestEvent(xEvent *from, xEvent *to) 10061.1384Smrg{ 10071.1384Smrg to->u.u.type = from->u.u.type; 10081.1384Smrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 10091.1384Smrg cpswapl(from->u.resizeRequest.window, to->u.resizeRequest.window); 10101.1384Smrg cpswaps(from->u.resizeRequest.width, to->u.resizeRequest.width); 10111.1384Smrg cpswaps(from->u.resizeRequest.height, to->u.resizeRequest.height); 10121.1384Smrg} 10131.1384Smrg 10141.1384Smrgvoid 10151.1384SmrgSCirculateEvent(xEvent *from, xEvent *to) 10161.1384Smrg{ 10171.1384Smrg to->u.u.type = from->u.u.type; 10181.1384Smrg to->u.u.detail = from->u.u.detail; 10191.1384Smrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 10201.1384Smrg cpswapl(from->u.circulate.event, to->u.circulate.event); 10211.1384Smrg cpswapl(from->u.circulate.window, to->u.circulate.window); 10221.1384Smrg cpswapl(from->u.circulate.parent, to->u.circulate.parent); 10231.1384Smrg to->u.circulate.place = from->u.circulate.place; 10241.1384Smrg} 10251.1384Smrg 10261.1384Smrgvoid 10271.1384SmrgSPropertyEvent(xEvent *from, xEvent *to) 10281.1417Sthorpej{ 10291.1384Smrg to->u.u.type = from->u.u.type; 10301.1384Smrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 10311.1384Smrg cpswapl(from->u.property.window, to->u.property.window); 10321.1384Smrg cpswapl(from->u.property.atom, to->u.property.atom); 10331.1384Smrg cpswapl(from->u.property.time, to->u.property.time); 10341.1417Sthorpej to->u.property.state = from->u.property.state; 10351.1384Smrg} 10361.1384Smrg 10371.1393Smsaitohvoid 10381.1393SmsaitohSSelectionClearEvent(xEvent *from, xEvent *to) 10391.1393Smsaitoh{ 10401.1393Smsaitoh to->u.u.type = from->u.u.type; 10411.1393Smsaitoh cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 10421.1384Smrg cpswapl(from->u.selectionClear.time, to->u.selectionClear.time); 10431.1384Smrg cpswapl(from->u.selectionClear.window, to->u.selectionClear.window); 10441.1384Smrg cpswapl(from->u.selectionClear.atom, to->u.selectionClear.atom); 10451.1384Smrg} 10461.1384Smrg 10471.1384Smrgvoid 10481.1384SmrgSSelectionRequestEvent(xEvent *from, xEvent *to) 10491.1384Smrg{ 10501.1384Smrg to->u.u.type = from->u.u.type; 10511.1240Snonaka cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 10521.1384Smrg cpswapl(from->u.selectionRequest.time, to->u.selectionRequest.time); 10531.1384Smrg cpswapl(from->u.selectionRequest.owner, 10541.1384Smrg to->u.selectionRequest.owner); 10551.1384Smrg cpswapl(from->u.selectionRequest.requestor, 10561.1384Smrg to->u.selectionRequest.requestor); 10571.1384Smrg cpswapl(from->u.selectionRequest.selection, 10581.1384Smrg to->u.selectionRequest.selection); 10591.1384Smrg cpswapl(from->u.selectionRequest.target, 10601.1384Smrg to->u.selectionRequest.target); 10611.1289Snonaka cpswapl(from->u.selectionRequest.property, 10621.1384Smrg to->u.selectionRequest.property); 10631.1384Smrg} 10641.1384Smrg 10651.1384Smrgvoid 10661.1384SmrgSSelectionNotifyEvent(xEvent *from, xEvent *to) 10671.1384Smrg{ 10681.1384Smrg to->u.u.type = from->u.u.type; 10691.1384Smrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 10701.1240Snonaka cpswapl(from->u.selectionNotify.time, to->u.selectionNotify.time); 10711.1384Smrg cpswapl(from->u.selectionNotify.requestor, 10721.1384Smrg to->u.selectionNotify.requestor); 10731.1384Smrg cpswapl(from->u.selectionNotify.selection, 10741.1384Smrg to->u.selectionNotify.selection); 10751.1384Smrg cpswapl(from->u.selectionNotify.target, 10761.1384Smrg to->u.selectionNotify.target); 10771.1384Smrg cpswapl(from->u.selectionNotify.property, 10781.1384Smrg to->u.selectionNotify.property); 10791.1384Smrg} 10801.1384Smrg 10811.1384Smrgvoid 10821.1384SmrgSColormapEvent(xEvent *from, xEvent *to) 10831.1384Smrg{ 10841.1384Smrg to->u.u.type = from->u.u.type; 10851.1384Smrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 10861.1384Smrg cpswapl(from->u.colormap.window, to->u.colormap.window); 10871.1384Smrg cpswapl(from->u.colormap.colormap, to->u.colormap.colormap); 10881.1384Smrg to->u.colormap.new = from->u.colormap.new; 10891.1384Smrg to->u.colormap.state = from->u.colormap.state; 10901.1384Smrg} 10911.1384Smrg 10921.1384Smrgvoid 10931.1384SmrgSMappingEvent(xEvent *from, xEvent *to) 10941.1384Smrg{ 10951.1384Smrg to->u.u.type = from->u.u.type; 10961.1384Smrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 10971.1384Smrg to->u.mappingNotify.request = from->u.mappingNotify.request; 10981.1384Smrg to->u.mappingNotify.firstKeyCode = 10991.1384Smrg from->u.mappingNotify.firstKeyCode; 11001.1384Smrg to->u.mappingNotify.count = from->u.mappingNotify.count; 11011.1384Smrg} 11021.1384Smrg 11031.1384Smrgvoid 11041.1384SmrgSClientMessageEvent(xEvent *from, xEvent *to) 11051.1349Sjmcneill{ 11061.1349Sjmcneill to->u.u.type = from->u.u.type; 11071.1384Smrg to->u.u.detail = from->u.u.detail; /* actually format */ 11081.1384Smrg cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber); 11091.1384Smrg cpswapl(from->u.clientMessage.window, to->u.clientMessage.window); 11101.1384Smrg cpswapl(from->u.clientMessage.u.l.type, 11111.1384Smrg to->u.clientMessage.u.l.type); 11121.863Sisaki switch (from->u.u.detail) { 11131.863Sisaki case 8: 11141.863Sisaki memmove(to->u.clientMessage.u.b.bytes, 11151.1410Sprlw1 from->u.clientMessage.u.b.bytes,20); 11161.1384Smrg break; 11171.889Sjnemeth case 16: 11181.889Sjnemeth cpswaps(from->u.clientMessage.u.s.shorts0, 11191.1384Smrg to->u.clientMessage.u.s.shorts0); 11201.1384Smrg cpswaps(from->u.clientMessage.u.s.shorts1, 11211.1384Smrg to->u.clientMessage.u.s.shorts1); 11221.1384Smrg cpswaps(from->u.clientMessage.u.s.shorts2, 11231.1384Smrg to->u.clientMessage.u.s.shorts2); 11241.1384Smrg cpswaps(from->u.clientMessage.u.s.shorts3, 11251.1384Smrg to->u.clientMessage.u.s.shorts3); 11261.1384Smrg cpswaps(from->u.clientMessage.u.s.shorts4, 11271.1384Smrg to->u.clientMessage.u.s.shorts4); 11281.1384Smrg cpswaps(from->u.clientMessage.u.s.shorts5, 11291.1382Smsaitoh to->u.clientMessage.u.s.shorts5); 11301.1382Smsaitoh cpswaps(from->u.clientMessage.u.s.shorts6, 11311.1382Smsaitoh to->u.clientMessage.u.s.shorts6); 11321.1382Smsaitoh cpswaps(from->u.clientMessage.u.s.shorts7, 11331.1382Smsaitoh to->u.clientMessage.u.s.shorts7); 11341.1382Smsaitoh cpswaps(from->u.clientMessage.u.s.shorts8, 11351.1382Smsaitoh to->u.clientMessage.u.s.shorts8); 11361.1384Smrg cpswaps(from->u.clientMessage.u.s.shorts9, 11371.1384Smrg to->u.clientMessage.u.s.shorts9); 11381.1384Smrg break; 11391.1384Smrg case 32: 11401.1384Smrg cpswapl(from->u.clientMessage.u.l.longs0, 11411.1384Smrg to->u.clientMessage.u.l.longs0); 11421.1384Smrg cpswapl(from->u.clientMessage.u.l.longs1, 11431.1384Smrg to->u.clientMessage.u.l.longs1); 11441.1384Smrg cpswapl(from->u.clientMessage.u.l.longs2, 11451.1384Smrg to->u.clientMessage.u.l.longs2); 11461.1384Smrg cpswapl(from->u.clientMessage.u.l.longs3, 11471.1384Smrg to->u.clientMessage.u.l.longs3); 11481.1384Smrg cpswapl(from->u.clientMessage.u.l.longs4, 11491.1384Smrg to->u.clientMessage.u.l.longs4); 11501.1384Smrg break; 11511.1384Smrg } 11521.1384Smrg} 11531.1384Smrg 11541.1384Smrgvoid 11551.1384SmrgSKeymapNotifyEvent(xEvent *from, xEvent *to) 11561.1384Smrg{ 11571.1384Smrg /* Keymap notify events are special; they have no 11581.1384Smrg sequence number field, and contain entirely 8-bit data */ 11591.1384Smrg *to = *from; 11601.1384Smrg} 11611.1384Smrg 11621.1384Smrgstatic void 11631.614SdrochnerSwapConnSetup(xConnSetup *pConnSetup, xConnSetup *pConnSetupT) 11641.614Sdrochner{ 11651.1384Smrg cpswapl(pConnSetup->release, pConnSetupT->release); 11661.1384Smrg cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase); 11671.1384Smrg cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask); 11681.1384Smrg cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize); 11691.1384Smrg cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor); 11701.889Sjnemeth cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize); 11711.889Sjnemeth pConnSetupT->minKeyCode = pConnSetup->minKeyCode; 11721.571Skleink pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode; 11731.528Snathanw pConnSetupT->numRoots = pConnSetup->numRoots; 11741.527Sfvdl pConnSetupT->numFormats = pConnSetup->numFormats; 11751.571Skleink pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder; 11761.572Skleink pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder; 11771.527Sfvdl pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit; 11781.889Sjnemeth pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad; 11791.889Sjnemeth} 11801.1382Smsaitoh 11811.1382Smsaitohstatic void 11821.1382SmsaitohSwapWinRoot(xWindowRoot *pRoot, xWindowRoot *pRootT) 11831.1382Smsaitoh{ 11841.1382Smsaitoh cpswapl(pRoot->windowId, pRootT->windowId); 11851.1382Smsaitoh cpswapl(pRoot->defaultColormap, pRootT->defaultColormap); 11861.1105Snonaka cpswapl(pRoot->whitePixel, pRootT->whitePixel); 11871.1105Snonaka cpswapl(pRoot->blackPixel, pRootT->blackPixel); 11881.1105Snonaka cpswapl(pRoot->currentInputMask, pRootT->currentInputMask); 11891.1105Snonaka cpswaps(pRoot->pixWidth, pRootT->pixWidth); 11901.1105Snonaka cpswaps(pRoot->pixHeight, pRootT->pixHeight); 11911.1105Snonaka cpswaps(pRoot->mmWidth, pRootT->mmWidth); 11921.1382Smsaitoh cpswaps(pRoot->mmHeight, pRootT->mmHeight); 11931.1105Snonaka cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps); 11941.1105Snonaka cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps); 11951.1105Snonaka cpswapl(pRoot->rootVisualID, pRootT->rootVisualID); 11961.1240Snonaka pRootT->backingStore = pRoot->backingStore; 11971.1240Snonaka pRootT->saveUnders = pRoot->saveUnders; 11981.1382Smsaitoh pRootT->rootDepth = pRoot->rootDepth; 11991.1382Smsaitoh pRootT->nDepths = pRoot->nDepths; 12001.1382Smsaitoh} 12011.1382Smsaitoh 12021.1382Smsaitohstatic void 12031.1382SmsaitohSwapVisual(xVisualType *pVis, xVisualType *pVisT) 12041.1316Smlelstv{ 12051.1382Smsaitoh cpswapl(pVis->visualID, pVisT->visualID); 12061.1382Smsaitoh pVisT->class = pVis->class; 12071.1162Ssoren pVisT->bitsPerRGB = pVis->bitsPerRGB; 12081.1162Ssoren cpswaps(pVis->colormapEntries, pVisT->colormapEntries); 12091.1162Ssoren cpswapl(pVis->redMask, pVisT->redMask); 12101.1052Scegger cpswapl(pVis->greenMask, pVisT->greenMask); 12111.1162Ssoren cpswapl(pVis->blueMask, pVisT->blueMask); 12121.1162Ssoren} 12131.1052Scegger 12141.1162Ssoren_X_EXPORT void 12151.1162SsorenSwapConnSetupInfo( 12161.1162Ssoren char *pInfo, 12171.1162Ssoren char *pInfoT 12181.1162Ssoren) 12191.259Sad{ 12201.259Sad int i, j, k; 12211.1261Smsaitoh xConnSetup *pConnSetup = (xConnSetup *)pInfo; 12221.845Smartti xDepth *depth; 12231.845Smartti xWindowRoot *root; 12241.338Sthorpej 12251.1413Sjmcneill SwapConnSetup(pConnSetup, (xConnSetup *)pInfoT); 12261.1413Sjmcneill pInfo += sizeof(xConnSetup); 12271.1413Sjmcneill pInfoT += sizeof(xConnSetup); 12281.1413Sjmcneill 12291.1413Sjmcneill /* Copy the vendor string */ 12301.1413Sjmcneill i = (pConnSetup->nbytesVendor + 3) & ~3; 12311.1413Sjmcneill memcpy(pInfoT, pInfo, i); 12321.1413Sjmcneill pInfo += i; 12331.1413Sjmcneill pInfoT += i; 12341.1413Sjmcneill 12351.665Sjunyoung /* The Pixmap formats don't need to be swapped, just copied. */ 12361.1137Schs i = sizeof(xPixmapFormat) * pConnSetup->numFormats; 12371.590Schs memcpy(pInfoT, pInfo, i); 12381.590Schs pInfo += i; 12391.665Sjunyoung pInfoT += i; 12401.338Sthorpej 12411.57Smycroft for(i = 0; i < pConnSetup->numRoots; i++) 12421.57Smycroft { 12431.130Stsubai root = (xWindowRoot*)pInfo; 12441.130Stsubai SwapWinRoot(root, (xWindowRoot *)pInfoT); 12451.130Stsubai pInfo += sizeof(xWindowRoot); 12461.130Stsubai pInfoT += sizeof(xWindowRoot); 12471.130Stsubai 12481.130Stsubai for(j = 0; j < root->nDepths; j++) 12491.642Smycroft { 12501.642Smycroft depth = (xDepth*)pInfo; 12511.1323Ssevan ((xDepth *)pInfoT)->depth = depth->depth; 12521.185Stsubai cpswaps(depth->nVisuals, ((xDepth *)pInfoT)->nVisuals); 12531.185Stsubai pInfo += sizeof(xDepth); 12541.185Stsubai pInfoT += sizeof(xDepth); 12551.185Stsubai for(k = 0; k < depth->nVisuals; k++) 12561.185Stsubai { 12571.642Smycroft SwapVisual((xVisualType *)pInfo, (xVisualType *)pInfoT); 12581.329Stsubai pInfo += sizeof(xVisualType); 12591.642Smycroft pInfoT += sizeof(xVisualType); 12601.350Stsubai } 12611.329Stsubai } 12621.329Stsubai } 12631.329Stsubai} 12641.350Stsubai 12651.350Stsubaivoid 12661.350StsubaiWriteSConnectionInfo(ClientPtr pClient, unsigned long size, char *pInfo) 12671.350Stsubai{ 12681.1323Ssevan char *pInfoTBase; 12691.452Smatt 12701.566Schs pInfoTBase = (char *) ALLOCATE_LOCAL(size); 12711.452Smatt if (!pInfoTBase) 12721.452Smatt { 12731.452Smatt pClient->noClientException = -1; 12741.516Stsubai return; 12751.643Smycroft } 12761.686Stsubai SwapConnSetupInfo(pInfo, pInfoTBase); 12771.686Stsubai (void)WriteToClient(pClient, (int)size, (char *) pInfoTBase); 12781.686Stsubai DEALLOCATE_LOCAL(pInfoTBase); 12791.686Stsubai} 12801.686Stsubai 12811.966Smatt_X_EXPORT void 12821.966SmattSwapConnSetupPrefix(xConnSetupPrefix *pcspFrom, xConnSetupPrefix *pcspTo) 12831.966Smatt{ 12841.966Smatt pcspTo->success = pcspFrom->success; 12851.966Smatt pcspTo->lengthReason = pcspFrom->lengthReason; 12861.686Stsubai cpswaps(pcspFrom->majorVersion, pcspTo->majorVersion); 12871.686Stsubai cpswaps(pcspFrom->minorVersion, pcspTo->minorVersion); 12881.942Schs cpswaps(pcspFrom->length, pcspTo->length); 12891.942Schs} 12901.923Sjdc 12911.942Schsvoid 12921.942SchsWriteSConnSetupPrefix(ClientPtr pClient, xConnSetupPrefix *pcsp) 12931.942Schs{ 12941.942Schs xConnSetupPrefix cspT; 12951.942Schs 12961.832Sbriggs SwapConnSetupPrefix(pcsp, &cspT); 12971.832Sbriggs (void)WriteToClient(pClient, sizeof(cspT), (char *) &cspT); 12981.832Sbriggs} 12991.832Sbriggs