⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 swaprep.c

📁 远程桌面连接工具
💻 C
📖 第 1 页 / 共 3 页
字号:
/************************************************************Copyright (c) 1987  X ConsortiumPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THEX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER INAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR INCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.Except as contained in this notice, the name of the X Consortium shall not beused in advertising or otherwise to promote the sale, use or other dealingsin this Software without prior written authorization from the X Consortium.Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.                        All Rights ReservedPermission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and thatboth that copyright notice and this permission notice appear in supporting documentation, and that the name of Digital not beused in advertising or publicity pertaining to distribution of thesoftware without specific, written prior permission.  DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDINGALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALLDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES ORANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THISSOFTWARE.********************************************************//* $XConsortium: swaprep.c /main/25 1995/12/08 13:39:45 dpw $ *//* $XFree86: xc/programs/Xserver/dix/swaprep.c,v 3.2 1996/04/15 11:19:58 dawes Exp $ */#include "X.h"#define NEED_REPLIES#define NEED_EVENTS#include "Xproto.h"#include "misc.h"#include "dixstruct.h"#include "fontstruct.h"#include "scrnintstr.h"#include "swaprep.h"static void SwapFontInfo(#if NeedFunctionPrototypes    xQueryFontReply * /* pr */#endif);#ifndef LBXstatic void SwapCharInfo(#if NeedFunctionPrototypes    xCharInfo * /* pInfo */#endif    );static void SwapFont(#if NeedFunctionPrototypes    xQueryFontReply * /* pr */,    Bool /* hasGlyphs */#endif    );#endif/* Thanks to Jack Palevich for testing and subsequently rewriting all this */voidSwap32Write(pClient, size, pbuf)    ClientPtr	pClient;    int		size;  /* in bytes */    register CARD32 *pbuf;{    register int i;    register char n;    size >>= 2;    for(i = 0; i < size; i++)    /* brackets are mandatory here, because "swapl" macro expands       to several statements */    {   	swapl(&pbuf[i], n);    }    (void)WriteToClient(pClient, size << 2, (char *) pbuf);}voidCopySwap32Write(pClient, size, pbuf)    ClientPtr	pClient;    int		size;   /* in bytes */    CARD32	*pbuf;{    int bufsize = size;    CARD32 *pbufT;    register CARD32 *from, *to, *fromLast, *toLast;    CARD32 tmpbuf[1];        /* Allocate as big a buffer as we can... */    while (!(pbufT = (CARD32 *) ALLOCATE_LOCAL(bufsize)))    {        bufsize >>= 1;	if (bufsize == 4)	{	    pbufT = tmpbuf;	    break;	}    }        /* convert lengths from # of bytes to # of longs */    size >>= 2;    bufsize >>= 2;    from = pbuf;    fromLast = from + size;    while (from < fromLast) {	int nbytes;        to = pbufT;        toLast = to + min (bufsize, fromLast - from);        nbytes = (toLast - to) << 2;        while (to < toLast) {            /* can't write "cpswapl(*from++, *to++)" because cpswapl is a macro	       that evaulates its args more than once */	    cpswapl(*from, *to);            from++;            to++;	    }	(void)WriteToClient (pClient, nbytes, (char *) pbufT);	}    if (pbufT != tmpbuf)	DEALLOCATE_LOCAL ((char *) pbufT);}voidCopySwap16Write(pClient, size, pbuf)    ClientPtr	pClient;    int		size;   /* in bytes */    short	*pbuf;{    int bufsize = size;    short *pbufT;    register short *from, *to, *fromLast, *toLast;    short tmpbuf[2];        /* Allocate as big a buffer as we can... */    while (!(pbufT = (short *) ALLOCATE_LOCAL(bufsize)))    {        bufsize >>= 1;	if (bufsize == 4)	{	    pbufT = tmpbuf;	    break;	}    }        /* convert lengths from # of bytes to # of shorts */    size >>= 1;    bufsize >>= 1;    from = pbuf;    fromLast = from + size;    while (from < fromLast) {	int nbytes;        to = pbufT;        toLast = to + min (bufsize, fromLast - from);        nbytes = (toLast - to) << 1;        while (to < toLast) {            /* can't write "cpswaps(*from++, *to++)" because cpswaps is a macro	       that evaulates its args more than once */	    cpswaps(*from, *to);            from++;            to++;	    }	(void)WriteToClient (pClient, nbytes, (char *) pbufT);	}    if (pbufT != tmpbuf)	DEALLOCATE_LOCAL ((char *) pbufT);}/* Extra-small reply */voidSGenericReply(pClient, size, pRep)    ClientPtr			pClient;    int				size;    xGenericReply		*pRep;{    register char n;    swaps(&pRep->sequenceNumber, n);    (void)WriteToClient(pClient, size, (char *) pRep);}/* Extra-large reply */voidSGetWindowAttributesReply(pClient, size, pRep)    ClientPtr			pClient;    int				size;    xGetWindowAttributesReply	*pRep;{    register char n;    swaps(&pRep->sequenceNumber, n);    swapl(&pRep->length, n);    swapl(&pRep->visualID, n);    swaps(&pRep->class, n);    swapl(&pRep->backingBitPlanes, n);    swapl(&pRep->backingPixel, n);    swapl(&pRep->colormap, n);    swapl(&pRep->allEventMasks, n);    swapl(&pRep->yourEventMask, n);    swaps(&pRep->doNotPropagateMask, n);    (void)WriteToClient(pClient, size, (char *) pRep);}voidSGetGeometryReply(pClient, size, pRep)    ClientPtr		pClient;    int			size;    xGetGeometryReply	*pRep;{    register char n;    swaps(&pRep->sequenceNumber, n);    swapl(&pRep->root, n);    swaps(&pRep->x, n);    swaps(&pRep->y, n);    swaps(&pRep->width, n);    swaps(&pRep->height, n);    swaps(&pRep->borderWidth, n);    (void)WriteToClient(pClient, size, (char *) pRep);}voidSQueryTreeReply(pClient, size, pRep)    ClientPtr		pClient;    int			size;    xQueryTreeReply	*pRep;{    register char n;    swaps(&pRep->sequenceNumber, n);    swapl(&pRep->length, n);    swapl(&pRep->root, n);    swapl(&pRep->parent, n);    swaps(&pRep->nChildren, n);    (void)WriteToClient(pClient, size, (char *) pRep);}voidSInternAtomReply(pClient, size, pRep)    ClientPtr		pClient;    int			size;    xInternAtomReply	*pRep;{    register char n;    swaps(&pRep->sequenceNumber, n);    swapl(&pRep->atom, n);    (void)WriteToClient(pClient, size, (char *) pRep);}voidSGetAtomNameReply(pClient, size, pRep)    ClientPtr			pClient;    int				size;    xGetAtomNameReply	*pRep;{    register char n;    swaps(&pRep->sequenceNumber, n);    swapl(&pRep->length, n);    swaps(&pRep->nameLength, n);    (void)WriteToClient(pClient, size, (char *) pRep);}voidSGetPropertyReply(pClient, size, pRep)    ClientPtr			pClient;    int				size;    xGetPropertyReply	*pRep;{    register char n;    swaps(&pRep->sequenceNumber, n);    swapl(&pRep->length, n);    swapl(&pRep->propertyType, n);    swapl(&pRep->bytesAfter, n);    swapl(&pRep->nItems, n);    (void)WriteToClient(pClient, size, (char *) pRep);}voidSListPropertiesReply(pClient, size, pRep)    ClientPtr			pClient;    int				size;    xListPropertiesReply	*pRep;{    register char n;    swaps(&pRep->sequenceNumber, n);    swapl(&pRep->length, n);    swaps(&pRep->nProperties, n);    (void)WriteToClient(pClient, size, (char *) pRep);}voidSGetSelectionOwnerReply(pClient, size, pRep)    ClientPtr			pClient;    int				size;    xGetSelectionOwnerReply	*pRep;{    register char n;    swaps(&pRep->sequenceNumber, n);    swapl(&pRep->owner, n);    (void)WriteToClient(pClient, size, (char *) pRep);}voidSQueryPointerReply(pClient, size, pRep)    ClientPtr		pClient;    int			size;    xQueryPointerReply	*pRep;{    register char n;    swaps(&pRep->sequenceNumber, n);    swapl(&pRep->root, n);    swapl(&pRep->child, n);    swaps(&pRep->rootX, n);    swaps(&pRep->rootY, n);    swaps(&pRep->winX, n);    swaps(&pRep->winY, n);    swaps(&pRep->mask, n);    (void)WriteToClient(pClient, size, (char *) pRep);}voidSwapTimecoord(pCoord)    xTimecoord *pCoord;{    register char n;    swapl(&pCoord->time, n);    swaps(&pCoord->x, n);    swaps(&pCoord->y, n);}voidSwapTimeCoordWrite(pClient, size, pRep)    ClientPtr			pClient;    int				size;    xTimecoord			*pRep;{    int	i, n;    xTimecoord			*pRepT;    n = size / sizeof(xTimecoord);    pRepT = pRep;    for(i = 0; i < n; i++)    {	SwapTimecoord(pRepT);	pRepT++;    }    (void)WriteToClient(pClient, size, (char *) pRep);}voidSGetMotionEventsReply(pClient, size, pRep)    ClientPtr			pClient;    int				size;    xGetMotionEventsReply	*pRep;{    register char n;    swaps(&pRep->sequenceNumber, n);    swapl(&pRep->length, n);    swapl(&pRep->nEvents, n);    (void)WriteToClient(pClient, size, (char *) pRep);}voidSTranslateCoordsReply(pClient, size, pRep)    ClientPtr			pClient;    int				size;    xTranslateCoordsReply	*pRep;{    register char n;    swaps(&pRep->sequenceNumber, n);    swapl(&pRep->child, n);    swaps(&pRep->dstX, n);    swaps(&pRep->dstY, n);    (void)WriteToClient(pClient, size, (char *) pRep);}voidSGetInputFocusReply(pClient, size, pRep)    ClientPtr		pClient;    int			size;    xGetInputFocusReply	*pRep;{    register char n;    swaps(&pRep->sequenceNumber, n);    swapl(&pRep->focus, n);    (void)WriteToClient(pClient, size, (char *) pRep);}/* extra long reply */voidSQueryKeymapReply(pClient, size, pRep)    ClientPtr			pClient;    int				size;    xQueryKeymapReply	*pRep;{    register char n;    swaps(&pRep->sequenceNumber, n);    swapl(&pRep->length, n);    (void)WriteToClient(pClient, size, (char *) pRep);}#ifndef LBXstatic#endifvoidSwapCharInfo(pInfo)    xCharInfo	*pInfo;{    register char n;    swaps(&pInfo->leftSideBearing, n);    swaps(&pInfo->rightSideBearing, n);    swaps(&pInfo->characterWidth, n);    swaps(&pInfo->ascent, n);    swaps(&pInfo->descent, n);    swaps(&pInfo->attributes, n);}static voidSwapFontInfo(pr)    xQueryFontReply *pr;{    register char		n;    swaps(&pr->minCharOrByte2, n);    swaps(&pr->maxCharOrByte2, n);    swaps(&pr->defaultChar, n);    swaps(&pr->nFontProps, n);    swaps(&pr->fontAscent, n);    swaps(&pr->fontDescent, n);    SwapCharInfo( &pr->minBounds);    SwapCharInfo( &pr->maxBounds);    swapl(&pr->nCharInfos, n);}#ifndef LBXstatic#endifvoidSwapFont( pr, hasGlyphs)    xQueryFontReply *	pr;    Bool hasGlyphs;{    unsigned	i;    xCharInfo *	pxci;    unsigned	nchars, nprops;    char	*pby;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -