コード例 #1
0
ファイル: rrcrtc.c プロジェクト: kthxbyte/xorg-wm8850
static int
transform_filter_encode (ClientPtr client, char *output,
			 CARD16	*nbytesFilter,
			 CARD16	*nparamsFilter,
			 RRTransformPtr transform)
{
    int	    nbytes, nparams;
    int	    n;

    if (transform->filter == NULL) {
	*nbytesFilter = 0;
	*nparamsFilter = 0;
	return 0;
    }
    nbytes = strlen (transform->filter->name);
    nparams = transform->nparams;
    *nbytesFilter = nbytes;
    *nparamsFilter = nparams;
    memcpy (output, transform->filter->name, nbytes);
    while ((nbytes & 3) != 0)
	output[nbytes++] = 0;
    memcpy (output + nbytes, transform->params, nparams * sizeof (xFixed));
    if (client->swapped) {
	swaps (nbytesFilter, n);
	swaps (nparamsFilter, n);
	SwapLongs ((CARD32 *) (output + nbytes), nparams);
    }
    nbytes += nparams * sizeof (xFixed);
    return nbytes;
}
コード例 #2
0
ファイル: rrcrtc.c プロジェクト: kthxbyte/xorg-wm8850
static void
transform_encode (ClientPtr client, xRenderTransform *wire, PictTransform *pict)
{
    xRenderTransform_from_PictTransform (wire, pict);
    if (client->swapped)
	SwapLongs ((CARD32 *) wire, bytes_to_int32(sizeof(xRenderTransform)));
}
コード例 #3
0
static int
SProcSecurityGenerateAuthorization(
    ClientPtr client)
{
    REQUEST(xSecurityGenerateAuthorizationReq);
    char	n;
    CARD32 *values;
    unsigned long nvalues;
    int values_offset;

    swaps(&stuff->length, n);
    REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
    swaps(&stuff->nbytesAuthProto, n);
    swaps(&stuff->nbytesAuthData, n);
    swapl(&stuff->valueMask, n);
    values_offset = bytes_to_int32(stuff->nbytesAuthProto) +
		    bytes_to_int32(stuff->nbytesAuthData);
    if (values_offset > 
	stuff->length - bytes_to_int32(sz_xSecurityGenerateAuthorizationReq))
	return BadLength;
    values = (CARD32 *)(&stuff[1]) + values_offset;
    nvalues = (((CARD32 *)stuff) + stuff->length) - values;
    SwapLongs(values, nvalues);
    return ProcSecurityGenerateAuthorization(client);
} /* SProcSecurityGenerateAuthorization */
コード例 #4
0
ファイル: sendexev.c プロジェクト: 4eremuxa/xserver
int
SProcXSendExtensionEvent(ClientPtr client)
{
    CARD32 *p;
    int i;
    xEvent eventT;
    xEvent *eventP;
    EventSwapPtr proc;

    REQUEST(xSendExtensionEventReq);
    swaps(&stuff->length);
    REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
    swapl(&stuff->destination);
    swaps(&stuff->count);

    if (stuff->length != bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
       bytes_to_int32(stuff->num_events * sizeof(xEvent)))
       return BadLength;

    eventP = (xEvent *) & stuff[1];
    for (i = 0; i < stuff->num_events; i++, eventP++) {
	proc = EventSwapVector[eventP->u.u.type & 0177];
	if (proc == NotImplemented)	/* no swapping proc; invalid event type? */
	    return BadValue;
	(*proc) (eventP, &eventT);
	*eventP = eventT;
    }

    p = (CARD32 *)(((xEvent *) & stuff[1]) + stuff->num_events);
    SwapLongs(p, stuff->count);
    return (ProcXSendExtensionEvent(client));
}
コード例 #5
0
ファイル: chgkmap.c プロジェクト: jon-turney/xorg-server
int _X_COLD
SProcXChangeDeviceKeyMapping(ClientPtr client)
{
    unsigned int count;

    REQUEST(xChangeDeviceKeyMappingReq);
    swaps(&stuff->length);
    REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
    count = stuff->keyCodes * stuff->keySymsPerKeyCode;
    REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));
    SwapLongs((CARD32 *) (&stuff[1]), count);
    return (ProcXChangeDeviceKeyMapping(client));
}
コード例 #6
0
ファイル: rrsdispatch.c プロジェクト: mirror/xserver
static int _X_COLD
SProcRRSetCrtcTransform(ClientPtr client)
{
    int nparams;
    char *filter;
    CARD32 *params;

    REQUEST(xRRSetCrtcTransformReq);

    REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
    swaps(&stuff->length);
    swapl(&stuff->crtc);
    SwapLongs((CARD32 *) &stuff->transform,
              bytes_to_int32(sizeof(xRenderTransform)));
    swaps(&stuff->nbytesFilter);
    filter = (char *) (stuff + 1);
    params = (CARD32 *) (filter + pad_to_int32(stuff->nbytesFilter));
    nparams = ((CARD32 *) stuff + client->req_len) - params;
    if (nparams < 0)
        return BadLength;

    SwapLongs(params, nparams);
    return (*ProcRandrVector[stuff->randrReqType]) (client);
}
コード例 #7
0
ファイル: xtrapdiswp.c プロジェクト: Magister/x11rdp_xorg71
void XETSwChangeProperty(register xChangePropertyReq *data)
{
    register char n;
    swaps(&(data->length), n);
    swapl(&(data->window), n);
    swapl(&(data->property), n);
    swapl(&(data->type), n);
    switch ( data->format ) {
        case 8L : break;
        case 16L:
            SwapShorts((short *)(data + 1), data->nUnits);
        break;
    case 32L:
            SwapLongs((CARD32 *)(data + 1), data->nUnits);
        break;
    }
    swapl(&(data->nUnits), n);
}
コード例 #8
0
ファイル: grabdev.c プロジェクト: dlespiau/xserver
int
SProcXGrabDevice(ClientPtr client)
{
    REQUEST(xGrabDeviceReq);
    swaps(&stuff->length);
    REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
    swapl(&stuff->grabWindow);
    swapl(&stuff->time);
    swaps(&stuff->event_count);

    if (stuff->length !=
        bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
        return BadLength;

    SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);

    return (ProcXGrabDevice(client));
}
コード例 #9
0
ファイル: xvdisp.c プロジェクト: eriytt/xserver-xsdl
static int 
ProcXvQueryImageAttributes(ClientPtr client)
{
  xvQueryImageAttributesReply rep;
  int size, num_planes, i;
  CARD16 width, height;
  XvImagePtr pImage = NULL;
  XvPortPtr pPort;
  int *offsets;
  int *pitches;
  int planeLength;
  REQUEST(xvQueryImageAttributesReq);

  REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);

  VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
  
  for(i = 0; i < pPort->pAdaptor->nImages; i++) {
      if(pPort->pAdaptor->pImages[i].id == stuff->id) {
	  pImage = &(pPort->pAdaptor->pImages[i]);
	  break;
      }
  }

