From 286d83260216e8e53db701eed5c785aae1c716bf Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 29 Jun 2016 01:36:31 +0200 Subject: Use internal temp variable for swap macros. Make swaps/swapl type safe (introducing wrong_size check at build time). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While working on this changeset, various spots got discovered where swapl or swaps was used on a wrong type, where byte swapping calls had been forgotten or done on the wrong variable. This backport at least includes changes from the following X.org commits, listed in non-chronological order: commit 2c7c520cfe0df30f4bc3adba59d9c62582823bf8 Author: Matt Turner Date: Thu Aug 4 15:35:41 2011 -0400 Use internal temp variable for swap macros Also, fix whitespace, mainly around swaps(&rep.sequenceNumber) Reviewed-by: Peter Harris Signed-off-by: Matt Turner commit 9edcae78c46286baff42e74bfe26f6ae4d00fe01 Author: Matt Turner Date: Wed Sep 21 17:14:16 2011 -0400 Use correct swap{l,s} (or none at all for CARD8) Swapping the wrong size was never caught because swap{l,s} are macros. It's clear in the case of Xext/xres.c, that the author believed client_major/minor to be CARD16 from looking at the code in the first hunk. v2: dmx.c fixes from Keith. Reviewed-by: Peter Harris Signed-off-by: Matt Turner commit dab064fa5e0b1f5c67222562ad5367005832cba1 Author: Andrea Canciani Date: Tue Nov 2 20:10:32 2010 +0100 render: Fix byteswapping of gradient stops The function swapStops repeatedly swaps the color components as CARD16, but incorrectly steps over them as if they were CARD32. This causes half of the stops not to be swapped at all and some unrelated data be swapped instead. Signed-off-by: Andrea Canciani Reviewed-by: Soren Sandmann Reviewed-by: Julien Cristau Signed-off-by: Keith Packard commit 54770c980cd2b91a8377f975a58ed69def5cfa42 Author: Matt Turner Date: Tue Aug 16 16:59:07 2011 -0400 Cast char* buffers to swap functions Reviewed-by: Peter Harris Signed-off-by: Matt Turner commit 6844bd2e63490870bab3c469eec6030354ef2865 Author: Alan Coopersmith Date: Wed Jan 9 19:52:00 2008 -0800 More Xv extension byte swapping fixes commit e46f6ddeccd082b2d507a1e8b57ea30e6b0a2c83 Author: Michel Dänzer Date: Wed Jan 16 14:24:22 2008 +0100 Yet another Xv extension byte swapping fix. --- nx-X11/programs/Xserver/randr/rrcrtc.c | 98 +++-- nx-X11/programs/Xserver/randr/rrdispatch.c | 10 +- nx-X11/programs/Xserver/randr/rrmode.c | 7 +- nx-X11/programs/Xserver/randr/rrmonitor.c | 28 +- nx-X11/programs/Xserver/randr/rroutput.c | 34 +- nx-X11/programs/Xserver/randr/rrproperty.c | 43 +-- nx-X11/programs/Xserver/randr/rrprovider.c | 36 +- nx-X11/programs/Xserver/randr/rrproviderproperty.c | 42 +-- nx-X11/programs/Xserver/randr/rrscreen.c | 155 ++++---- nx-X11/programs/Xserver/randr/rrsdispatch.c | 411 ++++++++------------- nx-X11/programs/Xserver/randr/rrxinerama.c | 83 ++--- 11 files changed, 409 insertions(+), 538 deletions(-) (limited to 'nx-X11/programs/Xserver/randr') diff --git a/nx-X11/programs/Xserver/randr/rrcrtc.c b/nx-X11/programs/Xserver/randr/rrcrtc.c index 4c9b805c2..072046e14 100644 --- a/nx-X11/programs/Xserver/randr/rrcrtc.c +++ b/nx-X11/programs/Xserver/randr/rrcrtc.c @@ -997,7 +997,6 @@ ProcRRGetCrtcInfo(ClientPtr client) int i, j, k; int width, height; BoxRec panned_area; - int n; REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); @@ -1060,7 +1059,7 @@ ProcRRGetCrtcInfo(ClientPtr client) for (i = 0; i < crtc->numOutputs; i++) { outputs[i] = crtc->outputs[i]->id; if (client->swapped) - swapl(&outputs[i], n); + swapl(&outputs[i]); } k = 0; for (i = 0; i < pScrPriv->numOutputs; i++) @@ -1068,23 +1067,23 @@ ProcRRGetCrtcInfo(ClientPtr client) if (pScrPriv->outputs[i]->crtcs[j] == crtc) { possible[k] = pScrPriv->outputs[i]->id; if (client->swapped) - swapl(&possible[k], n); + swapl(&possible[k]); k++; } if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.timestamp, n); - swaps(&rep.x, n); - swaps(&rep.y, n); - swaps(&rep.width, n); - swaps(&rep.height, n); - swapl(&rep.mode, n); - swaps(&rep.rotation, n); - swaps(&rep.rotations, n); - swaps(&rep.nOutput, n); - swaps(&rep.nPossibleOutput, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.timestamp); + swaps(&rep.x); + swaps(&rep.y); + swaps(&rep.width); + swaps(&rep.height); + swapl(&rep.mode); + swaps(&rep.rotation); + swaps(&rep.rotations); + swaps(&rep.nOutput); + swaps(&rep.nPossibleOutput); } WriteToClient(client, sizeof(xRRGetCrtcInfoReply), (char *) &rep); if (extraLen) { @@ -1115,7 +1114,6 @@ ProcRRSetCrtcConfig(ClientPtr client) #endif i, j; CARD8 status; - int n; REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq); numOutputs = (stuff->length - bytes_to_int32(SIZEOF(xRRSetCrtcConfigReq))); @@ -1314,9 +1312,9 @@ ProcRRSetCrtcConfig(ClientPtr client) .newTimestamp = pScrPriv->lastSetTime.milliseconds }; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.newTimestamp, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.newTimestamp); } WriteToClient(client, sizeof(xRRSetCrtcConfigReply), (char *) &rep); @@ -1334,7 +1332,6 @@ ProcRRGetPanning(ClientPtr client) BoxRec total; BoxRec tracking; INT16 border[4]; - int n; REQUEST_SIZE_MATCH(xRRGetPanningReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); @@ -1372,21 +1369,21 @@ ProcRRGetPanning(ClientPtr client) } if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.timestamp, n); - swaps(&rep.left, n); - swaps(&rep.top, n); - swaps(&rep.width, n); - swaps(&rep.height, n); - swaps(&rep.track_left, n); - swaps(&rep.track_top, n); - swaps(&rep.track_width, n); - swaps(&rep.track_height, n); - swaps(&rep.border_left, n); - swaps(&rep.border_top, n); - swaps(&rep.border_right, n); - swaps(&rep.border_bottom, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.timestamp); + swaps(&rep.left); + swaps(&rep.top); + swaps(&rep.width); + swaps(&rep.height); + swaps(&rep.track_left); + swaps(&rep.track_top); + swaps(&rep.track_width); + swaps(&rep.track_height); + swaps(&rep.border_left); + swaps(&rep.border_top); + swaps(&rep.border_right); + swaps(&rep.border_bottom); } WriteToClient(client, sizeof(xRRGetPanningReply), (char *) &rep); return Success; @@ -1405,7 +1402,6 @@ ProcRRSetPanning(ClientPtr client) BoxRec tracking; INT16 border[4]; CARD8 status; - int n; REQUEST_SIZE_MATCH(xRRSetPanningReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); @@ -1456,9 +1452,9 @@ ProcRRSetPanning(ClientPtr client) .newTimestamp = pScrPriv->lastSetTime.milliseconds }; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.newTimestamp, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.newTimestamp); } WriteToClient(client, sizeof(xRRSetPanningReply), (char *) &rep); return Success; @@ -1470,7 +1466,6 @@ ProcRRGetCrtcGammaSize(ClientPtr client) REQUEST(xRRGetCrtcGammaSizeReq); xRRGetCrtcGammaSizeReply reply; RRCrtcPtr crtc; - int n; REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); @@ -1486,9 +1481,9 @@ ProcRRGetCrtcGammaSize(ClientPtr client) .size = crtc->gammaSize }; if (client->swapped) { - swaps(&reply.sequenceNumber, n); - swapl(&reply.length, n); - swaps(&reply.size, n); + swaps(&reply.sequenceNumber); + swapl(&reply.length); + swaps(&reply.size); } WriteToClient(client, sizeof(xRRGetCrtcGammaSizeReply), (char *) &reply); return Success; @@ -1502,7 +1497,6 @@ ProcRRGetCrtcGamma(ClientPtr client) RRCrtcPtr crtc; unsigned long len; char *extra = NULL; - int n; REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); @@ -1526,9 +1520,9 @@ ProcRRGetCrtcGamma(ClientPtr client) .size = crtc->gammaSize }; if (client->swapped) { - swaps(&reply.sequenceNumber, n); - swapl(&reply.length, n); - swaps(&reply.size, n); + swaps(&reply.sequenceNumber); + swapl(&reply.length); + swaps(&reply.size); } WriteToClient(client, sizeof(xRRGetCrtcGammaReply), (char *) &reply); if (crtc->gammaSize) { @@ -1620,7 +1614,6 @@ transform_filter_encode(ClientPtr client, char *output, CARD16 *nparamsFilter, RRTransformPtr transform) { int nbytes, nparams; - int n; if (transform->filter == NULL) { *nbytesFilter = 0; @@ -1636,8 +1629,8 @@ transform_filter_encode(ClientPtr client, char *output, output[nbytes++] = 0; memcpy(output + nbytes, transform->params, nparams * sizeof(xFixed)); if (client->swapped) { - swaps(nbytesFilter, n); - swaps(nparamsFilter, n); + swaps(nbytesFilter); + swaps(nparamsFilter); SwapLongs((CARD32 *) (output + nbytes), nparams); } nbytes += nparams * sizeof(xFixed); @@ -1662,7 +1655,6 @@ ProcRRGetCrtcTransform(ClientPtr client) int nextra; RRTransformPtr current, pending; char *extra; - int n; REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq); VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess); @@ -1695,8 +1687,8 @@ ProcRRGetCrtcTransform(ClientPtr client) &reply->currentNparamsFilter, current); if (client->swapped) { - swaps(&reply->sequenceNumber, n); - swapl(&reply->length, n); + swaps(&reply->sequenceNumber); + swapl(&reply->length); } WriteToClient(client, sizeof(xRRGetCrtcTransformReply) + nextra, (char *) reply); diff --git a/nx-X11/programs/Xserver/randr/rrdispatch.c b/nx-X11/programs/Xserver/randr/rrdispatch.c index 50f2011c6..eae774636 100644 --- a/nx-X11/programs/Xserver/randr/rrdispatch.c +++ b/nx-X11/programs/Xserver/randr/rrdispatch.c @@ -35,8 +35,6 @@ RRClientKnowsRates(ClientPtr pClient) static int ProcRRQueryVersion(ClientPtr client) { - int n; - xRRQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, @@ -61,10 +59,10 @@ ProcRRQueryVersion(ClientPtr client) } if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.majorVersion, n); - swapl(&rep.minorVersion, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.majorVersion); + swapl(&rep.minorVersion); } #ifndef NXAGENT_SERVER WriteToClient(client, sizeof(xRRQueryVersionReply), &rep); diff --git a/nx-X11/programs/Xserver/randr/rrmode.c b/nx-X11/programs/Xserver/randr/rrmode.c index c4718c1b4..c3e60c0bd 100644 --- a/nx-X11/programs/Xserver/randr/rrmode.c +++ b/nx-X11/programs/Xserver/randr/rrmode.c @@ -344,7 +344,6 @@ ProcRRCreateMode(ClientPtr client) char *name; int error, rc; RRModePtr mode; - int n; REQUEST_AT_LEAST_SIZE(xRRCreateModeReq); #ifndef NXAGENT_SERVER @@ -377,9 +376,9 @@ ProcRRCreateMode(ClientPtr client) .mode = mode->mode.id }; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.mode, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.mode); } WriteToClient(client, sizeof(xRRCreateModeReply), (char *) &rep); /* Drop out reference to this mode */ diff --git a/nx-X11/programs/Xserver/randr/rrmonitor.c b/nx-X11/programs/Xserver/randr/rrmonitor.c index 42e0de64a..d648625c1 100644 --- a/nx-X11/programs/Xserver/randr/rrmonitor.c +++ b/nx-X11/programs/Xserver/randr/rrmonitor.c @@ -629,7 +629,7 @@ ProcRRGetMonitors(ClientPtr client) RRMonitorPtr monitors; int nmonitors; int noutputs; - int m, n; + int m; Bool get_active; REQUEST_SIZE_MATCH(xRRGetMonitorsReq); @@ -661,11 +661,11 @@ ProcRRGetMonitors(ClientPtr client) rep.noutputs = noutputs; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.timestamp, n); - swapl(&rep.nmonitors, n); - swapl(&rep.noutputs, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.timestamp); + swapl(&rep.nmonitors); + swapl(&rep.noutputs); } WriteToClient(client, sizeof(xRRGetMonitorsReply), (char *) &rep); @@ -686,14 +686,14 @@ ProcRRGetMonitors(ClientPtr client) .heightInMillimeters = monitor->geometry.mmHeight, }; if (client->swapped) { - swapl(&info.name, n); - swaps(&info.noutput, n); - swaps(&info.x, n); - swaps(&info.y, n); - swaps(&info.width, n); - swaps(&info.height, n); - swapl(&info.widthInMillimeters, n); - swapl(&info.heightInMillimeters, n); + swapl(&info.name); + swaps(&info.noutput); + swaps(&info.x); + swaps(&info.y); + swaps(&info.width); + swaps(&info.height); + swapl(&info.widthInMillimeters); + swapl(&info.heightInMillimeters); } WriteToClient(client, sizeof(xRRMonitorInfo), (char *) &info); diff --git a/nx-X11/programs/Xserver/randr/rroutput.c b/nx-X11/programs/Xserver/randr/rroutput.c index 4a3d32a12..c245de874 100644 --- a/nx-X11/programs/Xserver/randr/rroutput.c +++ b/nx-X11/programs/Xserver/randr/rroutput.c @@ -463,7 +463,6 @@ ProcRRGetOutputInfo(ClientPtr client) RROutput *clones; char *name; int i; - int n; REQUEST_SIZE_MATCH(xRRGetOutputInfoReq); VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); @@ -509,7 +508,7 @@ ProcRRGetOutputInfo(ClientPtr client) for (i = 0; i < output->numCrtcs; i++) { crtcs[i] = output->crtcs[i]->id; if (client->swapped) - swapl(&crtcs[i], n); + swapl(&crtcs[i]); } for (i = 0; i < output->numModes + output->numUserModes; i++) { if (i < output->numModes) @@ -517,26 +516,26 @@ ProcRRGetOutputInfo(ClientPtr client) else modes[i] = output->userModes[i - output->numModes]->mode.id; if (client->swapped) - swapl(&modes[i], n); + swapl(&modes[i]); } for (i = 0; i < output->numClones; i++) { clones[i] = output->clones[i]->id; if (client->swapped) - swapl(&clones[i], n); + swapl(&clones[i]); } memcpy(name, output->name, output->nameLength); if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.timestamp, n); - swapl(&rep.crtc, n); - swapl(&rep.mmWidth, n); - swapl(&rep.mmHeight, n); - swaps(&rep.nCrtcs, n); - swaps(&rep.nModes, n); - swaps(&rep.nPreferred, n); - swaps(&rep.nClones, n); - swaps(&rep.nameLength, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.timestamp); + swapl(&rep.crtc); + swapl(&rep.mmWidth); + swapl(&rep.mmHeight); + swaps(&rep.nCrtcs); + swaps(&rep.nModes); + swaps(&rep.nPreferred); + swaps(&rep.nClones); + swaps(&rep.nameLength); } WriteToClient(client, sizeof(xRRGetOutputInfoReply), (char *) &rep); if (extraLen) { @@ -639,7 +638,6 @@ ProcRRGetOutputPrimary(ClientPtr client) xRRGetOutputPrimaryReply rep; RROutputPtr primary = NULL; int rc; - int n; REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq); @@ -663,8 +661,8 @@ ProcRRGetOutputPrimary(ClientPtr client) .output = primary ? primary->id : None }; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.output, n); + swaps(&rep.sequenceNumber); + swapl(&rep.output); } WriteToClient(client, sizeof(xRRGetOutputPrimaryReply), (char *) &rep); diff --git a/nx-X11/programs/Xserver/randr/rrproperty.c b/nx-X11/programs/Xserver/randr/rrproperty.c index cf13ca23e..334fd4720 100644 --- a/nx-X11/programs/Xserver/randr/rrproperty.c +++ b/nx-X11/programs/Xserver/randr/rrproperty.c @@ -405,7 +405,6 @@ ProcRRListOutputProperties(ClientPtr client) int numProps = 0; RROutputPtr output; RRPropertyPtr prop; - int n; REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq); @@ -428,9 +427,9 @@ ProcRRListOutputProperties(ClientPtr client) .nAtoms = numProps }; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swaps(&rep.nAtoms, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swaps(&rep.nAtoms); } WriteToClient(client, sizeof(xRRListOutputPropertiesReply), (char *) &rep); @@ -455,7 +454,6 @@ ProcRRQueryOutputProperty(ClientPtr client) RROutputPtr output; RRPropertyPtr prop; char *extra = NULL; - int n; REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq); @@ -484,8 +482,8 @@ ProcRRQueryOutputProperty(ClientPtr client) .immutable = prop->immutable }; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); } WriteToClient(client, sizeof(xRRQueryOutputPropertyReply), (char *) &rep); if (prop->num_valid) { @@ -609,7 +607,6 @@ ProcRRGetOutputProperty(ClientPtr client) RROutputPtr output; xRRGetOutputPropertyReply reply; char *extra = NULL; - int m; REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq); if (stuff->delete) @@ -645,11 +642,11 @@ ProcRRGetOutputProperty(ClientPtr client) reply.propertyType = None; reply.format = 0; if (client->swapped) { - swaps(&reply.sequenceNumber, m); - swapl(&reply.length, m); - swapl(&reply.propertyType, m); - swapl(&reply.bytesAfter, m); - swapl(&reply.nItems, m); + swaps(&reply.sequenceNumber); + swapl(&reply.length); + swapl(&reply.propertyType); + swapl(&reply.bytesAfter); + swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetOutputPropertyReply), (char *) &reply); @@ -674,11 +671,11 @@ ProcRRGetOutputProperty(ClientPtr client) reply.nItems = 0; reply.propertyType = prop_value->type; if (client->swapped) { - swaps(&reply.sequenceNumber, n); - swapl(&reply.length, n); - swapl(&reply.propertyType, n); - swapl(&reply.bytesAfter, n); - swapl(&reply.nItems, n); + swaps(&reply.sequenceNumber); + swapl(&reply.length); + swapl(&reply.propertyType); + swapl(&reply.bytesAfter); + swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetOutputPropertyReply), (char *) &reply); @@ -728,11 +725,11 @@ ProcRRGetOutputProperty(ClientPtr client) } if (client->swapped) { - swaps(&reply.sequenceNumber, n); - swapl(&reply.length, n); - swapl(&reply.propertyType, n); - swapl(&reply.bytesAfter, n); - swapl(&reply.nItems, n); + swaps(&reply.sequenceNumber); + swapl(&reply.length); + swapl(&reply.propertyType); + swapl(&reply.bytesAfter); + swapl(&reply.nItems); } WriteToClient(client, sizeof(xGenericReply), (char *) &reply); if (len) { diff --git a/nx-X11/programs/Xserver/randr/rrprovider.c b/nx-X11/programs/Xserver/randr/rrprovider.c index 7d3096482..9ffb404c5 100644 --- a/nx-X11/programs/Xserver/randr/rrprovider.c +++ b/nx-X11/programs/Xserver/randr/rrprovider.c @@ -43,7 +43,7 @@ RRProviderInitErrorValue(void) if (pScrPriv->provider) { \ providers[count_providers] = pScrPriv->provider->id; \ if (client->swapped) \ - swapl(&providers[count_providers], n); \ + swapl(&providers[count_providers]); \ count_providers++; \ } \ } while(0) @@ -64,7 +64,6 @@ ProcRRGetProviders(ClientPtr client) #ifndef NXAGENT_SERVER ScreenPtr iter; #endif - int n; REQUEST_SIZE_MATCH(xRRGetProvidersReq); #ifndef NXAGENT_SERVER @@ -143,10 +142,10 @@ ProcRRGetProviders(ClientPtr client) } if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.timestamp, n); - swaps(&rep.nProviders, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.timestamp); + swaps(&rep.nProviders); } WriteToClient(client, sizeof(xRRGetProvidersReply), (char *) &rep); if (extraLen) @@ -179,7 +178,6 @@ ProcRRGetProviderInfo(ClientPtr client) #endif RRProvider *providers; uint32_t *prov_cap; - int n; REQUEST_SIZE_MATCH(xRRGetProviderInfoReq); VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess); @@ -233,31 +231,31 @@ ProcRRGetProviderInfo(ClientPtr client) for (i = 0; i < pScrPriv->numCrtcs; i++) { crtcs[i] = pScrPriv->crtcs[i]->id; if (client->swapped) - swapl(&crtcs[i], n); + swapl(&crtcs[i]); } for (i = 0; i < pScrPriv->numOutputs; i++) { outputs[i] = pScrPriv->outputs[i]->id; if (client->swapped) - swapl(&outputs[i], n); + swapl(&outputs[i]); } i = 0; if (provider->offload_sink) { providers[i] = provider->offload_sink->id; if (client->swapped) - swapl(&providers[i], n); + swapl(&providers[i]); prov_cap[i] = RR_Capability_SinkOffload; if (client->swapped) - swapl(&prov_cap[i], n); + swapl(&prov_cap[i]); i++; } if (provider->output_source) { providers[i] = provider->output_source->id; if (client->swapped) - swapl(&providers[i], n); + swapl(&providers[i]); prov_cap[i] = RR_Capability_SourceOutput; - swapl(&prov_cap[i], n); + swapl(&prov_cap[i]); i++; } #ifndef NXAGENT_SERVER @@ -284,12 +282,12 @@ ProcRRGetProviderInfo(ClientPtr client) #endif memcpy(name, provider->name, rep.nameLength); if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.capabilities, n); - swaps(&rep.nCrtcs, n); - swaps(&rep.nOutputs, n); - swaps(&rep.nameLength, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.capabilities); + swaps(&rep.nCrtcs); + swaps(&rep.nOutputs); + swaps(&rep.nameLength); } WriteToClient(client, sizeof(xRRGetProviderInfoReply), (char *) &rep); if (extraLen) diff --git a/nx-X11/programs/Xserver/randr/rrproviderproperty.c b/nx-X11/programs/Xserver/randr/rrproviderproperty.c index b7ba8ab53..303719909 100644 --- a/nx-X11/programs/Xserver/randr/rrproviderproperty.c +++ b/nx-X11/programs/Xserver/randr/rrproviderproperty.c @@ -401,7 +401,6 @@ ProcRRListProviderProperties(ClientPtr client) int numProps = 0; RRProviderPtr provider; RRPropertyPtr prop; - int n; REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq); @@ -424,9 +423,9 @@ ProcRRListProviderProperties(ClientPtr client) .nAtoms = numProps }; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swaps(&rep.nAtoms, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swaps(&rep.nAtoms); } temppAtoms = pAtoms; for (prop = provider->properties; prop; prop = prop->next) @@ -450,7 +449,6 @@ ProcRRQueryProviderProperty(ClientPtr client) RRProviderPtr provider; RRPropertyPtr prop; char *extra = NULL; - int n; REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq); @@ -478,8 +476,8 @@ ProcRRQueryProviderProperty(ClientPtr client) .immutable = prop->immutable }; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); } WriteToClient(client, sizeof(xRRQueryProviderPropertyReply), (char *) &rep); if (prop->num_valid) { @@ -637,11 +635,11 @@ ProcRRGetProviderProperty(ClientPtr client) reply.propertyType = None; reply.format = 0; if (client->swapped) { - swaps(&reply.sequenceNumber, n); - swapl(&reply.length, n); - swapl(&reply.propertyType, n); - swapl(&reply.bytesAfter, n); - swapl(&reply.nItems, n); + swaps(&reply.sequenceNumber); + swapl(&reply.length); + swapl(&reply.propertyType); + swapl(&reply.bytesAfter); + swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetProviderPropertyReply), (char *) &reply); @@ -666,11 +664,11 @@ ProcRRGetProviderProperty(ClientPtr client) reply.nItems = 0; reply.propertyType = prop_value->type; if (client->swapped) { - swaps(&reply.sequenceNumber, n); - swapl(&reply.length, n); - swapl(&reply.propertyType, n); - swapl(&reply.bytesAfter, n); - swapl(&reply.nItems, n); + swaps(&reply.sequenceNumber); + swapl(&reply.length); + swapl(&reply.propertyType); + swapl(&reply.bytesAfter); + swapl(&reply.nItems); } WriteToClient(client, sizeof(xRRGetProviderPropertyReply), (char *) &reply); @@ -720,11 +718,11 @@ ProcRRGetProviderProperty(ClientPtr client) } if (client->swapped) { - swaps(&reply.sequenceNumber, n); - swapl(&reply.length, n); - swapl(&reply.propertyType, n); - swapl(&reply.bytesAfter, n); - swapl(&reply.nItems, n); + swaps(&reply.sequenceNumber); + swapl(&reply.length); + swapl(&reply.propertyType); + swapl(&reply.bytesAfter); + swapl(&reply.nItems); } WriteToClient(client, sizeof(xGenericReply), (char *) &reply); if (len) { diff --git a/nx-X11/programs/Xserver/randr/rrscreen.c b/nx-X11/programs/Xserver/randr/rrscreen.c index 017ff0143..81ae5b741 100644 --- a/nx-X11/programs/Xserver/randr/rrscreen.c +++ b/nx-X11/programs/Xserver/randr/rrscreen.c @@ -212,7 +212,6 @@ ProcRRGetScreenSizeRange(ClientPtr client) ScreenPtr pScreen; rrScrPrivPtr pScrPriv; int rc; - int n; REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq); #ifndef NXAGENT_SERVER @@ -248,12 +247,12 @@ ProcRRGetScreenSizeRange(ClientPtr client) rep.maxHeight = rep.minHeight = pScreen->height; } if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swaps(&rep.minWidth, n); - swaps(&rep.minHeight, n); - swaps(&rep.maxWidth, n); - swaps(&rep.maxHeight, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swaps(&rep.minWidth); + swaps(&rep.minHeight); + swaps(&rep.maxWidth); + swaps(&rep.maxHeight); } WriteToClient(client, sizeof(xRRGetScreenSizeRangeReply), (char *) &rep); return Success; @@ -340,21 +339,19 @@ ProcRRSetScreenSize(ClientPtr client) static inline void swap_modeinfos(xRRModeInfo * modeinfos, int i) { - int n; - - swapl(&modeinfos[i].id, n); - swaps(&modeinfos[i].width, n); - swaps(&modeinfos[i].height, n); - swapl(&modeinfos[i].dotClock, n); - swaps(&modeinfos[i].hSyncStart, n); - swaps(&modeinfos[i].hSyncEnd, n); - swaps(&modeinfos[i].hTotal, n); - swaps(&modeinfos[i].hSkew, n); - swaps(&modeinfos[i].vSyncStart, n); - swaps(&modeinfos[i].vSyncEnd, n); - swaps(&modeinfos[i].vTotal, n); - swaps(&modeinfos[i].nameLength, n); - swapl(&modeinfos[i].modeFlags, n); + swapl(&modeinfos[i].id); + swaps(&modeinfos[i].width); + swaps(&modeinfos[i].height); + swapl(&modeinfos[i].dotClock); + swaps(&modeinfos[i].hSyncStart); + swaps(&modeinfos[i].hSyncEnd); + swaps(&modeinfos[i].hTotal); + swaps(&modeinfos[i].hSkew); + swaps(&modeinfos[i].vSyncStart); + swaps(&modeinfos[i].vSyncEnd); + swaps(&modeinfos[i].vTotal); + swaps(&modeinfos[i].nameLength); + swapl(&modeinfos[i].modeFlags); } #define update_arrays(gpuscreen, pScrPriv, primary_crtc, has_primary) do { \ @@ -366,13 +363,13 @@ swap_modeinfos(xRRModeInfo * modeinfos, int i) }\ crtcs[crtc_count] = pScrPriv->crtcs[j]->id; \ if (client->swapped) \ - swapl(&crtcs[crtc_count], n); \ + swapl(&crtcs[crtc_count]); \ crtc_count++; \ } \ for (j = 0; j < pScrPriv->numOutputs; j++) { \ outputs[output_count] = pScrPriv->outputs[j]->id; \ if (client->swapped) \ - swapl(&outputs[output_count], n); \ + swapl(&outputs[output_count]); \ output_count++; \ } \ { \ @@ -412,7 +409,6 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) xRRModeInfo *modeinfos; CARD8 *names; int has_primary = 0; - int n; /* we need to iterate all the GPU masters and all their output slaves */ total_crtcs = 0; @@ -479,7 +475,7 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) primary_crtc = pScrPriv->primaryOutput->crtc; crtcs[0] = pScrPriv->primaryOutput->crtc->id; if (client->swapped) - swapl(&crtcs[0], n); + swapl(&crtcs[0]); crtc_count = 1; } update_arrays(pScreen, pScrPriv, primary_crtc, has_primary); @@ -492,14 +488,14 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) assert(bytes_to_int32((char *) names - (char *) extra) == rep.length); if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.timestamp, n); - swapl(&rep.configTimestamp, n); - swaps(&rep.nCrtcs, n); - swaps(&rep.nOutputs, n); - swaps(&rep.nModes, n); - swaps(&rep.nbytesNames, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.timestamp); + swapl(&rep.configTimestamp); + swaps(&rep.nCrtcs); + swaps(&rep.nOutputs); + swaps(&rep.nModes); + swaps(&rep.nbytesNames); } WriteToClient(client, sizeof(xRRGetScreenResourcesReply), (char *) &rep); if (extraLen) { @@ -525,7 +521,6 @@ rrGetScreenResources(ClientPtr client, Bool query) RROutput *outputs; xRRModeInfo *modeinfos; CARD8 *names; - int n; REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq); @@ -613,7 +608,7 @@ rrGetScreenResources(ClientPtr client, Bool query) has_primary = 1; crtcs[0] = pScrPriv->primaryOutput->crtc->id; if (client->swapped) - swapl(&crtcs[0], n); + swapl(&crtcs[0]); } for (i = 0; i < pScrPriv->numCrtcs; i++) { @@ -624,13 +619,13 @@ rrGetScreenResources(ClientPtr client, Bool query) } crtcs[i + has_primary] = pScrPriv->crtcs[i]->id; if (client->swapped) - swapl(&crtcs[i + has_primary], n); + swapl(&crtcs[i + has_primary]); } for (i = 0; i < pScrPriv->numOutputs; i++) { outputs[i] = pScrPriv->outputs[i]->id; if (client->swapped) - swapl(&outputs[i], n); + swapl(&outputs[i]); } for (i = 0; i < num_modes; i++) { @@ -638,19 +633,19 @@ rrGetScreenResources(ClientPtr client, Bool query) modeinfos[i] = mode->mode; if (client->swapped) { - swapl(&modeinfos[i].id, n); - swaps(&modeinfos[i].width, n); - swaps(&modeinfos[i].height, n); - swapl(&modeinfos[i].dotClock, n); - swaps(&modeinfos[i].hSyncStart, n); - swaps(&modeinfos[i].hSyncEnd, n); - swaps(&modeinfos[i].hTotal, n); - swaps(&modeinfos[i].hSkew, n); - swaps(&modeinfos[i].vSyncStart, n); - swaps(&modeinfos[i].vSyncEnd, n); - swaps(&modeinfos[i].vTotal, n); - swaps(&modeinfos[i].nameLength, n); - swapl(&modeinfos[i].modeFlags, n); + swapl(&modeinfos[i].id); + swaps(&modeinfos[i].width); + swaps(&modeinfos[i].height); + swapl(&modeinfos[i].dotClock); + swaps(&modeinfos[i].hSyncStart); + swaps(&modeinfos[i].hSyncEnd); + swaps(&modeinfos[i].hTotal); + swaps(&modeinfos[i].hSkew); + swaps(&modeinfos[i].vSyncStart); + swaps(&modeinfos[i].vSyncEnd); + swaps(&modeinfos[i].vTotal); + swaps(&modeinfos[i].nameLength); + swapl(&modeinfos[i].modeFlags); } memcpy(names, mode->name, mode->mode.nameLength); names += mode->mode.nameLength; @@ -660,14 +655,14 @@ rrGetScreenResources(ClientPtr client, Bool query) } if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.timestamp, n); - swapl(&rep.configTimestamp, n); - swaps(&rep.nCrtcs, n); - swaps(&rep.nOutputs, n); - swaps(&rep.nModes, n); - swaps(&rep.nbytesNames, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.timestamp); + swapl(&rep.configTimestamp); + swaps(&rep.nCrtcs); + swaps(&rep.nOutputs); + swaps(&rep.nModes); + swaps(&rep.nbytesNames); } WriteToClient(client, sizeof(xRRGetScreenResourcesReply), (char *) (char *) &rep); @@ -801,7 +796,6 @@ ProcRRGetScreenInfo(ClientPtr client) CARD8 *extra; unsigned long extraLen; RROutputPtr output; - int n; REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); #ifndef NXAGENT_SERVER @@ -895,22 +889,22 @@ ProcRRGetScreenInfo(ClientPtr client) size->widthInMillimeters = pSize->mmWidth; size->heightInMillimeters = pSize->mmHeight; if (client->swapped) { - swaps(&size->widthInPixels, n); - swaps(&size->heightInPixels, n); - swaps(&size->widthInMillimeters, n); - swaps(&size->heightInMillimeters, n); + swaps(&size->widthInPixels); + swaps(&size->heightInPixels); + swaps(&size->widthInMillimeters); + swaps(&size->heightInMillimeters); } size++; if (has_rate) { *rates = pSize->nRates; if (client->swapped) { - swaps(rates, n); + swaps(rates); } rates++; for (j = 0; j < pSize->nRates; j++) { *rates = pSize->pRates[j].rate; if (client->swapped) { - swaps(rates, n); + swaps(rates); } rates++; } @@ -926,15 +920,15 @@ ProcRRGetScreenInfo(ClientPtr client) rep.length = bytes_to_int32(extraLen); } if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.timestamp, n); - swapl(&rep.configTimestamp, n); - swaps(&rep.rotation, n); - swaps(&rep.nSizes, n); - swaps(&rep.sizeID, n); - swaps(&rep.rate, n); - swaps(&rep.nrateEnts, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.timestamp); + swapl(&rep.configTimestamp); + swaps(&rep.rotation); + swaps(&rep.nSizes); + swaps(&rep.sizeID); + swaps(&rep.rate); + swaps(&rep.nrateEnts); } WriteToClient(client, sizeof(xRRGetScreenInfoReply), (char *) &rep); if (extraLen) { @@ -965,7 +959,6 @@ ProcRRSetScreenConfig(ClientPtr client) RR10DataPtr pData = NULL; RRScreenSizePtr pSize; int width, height; - int n; UpdateCurrentTime(); @@ -1173,11 +1166,11 @@ ProcRRSetScreenConfig(ClientPtr client) }; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.newTimestamp, n); - swapl(&rep.newConfigTimestamp, n); - swapl(&rep.root, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.newTimestamp); + swapl(&rep.newConfigTimestamp); + swapl(&rep.root); } WriteToClient(client, sizeof(xRRSetScreenConfigReply), (char *) &rep); diff --git a/nx-X11/programs/Xserver/randr/rrsdispatch.c b/nx-X11/programs/Xserver/randr/rrsdispatch.c index 6ac394344..04ac8526c 100644 --- a/nx-X11/programs/Xserver/randr/rrsdispatch.c +++ b/nx-X11/programs/Xserver/randr/rrsdispatch.c @@ -25,162 +25,140 @@ static int SProcRRQueryVersion(ClientPtr client) { - int n; - REQUEST(xRRQueryVersionReq); REQUEST_SIZE_MATCH(xRRQueryVersionReq); - swaps(&stuff->length, n); - swapl(&stuff->majorVersion, n); - swapl(&stuff->minorVersion, n); + swaps(&stuff->length); + swapl(&stuff->majorVersion); + swapl(&stuff->minorVersion); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetScreenInfo(ClientPtr client) { - int n; - REQUEST(xRRGetScreenInfoReq); REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); - swaps(&stuff->length, n); - swapl(&stuff->window, n); + swaps(&stuff->length); + swapl(&stuff->window); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSetScreenConfig(ClientPtr client) { - int n; - REQUEST(xRRSetScreenConfigReq); if (RRClientKnowsRates(client)) { REQUEST_SIZE_MATCH(xRRSetScreenConfigReq); - swaps(&stuff->rate, n); + swaps(&stuff->rate); } else { REQUEST_SIZE_MATCH(xRR1_0SetScreenConfigReq); } - swaps(&stuff->length, n); - swapl(&stuff->drawable, n); - swapl(&stuff->timestamp, n); - swaps(&stuff->sizeID, n); - swaps(&stuff->rotation, n); + swaps(&stuff->length); + swapl(&stuff->drawable); + swapl(&stuff->timestamp); + swaps(&stuff->sizeID); + swaps(&stuff->rotation); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSelectInput(ClientPtr client) { - int n; - REQUEST(xRRSelectInputReq); REQUEST_SIZE_MATCH(xRRSelectInputReq); - swaps(&stuff->length, n); - swapl(&stuff->window, n); - swaps(&stuff->enable, n); + swaps(&stuff->length); + swapl(&stuff->window); + swaps(&stuff->enable); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetScreenSizeRange(ClientPtr client) { - int n; - REQUEST(xRRGetScreenSizeRangeReq); REQUEST_SIZE_MATCH(xRRGetScreenSizeRangeReq); - swaps(&stuff->length, n); - swapl(&stuff->window, n); + swaps(&stuff->length); + swapl(&stuff->window); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSetScreenSize(ClientPtr client) { - int n; - REQUEST(xRRSetScreenSizeReq); REQUEST_SIZE_MATCH(xRRSetScreenSizeReq); - swaps(&stuff->length, n); - swapl(&stuff->window, n); - swaps(&stuff->width, n); - swaps(&stuff->height, n); - swapl(&stuff->widthInMillimeters, n); - swapl(&stuff->heightInMillimeters, n); + swaps(&stuff->length); + swapl(&stuff->window); + swaps(&stuff->width); + swaps(&stuff->height); + swapl(&stuff->widthInMillimeters); + swapl(&stuff->heightInMillimeters); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetScreenResources(ClientPtr client) { - int n; - REQUEST(xRRGetScreenResourcesReq); REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq); - swaps(&stuff->length, n); - swapl(&stuff->window, n); + swaps(&stuff->length); + swapl(&stuff->window); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetOutputInfo(ClientPtr client) { - int n; - REQUEST(xRRGetOutputInfoReq); REQUEST_SIZE_MATCH(xRRGetOutputInfoReq); - swaps(&stuff->length, n); - swapl(&stuff->output, n); - swapl(&stuff->configTimestamp, n); + swaps(&stuff->length); + swapl(&stuff->output); + swapl(&stuff->configTimestamp); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRListOutputProperties(ClientPtr client) { - int n; - REQUEST(xRRListOutputPropertiesReq); REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq); - swaps(&stuff->length, n); - swapl(&stuff->output, n); + swaps(&stuff->length); + swapl(&stuff->output); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRQueryOutputProperty(ClientPtr client) { - int n; - REQUEST(xRRQueryOutputPropertyReq); REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq); - swaps(&stuff->length, n); - swapl(&stuff->output, n); - swapl(&stuff->property, n); + swaps(&stuff->length); + swapl(&stuff->output); + swapl(&stuff->property); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRConfigureOutputProperty(ClientPtr client) { - int n; - REQUEST(xRRConfigureOutputPropertyReq); REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq); - swaps(&stuff->length, n); - swapl(&stuff->output, n); - swapl(&stuff->property, n); + swaps(&stuff->length); + swapl(&stuff->output); + swapl(&stuff->property); SwapRestL(stuff); return (*ProcRandrVector[stuff->randrReqType]) (client); } @@ -188,16 +166,14 @@ SProcRRConfigureOutputProperty(ClientPtr client) static int SProcRRChangeOutputProperty(ClientPtr client) { - int n; - REQUEST(xRRChangeOutputPropertyReq); REQUEST_AT_LEAST_SIZE(xRRChangeOutputPropertyReq); - swaps(&stuff->length, n); - swapl(&stuff->output, n); - swapl(&stuff->property, n); - swapl(&stuff->type, n); - swapl(&stuff->nUnits, n); + swaps(&stuff->length); + swapl(&stuff->output); + swapl(&stuff->property); + swapl(&stuff->type); + swapl(&stuff->nUnits); switch (stuff->format) { case 8: break; @@ -217,134 +193,118 @@ SProcRRChangeOutputProperty(ClientPtr client) static int SProcRRDeleteOutputProperty(ClientPtr client) { - int n; - REQUEST(xRRDeleteOutputPropertyReq); REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq); - swaps(&stuff->length, n); - swapl(&stuff->output, n); - swapl(&stuff->property, n); + swaps(&stuff->length); + swapl(&stuff->output); + swapl(&stuff->property); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetOutputProperty(ClientPtr client) { - int n; - REQUEST(xRRGetOutputPropertyReq); REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq); - swaps(&stuff->length, n); - swapl(&stuff->output, n); - swapl(&stuff->property, n); - swapl(&stuff->type, n); - swapl(&stuff->longOffset, n); - swapl(&stuff->longLength, n); + swaps(&stuff->length); + swapl(&stuff->output); + swapl(&stuff->property); + swapl(&stuff->type); + swapl(&stuff->longOffset); + swapl(&stuff->longLength); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRCreateMode(ClientPtr client) { - int n; - xRRModeInfo *modeinfo; REQUEST(xRRCreateModeReq); REQUEST_AT_LEAST_SIZE(xRRCreateModeReq); - swaps(&stuff->length, n); - swapl(&stuff->window, n); + swaps(&stuff->length); + swapl(&stuff->window); modeinfo = &stuff->modeInfo; - swapl(&modeinfo->id, n); - swaps(&modeinfo->width, n); - swaps(&modeinfo->height, n); - swapl(&modeinfo->dotClock, n); - swaps(&modeinfo->hSyncStart, n); - swaps(&modeinfo->hSyncEnd, n); - swaps(&modeinfo->hTotal, n); - swaps(&modeinfo->vSyncStart, n); - swaps(&modeinfo->vSyncEnd, n); - swaps(&modeinfo->vTotal, n); - swaps(&modeinfo->nameLength, n); - swapl(&modeinfo->modeFlags, n); + swapl(&modeinfo->id); + swaps(&modeinfo->width); + swaps(&modeinfo->height); + swapl(&modeinfo->dotClock); + swaps(&modeinfo->hSyncStart); + swaps(&modeinfo->hSyncEnd); + swaps(&modeinfo->hTotal); + swaps(&modeinfo->vSyncStart); + swaps(&modeinfo->vSyncEnd); + swaps(&modeinfo->vTotal); + swaps(&modeinfo->nameLength); + swapl(&modeinfo->modeFlags); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRDestroyMode(ClientPtr client) { - int n; - REQUEST(xRRDestroyModeReq); REQUEST_SIZE_MATCH(xRRDestroyModeReq); - swaps(&stuff->length, n); - swapl(&stuff->mode, n); + swaps(&stuff->length); + swapl(&stuff->mode); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRAddOutputMode(ClientPtr client) { - int n; - REQUEST(xRRAddOutputModeReq); REQUEST_SIZE_MATCH(xRRAddOutputModeReq); - swaps(&stuff->length, n); - swapl(&stuff->output, n); - swapl(&stuff->mode, n); + swaps(&stuff->length); + swapl(&stuff->output); + swapl(&stuff->mode); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRDeleteOutputMode(ClientPtr client) { - int n; - REQUEST(xRRDeleteOutputModeReq); REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq); - swaps(&stuff->length, n); - swapl(&stuff->output, n); - swapl(&stuff->mode, n); + swaps(&stuff->length); + swapl(&stuff->output); + swapl(&stuff->mode); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetCrtcInfo(ClientPtr client) { - int n; - REQUEST(xRRGetCrtcInfoReq); REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq); - swaps(&stuff->length, n); - swapl(&stuff->crtc, n); - swapl(&stuff->configTimestamp, n); + swaps(&stuff->length); + swapl(&stuff->crtc); + swapl(&stuff->configTimestamp); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSetCrtcConfig(ClientPtr client) { - int n; - REQUEST(xRRSetCrtcConfigReq); REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq); - swaps(&stuff->length, n); - swapl(&stuff->crtc, n); - swapl(&stuff->timestamp, n); - swapl(&stuff->configTimestamp, n); - swaps(&stuff->x, n); - swaps(&stuff->y, n); - swapl(&stuff->mode, n); - swaps(&stuff->rotation, n); + swaps(&stuff->length); + swapl(&stuff->crtc); + swapl(&stuff->timestamp); + swapl(&stuff->configTimestamp); + swaps(&stuff->x); + swaps(&stuff->y); + swapl(&stuff->mode); + swaps(&stuff->rotation); SwapRestL(stuff); return (*ProcRandrVector[stuff->randrReqType]) (client); } @@ -352,40 +312,34 @@ SProcRRSetCrtcConfig(ClientPtr client) static int SProcRRGetCrtcGammaSize(ClientPtr client) { - int n; - REQUEST(xRRGetCrtcGammaSizeReq); REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq); - swaps(&stuff->length, n); - swapl(&stuff->crtc, n); + swaps(&stuff->length); + swapl(&stuff->crtc); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetCrtcGamma(ClientPtr client) { - int n; - REQUEST(xRRGetCrtcGammaReq); REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq); - swaps(&stuff->length, n); - swapl(&stuff->crtc, n); + swaps(&stuff->length); + swapl(&stuff->crtc); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSetCrtcGamma(ClientPtr client) { - int n; - REQUEST(xRRSetCrtcGammaReq); REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq); - swaps(&stuff->length, n); - swapl(&stuff->crtc, n); - swaps(&stuff->size, n); + swaps(&stuff->length); + swapl(&stuff->crtc); + swaps(&stuff->size); SwapRestS(stuff); return (*ProcRandrVector[stuff->randrReqType]) (client); } @@ -396,16 +350,15 @@ SProcRRSetCrtcTransform(ClientPtr client) int nparams; char *filter; CARD32 *params; - int n; REQUEST(xRRSetCrtcTransformReq); REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq); - swaps(&stuff->length, n); - swapl(&stuff->crtc, n); + swaps(&stuff->length); + swapl(&stuff->crtc); SwapLongs((CARD32 *) &stuff->transform, bytes_to_int32(sizeof(xRenderTransform))); - swaps(&stuff->nbytesFilter, n); + swaps(&stuff->nbytesFilter); filter = (char *) (stuff + 1); params = (CARD32 *) (filter + pad_to_int32(stuff->nbytesFilter)); nparams = ((CARD32 *) stuff + client->req_len) - params; @@ -419,177 +372,153 @@ SProcRRSetCrtcTransform(ClientPtr client) static int SProcRRGetCrtcTransform(ClientPtr client) { - int n; - REQUEST(xRRGetCrtcTransformReq); REQUEST_SIZE_MATCH(xRRGetCrtcTransformReq); - swaps(&stuff->length, n); - swapl(&stuff->crtc, n); + swaps(&stuff->length); + swapl(&stuff->crtc); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRGetPanning(ClientPtr client) { - int n; - REQUEST(xRRGetPanningReq); REQUEST_SIZE_MATCH(xRRGetPanningReq); - swaps(&stuff->length, n); - swapl(&stuff->crtc, n); + swaps(&stuff->length); + swapl(&stuff->crtc); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSetPanning(ClientPtr client) { - int n; - REQUEST(xRRSetPanningReq); REQUEST_SIZE_MATCH(xRRSetPanningReq); - swaps(&stuff->length, n); - swapl(&stuff->crtc, n); - swapl(&stuff->timestamp, n); - swaps(&stuff->left, n); - swaps(&stuff->top, n); - swaps(&stuff->width, n); - swaps(&stuff->height, n); - swaps(&stuff->track_left, n); - swaps(&stuff->track_top, n); - swaps(&stuff->track_width, n); - swaps(&stuff->track_height, n); - swaps(&stuff->border_left, n); - swaps(&stuff->border_top, n); - swaps(&stuff->border_right, n); - swaps(&stuff->border_bottom, n); + swaps(&stuff->length); + swapl(&stuff->crtc); + swapl(&stuff->timestamp); + swaps(&stuff->left); + swaps(&stuff->top); + swaps(&stuff->width); + swaps(&stuff->height); + swaps(&stuff->track_left); + swaps(&stuff->track_top); + swaps(&stuff->track_width); + swaps(&stuff->track_height); + swaps(&stuff->border_left); + swaps(&stuff->border_top); + swaps(&stuff->border_right); + swaps(&stuff->border_bottom); return (*ProcRandrVector[stuff->randrReqType]) (client); } static int SProcRRSetOutputPrimary(ClientPtr client) { - int n; - REQUEST(xRRSetOutputPrimaryReq); REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq); - swaps(&stuff->length, n); - swapl(&stuff->window, n); - swapl(&stuff->output, n); + swaps(&stuff->length); + swapl(&stuff->window); + swapl(&stuff->output); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRGetOutputPrimary(ClientPtr client) { - int n; - REQUEST(xRRGetOutputPrimaryReq); REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq); - swaps(&stuff->length, n); - swapl(&stuff->window, n); + swaps(&stuff->length); + swapl(&stuff->window); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRGetProviders(ClientPtr client) { - int n; - REQUEST(xRRGetProvidersReq); REQUEST_SIZE_MATCH(xRRGetProvidersReq); - swaps(&stuff->length, n); - swapl(&stuff->window, n); + swaps(&stuff->length); + swapl(&stuff->window); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRGetProviderInfo(ClientPtr client) { - int n; - REQUEST(xRRGetProviderInfoReq); REQUEST_SIZE_MATCH(xRRGetProviderInfoReq); - swaps(&stuff->length, n); - swapl(&stuff->provider, n); - swapl(&stuff->configTimestamp, n); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->configTimestamp); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRSetProviderOffloadSink(ClientPtr client) { - int n; - REQUEST(xRRSetProviderOffloadSinkReq); REQUEST_SIZE_MATCH(xRRSetProviderOffloadSinkReq); - swaps(&stuff->length, n); - swapl(&stuff->provider, n); - swapl(&stuff->sink_provider, n); - swapl(&stuff->configTimestamp, n); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->sink_provider); + swapl(&stuff->configTimestamp); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRSetProviderOutputSource(ClientPtr client) { - int n; - REQUEST(xRRSetProviderOutputSourceReq); REQUEST_SIZE_MATCH(xRRSetProviderOutputSourceReq); - swaps(&stuff->length, n); - swapl(&stuff->provider, n); - swapl(&stuff->source_provider, n); - swapl(&stuff->configTimestamp, n); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->source_provider); + swapl(&stuff->configTimestamp); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRListProviderProperties(ClientPtr client) { - int n; - REQUEST(xRRListProviderPropertiesReq); REQUEST_SIZE_MATCH(xRRListProviderPropertiesReq); - swaps(&stuff->length, n); - swapl(&stuff->provider, n); + swaps(&stuff->length); + swapl(&stuff->provider); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRQueryProviderProperty(ClientPtr client) { - int n; - REQUEST(xRRQueryProviderPropertyReq); REQUEST_SIZE_MATCH(xRRQueryProviderPropertyReq); - swaps(&stuff->length, n); - swapl(&stuff->provider, n); - swapl(&stuff->property, n); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->property); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRConfigureProviderProperty(ClientPtr client) { - int n; - REQUEST(xRRConfigureProviderPropertyReq); REQUEST_AT_LEAST_SIZE(xRRConfigureProviderPropertyReq); - swaps(&stuff->length, n); - swapl(&stuff->provider, n); - swapl(&stuff->property, n); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->property); /* TODO: no way to specify format? */ SwapRestL(stuff); return ProcRandrVector[stuff->randrReqType] (client); @@ -598,16 +527,14 @@ SProcRRConfigureProviderProperty(ClientPtr client) static int SProcRRChangeProviderProperty(ClientPtr client) { - int n; - REQUEST(xRRChangeProviderPropertyReq); REQUEST_AT_LEAST_SIZE(xRRChangeProviderPropertyReq); - swaps(&stuff->length, n); - swapl(&stuff->provider, n); - swapl(&stuff->property, n); - swapl(&stuff->type, n); - swapl(&stuff->nUnits, n); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->property); + swapl(&stuff->type); + swapl(&stuff->nUnits); switch (stuff->format) { case 8: break; @@ -624,63 +551,55 @@ SProcRRChangeProviderProperty(ClientPtr client) static int SProcRRDeleteProviderProperty(ClientPtr client) { - int n; - REQUEST(xRRDeleteProviderPropertyReq); REQUEST_SIZE_MATCH(xRRDeleteProviderPropertyReq); - swaps(&stuff->length, n); - swapl(&stuff->provider, n); - swapl(&stuff->property, n); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->property); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRGetProviderProperty(ClientPtr client) { - int n; - REQUEST(xRRGetProviderPropertyReq); REQUEST_SIZE_MATCH(xRRGetProviderPropertyReq); - swaps(&stuff->length, n); - swapl(&stuff->provider, n); - swapl(&stuff->property, n); - swapl(&stuff->type, n); - swapl(&stuff->longOffset, n); - swapl(&stuff->longLength, n); + swaps(&stuff->length); + swapl(&stuff->provider); + swapl(&stuff->property); + swapl(&stuff->type); + swapl(&stuff->longOffset); + swapl(&stuff->longLength); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRGetMonitors(ClientPtr client) { - int n; - REQUEST(xRRGetMonitorsReq); REQUEST_SIZE_MATCH(xRRGetMonitorsReq); - swaps(&stuff->length, n); - swapl(&stuff->window, n); + swaps(&stuff->length); + swapl(&stuff->window); return ProcRandrVector[stuff->randrReqType] (client); } static int SProcRRSetMonitor(ClientPtr client) { - int n; - REQUEST(xRRSetMonitorReq); REQUEST_AT_LEAST_SIZE(xRRGetMonitorsReq); - swaps(&stuff->length, n); - swapl(&stuff->window, n); - swapl(&stuff->monitor.name, n); - swaps(&stuff->monitor.noutput, n); - swaps(&stuff->monitor.x, n); - swaps(&stuff->monitor.y, n); - swaps(&stuff->monitor.width, n); - swaps(&stuff->monitor.height, n); + swaps(&stuff->length); + swapl(&stuff->window); + swapl(&stuff->monitor.name); + swaps(&stuff->monitor.noutput); + swaps(&stuff->monitor.x); + swaps(&stuff->monitor.y); + swaps(&stuff->monitor.width); + swaps(&stuff->monitor.height); SwapRestL(stuff); return ProcRandrVector[stuff->randrReqType] (client); } @@ -688,14 +607,12 @@ SProcRRSetMonitor(ClientPtr client) static int SProcRRDeleteMonitor(ClientPtr client) { - int n; - REQUEST(xRRDeleteMonitorReq); REQUEST_SIZE_MATCH(xRRDeleteMonitorReq); - swaps(&stuff->length, n); - swapl(&stuff->window, n); - swapl(&stuff->name, n); + swaps(&stuff->length); + swapl(&stuff->window); + swapl(&stuff->name); return ProcRandrVector[stuff->randrReqType] (client); } diff --git a/nx-X11/programs/Xserver/randr/rrxinerama.c b/nx-X11/programs/Xserver/randr/rrxinerama.c index 5332ac01b..bd6340296 100644 --- a/nx-X11/programs/Xserver/randr/rrxinerama.c +++ b/nx-X11/programs/Xserver/randr/rrxinerama.c @@ -108,8 +108,6 @@ extern Bool noRRXineramaExtension; int ProcRRXineramaQueryVersion(ClientPtr client) { - int n; - xPanoramiXQueryVersionReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, @@ -120,10 +118,10 @@ ProcRRXineramaQueryVersion(ClientPtr client) REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swaps(&rep.majorVersion, n); - swaps(&rep.minorVersion, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swaps(&rep.majorVersion); + swaps(&rep.minorVersion); } WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *) &rep); return Success; @@ -139,7 +137,6 @@ ProcRRXineramaGetState(ClientPtr client) ScreenPtr pScreen; rrScrPrivPtr pScrPriv; Bool active = FALSE; - int n; REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); #ifndef NXAGENT_SERVER @@ -167,9 +164,9 @@ ProcRRXineramaGetState(ClientPtr client) .window = stuff->window }; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.window, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.window); } WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *) &rep); return Success; @@ -194,7 +191,6 @@ ProcRRXineramaGetScreenCount(ClientPtr client) WindowPtr pWin; xPanoramiXGetScreenCountReply rep; register int rc; - int n; REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); @@ -215,9 +211,9 @@ ProcRRXineramaGetScreenCount(ClientPtr client) .window = stuff->window }; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.window, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.window); } WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *) &rep); return Success; @@ -231,7 +227,6 @@ ProcRRXineramaGetScreenSize(ClientPtr client) ScreenPtr pScreen; xPanoramiXGetScreenSizeReply rep; register int rc; - int n; REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); #ifndef NXAGENT_SERVER @@ -257,12 +252,12 @@ ProcRRXineramaGetScreenSize(ClientPtr client) .screen = stuff->screen }; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.width, n); - swapl(&rep.height, n); - swapl(&rep.window, n); - swapl(&rep.screen, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.width); + swapl(&rep.height); + swapl(&rep.window); + swapl(&rep.screen); } WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *) &rep); return Success; @@ -272,7 +267,6 @@ int ProcRRXineramaIsActive(ClientPtr client) { xXineramaIsActiveReply rep; - int n; REQUEST_SIZE_MATCH(xXineramaIsActiveReq); @@ -283,9 +277,9 @@ ProcRRXineramaIsActive(ClientPtr client) .state = RRXineramaScreenActive(screenInfo.screens[RR_XINERAMA_SCREEN]) }; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.state, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.state); } WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep); return Success; @@ -312,7 +306,6 @@ ProcRRXineramaQueryScreens(ClientPtr client) int m; RRMonitorPtr monitors = NULL; int nmonitors = 0; - int n; REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); @@ -329,9 +322,9 @@ ProcRRXineramaQueryScreens(ClientPtr client) .number = nmonitors }; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.number, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.number); } WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *) &rep); @@ -370,10 +363,8 @@ ProcRRXineramaDispatch(ClientPtr client) static int SProcRRXineramaQueryVersion(ClientPtr client) { - int n; - REQUEST(xPanoramiXQueryVersionReq); - swaps(&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); return ProcRRXineramaQueryVersion(client); } @@ -381,47 +372,39 @@ SProcRRXineramaQueryVersion(ClientPtr client) static int SProcRRXineramaGetState(ClientPtr client) { - int n; - REQUEST(xPanoramiXGetStateReq); - swaps(&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetStateReq); - swapl(&stuff->window, n); + swapl(&stuff->window); return ProcRRXineramaGetState(client); } static int SProcRRXineramaGetScreenCount(ClientPtr client) { - int n; - REQUEST(xPanoramiXGetScreenCountReq); - swaps(&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetScreenCountReq); - swapl(&stuff->window, n); + swapl(&stuff->window); return ProcRRXineramaGetScreenCount(client); } static int SProcRRXineramaGetScreenSize(ClientPtr client) { - int n; - REQUEST(xPanoramiXGetScreenSizeReq); - swaps(&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xPanoramiXGetScreenSizeReq); - swapl(&stuff->window, n); - swapl(&stuff->screen, n); + swapl(&stuff->window); + swapl(&stuff->screen); return ProcRRXineramaGetScreenSize(client); } static int SProcRRXineramaIsActive(ClientPtr client) { - int n; - REQUEST(xXineramaIsActiveReq); - swaps(&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xXineramaIsActiveReq); return ProcRRXineramaIsActive(client); } @@ -429,10 +412,8 @@ SProcRRXineramaIsActive(ClientPtr client) static int SProcRRXineramaQueryScreens(ClientPtr client) { - int n; - REQUEST(xXineramaQueryScreensReq); - swaps(&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); return ProcRRXineramaQueryScreens(client); } -- cgit v1.2.3