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