#ifdef XvMCExtension
  if(!pImage)
     pImage = XvMCFindXvImage(pPort, stuff->id);
#endif

  if(!pImage)
     return BadMatch;

  num_planes = pImage->num_planes;

  if(!(offsets = malloc(num_planes << 3)))
	return BadAlloc;
  pitches = offsets + num_planes;

  width = stuff->width;
  height = stuff->height;

  size = (*pPort->pAdaptor->ddQueryImageAttributes)(client, pPort, pImage,
					&width, &height, offsets, pitches);

  rep.type = X_Reply;
  rep.sequenceNumber = client->sequence;
  rep.length = planeLength = num_planes << 1;
  rep.num_planes = num_planes;
  rep.width = width;
  rep.height = height;
  rep.data_size = size;
 
  _WriteQueryImageAttributesReply(client, &rep);
  if(client->swapped)
    SwapLongs((CARD32*)offsets, planeLength);
  WriteToClient(client, planeLength << 2, (char*)offsets);

  free(offsets);

  return Success;
}
コード例 #10
0
ファイル: sendexev.c プロジェクト: jon-turney/xorg-server
int _X_COLD
SProcXSendExtensionEvent(ClientPtr client)
{
    CARD32 *p;
    int i;
    xEvent eventT = { .u.u.type = 0 };
    xEvent *eventP;
    EventSwapPtr proc;

    REQUEST(xSendExtensionEventReq);
    swaps(&stuff->length);
    REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
    swapl(&stuff->destination);
    swaps(&stuff->count);

    if (stuff->length !=
        bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
        bytes_to_int32(stuff->num_events * sizeof(xEvent)))
        return BadLength;

    eventP = (xEvent *) &stuff[1];
    for (i = 0; i < stuff->num_events; i++, eventP++) {
        if (eventP->u.u.type == GenericEvent) {
            client->errorValue = eventP->u.u.type;
            return BadValue;
        }

        proc = EventSwapVector[eventP->u.u.type & 0177];
        /* no swapping proc; invalid event type? */
        if (proc == NotImplemented) {
            client->errorValue = eventP->u.u.type;
            return BadValue;
        }
        (*proc) (eventP, &eventT);
        *eventP = eventT;
    }

    p = (CARD32 *) (((xEvent *) &stuff[1]) + stuff->num_events);
    SwapLongs(p, stuff->count);
    return (ProcXSendExtensionEvent(client));
}

/***********************************************************************
 *
 * Send an event to some client, as if it had come from an extension input
 * device.
 *
 */

