Exemplo n.º 1
0
int
SProcCreateGlyphCursor (ClientPtr client)
{
    char n;
    REQUEST(xCreateGlyphCursorReq);
    swaps(&stuff->length, n);
    REQUEST_SIZE_MATCH(xCreateGlyphCursorReq);
    swapl(&stuff->cid, n);
    swapl(&stuff->source, n);
    swapl(&stuff->mask, n);
    swaps(&stuff->sourceChar, n);
    swaps(&stuff->maskChar, n);
    swaps(&stuff->foreRed, n);
    swaps(&stuff->foreGreen, n);
    swaps(&stuff->foreBlue, n);
    swaps(&stuff->backRed, n);
    swaps(&stuff->backGreen, n);
    swaps(&stuff->backBlue, n);
    return((* ProcVector[X_CreateGlyphCursor])(client));
}
Exemplo n.º 2
0
void XETSwWarpPointer(register xWarpPointerReq *data)
{
    register char n;
    swaps(&(data->length), n);
    swapl(&(data->srcWid), n);
    swapl(&(data->dstWid), n);
    swaps(&(data->srcX), n);
    swaps(&(data->srcY), n);
    swaps(&(data->srcWidth), n);
    swaps(&(data->srcHeight), n);
    swaps(&(data->dstX), n);
    swaps(&(data->dstY), n);
}
Exemplo n.º 3
0
static int
SProcShmPutImage(ClientPtr client)
{
    REQUEST(xShmPutImageReq);
    swaps(&stuff->length);
    REQUEST_SIZE_MATCH(xShmPutImageReq);
    swapl(&stuff->drawable);
    swapl(&stuff->gc);
    swaps(&stuff->totalWidth);
    swaps(&stuff->totalHeight);
    swaps(&stuff->srcX);
    swaps(&stuff->srcY);
    swaps(&stuff->srcWidth);
    swaps(&stuff->srcHeight);
    swaps(&stuff->dstX);
    swaps(&stuff->dstY);
    swapl(&stuff->shmseg);
    swapl(&stuff->offset);
    return ProcShmPutImage(client);
}
Exemplo n.º 4
0
int
ProcRRGetCrtcTransform(ClientPtr client)
{
    REQUEST(xRRGetCrtcTransformReq);
    xRRGetCrtcTransformReply *reply;
    RRCrtcPtr crtc;
    int nextra;
    RRTransformPtr current, pending;
    char *extra;

    REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq);
    VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);

    pending = &crtc->client_pending_transform;
    current = &crtc->client_current_transform;

    nextra = (transform_filter_length(pending) +
              transform_filter_length(current));

    reply = malloc(sizeof(xRRGetCrtcTransformReply) + nextra);
    if (!reply)
        return BadAlloc;

    extra = (char *) (reply + 1);
    reply->type = X_Reply;
    reply->sequenceNumber = client->sequence;
    reply->length = bytes_to_int32(CrtcTransformExtra + nextra);

    reply->hasTransforms = crtc->transforms;

    transform_encode(client, &reply->pendingTransform, &pending->transform);
    extra += transform_filter_encode(client, extra,
                                     &reply->pendingNbytesFilter,
                                     &reply->pendingNparamsFilter, pending);

    transform_encode(client, &reply->currentTransform, &current->transform);
    extra += transform_filter_encode(client, extra,
                                     &reply->currentNbytesFilter,
                                     &reply->currentNparamsFilter, current);

    if (client->swapped) {
        swaps(&reply->sequenceNumber);
        swapl(&reply->length);
    }
    WriteToClient(client, sizeof(xRRGetCrtcTransformReply) + nextra,
                  (char *) reply);
    free(reply);
    return Success;
}
Exemplo n.º 5
0
static int
SWriteListImageFormatsReply(
   ClientPtr client,
   xvListImageFormatsReply *rep
){
  char n;

  swaps(&rep->sequenceNumber, n);
  swapl(&rep->length, n);
  swapl(&rep->num_formats, n);

  (void)WriteToClient(client, sz_xvListImageFormatsReply, (char *)rep);

  return Success;
}
Exemplo n.º 6
0
static int
SWriteGetPortAttributeReply(
   ClientPtr client,
   xvGetPortAttributeReply *rep
){
  char n;

  swaps(&rep->sequenceNumber, n);
  swapl(&rep->length, n);
  swapl(&rep->value, n);

  (void)WriteToClient(client, sz_xvGetPortAttributeReply, (char *)rep);

  return Success;
}
Exemplo n.º 7
0
/* reply handling for the first bytes that constitute the reply */
static void reply_XIQueryDevice(ClientPtr client, int len, char* data, void *userdata)
{
    xXIQueryDeviceReply *rep = (xXIQueryDeviceReply*)data;
    struct test_data *querydata = (struct test_data*)userdata;

    if (client->swapped)
    {
        swapl(&rep->length);
        swaps(&rep->sequenceNumber);
        swaps(&rep->num_devices);
    }

    reply_check_defaults(rep, len, XIQueryDevice);

    if (querydata->which_device == XIAllDevices)
        assert(rep->num_devices == devices.num_devices);
    else if (querydata->which_device == XIAllMasterDevices)
        assert(rep->num_devices == devices.num_master_devices);
    else
        assert(rep->num_devices == 1);

    querydata->num_devices_in_reply = rep->num_devices;
    reply_handler = reply_XIQueryDevice_data;
}
Exemplo n.º 8
0
static void
request_XISetClientPointer(xXISetClientPointerReq * req, int error)
{
    int rc;

    client_request = init_client(req->length, req);

    rc = ProcXISetClientPointer(&client_request);
    assert(rc == error);

    if (rc == BadDevice)
        assert(client_request.errorValue == req->deviceid);

    client_request.swapped = TRUE;
    swapl(&req->win);
    swaps(&req->length);
    swaps(&req->deviceid);
    rc = SProcXISetClientPointer(&client_request);
    assert(rc == error);

    if (rc == BadDevice)
        assert(client_request.errorValue == req->deviceid);

}
Exemplo n.º 9
0
int main(void)
{
 
 printf("Here are some swaps: ");
 int x = GetInt();
 int y = GetInt();
 
 
 printf("%i", x);
 printf("%i", y);
 swaps(1, 2);
 
 printf("%i", x);
 printf("%i", y);   
}
Exemplo n.º 10
0
static int
ProcXF86DRIQueryVersion(
    register ClientPtr client
)
{
    xXF86DRIQueryVersionReply rep;

    REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq);
    rep.type = X_Reply;
    rep.length = 0;
    rep.sequenceNumber = client->sequence;
    rep.majorVersion = SERVER_XF86DRI_MAJOR_VERSION;
    rep.minorVersion = SERVER_XF86DRI_MINOR_VERSION;
    rep.patchVersion = SERVER_XF86DRI_PATCH_VERSION;
    if (client->swapped) {
	swaps(&rep.sequenceNumber);
	swapl(&rep.length);
	swaps(&rep.majorVersion);
	swaps(&rep.minorVersion);
	swapl(&rep.patchVersion);
    }
    WriteToClient(client, sizeof(xXF86DRIQueryVersionReply), (char *)&rep);
    return Success;
}
Exemplo n.º 11
0
static void
SwapDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info)
{
    char n;
    char *any = (char*)&info[1];
    int i;

    /* Skip over name */
    any += pad_to_int32(info->name_len);

    for (i = 0; i < info->num_classes; i++)
    {
        int len = ((xXIAnyInfo*)any)->length;
        switch(((xXIAnyInfo*)any)->type)
        {
            case XIButtonClass:
                SwapButtonInfo(dev, (xXIButtonInfo*)any);
                break;
            case XIKeyClass:
                SwapKeyInfo(dev, (xXIKeyInfo*)any);
                break;
            case XIValuatorClass:
                SwapValuatorInfo(dev, (xXIValuatorInfo*)any);
                break;
        }

        any += len * 4;
    }

    swaps(&info->deviceid, n);
    swaps(&info->use, n);
    swaps(&info->attachment, n);
    swaps(&info->num_classes, n);
    swaps(&info->name_len, n);

}
Exemplo n.º 12
0
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);
}
static int
ProcSecurityQueryVersion(
    ClientPtr client)
{
    /* REQUEST(xSecurityQueryVersionReq); */
    xSecurityQueryVersionReply 	rep;

    REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
    rep.type        	= X_Reply;
    rep.sequenceNumber 	= client->sequence;
    rep.length         	= 0;
    rep.majorVersion  	= SERVER_SECURITY_MAJOR_VERSION;
    rep.minorVersion  	= SERVER_SECURITY_MINOR_VERSION;
    if(client->swapped)
    {
	char n;
    	swaps(&rep.sequenceNumber, n);
	swaps(&rep.majorVersion, n);
	swaps(&rep.minorVersion, n);
    }
    (void)WriteToClient(client, SIZEOF(xSecurityQueryVersionReply),
			(char *)&rep);
    return Success;
} /* ProcSecurityQueryVersion */
Exemplo n.º 14
0
static int
SProcLbxGetProperty(ClientPtr client)
{
    register int n;

    REQUEST(xLbxGetPropertyReq);

    swaps(&stuff->length, n);
    swapl(&stuff->window, n);
    swapl(&stuff->property, n);
    swapl(&stuff->type, n);
    swapl(&stuff->longOffset, n);
    swapl(&stuff->longLength, n);
    return ProcLbxGetProperty(client);
}
Exemplo n.º 15
0
int
SProcXChangeDeviceControl(ClientPtr client)
{
    xDeviceCtl *ctl;

    REQUEST(xChangeDeviceControlReq);
    swaps(&stuff->length);
    REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
    swaps(&stuff->control);
    ctl = (xDeviceCtl *) &stuff[1];
    swaps(&ctl->control);
    swaps(&ctl->length);
    switch (stuff->control) {
    case DEVICE_ABS_CALIB:
    case DEVICE_ABS_AREA:
    case DEVICE_CORE:
    case DEVICE_ENABLE:
    case DEVICE_RESOLUTION:
        /* hmm. beer. *drool* */
        break;

    }
    return (ProcXChangeDeviceControl(client));
}
Exemplo n.º 16
0
static void
SDeviceLeaveNotifyEvent (xXILeaveEvent *from, xXILeaveEvent *to)
{
    char n;

    *to = *from;
    swaps(&to->sequenceNumber,n);
    swapl(&to->length, n);
    swaps(&to->evtype, n);
    swaps(&to->deviceid, n);
    swapl(&to->time, n);
    swapl(&to->root, n);
    swapl(&to->event, n);
    swapl(&to->child, n);
    swapl(&to->root_x, n);
    swapl(&to->root_y, n);
    swapl(&to->event_x, n);
    swapl(&to->event_y, n);
    swaps(&to->sourceid, n);
    swaps(&to->buttons_len, n);
    swapl(&to->mods.base_mods, n);
    swapl(&to->mods.latched_mods, n);
    swapl(&to->mods.locked_mods, n);
}
Exemplo n.º 17
0
/**
 * Run a single test with server version smaj.smin and client
 * version cmaj.cmin. Verify that return code is equal to 'error'.
 *
 * Test is run normal, then for a swapped client.
 */
