Xext: vidmode: simplify reply struct initialization
Coherently moving all reply struct decls and assignments into static initialization right at declaration, just before it is getting byte- swapped and sent out. Zero-assignments can be dropped here, since the compiler automatically initializes all other fields to zero. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
de636d491b
commit
877b18d458
187
Xext/vidmode.c
187
Xext/vidmode.c
|
@ -191,6 +191,9 @@ ClientMajorVersion(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeQueryVersion(ClientPtr client)
|
ProcVidModeQueryVersion(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
DEBUG_P("XF86VidModeQueryVersion");
|
||||||
|
REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
|
||||||
|
|
||||||
xXF86VidModeQueryVersionReply rep = {
|
xXF86VidModeQueryVersionReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
|
@ -199,10 +202,6 @@ ProcVidModeQueryVersion(ClientPtr client)
|
||||||
.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION
|
.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION
|
||||||
};
|
};
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeQueryVersion");
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
|
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
|
@ -217,10 +216,6 @@ static int
|
||||||
ProcVidModeGetModeLine(ClientPtr client)
|
ProcVidModeGetModeLine(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeGetModeLineReq);
|
REQUEST(xXF86VidModeGetModeLineReq);
|
||||||
xXF86VidModeGetModeLineReply rep = {
|
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence
|
|
||||||
};
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
DisplayModePtr mode;
|
DisplayModePtr mode;
|
||||||
|
@ -232,15 +227,6 @@ ProcVidModeGetModeLine(ClientPtr client)
|
||||||
ver = ClientMajorVersion(client);
|
ver = ClientMajorVersion(client);
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
|
REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
|
||||||
|
|
||||||
if (ver < 2) {
|
|
||||||
rep.length = bytes_to_int32(SIZEOF(xXF86OldVidModeGetModeLineReply) -
|
|
||||||
SIZEOF(xGenericReply));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetModeLineReply) -
|
|
||||||
SIZEOF(xGenericReply));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
pScreen = screenInfo.screens[stuff->screen];
|
pScreen = screenInfo.screens[stuff->screen];
|
||||||
|
@ -251,17 +237,29 @@ ProcVidModeGetModeLine(ClientPtr client)
|
||||||
if (!pVidMode->GetCurrentModeline(pScreen, &mode, &dotClock))
|
if (!pVidMode->GetCurrentModeline(pScreen, &mode, &dotClock))
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
rep.dotclock = dotClock;
|
xXF86VidModeGetModeLineReply rep = {
|
||||||
rep.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY);
|
.type = X_Reply,
|
||||||
rep.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART);
|
.sequenceNumber = client->sequence,
|
||||||
rep.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND);
|
.dotclock = dotClock,
|
||||||
rep.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL);
|
.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
|
||||||
rep.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW);
|
.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
|
||||||
rep.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY);
|
.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
|
||||||
rep.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART);
|
.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL),
|
||||||
rep.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND);
|
.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW),
|
||||||
rep.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL);
|
.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
|
||||||
rep.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS);
|
.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
|
||||||
|
.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
|
||||||
|
.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
|
||||||
|
.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS),
|
||||||
|
.length = bytes_to_int32(sizeof(xXF86VidModeGetModeLineReply) -
|
||||||
|
sizeof(xGenericReply)),
|
||||||
|
/*
|
||||||
|
* Older servers sometimes had server privates that the VidMode
|
||||||
|
* extension made available. So to be compatible pretend that
|
||||||
|
* there are no server privates to pass to the client.
|
||||||
|
*/
|
||||||
|
.privsize = 0,
|
||||||
|
};
|
||||||
|
|
||||||
DebugF("GetModeLine - scrn: %d clock: %ld\n",
|
DebugF("GetModeLine - scrn: %d clock: %ld\n",
|
||||||
stuff->screen, (unsigned long) rep.dotclock);
|
stuff->screen, (unsigned long) rep.dotclock);
|
||||||
|
@ -271,13 +269,6 @@ ProcVidModeGetModeLine(ClientPtr client)
|
||||||
rep.vdisplay, rep.vsyncstart, rep.vsyncend,
|
rep.vdisplay, rep.vsyncstart, rep.vsyncend,
|
||||||
rep.vtotal, (unsigned long) rep.flags);
|
rep.vtotal, (unsigned long) rep.flags);
|
||||||
|
|
||||||
/*
|
|
||||||
* Older servers sometimes had server privates that the VidMode
|
|
||||||
* extension made available. So to be compatible pretend that
|
|
||||||
* there are no server privates to pass to the client.
|
|
||||||
*/
|
|
||||||
rep.privsize = 0;
|
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
|
@ -298,7 +289,8 @@ ProcVidModeGetModeLine(ClientPtr client)
|
||||||
xXF86OldVidModeGetModeLineReply oldrep = {
|
xXF86OldVidModeGetModeLineReply oldrep = {
|
||||||
.type = rep.type,
|
.type = rep.type,
|
||||||
.sequenceNumber = rep.sequenceNumber,
|
.sequenceNumber = rep.sequenceNumber,
|
||||||
.length = rep.length,
|
.length = bytes_to_int32(sizeof(xXF86OldVidModeGetModeLineReply) -
|
||||||
|
sizeof(xGenericReply)),
|
||||||
.dotclock = rep.dotclock,
|
.dotclock = rep.dotclock,
|
||||||
.hdisplay = rep.hdisplay,
|
.hdisplay = rep.hdisplay,
|
||||||
.hsyncstart = rep.hsyncstart,
|
.hsyncstart = rep.hsyncstart,
|
||||||
|
@ -323,7 +315,6 @@ static int
|
||||||
ProcVidModeGetAllModeLines(ClientPtr client)
|
ProcVidModeGetAllModeLines(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeGetAllModeLinesReq);
|
REQUEST(xXF86VidModeGetAllModeLinesReq);
|
||||||
xXF86VidModeGetAllModeLinesReply rep;
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
DisplayModePtr mode;
|
DisplayModePtr mode;
|
||||||
|
@ -349,18 +340,17 @@ ProcVidModeGetAllModeLines(ClientPtr client)
|
||||||
if (!pVidMode->GetFirstModeline(pScreen, &mode, &dotClock))
|
if (!pVidMode->GetFirstModeline(pScreen, &mode, &dotClock))
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
rep = (xXF86VidModeGetAllModeLinesReply) {
|
int payload_len = modecount * ((ver < 2) ? sizeof(xXF86OldVidModeModeInfo)
|
||||||
|
: sizeof(xXF86VidModeModeInfo));
|
||||||
|
|
||||||
|
xXF86VidModeGetAllModeLinesReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
|
.length = bytes_to_int32(sizeof(xXF86VidModeGetAllModeLinesReply) -
|
||||||
SIZEOF(xGenericReply),
|
sizeof(xGenericReply) + payload_len),
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.modecount = modecount
|
.modecount = modecount
|
||||||
};
|
};
|
||||||
if (ver < 2)
|
|
||||||
rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
|
|
||||||
else
|
|
||||||
rep.length += modecount * sizeof(xXF86VidModeModeInfo);
|
|
||||||
rep.length >>= 2;
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
|
@ -955,7 +945,6 @@ VidModeValidateModeLine(ClientPtr client, xXF86VidModeValidateModeLineReq *stuff
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
DisplayModePtr mode, modetmp = NULL;
|
DisplayModePtr mode, modetmp = NULL;
|
||||||
int status, dotClock;
|
int status, dotClock;
|
||||||
xXF86VidModeValidateModeLineReply rep = { 0 };
|
|
||||||
|
|
||||||
DebugF("ValidateModeLine - scrn: %d clock: %ld\n",
|
DebugF("ValidateModeLine - scrn: %d clock: %ld\n",
|
||||||
(int) stuff->screen, (unsigned long) stuff->dotclock);
|
(int) stuff->screen, (unsigned long) stuff->dotclock);
|
||||||
|
@ -1019,11 +1008,11 @@ VidModeValidateModeLine(ClientPtr client, xXF86VidModeValidateModeLineReq *stuff
|
||||||
status_reply:
|
status_reply:
|
||||||
free(modetmp);
|
free(modetmp);
|
||||||
|
|
||||||
rep = (xXF86VidModeValidateModeLineReply) {
|
xXF86VidModeValidateModeLineReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply)
|
.length = bytes_to_int32(sizeof(xXF86VidModeValidateModeLineReply)
|
||||||
- SIZEOF(xGenericReply)),
|
- sizeof(xGenericReply)),
|
||||||
.status = status
|
.status = status
|
||||||
};
|
};
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
|
@ -1097,7 +1086,6 @@ ProcVidModeSwitchToMode(ClientPtr client)
|
||||||
.hsyncstart = stuff->hsyncstart,
|
.hsyncstart = stuff->hsyncstart,
|
||||||
.hsyncend = stuff->hsyncend,
|
.hsyncend = stuff->hsyncend,
|
||||||
.htotal = stuff->htotal,
|
.htotal = stuff->htotal,
|
||||||
.hskew = 0,
|
|
||||||
.vdisplay = stuff->vdisplay,
|
.vdisplay = stuff->vdisplay,
|
||||||
.vsyncstart = stuff->vsyncstart,
|
.vsyncstart = stuff->vsyncstart,
|
||||||
.vsyncend = stuff->vsyncend,
|
.vsyncend = stuff->vsyncend,
|
||||||
|
@ -1216,14 +1204,10 @@ static int
|
||||||
ProcVidModeGetMonitor(ClientPtr client)
|
ProcVidModeGetMonitor(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeGetMonitorReq);
|
REQUEST(xXF86VidModeGetMonitorReq);
|
||||||
xXF86VidModeGetMonitorReply rep = {
|
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence
|
|
||||||
};
|
|
||||||
CARD32 *hsyncdata, *vsyncdata;
|
CARD32 *hsyncdata, *vsyncdata;
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
int i, nHsync, nVrefresh;
|
int i, nHsync, nVrefresh, vendorLength = 0, modelLength = 0;
|
||||||
|
|
||||||
DEBUG_P("XF86VidModeGetMonitor");
|
DEBUG_P("XF86VidModeGetMonitor");
|
||||||
|
|
||||||
|
@ -1241,25 +1225,29 @@ ProcVidModeGetMonitor(ClientPtr client)
|
||||||
nVrefresh = pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_NVREFRESH, 0).i;
|
nVrefresh = pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_NVREFRESH, 0).i;
|
||||||
|
|
||||||
if ((char *) (pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_VENDOR, 0)).ptr)
|
if ((char *) (pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_VENDOR, 0)).ptr)
|
||||||
rep.vendorLength = strlen((char *) (pVidMode->GetMonitorValue(pScreen,
|
vendorLength = strlen((char *) (pVidMode->GetMonitorValue(pScreen,
|
||||||
VIDMODE_MON_VENDOR,
|
VIDMODE_MON_VENDOR,
|
||||||
0)).ptr);
|
0)).ptr);
|
||||||
else
|
|
||||||
rep.vendorLength = 0;
|
|
||||||
if ((char *) (pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_MODEL, 0)).ptr)
|
if ((char *) (pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_MODEL, 0)).ptr)
|
||||||
rep.modelLength = strlen((char *) (pVidMode->GetMonitorValue(pScreen,
|
modelLength = strlen((char *) (pVidMode->GetMonitorValue(pScreen,
|
||||||
VIDMODE_MON_MODEL,
|
VIDMODE_MON_MODEL,
|
||||||
0)).ptr);
|
0)).ptr);
|
||||||
else
|
|
||||||
rep.modelLength = 0;
|
xXF86VidModeGetMonitorReply rep = {
|
||||||
rep.length =
|
.type = X_Reply,
|
||||||
bytes_to_int32(SIZEOF(xXF86VidModeGetMonitorReply) -
|
.sequenceNumber = client->sequence,
|
||||||
SIZEOF(xGenericReply) + (nHsync +
|
.nhsync = nHsync,
|
||||||
nVrefresh) * sizeof(CARD32) +
|
.nvsync = nVrefresh,
|
||||||
pad_to_int32(rep.vendorLength) +
|
.vendorLength = vendorLength,
|
||||||
pad_to_int32(rep.modelLength));
|
.modelLength = modelLength,
|
||||||
rep.nhsync = nHsync;
|
.length = bytes_to_int32(sizeof(xXF86VidModeGetMonitorReply) -
|
||||||
rep.nvsync = nVrefresh;
|
sizeof(xGenericReply) +
|
||||||
|
(nHsync + nVrefresh) * sizeof(CARD32) +
|
||||||
|
pad_to_int32(vendorLength) +
|
||||||
|
pad_to_int32(modelLength)),
|
||||||
|
};
|
||||||
|
|
||||||
hsyncdata = calloc(nHsync, sizeof(CARD32));
|
hsyncdata = calloc(nHsync, sizeof(CARD32));
|
||||||
if (!hsyncdata) {
|
if (!hsyncdata) {
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
@ -1313,7 +1301,6 @@ static int
|
||||||
ProcVidModeGetViewPort(ClientPtr client)
|
ProcVidModeGetViewPort(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeGetViewPortReq);
|
REQUEST(xXF86VidModeGetViewPortReq);
|
||||||
xXF86VidModeGetViewPortReply rep;
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
@ -1332,10 +1319,9 @@ ProcVidModeGetViewPort(ClientPtr client)
|
||||||
|
|
||||||
pVidMode->GetViewPort(pScreen, &x, &y);
|
pVidMode->GetViewPort(pScreen, &x, &y);
|
||||||
|
|
||||||
rep = (xXF86VidModeGetViewPortReply) {
|
xXF86VidModeGetViewPortReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = 0,
|
|
||||||
.x = x,
|
.x = x,
|
||||||
.y = y
|
.y = y
|
||||||
};
|
};
|
||||||
|
@ -1383,7 +1369,6 @@ static int
|
||||||
ProcVidModeGetDotClocks(ClientPtr client)
|
ProcVidModeGetDotClocks(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeGetDotClocksReq);
|
REQUEST(xXF86VidModeGetDotClocksReq);
|
||||||
xXF86VidModeGetDotClocksReply rep;
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
int n;
|
int n;
|
||||||
|
@ -1406,16 +1391,6 @@ ProcVidModeGetDotClocks(ClientPtr client)
|
||||||
|
|
||||||
numClocks = pVidMode->GetNumOfClocks(pScreen, &ClockProg);
|
numClocks = pVidMode->GetNumOfClocks(pScreen, &ClockProg);
|
||||||
|
|
||||||
rep = (xXF86VidModeGetDotClocksReply) {
|
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply)
|
|
||||||
- SIZEOF(xGenericReply) + numClocks),
|
|
||||||
.clocks = numClocks,
|
|
||||||
.maxclocks = MAXCLOCKS,
|
|
||||||
.flags = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!ClockProg) {
|
if (!ClockProg) {
|
||||||
Clocks = calloc(numClocks, sizeof(int));
|
Clocks = calloc(numClocks, sizeof(int));
|
||||||
if (!Clocks)
|
if (!Clocks)
|
||||||
|
@ -1425,9 +1400,17 @@ ProcVidModeGetDotClocks(ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ClockProg) {
|
|
||||||
rep.flags |= CLKFLAG_PROGRAMABLE;
|
xXF86VidModeGetDotClocksReply rep = {
|
||||||
}
|
.type = X_Reply,
|
||||||
|
.sequenceNumber = client->sequence,
|
||||||
|
.length = bytes_to_int32(sizeof(xXF86VidModeGetDotClocksReply)
|
||||||
|
- sizeof(xGenericReply) + numClocks),
|
||||||
|
.clocks = numClocks,
|
||||||
|
.maxclocks = MAXCLOCKS,
|
||||||
|
.flags = (ClockProg ? CLKFLAG_PROGRAMABLE : 0),
|
||||||
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
|
@ -1487,7 +1470,6 @@ static int
|
||||||
ProcVidModeGetGamma(ClientPtr client)
|
ProcVidModeGetGamma(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xXF86VidModeGetGammaReq);
|
REQUEST(xXF86VidModeGetGammaReq);
|
||||||
xXF86VidModeGetGammaReply rep;
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
float red, green, blue;
|
float red, green, blue;
|
||||||
|
@ -1506,10 +1488,10 @@ ProcVidModeGetGamma(ClientPtr client)
|
||||||
|
|
||||||
if (!pVidMode->GetGamma(pScreen, &red, &green, &blue))
|
if (!pVidMode->GetGamma(pScreen, &red, &green, &blue))
|
||||||
return BadValue;
|
return BadValue;
|
||||||
rep = (xXF86VidModeGetGammaReply) {
|
|
||||||
|
xXF86VidModeGetGammaReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = 0,
|
|
||||||
.red = (CARD32) (red * 10000.),
|
.red = (CARD32) (red * 10000.),
|
||||||
.green = (CARD32) (green * 10000.),
|
.green = (CARD32) (green * 10000.),
|
||||||
.blue = (CARD32) (blue * 10000.)
|
.blue = (CARD32) (blue * 10000.)
|
||||||
|
@ -1572,7 +1554,6 @@ ProcVidModeGetGammaRamp(ClientPtr client)
|
||||||
CARD16 *ramp = NULL;
|
CARD16 *ramp = NULL;
|
||||||
int length;
|
int length;
|
||||||
size_t ramplen = 0;
|
size_t ramplen = 0;
|
||||||
xXF86VidModeGetGammaRampReply rep;
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
|
|
||||||
|
@ -1604,7 +1585,8 @@ ProcVidModeGetGammaRamp(ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rep = (xXF86VidModeGetGammaRampReply) {
|
|
||||||
|
xXF86VidModeGetGammaRampReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = (length >> 1) * 3,
|
.length = (length >> 1) * 3,
|
||||||
|
@ -1630,7 +1612,6 @@ ProcVidModeGetGammaRamp(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeGetGammaRampSize(ClientPtr client)
|
ProcVidModeGetGammaRampSize(ClientPtr client)
|
||||||
{
|
{
|
||||||
xXF86VidModeGetGammaRampSizeReply rep;
|
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
VidModePtr pVidMode;
|
VidModePtr pVidMode;
|
||||||
|
|
||||||
|
@ -1646,10 +1627,9 @@ ProcVidModeGetGammaRampSize(ClientPtr client)
|
||||||
if (pVidMode == NULL)
|
if (pVidMode == NULL)
|
||||||
return BadImplementation;
|
return BadImplementation;
|
||||||
|
|
||||||
rep = (xXF86VidModeGetGammaRampSizeReply) {
|
xXF86VidModeGetGammaRampSizeReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
.length = 0,
|
|
||||||
.size = pVidMode->GetGammaRampSize(pScreen)
|
.size = pVidMode->GetGammaRampSize(pScreen)
|
||||||
};
|
};
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
|
@ -1665,23 +1645,20 @@ ProcVidModeGetGammaRampSize(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcVidModeGetPermissions(ClientPtr client)
|
ProcVidModeGetPermissions(ClientPtr client)
|
||||||
{
|
{
|
||||||
xXF86VidModeGetPermissionsReply rep = {
|
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
.permissions = XF86VM_READ_PERMISSION
|
|
||||||
};
|
|
||||||
|
|
||||||
REQUEST(xXF86VidModeGetPermissionsReq);
|
REQUEST(xXF86VidModeGetPermissionsReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
|
REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
|
||||||
|
|
||||||
if (stuff->screen >= screenInfo.numScreens)
|
if (stuff->screen >= screenInfo.numScreens)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
if (VidModeAllowNonLocal || client->local) {
|
xXF86VidModeGetPermissionsReply rep = {
|
||||||
rep.permissions |= XF86VM_WRITE_PERMISSION;
|
.type = X_Reply,
|
||||||
}
|
.sequenceNumber = client->sequence,
|
||||||
|
.permissions = (XF86VM_READ_PERMISSION |
|
||||||
|
((VidModeAllowNonLocal || client->local) ?
|
||||||
|
XF86VM_WRITE_PERMISSION : 0)),
|
||||||
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
|
|
Loading…
Reference in New Issue