int
ProcXSendExtensionEvent(ClientPtr client)
{
    int ret, i;
    DeviceIntPtr dev;
    xEvent *first;
    XEventClass *list;
    struct tmask tmp[EMASKSIZE];

    REQUEST(xSendExtensionEventReq);
    REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);

    if (stuff->length !=
        bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
        (stuff->num_events * bytes_to_int32(sizeof(xEvent))))
        return BadLength;

    ret = dixLookupDevice(&dev, stuff->deviceid, client, DixWriteAccess);
    if (ret != Success)
        return ret;

    if (stuff->num_events == 0)
        return ret;

    /* The client's event type must be one defined by an extension. */

    first = ((xEvent *) &stuff[1]);
    for (i = 0; i < stuff->num_events; i++) {
        if (!((EXTENSION_EVENT_BASE <= first[i].u.u.type) &&
            (first[i].u.u.type < lastEvent))) {
            client->errorValue = first[i].u.u.type;
            return BadValue;
        }
    }

    list = (XEventClass *) (first + stuff->num_events);
    if ((ret = CreateMaskFromList(client, list, stuff->count, tmp, dev,
                                  X_SendExtensionEvent)) != Success)
        return ret;

    ret = (SendEvent(client, dev, stuff->destination,
                     stuff->propagate, (xEvent *) &stuff[1],
                     tmp[stuff->deviceid].mask, stuff->num_events));

    return ret;
}
コード例 #11
0
ファイル: lbxdix.c プロジェクト: aosm/X11
int
LbxSendConnSetup(ClientPtr   client,
		 char       *reason)
{
    int		dlength;
    int         i, ndex, lim, wndex;
    CARD32      dataBuf[16];
    xLbxConnSetupPrefix csp;
    NewClientInfoRec nci;
    LbxProxyPtr proxy = LbxProxy(client);

    if (reason) {
	SendConnSetup(client, reason);
	LbxForceOutput(proxy); /* expedient to avoid another state variable */
	return (client->noClientException);
    }

    IncrementClientCount();

    client->requestVector = client->swapped ? SwappedProcVector : ProcVector;
    client->sequence = 0;
    dataBuf[0] = client->clientAsMask;

    csp.success = TRUE;
    csp.majorVersion = connSetupPrefix.majorVersion;
    csp.minorVersion = connSetupPrefix.minorVersion;
    csp.tag = 0;
#ifdef XAPPGROUP
    if (!client->appgroup) {
#endif
    csp.changeType = 1; /* LbxNormalDeltas */
    csp.length = 2 +			/* tag + resource-id-base */
		 screenInfo.numScreens; /* input-mask per screen */
    wndex = 0; ndex = 1; lim = screenInfo.numScreens;
#ifdef XAPPGROUP
    } else {
	csp.changeType = 2; /* LbxAppGroupDeltas */
	csp.length = 7 + /* tag, res-id-base, root, visual, colormap, b&w-pix */
		     1 + screenInfo.numScreens - screenInfo.numVideoScreens;
	XagGetDeltaInfo (client, &dataBuf[1]);
	for (i = 0; i < MAXSCREENS; i++) {
	    if ((CARD32) WindowTable[i]->drawable.id == dataBuf[1]) {
		dataBuf[6] =  WindowTable[i]->eventMask | wOtherEventMasks(WindowTable[i]);
		break;
	    }
	}
	wndex = screenInfo.numVideoScreens;
	ndex = 7;
	lim = screenInfo.numScreens - screenInfo.numVideoScreens;
    }
#endif
    for (i = 0; i < lim; i++, ndex++, wndex++) {
	dataBuf[ndex] = 
	    WindowTable[wndex]->eventMask | wOtherEventMasks(WindowTable[wndex]);
    }
    dlength = (csp.length - 1) << 2;

    if (LbxProxyClient(proxy)->swapped) {
	swaps(&csp.length, i);
    }

    if (client->swapped) {
	LbxWriteSConnSetupPrefix(client, &csp);
	SwapLongs(dataBuf, (1 + screenInfo.numScreens));
	WriteToClient(client, dlength, (pointer) dataBuf);
    } else {
	WriteToClient(client, sizeof(xLbxConnSetupPrefix), (char *) &csp);
	WriteToClient(client, dlength, (pointer) dataBuf);
    }

    LbxForceOutput(proxy); /* expedient to avoid another state variable */
    client->clientState = ClientStateRunning;
    if (ClientStateCallback) {
	if (LbxProxyClient(proxy)->swapped != client->swapped) {
	    swaps(&csp.length, i);
	}
	nci.client = client;
	nci.prefix = (xConnSetupPrefix*) &csp;
	nci.setup = (xConnSetup *) ConnectionInfo;
	CallCallbacks(&ClientStateCallback, (pointer) &nci);
    }

    return client->noClientException;
}