Annotation of researchv9/X11/src/X.V11R1/server/dix/swaprep.c, revision 1.1.1.1

1.1       root        1: /************************************************************
                      2: Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
                      3: and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
                      4: 
                      5:                         All Rights Reserved
                      6: 
                      7: Permission to use, copy, modify, and distribute this software and its 
                      8: documentation for any purpose and without fee is hereby granted, 
                      9: provided that the above copyright notice appear in all copies and that
                     10: both that copyright notice and this permission notice appear in 
                     11: supporting documentation, and that the names of Digital or MIT not be
                     12: used in advertising or publicity pertaining to distribution of the
                     13: software without specific, written prior permission.  
                     14: 
                     15: DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
                     16: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
                     17: DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
                     18: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
                     19: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
                     20: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
                     21: SOFTWARE.
                     22: 
                     23: ********************************************************/
                     24: 
                     25: /* $Header: swaprep.c,v 1.27 87/09/05 17:57:32 toddb Exp $ */
                     26: 
                     27: #include "X.h"
                     28: #define NEED_REPLIES
                     29: #define NEED_EVENTS
                     30: #include "Xproto.h"
                     31: #include "misc.h"
                     32: #include "dixstruct.h"
                     33: #include "scrnintstr.h"
                     34: 
                     35: void SwapVisual(), SwapConnSetup(), SwapWinRoot(), WriteToClient();
                     36: 
                     37: /* copy long from src to dst byteswapping on the way */
                     38: #define cpswapl(src, dst) \
                     39:                  ((char *)&(dst))[0] = ((char *) &(src))[3];\
                     40:                  ((char *)&(dst))[1] = ((char *) &(src))[2];\
                     41:                  ((char *)&(dst))[2] = ((char *) &(src))[1];\
                     42:                  ((char *)&(dst))[3] = ((char *) &(src))[0];
                     43: 
                     44: /* copy short from src to dst byteswapping on the way */
                     45: #define cpswaps(src, dst)\
                     46:                 ((char *) &(dst))[0] = ((char *) &(src))[1];\
                     47:                 ((char *) &(dst))[1] = ((char *) &(src))[0];
                     48: 
                     49: /* Thanks to Jack Palevich for testing and subsequently rewriting all this */
                     50: void
                     51: Swap32Write(pClient, size, pbuf)
                     52:     ClientPtr  pClient;
                     53:     int                size;  /* in bytes */
                     54:     register long *pbuf;
                     55: {
                     56:     int                n, i;
                     57: 
                     58:     size >>= 2;
                     59:     for(i = 0; i < size; i++)
                     60:     /* brackets are mandatory here, because "swapl" macro expands
                     61:        to several statements */
                     62:     {   
                     63:        swapl(&pbuf[i], n);
                     64:     }
                     65:     WriteToClient(pClient, size << 2, (char *) pbuf);
                     66: }
                     67: 
                     68: void
                     69: CopySwap32Write(pClient, size, pbuf)
                     70:     ClientPtr  pClient;
                     71:     int                size;   /* in bytes */
                     72:     long       *pbuf;
                     73: {
                     74:     int bufsize = size;
                     75:     long *pbufT;
                     76:     register long *from, *to, *fromLast, *toLast;
                     77:     
                     78:     /* Allocate as big a buffer as we can... */
                     79:     while ((pbufT = (long *) ALLOCATE_LOCAL(bufsize)) == NULL)
                     80:         bufsize >>= 1;
                     81:     
                     82:     /* convert lengths from # of bytes to # of longs */
                     83:     size >>= 2;
                     84:     bufsize >>= 2;
                     85: 
                     86:     from = pbuf;
                     87:     fromLast = from + size;
                     88:     while (from < fromLast) {
                     89:        int nbytes;
                     90:         to = pbufT;
                     91:         toLast = to + min (bufsize, fromLast - from);
                     92:         nbytes = (toLast - to) << 2;
                     93:         while (to < toLast) {
                     94:             /* can't write "cpswapl(*from++, *to++)" because cpswapl is a macro
                     95:               that evaulates its args more than once */
                     96:            cpswapl(*from, *to);
                     97:             from++;
                     98:             to++;
                     99:            }
                    100:        WriteToClient (pClient, nbytes, (char *) pbufT);
                    101:        }
                    102: 
                    103:     DEALLOCATE_LOCAL ((char *) pbufT);
                    104: }
                    105: 
                    106: void
                    107: CopySwap16Write(pClient, size, pbuf)
                    108:     ClientPtr  pClient;
                    109:     int                size;   /* in bytes */
                    110:     short      *pbuf;
                    111: {
                    112:     int bufsize = size;
                    113:     short *pbufT;
                    114:     register short *from, *to, *fromLast, *toLast;
                    115:     
                    116:     /* Allocate as big a buffer as we can... */
                    117:     while ((pbufT = (short *) ALLOCATE_LOCAL(bufsize)) == NULL)
                    118:         bufsize >>= 1;
                    119:     
                    120:     /* convert lengths from # of bytes to # of shorts */
                    121:     size >>= 1;
                    122:     bufsize >>= 1;
                    123: 
                    124:     from = pbuf;
                    125:     fromLast = from + size;
                    126:     while (from < fromLast) {
                    127:        int nbytes;
                    128:         to = pbufT;
                    129:         toLast = to + min (bufsize, fromLast - from);
                    130:         nbytes = (toLast - to) << 1;
                    131:         while (to < toLast) {
                    132:             /* can't write "cpswaps(*from++, *to++)" because cpswaps is a macro
                    133:               that evaulates its args more than once */
                    134:            cpswaps(*from, *to);
                    135:             from++;
                    136:             to++;
                    137:            }
                    138:        WriteToClient (pClient, nbytes, (char *) pbufT);
                    139:        }
                    140: 
                    141:     DEALLOCATE_LOCAL ((char *) pbufT);
                    142: }
                    143: 
                    144: 
                    145: /* Extra-small reply */
                    146: void
                    147: SGenericReply(pClient, size, pRep)
                    148:     ClientPtr                  pClient;
                    149:     int                                size;
                    150:     xGenericReply              *pRep;
                    151: {
                    152:     int n;
                    153: 
                    154:     swaps(&pRep->sequenceNumber, n);
                    155:     WriteToClient(pClient, size, (char *) pRep);
                    156: }
                    157: 
                    158: /* Extra-large reply */
                    159: void
                    160: SGetWindowAttributesReply(pClient, size, pRep)
                    161:     ClientPtr                  pClient;
                    162:     int                                size;
                    163:     xGetWindowAttributesReply  *pRep;
                    164: {
                    165:     int n;
                    166: 
                    167:     swaps(&pRep->sequenceNumber, n);
                    168:     swapl(&pRep->length, n);
                    169:     swapl(&pRep->visualID, n);
                    170:     swaps(&pRep->class, n);
                    171:     swapl(&pRep->backingBitPlanes, n);
                    172:     swapl(&pRep->backingPixel, n);
                    173:     swapl(&pRep->colormap, n);
                    174:     swapl(&pRep->allEventMasks, n);
                    175:     swapl(&pRep->yourEventMask, n);
                    176:     swaps(&pRep->doNotPropagateMask, n);
                    177:     WriteToClient(pClient, size, (char *) pRep);
                    178: }
                    179: 
                    180: void
                    181: SGetGeometryReply(pClient, size, pRep)
                    182:     ClientPtr          pClient;
                    183:     int                        size;
                    184:     xGetGeometryReply  *pRep;
                    185: {
                    186:     int n;
                    187: 
                    188:     swaps(&pRep->sequenceNumber, n);
                    189:     swapl(&pRep->root, n);
                    190:     swaps(&pRep->x, n);
                    191:     swaps(&pRep->y, n);
                    192:     swaps(&pRep->width, n);
                    193:     swaps(&pRep->height, n);
                    194:     swaps(&pRep->borderWidth, n);
                    195:     WriteToClient(pClient, size, (char *) pRep);
                    196: }
                    197: 
                    198: void
                    199: SQueryTreeReply(pClient, size, pRep)
                    200:     ClientPtr          pClient;
                    201:     int                        size;
                    202:     xQueryTreeReply    *pRep;
                    203: {
                    204:     int n;
                    205: 
                    206:     swaps(&pRep->sequenceNumber, n);
                    207:     swapl(&pRep->length, n);
                    208:     swapl(&pRep->root, n);
                    209:     swapl(&pRep->parent, n);
                    210:     swaps(&pRep->nChildren, n);
                    211:     WriteToClient(pClient, size, (char *) pRep);
                    212: }
                    213: 
                    214: void
                    215: SInternAtomReply(pClient, size, pRep)
                    216:     ClientPtr          pClient;
                    217:     int                        size;
                    218:     xInternAtomReply   *pRep;
                    219: {
                    220:     int n;
                    221: 
                    222:     swaps(&pRep->sequenceNumber, n);
                    223:     swapl(&pRep->atom, n);
                    224:     WriteToClient(pClient, size, (char *) pRep);
                    225: }
                    226: 
                    227: void
                    228: SGetAtomNameReply(pClient, size, pRep)
                    229:     ClientPtr                  pClient;
                    230:     int                                size;
                    231:     xGetAtomNameReply  *pRep;
                    232: {
                    233:     int n;
                    234: 
                    235:     swaps(&pRep->sequenceNumber, n);
                    236:     swapl(&pRep->length, n);
                    237:     swaps(&pRep->nameLength, n);
                    238:     WriteToClient(pClient, size, (char *) pRep);
                    239: }
                    240: 
                    241: 
                    242: void
                    243: SGetPropertyReply(pClient, size, pRep)
                    244:     ClientPtr                  pClient;
                    245:     int                                size;
                    246:     xGetPropertyReply  *pRep;
                    247: {
                    248:     int n;
                    249: 
                    250:     swaps(&pRep->sequenceNumber, n);
                    251:     swapl(&pRep->length, n);
                    252:     swapl(&pRep->propertyType, n);
                    253:     swapl(&pRep->bytesAfter, n);
                    254:     swapl(&pRep->nItems, n);
                    255:     WriteToClient(pClient, size, (char *) pRep);
                    256: }
                    257: 
                    258: void
                    259: SListPropertiesReply(pClient, size, pRep)
                    260:     ClientPtr                  pClient;
                    261:     int                                size;
                    262:     xListPropertiesReply       *pRep;
                    263: {
                    264:     int n;
                    265: 
                    266:     swaps(&pRep->sequenceNumber, n);
                    267:     swapl(&pRep->length, n);
                    268:     swaps(&pRep->nProperties, n);
                    269:     WriteToClient(pClient, size, (char *) pRep);
                    270: }
                    271: 
                    272: void
                    273: SGetSelectionOwnerReply(pClient, size, pRep)
                    274:     ClientPtr                  pClient;
                    275:     int                                size;
                    276:     xGetSelectionOwnerReply    *pRep;
                    277: {
                    278:     int n;
                    279: 
                    280:     swaps(&pRep->sequenceNumber, n);
                    281:     swapl(&pRep->owner, n);
                    282:     WriteToClient(pClient, size, (char *) pRep);
                    283: }
                    284: 
                    285: 
                    286: void
                    287: SQueryPointerReply(pClient, size, pRep)
                    288:     ClientPtr          pClient;
                    289:     int                        size;
                    290:     xQueryPointerReply *pRep;
                    291: {
                    292:     int n;
                    293: 
                    294:     swaps(&pRep->sequenceNumber, n);
                    295:     swapl(&pRep->root, n);
                    296:     swapl(&pRep->child, n);
                    297:     swaps(&pRep->rootX, n);
                    298:     swaps(&pRep->rootY, n);
                    299:     swaps(&pRep->winX, n);
                    300:     swaps(&pRep->winY, n);
                    301:     swaps(&pRep->mask, n);
                    302:     WriteToClient(pClient, size, (char *) pRep);
                    303: }
                    304: 
                    305: void
                    306: SwapTimeCoordWrite(pClient, size, pRep)
                    307:     ClientPtr                  pClient;
                    308:     int                                size;
                    309:     xTimecoord                 *pRep;
                    310: {
                    311:     int        i, n;
                    312:     xTimecoord                 *pRepT;
                    313: 
                    314:     n = size / sizeof(xTimecoord);
                    315:     pRepT = pRep;
                    316:     for(i = 0; i < n; i++)
                    317:     {
                    318:        SwapTimecoord(pRepT);
                    319:        pRepT++;
                    320:     }
                    321:     WriteToClient(pClient, size, (char *) pRep);
                    322: 
                    323: }
                    324: void
                    325: SGetMotionEventsReply(pClient, size, pRep)
                    326:     ClientPtr                  pClient;
                    327:     int                                size;
                    328:     xGetMotionEventsReply      *pRep;
                    329: {
                    330:     int n;
                    331: 
                    332:     swaps(&pRep->sequenceNumber, n);
                    333:     swapl(&pRep->length, n);
                    334:     swapl(&pRep->nEvents, n);
                    335:     WriteToClient(pClient, size, (char *) pRep);
                    336: }
                    337: 
                    338: void
                    339: STranslateCoordsReply(pClient, size, pRep)
                    340:     ClientPtr                  pClient;
                    341:     int                                size;
                    342:     xTranslateCoordsReply      *pRep;
                    343: {
                    344:     int n;
                    345: 
                    346:     swaps(&pRep->sequenceNumber, n);
                    347:     swapl(&pRep->child, n);
                    348:     swaps(&pRep->dstX, n);
                    349:     swaps(&pRep->dstY, n);
                    350:     WriteToClient(pClient, size, (char *) pRep);
                    351: }
                    352: 
                    353: void
                    354: SGetInputFocusReply(pClient, size, pRep)
                    355:     ClientPtr          pClient;
                    356:     int                        size;
                    357:     xGetInputFocusReply        *pRep;
                    358: {
                    359:     int n;
                    360: 
                    361:     swaps(&pRep->sequenceNumber, n);
                    362:     swapl(&pRep->focus, n);
                    363:     WriteToClient(pClient, size, (char *) pRep);
                    364: }
                    365: 
                    366: /* extra long reply */
                    367: void
                    368: SQueryKeymapReply(pClient, size, pRep)
                    369:     ClientPtr                  pClient;
                    370:     int                                size;
                    371:     xQueryKeymapReply  *pRep;
                    372: {
                    373:     int n;
                    374: 
                    375:     swaps(&pRep->sequenceNumber, n);
                    376:     swapl(&pRep->length, n);
                    377:     WriteToClient(pClient, size, (char *) pRep);
                    378: }
                    379: 
                    380: void
                    381: SQueryFontReply(pClient, size, pRep)
                    382:     ClientPtr          pClient;
                    383:     int                        size;
                    384:     xQueryFontReply    *pRep;
                    385: {
                    386:     SwapFont(pRep, TRUE);
                    387:     WriteToClient(pClient, size, (char *) pRep);
                    388: }
                    389: 
                    390: void
                    391: SQueryTextExtentsReply(pClient, size, pRep)
                    392:     ClientPtr                  pClient;
                    393:     int                                size;
                    394:     xQueryTextExtentsReply     *pRep;
                    395: {
                    396:     int n;
                    397: 
                    398:     swaps(&pRep->sequenceNumber, n);
                    399:     swaps(&pRep->fontAscent, n);
                    400:     swaps(&pRep->fontDescent, n);
                    401:     swaps(&pRep->overallAscent, n);
                    402:     swaps(&pRep->overallDescent, n);
                    403:     swapl(&pRep->overallWidth, n);
                    404:     swapl(&pRep->overallLeft, n);
                    405:     swapl(&pRep->overallRight, n);
                    406:     WriteToClient(pClient, size, (char *) pRep);
                    407: }
                    408: 
                    409: void
                    410: SListFontsReply(pClient, size, pRep)
                    411:     ClientPtr          pClient;
                    412:     int                        size;
                    413:     xListFontsReply    *pRep;
                    414: {
                    415:     int n;
                    416: 
                    417:     swaps(&pRep->sequenceNumber, n);
                    418:     swapl(&pRep->length, n);
                    419:     swaps(&pRep->nFonts, n);
                    420:     WriteToClient(pClient, size, (char *) pRep);
                    421: }
                    422: 
                    423: void
                    424: SListFontsWithInfoReply(pClient, size, pRep)
                    425:     ClientPtr                  pClient;
                    426:     int                                size;
                    427:     xListFontsWithInfoReply    *pRep;
                    428: {
                    429:     SwapFont((xQueryFontReply *)pRep, FALSE);
                    430:     WriteToClient(pClient, size, (char *) pRep);
                    431: }
                    432: 
                    433: void
                    434: SGetFontPathReply(pClient, size, pRep)
                    435:     ClientPtr          pClient;
                    436:     int                        size;
                    437:     xGetFontPathReply  *pRep;
                    438: {
                    439:     int n;
                    440: 
                    441:     swaps(&pRep->sequenceNumber, n);
                    442:     swapl(&pRep->length, n);
                    443:     swaps(&pRep->nPaths, n);
                    444:     WriteToClient(pClient, size, (char *) pRep);
                    445: }
                    446: 
                    447: void
                    448: SGetImageReply(pClient, size, pRep)
                    449:     ClientPtr          pClient;
                    450:     int                        size;
                    451:     xGetImageReply     *pRep;
                    452: {
                    453:     int n;
                    454: 
                    455:     swaps(&pRep->sequenceNumber, n);
                    456:     swapl(&pRep->length, n);
                    457:     swapl(&pRep->visual, n);
                    458:     WriteToClient(pClient, size, (char *) pRep);
                    459:     /* Fortunately, image doesn't need swapping */
                    460: }
                    461: 
                    462: void
                    463: SListInstalledColormapsReply(pClient, size, pRep)
                    464:     ClientPtr                          pClient;
                    465:     int                                        size;
                    466:     xListInstalledColormapsReply       *pRep;
                    467: {
                    468:     int n;
                    469: 
                    470:     swaps(&pRep->sequenceNumber, n);
                    471:     swapl(&pRep->length, n);
                    472:     swaps(&pRep->nColormaps, n);
                    473:     WriteToClient(pClient, size, (char *) pRep);
                    474: }
                    475: 
                    476: void
                    477: SAllocColorReply(pClient, size, pRep)
                    478:     ClientPtr          pClient;
                    479:     int                        size;
                    480:     xAllocColorReply   *pRep;
                    481: {
                    482:     int n;
                    483: 
                    484:     swaps(&pRep->sequenceNumber, n);
                    485:     swaps(&pRep->red, n);
                    486:     swaps(&pRep->green, n);
                    487:     swaps(&pRep->blue, n);
                    488:     swapl(&pRep->pixel, n);
                    489:     WriteToClient(pClient, size, (char *) pRep);
                    490: }
                    491: 
                    492: void
                    493: SAllocNamedColorReply(pClient, size, pRep)
                    494:     ClientPtr                  pClient;
                    495:     int                                size;
                    496:     xAllocNamedColorReply      *pRep;
                    497: {
                    498:     int n;
                    499: 
                    500:     swaps(&pRep->sequenceNumber, n);
                    501:     swapl(&pRep->pixel, n);
                    502:     swaps(&pRep->exactRed, n);
                    503:     swaps(&pRep->exactGreen, n);
                    504:     swaps(&pRep->exactBlue, n);
                    505:     swaps(&pRep->screenRed, n);
                    506:     swaps(&pRep->screenGreen, n);
                    507:     swaps(&pRep->screenBlue, n);
                    508:     WriteToClient(pClient, size, (char *) pRep);
                    509: }
                    510: 
                    511: void
                    512: SAllocColorCellsReply(pClient, size, pRep)
                    513:     ClientPtr                  pClient;
                    514:     int                                size;
                    515:     xAllocColorCellsReply      *pRep;
                    516: {
                    517:     int n;
                    518: 
                    519:     swaps(&pRep->sequenceNumber, n);
                    520:     swapl(&pRep->length, n);
                    521:     swaps(&pRep->nPixels, n);
                    522:     swaps(&pRep->nMasks, n);
                    523:     WriteToClient(pClient, size, (char *) pRep);
                    524: }
                    525: 
                    526: 
                    527: void
                    528: SAllocColorPlanesReply(pClient, size, pRep)
                    529:     ClientPtr                  pClient;
                    530:     int                                size;
                    531:     xAllocColorPlanesReply     *pRep;
                    532: {
                    533:     int n;
                    534: 
                    535:     swaps(&pRep->sequenceNumber, n);
                    536:     swapl(&pRep->length, n);
                    537:     swaps(&pRep->nPixels, n);
                    538:     swapl(&pRep->redMask, n);
                    539:     swapl(&pRep->greenMask, n);
                    540:     swapl(&pRep->blueMask, n);
                    541:     WriteToClient(pClient, size, (char *) pRep);
                    542: }
                    543: 
                    544: void
                    545: SQColorsExtend(pClient, size, prgb)
                    546:     ClientPtr  pClient;
                    547:     int                size;
                    548:     xrgb       *prgb;
                    549: {
                    550:     int                i, n;
                    551:     xrgb       *prgbT;
                    552: 
                    553:     n = size / sizeof(xrgb);
                    554:     prgbT = prgb;
                    555:     for(i = 0; i < n; i++)
                    556:     {
                    557:        SwapRGB(prgbT);
                    558:        prgbT++;
                    559:     }
                    560:     WriteToClient(pClient, size, (char *) prgb);
                    561: }
                    562: 
                    563: void
                    564: SQueryColorsReply(pClient, size, pRep)
                    565:     ClientPtr          pClient;
                    566:     int                        size;
                    567:     xQueryColorsReply  *pRep;
                    568: {
                    569:     int n;
                    570: 
                    571:     swaps(&pRep->sequenceNumber, n);
                    572:     swapl(&pRep->length, n);
                    573:     swaps(&pRep->nColors, n);
                    574:     WriteToClient(pClient, size, (char *) pRep);
                    575: }
                    576: 
                    577: void
                    578: SLookupColorReply(pClient, size, pRep)
                    579:     ClientPtr          pClient;
                    580:     int                        size;
                    581:     xLookupColorReply  *pRep;
                    582: {
                    583:     int n;
                    584: 
                    585:     swaps(&pRep->sequenceNumber, n);
                    586:     swaps(&pRep->exactRed, n);
                    587:     swaps(&pRep->exactGreen, n);
                    588:     swaps(&pRep->exactBlue, n);
                    589:     swaps(&pRep->screenRed, n);
                    590:     swaps(&pRep->screenGreen, n);
                    591:     swaps(&pRep->screenBlue, n);
                    592:     WriteToClient(pClient, size, (char *) pRep);
                    593: }
                    594: 
                    595: void
                    596: SQueryBestSizeReply(pClient, size, pRep)
                    597:     ClientPtr          pClient;
                    598:     int                        size;
                    599:     xQueryBestSizeReply        *pRep;
                    600: {
                    601:     int n;
                    602: 
                    603:     swaps(&pRep->sequenceNumber, n);
                    604:     swaps(&pRep->width, n);
                    605:     swaps(&pRep->height, n);
                    606:     WriteToClient(pClient, size, (char *) pRep);
                    607: }
                    608: 
                    609: void
                    610: SListExtensionsReply(pClient, size, pRep)
                    611:     ClientPtr                  pClient;
                    612:     int                                size;
                    613:     xListExtensionsReply       *pRep;
                    614: {
                    615:     int n;
                    616: 
                    617:     swaps(&pRep->sequenceNumber, n);
                    618:     swapl(&pRep->length, n);
                    619:     WriteToClient(pClient, size, (char *) pRep);
                    620: }
                    621: 
                    622: void
                    623: SGetKeyboardMappingReply(pClient, size, pRep)
                    624:     ClientPtr                  pClient;
                    625:     int                                size;
                    626:     xGetKeyboardMappingReply   *pRep;
                    627: {
                    628:     int n;
                    629: 
                    630:     swaps(&pRep->sequenceNumber, n);
                    631:     swapl(&pRep->length, n);
                    632:     WriteToClient(pClient, size, (char *) pRep);
                    633: }
                    634: 
                    635: void
                    636: SGetPointerMappingReply(pClient, size, pRep)
                    637:     ClientPtr                  pClient;
                    638:     int                                size;
                    639:     xGetPointerMappingReply    *pRep;
                    640: {
                    641:     int n;
                    642: 
                    643:     swaps(&pRep->sequenceNumber, n);
                    644:     swapl(&pRep->length, n);
                    645:     WriteToClient(pClient, size, (char *) pRep);
                    646: }
                    647: 
                    648: void
                    649: SGetModifierMappingReply(pClient, size, pRep)
                    650:     ClientPtr                  pClient;
                    651:     int                                size;
                    652:     xGetModifierMappingReply   *pRep;
                    653: {
                    654:     int n;
                    655: 
                    656:     swaps(&pRep->sequenceNumber, n);
                    657:     swapl(&pRep->length, n);
                    658:     WriteToClient(pClient, size, (char *) pRep);
                    659: }
                    660: 
                    661: void
                    662: SGetKeyboardControlReply(pClient, size, pRep)
                    663:     ClientPtr                  pClient;
                    664:     int                                size;
                    665:     xGetKeyboardControlReply   *pRep;
                    666: {
                    667:     int n;
                    668: 
                    669:     swaps(&pRep->sequenceNumber, n);
                    670:     swapl(&pRep->length, n);
                    671:     swapl(&pRep->ledMask, n);
                    672:     swaps(&pRep->bellPitch, n);
                    673:     swaps(&pRep->bellDuration, n);
                    674:     WriteToClient(pClient, size, (char *) pRep);
                    675: }
                    676: 
                    677: void
                    678: SGetPointerControlReply(pClient, size, pRep)
                    679:     ClientPtr                  pClient;
                    680:     int                                size;
                    681:     xGetPointerControlReply    *pRep;
                    682: {
                    683:     int n;
                    684: 
                    685:     swaps(&pRep->sequenceNumber, n);
                    686:     swaps(&pRep->accelNumerator, n);
                    687:     swaps(&pRep->accelDenominator, n);
                    688:     swaps(&pRep->threshold, n);
                    689:     WriteToClient(pClient, size, (char *) pRep);
                    690: }
                    691: 
                    692: void
                    693: SGetScreenSaverReply(pClient, size, pRep)
                    694:     ClientPtr                  pClient;
                    695:     int                                size;
                    696:     xGetScreenSaverReply       *pRep;
                    697: {
                    698:     int n;
                    699: 
                    700:     swaps(&pRep->sequenceNumber, n);
                    701:     swaps(&pRep->timeout, n);
                    702:     swaps(&pRep->interval, n);
                    703:     WriteToClient(pClient, size, (char *) pRep);
                    704: }
                    705: 
                    706: void
                    707: SLHostsExtend(pClient, size, buf)
                    708:     ClientPtr          pClient;
                    709:     int                        size;
                    710:     char               *buf;
                    711: {
                    712:     char *bufT = buf;
                    713:     char *endbuf = buf + size;
                    714:     while (bufT < endbuf) {
                    715:        xHostEntry *host = (xHostEntry *) bufT;
                    716:        int len = host->length;
                    717:         int n;
                    718:        swaps (&host->length, n);
                    719:        bufT += sizeof (xHostEntry) + (((len + 3) >> 2) << 2);
                    720:        }
                    721:     WriteToClient (pClient, size, buf);
                    722: }
                    723: 
                    724: void
                    725: SListHostsReply(pClient, size, pRep)
                    726:     ClientPtr          pClient;
                    727:     int                        size;
                    728:     xListHostsReply    *pRep;
                    729: {
                    730:     int n;
                    731: 
                    732:     swaps(&pRep->sequenceNumber, n);
                    733:     swapl(&pRep->length, n);
                    734:     swaps(&pRep->nHosts, n);
                    735:     WriteToClient(pClient, size, (char *) pRep);
                    736: }
                    737: 
                    738: 
                    739: 
                    740: void
                    741: SErrorEvent(from, to)
                    742:     xError     *from, *to;
                    743: {
                    744:     to->type = X_Error;
                    745:     to->errorCode = from->errorCode;
                    746:     cpswaps(from->sequenceNumber, to->sequenceNumber);
                    747:     cpswapl(from->resourceID, to->resourceID);
                    748:     cpswaps(from->minorCode, to->minorCode);
                    749:     to->majorCode = from->majorCode;
                    750: }
                    751: 
                    752: void
                    753: SKeyButtonPtrEvent(from, to)
                    754:     xEvent     *from, *to;
                    755: {
                    756:     to->u.u.type = from->u.u.type;
                    757:     to->u.u.detail = from->u.u.detail;
                    758:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    759:     cpswapl(from->u.keyButtonPointer.time,
                    760:         to->u.keyButtonPointer.time);
                    761:     cpswapl(from->u.keyButtonPointer.root,
                    762:         to->u.keyButtonPointer.root);
                    763:     cpswapl(from->u.keyButtonPointer.event,
                    764:         to->u.keyButtonPointer.event);
                    765:     cpswapl(from->u.keyButtonPointer.child,
                    766:         to->u.keyButtonPointer.child);
                    767:     cpswaps(from->u.keyButtonPointer.rootX,
                    768:         to->u.keyButtonPointer.rootX);
                    769:     cpswaps(from->u.keyButtonPointer.rootY,
                    770:        to->u.keyButtonPointer.rootY);
                    771:     cpswaps(from->u.keyButtonPointer.eventX,
                    772:         to->u.keyButtonPointer.eventX);
                    773:     cpswaps(from->u.keyButtonPointer.eventY,
                    774:         to->u.keyButtonPointer.eventY);
                    775:     cpswaps(from->u.keyButtonPointer.state,
                    776:         to->u.keyButtonPointer.state);
                    777:     to->u.keyButtonPointer.sameScreen = 
                    778:        from->u.keyButtonPointer.sameScreen;
                    779: }
                    780: 
                    781: void
                    782: SEnterLeaveEvent(from, to)
                    783:     xEvent     *from, *to;
                    784: {
                    785:     to->u.u.type = from->u.u.type;
                    786:     to->u.u.detail = from->u.u.detail;
                    787:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    788:     cpswapl(from->u.enterLeave.time, to->u.enterLeave.time);
                    789:     cpswapl(from->u.enterLeave.root, to->u.enterLeave.root);
                    790:     cpswapl(from->u.enterLeave.event, to->u.enterLeave.event);
                    791:     cpswapl(from->u.enterLeave.child, to->u.enterLeave.child);
                    792:     cpswaps(from->u.enterLeave.rootX, to->u.enterLeave.rootX);
                    793:     cpswaps(from->u.enterLeave.rootY, to->u.enterLeave.rootY);
                    794:     cpswaps(from->u.enterLeave.eventX, to->u.enterLeave.eventX);
                    795:     cpswaps(from->u.enterLeave.eventY, to->u.enterLeave.eventY);
                    796:     cpswaps(from->u.enterLeave.state, to->u.enterLeave.state);
                    797:     to->u.enterLeave.mode = from->u.enterLeave.mode;
                    798:     to->u.enterLeave.flags = from->u.enterLeave.flags;
                    799: }
                    800: 
                    801: void
                    802: SFocusEvent(from, to)
                    803:     xEvent     *from, *to;
                    804: {
                    805:     to->u.u.type = from->u.u.type;
                    806:     to->u.u.detail = from->u.u.detail;
                    807:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    808:     cpswapl(from->u.focus.window, to->u.focus.window);
                    809:     to->u.focus.mode = from->u.focus.mode;
                    810: }
                    811: 
                    812: void
                    813: SExposeEvent(from, to)
                    814:     xEvent     *from, *to;
                    815: {
                    816:     to->u.u.type = from->u.u.type;
                    817:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    818:     cpswapl(from->u.expose.window, to->u.expose.window);
                    819:     cpswaps(from->u.expose.x, to->u.expose.x);
                    820:     cpswaps(from->u.expose.y, to->u.expose.y);
                    821:     cpswaps(from->u.expose.width, to->u.expose.width);
                    822:     cpswaps(from->u.expose.height, to->u.expose.height);
                    823:     cpswaps(from->u.expose.count, to->u.expose.count);
                    824: }
                    825: 
                    826: void
                    827: SGraphicsExposureEvent(from, to)
                    828:     xEvent     *from, *to;
                    829: {
                    830:     to->u.u.type = from->u.u.type;
                    831:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    832:     cpswapl(from->u.graphicsExposure.drawable,
                    833:         to->u.graphicsExposure.drawable);
                    834:     cpswaps(from->u.graphicsExposure.x, 
                    835:        to->u.graphicsExposure.x);
                    836:     cpswaps(from->u.graphicsExposure.y, 
                    837:        to->u.graphicsExposure.y);
                    838:     cpswaps(from->u.graphicsExposure.width, 
                    839:        to->u.graphicsExposure.width);
                    840:     cpswaps(from->u.graphicsExposure.height, 
                    841:        to->u.graphicsExposure.height);
                    842:     cpswaps(from->u.graphicsExposure.minorEvent,
                    843:         to->u.graphicsExposure.minorEvent);
                    844:     cpswaps(from->u.graphicsExposure.count,
                    845:        to->u.graphicsExposure.count);
                    846:     to->u.graphicsExposure.majorEvent = 
                    847:        from->u.graphicsExposure.majorEvent;
                    848: }
                    849: 
                    850: void
                    851: SNoExposureEvent(from, to)
                    852:     xEvent     *from, *to;
                    853: {
                    854:     to->u.u.type = from->u.u.type;
                    855:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    856:     cpswapl(from->u.noExposure.drawable, to->u.noExposure.drawable);
                    857:     cpswaps(from->u.noExposure.minorEvent, to->u.noExposure.minorEvent);
                    858:     to->u.noExposure.majorEvent = from->u.noExposure.majorEvent;
                    859: }
                    860: 
                    861: void
                    862: SVisibilityEvent(from, to)
                    863:     xEvent     *from, *to;
                    864: {
                    865:     to->u.u.type = from->u.u.type;
                    866:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    867:     cpswapl(from->u.visibility.window, to->u.visibility.window);
                    868:     to->u.visibility.state = from->u.visibility.state;
                    869: }
                    870: 
                    871: void
                    872: SCreateNotifyEvent(from, to)
                    873:     xEvent     *from, *to;
                    874: {
                    875:     to->u.u.type = from->u.u.type;
                    876:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    877:     cpswapl(from->u.createNotify.window, to->u.createNotify.window);
                    878:     cpswapl(from->u.createNotify.parent, to->u.createNotify.parent);
                    879:     cpswaps(from->u.createNotify.x, to->u.createNotify.x);
                    880:     cpswaps(from->u.createNotify.y, to->u.createNotify.y);
                    881:     cpswaps(from->u.createNotify.width, to->u.createNotify.width);
                    882:     cpswaps(from->u.createNotify.height, to->u.createNotify.height);
                    883:     cpswaps(from->u.createNotify.borderWidth,
                    884:         to->u.createNotify.borderWidth);
                    885:     to->u.createNotify.override = from->u.createNotify.override;
                    886: }
                    887: 
                    888: void
                    889: SDestroyNotifyEvent(from, to)
                    890:     xEvent     *from, *to;
                    891: {
                    892:     to->u.u.type = from->u.u.type;
                    893:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    894:     cpswapl(from->u.destroyNotify.event, to->u.destroyNotify.event);
                    895:     cpswapl(from->u.destroyNotify.window, to->u.destroyNotify.window);
                    896: }
                    897: 
                    898: void
                    899: SUnmapNotifyEvent(from, to)
                    900:     xEvent     *from, *to;
                    901: {
                    902:     to->u.u.type = from->u.u.type;
                    903:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    904:     cpswapl(from->u.unmapNotify.event, to->u.unmapNotify.event);
                    905:     cpswapl(from->u.unmapNotify.window, to->u.unmapNotify.window);
                    906:     to->u.unmapNotify.fromConfigure = from->u.unmapNotify.fromConfigure;
                    907: }
                    908: 
                    909: void
                    910: SMapNotifyEvent(from, to)
                    911:     xEvent     *from, *to;
                    912: {
                    913:     to->u.u.type = from->u.u.type;
                    914:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    915:     cpswapl(from->u.mapNotify.event, to->u.mapNotify.event);
                    916:     cpswapl(from->u.mapNotify.window, to->u.mapNotify.window);
                    917:     to->u.mapNotify.override = from->u.mapNotify.override;
                    918: }
                    919: 
                    920: void
                    921: SMapRequestEvent(from, to)
                    922:     xEvent     *from, *to;
                    923: {
                    924:     to->u.u.type = from->u.u.type;
                    925:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    926:     cpswapl(from->u.mapRequest.parent, to->u.mapRequest.parent);
                    927:     cpswapl(from->u.mapRequest.window, to->u.mapRequest.window);
                    928: }
                    929: 
                    930: void
                    931: SReparentEvent(from, to)
                    932:     xEvent     *from, *to;
                    933: {
                    934:     to->u.u.type = from->u.u.type;
                    935:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    936:     cpswapl(from->u.reparent.event, to->u.reparent.event);
                    937:     cpswapl(from->u.reparent.window, to->u.reparent.window);
                    938:     cpswapl(from->u.reparent.parent, to->u.reparent.parent);
                    939:     cpswaps(from->u.reparent.x, to->u.reparent.x);
                    940:     cpswaps(from->u.reparent.y, to->u.reparent.y);
                    941:     to->u.reparent.override = from->u.reparent.override;
                    942: }
                    943: 
                    944: void
                    945: SConfigureNotifyEvent(from, to)
                    946:     xEvent     *from, *to;
                    947: {
                    948:     to->u.u.type = from->u.u.type;
                    949:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    950:     cpswapl(from->u.configureNotify.event,
                    951:         to->u.configureNotify.event);
                    952:     cpswapl(from->u.configureNotify.window,
                    953:         to->u.configureNotify.window);
                    954:     cpswapl(from->u.configureNotify.aboveSibling,
                    955:         to->u.configureNotify.aboveSibling);
                    956:     cpswaps(from->u.configureNotify.x, to->u.configureNotify.x);
                    957:     cpswaps(from->u.configureNotify.y, to->u.configureNotify.y);
                    958:     cpswaps(from->u.configureNotify.width, to->u.configureNotify.width);
                    959:     cpswaps(from->u.configureNotify.height,
                    960:         to->u.configureNotify.height);
                    961:     cpswaps(from->u.configureNotify.borderWidth,
                    962:         to->u.configureNotify.borderWidth);
                    963:     to->u.configureNotify.override = from->u.configureNotify.override;
                    964: }
                    965: 
                    966: void
                    967: SConfigureRequestEvent(from, to)
                    968:     xEvent     *from, *to;
                    969: {
                    970:     to->u.u.type = from->u.u.type;
                    971:     to->u.u.detail = from->u.u.detail;  /* actually stack-mode */
                    972:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    973:     cpswapl(from->u.configureRequest.parent,
                    974:         to->u.configureRequest.parent);
                    975:     cpswapl(from->u.configureRequest.window,
                    976:         to->u.configureRequest.window);
                    977:     cpswapl(from->u.configureRequest.sibling,
                    978:         to->u.configureRequest.sibling);
                    979:     cpswaps(from->u.configureRequest.x, to->u.configureRequest.x);
                    980:     cpswaps(from->u.configureRequest.y, to->u.configureRequest.y);
                    981:     cpswaps(from->u.configureRequest.width,
                    982:         to->u.configureRequest.width);
                    983:     cpswaps(from->u.configureRequest.height,
                    984:         to->u.configureRequest.height);
                    985:     cpswaps(from->u.configureRequest.borderWidth,
                    986:         to->u.configureRequest.borderWidth);
                    987:     cpswaps(from->u.configureRequest.valueMask,
                    988:         to->u.configureRequest.valueMask);
                    989: }
                    990: 
                    991: 
                    992: void
                    993: SGravityEvent(from, to)
                    994:     xEvent     *from, *to;
                    995: {
                    996:     to->u.u.type = from->u.u.type;
                    997:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                    998:     cpswapl(from->u.gravity.event, to->u.gravity.event);
                    999:     cpswapl(from->u.gravity.window, to->u.gravity.window);
                   1000:     cpswaps(from->u.gravity.x, to->u.gravity.x);
                   1001:     cpswaps(from->u.gravity.y, to->u.gravity.y);
                   1002: }
                   1003: 
                   1004: void
                   1005: SResizeRequestEvent(from, to)
                   1006:     xEvent     *from, *to;
                   1007: {
                   1008:     to->u.u.type = from->u.u.type;
                   1009:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                   1010:     cpswapl(from->u.resizeRequest.window, to->u.resizeRequest.window);
                   1011:     cpswaps(from->u.resizeRequest.width, to->u.resizeRequest.width);
                   1012:     cpswaps(from->u.resizeRequest.height, to->u.resizeRequest.height);
                   1013: }
                   1014: 
                   1015: void
                   1016: SCirculateEvent(from, to)
                   1017:     xEvent     *from, *to;
                   1018: {
                   1019:     to->u.u.type = from->u.u.type;
                   1020:     to->u.u.detail = from->u.u.detail;
                   1021:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                   1022:     cpswapl(from->u.circulate.event, to->u.circulate.event);
                   1023:     cpswapl(from->u.circulate.window, to->u.circulate.window);
                   1024:     cpswapl(from->u.circulate.parent, to->u.circulate.parent);
                   1025:     to->u.circulate.place = from->u.circulate.place;
                   1026: }
                   1027: 
                   1028: void
                   1029: SPropertyEvent(from, to)
                   1030:     xEvent     *from, *to;
                   1031: {
                   1032:     to->u.u.type = from->u.u.type;
                   1033:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                   1034:     cpswapl(from->u.property.window, to->u.property.window);
                   1035:     cpswapl(from->u.property.atom, to->u.property.atom);
                   1036:     cpswapl(from->u.property.time, to->u.property.time);
                   1037:     to->u.property.state = from->u.property.state;
                   1038: }
                   1039: 
                   1040: void
                   1041: SSelectionClearEvent(from, to)
                   1042:     xEvent     *from, *to;
                   1043: {
                   1044:     to->u.u.type = from->u.u.type;
                   1045:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                   1046:     cpswapl(from->u.selectionClear.time, to->u.selectionClear.time);
                   1047:     cpswapl(from->u.selectionClear.window, to->u.selectionClear.window);
                   1048:     cpswapl(from->u.selectionClear.atom, to->u.selectionClear.atom);
                   1049: }
                   1050: 
                   1051: void
                   1052: SSelectionRequestEvent(from, to)
                   1053:     xEvent     *from, *to;
                   1054: {
                   1055:     to->u.u.type = from->u.u.type;
                   1056:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                   1057:     cpswapl(from->u.selectionRequest.time, to->u.selectionRequest.time);
                   1058:     cpswapl(from->u.selectionRequest.owner,
                   1059:         to->u.selectionRequest.owner);
                   1060:     cpswapl(from->u.selectionRequest.requestor,
                   1061:        to->u.selectionRequest.requestor);
                   1062:     cpswapl(from->u.selectionRequest.selection,
                   1063:        to->u.selectionRequest.selection);
                   1064:     cpswapl(from->u.selectionRequest.target,
                   1065:         to->u.selectionRequest.target);
                   1066:     cpswapl(from->u.selectionRequest.property,
                   1067:        to->u.selectionRequest.property);
                   1068: }
                   1069: 
                   1070: void
                   1071: SSelectionNotifyEvent(from, to)
                   1072:     xEvent     *from, *to;
                   1073: {
                   1074:     to->u.u.type = from->u.u.type;
                   1075:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                   1076:     cpswapl(from->u.selectionNotify.time, to->u.selectionNotify.time);
                   1077:     cpswapl(from->u.selectionNotify.requestor,
                   1078:        to->u.selectionNotify.requestor);
                   1079:     cpswapl(from->u.selectionNotify.selection,
                   1080:        to->u.selectionNotify.selection);
                   1081:     cpswapl(from->u.selectionNotify.target,
                   1082:        to->u.selectionNotify.target);
                   1083:     cpswapl(from->u.selectionNotify.property,
                   1084:         to->u.selectionNotify.property);
                   1085: }
                   1086: 
                   1087: void
                   1088: SColormapEvent(from, to)
                   1089:     xEvent     *from, *to;
                   1090: {
                   1091:     to->u.u.type = from->u.u.type;
                   1092:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                   1093:     cpswapl(from->u.colormap.window, to->u.colormap.window);
                   1094:     cpswapl(from->u.colormap.colormap, to->u.colormap.colormap);
                   1095:     to->u.colormap.new = from->u.colormap.new;
                   1096:     to->u.colormap.state = from->u.colormap.state;
                   1097: }
                   1098: 
                   1099: void
                   1100: SMappingEvent(from, to)
                   1101:     xEvent     *from, *to;
                   1102: {
                   1103:     to->u.u.type = from->u.u.type;
                   1104:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                   1105:     to->u.mappingNotify.request = from->u.mappingNotify.request;
                   1106:     to->u.mappingNotify.firstKeyCode =
                   1107:        from->u.mappingNotify.firstKeyCode;
                   1108:     to->u.mappingNotify.count = from->u.mappingNotify.count;
                   1109: }
                   1110: 
                   1111: void
                   1112: SClientMessageEvent(from, to)
                   1113:     xEvent     *from, *to;
                   1114: {
                   1115:     to->u.u.type = from->u.u.type;
                   1116:     to->u.u.detail = from->u.u.detail;  /* actually format */
                   1117:     cpswaps(from->u.u.sequenceNumber, to->u.u.sequenceNumber);
                   1118:     cpswapl(from->u.clientMessage.window, to->u.clientMessage.window);
                   1119:     cpswapl(from->u.clientMessage.u.l.type, 
                   1120:            to->u.clientMessage.u.l.type);
                   1121:     switch (from->u.u.detail) {
                   1122:        case 8:
                   1123:           bcopy(from->u.clientMessage.u.b.bytes,
                   1124:                to->u.clientMessage.u.b.bytes, 20);
                   1125:          break;
                   1126:        case 16:
                   1127:          cpswaps(from->u.clientMessage.u.s.shorts0,
                   1128:             to->u.clientMessage.u.s.shorts0);
                   1129:          cpswaps(from->u.clientMessage.u.s.shorts1,
                   1130:             to->u.clientMessage.u.s.shorts1);
                   1131:          cpswaps(from->u.clientMessage.u.s.shorts2,
                   1132:             to->u.clientMessage.u.s.shorts2);
                   1133:          cpswaps(from->u.clientMessage.u.s.shorts3,
                   1134:             to->u.clientMessage.u.s.shorts3);
                   1135:          cpswaps(from->u.clientMessage.u.s.shorts4,
                   1136:             to->u.clientMessage.u.s.shorts4);
                   1137:          cpswaps(from->u.clientMessage.u.s.shorts5,
                   1138:             to->u.clientMessage.u.s.shorts5);
                   1139:          cpswaps(from->u.clientMessage.u.s.shorts6,
                   1140:             to->u.clientMessage.u.s.shorts6);
                   1141:          cpswaps(from->u.clientMessage.u.s.shorts7,
                   1142:             to->u.clientMessage.u.s.shorts7);
                   1143:          cpswaps(from->u.clientMessage.u.s.shorts8,
                   1144:             to->u.clientMessage.u.s.shorts8);
                   1145:          cpswaps(from->u.clientMessage.u.s.shorts9,
                   1146:             to->u.clientMessage.u.s.shorts9);
                   1147:          break;
                   1148:        case 32:
                   1149:          cpswaps(from->u.clientMessage.u.l.longs0,
                   1150:             to->u.clientMessage.u.l.longs0);
                   1151:          cpswaps(from->u.clientMessage.u.l.longs1,
                   1152:             to->u.clientMessage.u.l.longs1);
                   1153:          cpswaps(from->u.clientMessage.u.l.longs2,
                   1154:             to->u.clientMessage.u.l.longs2);
                   1155:          cpswaps(from->u.clientMessage.u.l.longs3,
                   1156:             to->u.clientMessage.u.l.longs3);
                   1157:          cpswaps(from->u.clientMessage.u.l.longs4,
                   1158:             to->u.clientMessage.u.l.longs4);
                   1159:          break;
                   1160:        }
                   1161: }
                   1162: 
                   1163: void
                   1164: SKeymapNotifyEvent(from, to)
                   1165:     xEvent     *from, *to;
                   1166: {
                   1167:     /* Keymap notify events are special; they have no
                   1168:        sequence number field, and contain entirely 8-bit data */
                   1169:     *to = *from;
                   1170: }
                   1171: 
                   1172: void
                   1173: WriteSConnectionInfo(pClient, size, pInfo)
                   1174:     ClientPtr          pClient;
                   1175:     int                        size;
                   1176:     char               *pInfo;
                   1177: {
                   1178:     int                i, j, k;
                   1179:     ScreenPtr  pScreen;
                   1180:     DepthPtr   pDepth;
                   1181:     char       *pInfoT, *pInfoTBase;
                   1182:     xConnSetup *pConnSetup = (xConnSetup *)pInfo;
                   1183: 
                   1184:     pInfoT = pInfoTBase = (char *) ALLOCATE_LOCAL(size);
                   1185: 
                   1186:     SwapConnSetup(pInfo, pInfoT);
                   1187:     pInfo += sizeof(xConnSetup);
                   1188:     pInfoT += sizeof(xConnSetup);
                   1189: 
                   1190:     /* Copy the vendor string */
                   1191:     i = (pConnSetup->nbytesVendor + 3) & ~3;
                   1192:     bcopy(pInfo, pInfoT, i);
                   1193:     pInfo += i;
                   1194:     pInfoT += i;
                   1195: 
                   1196:     /* The Pixmap formats don't need to be swapped, just copied. */
                   1197:     i = sizeof(xPixmapFormat) * screenInfo.numPixmapFormats;
                   1198:     bcopy(pInfo, pInfoT, i);
                   1199:     pInfo += i;
                   1200:     pInfoT += i;
                   1201: 
                   1202:     for(i = 0; i < screenInfo.numScreens; i++)
                   1203:     {
                   1204:        pScreen = (ScreenPtr)&screenInfo.screen[i];
                   1205:        SwapWinRoot(pInfo, pInfoT);
                   1206:        pInfo += sizeof(xWindowRoot);
                   1207:        pInfoT += sizeof(xWindowRoot);
                   1208:        pDepth = pScreen->allowedDepths;
                   1209:        for(j = 0; j < pScreen->numDepths; j++, pDepth++)
                   1210:        {
                   1211:             ((xDepth *)pInfoT)->depth = ((xDepth *)pInfo)->depth;
                   1212:            cpswaps(((xDepth *)pInfo)->nVisuals, ((xDepth *)pInfoT)->nVisuals);
                   1213:            pInfo += sizeof(xDepth);
                   1214:            pInfoT += sizeof(xDepth);
                   1215:            for(k = 0; k < pDepth->numVids; k++)
                   1216:            {
                   1217:                SwapVisual(pInfo, pInfoT);
                   1218:                pInfo += sizeof(xVisualType);
                   1219:                pInfoT += sizeof(xVisualType);
                   1220:            }
                   1221:        }
                   1222:     }
                   1223:     WriteToClient(pClient, size, (char *) pInfoTBase);
                   1224:     DEALLOCATE_LOCAL(pInfoTBase);
                   1225: }
                   1226: 
                   1227: void
                   1228: SwapConnSetup(pConnSetup, pConnSetupT)
                   1229:     xConnSetup         *pConnSetup, *pConnSetupT;
                   1230: {
                   1231:     cpswapl(pConnSetup->release, pConnSetupT->release);
                   1232:     cpswapl(pConnSetup->ridBase, pConnSetupT->ridBase);
                   1233:     cpswapl(pConnSetup->ridMask, pConnSetupT->ridMask);
                   1234:     cpswapl(pConnSetup->motionBufferSize, pConnSetupT->motionBufferSize);
                   1235:     cpswaps(pConnSetup->nbytesVendor, pConnSetupT->nbytesVendor);
                   1236:     cpswaps(pConnSetup->maxRequestSize, pConnSetupT->maxRequestSize);
                   1237:     pConnSetupT->minKeyCode = pConnSetup->minKeyCode;
                   1238:     pConnSetupT->maxKeyCode = pConnSetup->maxKeyCode;
                   1239:     pConnSetupT->numRoots = pConnSetup->numRoots;
                   1240:     pConnSetupT->numFormats = pConnSetup->numFormats;
                   1241:     pConnSetupT->imageByteOrder = pConnSetup->imageByteOrder;
                   1242:     pConnSetupT->bitmapBitOrder = pConnSetup->bitmapBitOrder;
                   1243:     pConnSetupT->bitmapScanlineUnit = pConnSetup->bitmapScanlineUnit;
                   1244:     pConnSetupT->bitmapScanlinePad = pConnSetup->bitmapScanlinePad;
                   1245: }
                   1246: 
                   1247: void
                   1248: SwapWinRoot(pRoot, pRootT)
                   1249:     xWindowRoot        *pRoot, *pRootT;
                   1250: {
                   1251:     cpswapl(pRoot->windowId, pRootT->windowId);
                   1252:     cpswapl(pRoot->defaultColormap, pRootT->defaultColormap);
                   1253:     cpswapl(pRoot->whitePixel, pRootT->whitePixel);
                   1254:     cpswapl(pRoot->blackPixel, pRootT->blackPixel);
                   1255:     cpswapl(pRoot->currentInputMask, pRootT->currentInputMask);
                   1256:     cpswaps(pRoot->pixWidth, pRootT->pixWidth);
                   1257:     cpswaps(pRoot->pixHeight, pRootT->pixHeight);
                   1258:     cpswaps(pRoot->mmWidth, pRootT->mmWidth);
                   1259:     cpswaps(pRoot->mmHeight, pRootT->mmHeight);
                   1260:     cpswaps(pRoot->minInstalledMaps, pRootT->minInstalledMaps);
                   1261:     cpswaps(pRoot->maxInstalledMaps, pRootT->maxInstalledMaps);
                   1262:     cpswapl(pRoot->rootVisualID, pRootT->rootVisualID);
                   1263:     pRootT->backingStore = pRoot->backingStore;
                   1264:     pRootT->saveUnders = pRoot->saveUnders;
                   1265:     pRootT->rootDepth = pRoot->rootDepth;
                   1266:     pRootT->nDepths = pRoot->nDepths;
                   1267: }
                   1268: 
                   1269: void
                   1270: SwapVisual(pVis, pVisT)
                   1271:     xVisualType        *pVis, *pVisT;
                   1272: {
                   1273:     cpswapl(pVis->visualID, pVisT->visualID);
                   1274:     pVisT->class = pVis->class;
                   1275:     pVisT->bitsPerRGB = pVis->bitsPerRGB;
                   1276:     cpswaps(pVis->colormapEntries, pVisT->colormapEntries);
                   1277:     cpswapl(pVis->redMask, pVisT->redMask);
                   1278:     cpswapl(pVis->greenMask, pVisT->greenMask);
                   1279:     cpswapl(pVis->blueMask, pVisT->blueMask);
                   1280: }
                   1281: 
                   1282: void
                   1283: WriteSConnSetupPrefix(pClient, pcsp)
                   1284:     ClientPtr          pClient;
                   1285:     xConnSetupPrefix   *pcsp;
                   1286: {
                   1287:     xConnSetupPrefix   cspT;
                   1288: 
                   1289:     cspT.success = pcsp->success;
                   1290:     cpswaps(pcsp->majorVersion, cspT.majorVersion);
                   1291:     cpswaps(pcsp->minorVersion, cspT.minorVersion);
                   1292:     cpswaps(pcsp->length, cspT.length);
                   1293:     WriteToClient(pClient, sizeof(cspT), (char *) &cspT);
                   1294: }
                   1295: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.