static void request_XIQueryVersion(int smaj, int smin, int cmaj, int cmin, int error)
{
    char n;
    int rc;
    struct test_data versions;
    xXIQueryVersionReq request;
    ClientRec client;

    request_init(&request, XIQueryVersion);
    client = init_client(request.length, &request);
    userdata = (void*)&versions;

    /* Change the server to support smaj.smin */
    XIVersion.major_version = smaj;
    XIVersion.minor_version = smin;

    /* remember versions we send and expect */
    versions.major_client = cmaj;
    versions.minor_client = cmin;
    versions.major_server = XIVersion.major_version;
    versions.minor_server = XIVersion.minor_version;

    request.major_version = versions.major_client;
    request.minor_version = versions.minor_client;
    rc = ProcXIQueryVersion(&client);
    g_assert(rc == error);

    client.swapped = TRUE;

    swaps(&request.length, n);
    swaps(&request.major_version, n);
    swaps(&request.minor_version, n);

    rc = SProcXIQueryVersion(&client);
    g_assert(rc == error);
}
Exemplo n.º 18
0
int _X_COLD
SProcXIPassiveUngrabDevice(ClientPtr client)
{
    int i;
    uint32_t *modifiers;

    REQUEST(xXIPassiveUngrabDeviceReq);
    REQUEST_AT_LEAST_SIZE(xXIPassiveUngrabDeviceReq);

    swaps(&stuff->length);
    swapl(&stuff->grab_window);
    swaps(&stuff->deviceid);
    swapl(&stuff->detail);
    swaps(&stuff->num_modifiers);

    REQUEST_FIXED_SIZE(xXIPassiveUngrabDeviceReq,
                       ((uint32_t) stuff->num_modifiers) << 2);
    modifiers = (uint32_t *) &stuff[1];

    for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
        swapl(modifiers);

    return ProcXIPassiveUngrabDevice(client);
}
Exemplo n.º 19
0
static void
SDeviceStateNotifyEvent(deviceStateNotify * from, deviceStateNotify * to)
{
    int i;
    char n;
    INT32 *ip B32;

    *to = *from;
    swaps(&to->sequenceNumber, n);
    swapl(&to->time, n);
    ip = &to->valuator0;
    for (i = 0; i < 3; i++) {
        swapl((ip + i), n);	/* macro - braces are required      */
    }
}
Exemplo n.º 20
0
void XETSwChangeKeyboardMapping   (register xChangeKeyboardMappingReq *data)
{
    register char n;
    register long *p;
    register int i, count;

    swaps(&(data->length), n);
    p = (long *)&(data[1]);
    count = data->keyCodes * data->keySymsPerKeyCode;
    for(i = 0; i < count; i++)
    {
        swapl(p, n);
        p++;
    }
}
Exemplo n.º 21
0
void XETSwSendEvent(register xSendEventReq *data)
{
    register char n;
    xEvent eventT;
    void (*proc)();
    swapl(&(data->destination), n);
    swapl(&(data->eventMask), n);

    /* Swap event */
    proc = EventSwapVector[data->event.u.u.type & 0177];
    if (!proc || (int (*)()) proc == (int (*)()) NotImplemented)   
        (*proc)(&(data->event), &eventT);
    data->event = eventT;
    swaps(&(data->length), n);
}
Exemplo n.º 22
0
Arquivo: shm.c Projeto: Agnarr/xserver
static int
SProcShmPutImage(ClientPtr client)
{
    int n;
    REQUEST(xShmPutImageReq);
    swaps(&stuff->length, n);
    REQUEST_SIZE_MATCH(xShmPutImageReq);
    swapl(&stuff->drawable, n);
    swapl(&stuff->gc, n);
    swaps(&stuff->totalWidth, n);
    swaps(&stuff->totalHeight, n);
    swaps(&stuff->srcX, n);
    swaps(&stuff->srcY, n);
    swaps(&stuff->srcWidth, n);
    swaps(&stuff->srcHeight, n);
    swaps(&stuff->dstX, n);
    swaps(&stuff->dstY, n);
    swapl(&stuff->shmseg, n);
    swapl(&stuff->offset, n);
    return ProcShmPutImage(client);
}
Exemplo n.º 23
0
static int
ProcEVIGetVisualInfo(ClientPtr client)
{
    REQUEST(xEVIGetVisualInfoReq);
    xEVIGetVisualInfoReply rep;
    int i, n, n_conflict, n_info, sz_info, sz_conflict;
    VisualID32 *conflict;
    unsigned int total_visuals = 0;
    xExtendedVisualInfo *eviInfo;
    int status;

    /*
     * do this first, otherwise REQUEST_FIXED_SIZE can overflow.  we assume
     * here that you don't have more than 2^32 visuals over all your screens;
     * this seems like a safe assumption.
     */
    for (i = 0; i < screenInfo.numScreens; i++)
	total_visuals += screenInfo.screens[i]->numVisuals;
    if (stuff->n_visual > total_visuals) {
	return BadValue;
    }

    REQUEST_FIXED_SIZE(xEVIGetVisualInfoReq, stuff->n_visual * sz_VisualID32);
    status = eviPriv->getVisualInfo((VisualID32 *)&stuff[1], (int)stuff->n_visual,
		&eviInfo, &n_info, &conflict, &n_conflict);
    if (status != Success)
	return status;
    sz_info = n_info * sz_xExtendedVisualInfo;
    sz_conflict = n_conflict * sz_VisualID32;
    rep.type = X_Reply;
    rep.n_info = n_info;
    rep.n_conflicts = n_conflict;
    rep.sequenceNumber = client->sequence;
    rep.length = (sz_info + sz_conflict) >> 2;
    if (client->swapped) {
    	swaps(&rep.sequenceNumber, n);
    	swapl(&rep.length, n);
    	swapl(&rep.n_info, n);
    	swapl(&rep.n_conflicts, n);
	swapEviInfo(eviInfo, n_info);
	swapVisual(conflict, n_conflict);
    }
    WriteToClient(client, sz_xEVIGetVisualInfoReply, (char *)&rep);
    WriteToClient(client, sz_info, (char *)eviInfo);
    WriteToClient(client, sz_conflict, (char *)conflict);
    eviPriv->freeVisualInfo(eviInfo, conflict);
    return (client->noClientException);
}
Exemplo n.º 24
0
static void
swapCharInfo(xCharInfo * pCI)
{
    swaps(&pCI->leftSideBearing);
    swaps(&pCI->rightSideBearing);
    swaps(&pCI->characterWidth);
    swaps(&pCI->ascent);
    swaps(&pCI->descent);
    swaps(&pCI->attributes);
}
Exemplo n.º 25
0
void XETSwCopyArea(register xCopyAreaReq *data)
{
    register char n;
    swaps(&(data->length), n);
    swapl(&(data->srcDrawable), n);
    swapl(&(data->dstDrawable), n);
    swapl(&(data->gc), n);
    swaps(&(data->srcX), n);
    swaps(&(data->srcY), n);
    swaps(&(data->dstX), n);
    swaps(&(data->dstY), n);
    swaps(&(data->width), n);
    swaps(&(data->height), n);
}
Exemplo n.º 26
0
static int
SWriteQueryPortAttributesReply(
   ClientPtr client,
   xvQueryPortAttributesReply *rep
){
  char n;

  swaps(&rep->sequenceNumber, n);
  swapl(&rep->length, n);
  swapl(&rep->num_attributes, n);
  swapl(&rep->text_size, n);

  (void)WriteToClient(client, sz_xvQueryPortAttributesReply, (char *)rep);

  return Success;
}
Exemplo n.º 27
0
int
SProcStoreColors(ClientPtr client)
{
    char n;
    long count;
    xColorItem 	*pItem;

    REQUEST(xStoreColorsReq);
    swaps(&stuff->length, n);
    REQUEST_AT_LEAST_SIZE(xStoreColorsReq);
    swapl(&stuff->cmap, n);
    pItem = (xColorItem *) &stuff[1];
    for(count = LengthRestB(stuff)/sizeof(xColorItem); --count >= 0; )
	SwapColorItem(pItem++);
    return((* ProcVector[X_StoreColors])(client));
}
Exemplo n.º 28
0
static int
ProcGEQueryVersion(ClientPtr client)
{
    GEClientInfoPtr pGEClient = GEGetClient(client);
    xGEQueryVersionReply rep;

    REQUEST(xGEQueryVersionReq);

    REQUEST_SIZE_MATCH(xGEQueryVersionReq);

    rep = (xGEQueryVersionReply) {
        .repType = X_Reply,
        .RepType = X_GEQueryVersion,
        .sequenceNumber = client->sequence,
        .length = 0,

        /* return the supported version by the server */
        .majorVersion = SERVER_GE_MAJOR_VERSION,
        .minorVersion = SERVER_GE_MINOR_VERSION
    };

    /* Remember version the client requested */
    pGEClient->major_version = stuff->majorVersion;
    pGEClient->minor_version = stuff->minorVersion;

    if (client->swapped) {
        swaps(&rep.sequenceNumber);
        swapl(&rep.length);
        swaps(&rep.majorVersion);
        swaps(&rep.minorVersion);
    }

    WriteToClient(client, sizeof(xGEQueryVersionReply), &rep);
    return Success;
}

