static int ProcEVIGetVisualInfo(ClientPtr client) { REQUEST(xEVIGetVisualInfoReq); xEVIGetVisualInfoReply rep; int n, n_conflict, n_info, sz_info, sz_conflict; VisualID32 *conflict; xExtendedVisualInfo *eviInfo; int status; 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); }
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); }