int (*ProcGEVector[GENumberRequests]) (ClientPtr) = {
    /* Version 1.0 */
ProcGEQueryVersion};

/************************************************************/
/*                swapped request handlers                  */
/************************************************************/
static int
SProcGEQueryVersion(ClientPtr client)
{
    REQUEST(xGEQueryVersionReq);

    swaps(&stuff->length);
    REQUEST_SIZE_MATCH(xGEQueryVersionReq);
    swaps(&stuff->majorVersion);
    swaps(&stuff->minorVersion);
    return (*ProcGEVector[stuff->ReqType]) (client);
}
Exemplo n.º 29
0
static int
SProcXkbSetGeometry(ClientPtr client)
{
register int	n;

    REQUEST(xkbSetGeometryReq);

    swaps(&stuff->length,n);
    REQUEST_AT_LEAST_SIZE(xkbSetGeometryReq);
    swaps(&stuff->deviceSpec,n);
    swapl(&stuff->name,n);
    swaps(&stuff->widthMM,n);
    swaps(&stuff->heightMM,n);
    swaps(&stuff->nProperties,n);
    swaps(&stuff->nColors,n);
    swaps(&stuff->nDoodads,n);
    swaps(&stuff->nKeyAliases,n);
    return ProcXkbSetGeometry(client);
}
Exemplo n.º 30
0
int
SProcRecolorCursor (ClientPtr client)
{
    char n;
    REQUEST(xRecolorCursorReq);
    swaps(&stuff->length, n);
    REQUEST_SIZE_MATCH(xRecolorCursorReq);
    swapl(&stuff->cursor, n);
    swaps(&stuff->foreRed, n);
    swaps(&stuff->foreGreen, n);
    swaps(&stuff->foreBlue, n);
    swaps(&stuff->backRed, n);
    swaps(&stuff->backGreen, n);
    swaps(&stuff->backBlue, n);
    return((* ProcVector[X_RecolorCursor])(client));
}