Use C99 designated initializers in xf86 extension Replies

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
Alan Coopersmith 2012-07-09 19:12:43 -07:00 committed by Keith Packard
parent 14501fd33e
commit 483266a583
4 changed files with 302 additions and 261 deletions

View File

@ -75,14 +75,15 @@ XDGAResetProc(ExtensionEntry * extEntry)
static int static int
ProcXDGAQueryVersion(ClientPtr client) ProcXDGAQueryVersion(ClientPtr client)
{ {
xXDGAQueryVersionReply rep; xXDGAQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_XDGA_MAJOR_VERSION,
.minorVersion = SERVER_XDGA_MINOR_VERSION
};
REQUEST_SIZE_MATCH(xXDGAQueryVersionReq); REQUEST_SIZE_MATCH(xXDGAQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = SERVER_XDGA_MAJOR_VERSION;
rep.minorVersion = SERVER_XDGA_MINOR_VERSION;
WriteToClient(client, sizeof(xXDGAQueryVersionReply), &rep); WriteToClient(client, sizeof(xXDGAQueryVersionReply), &rep);
return Success; return Success;
@ -92,7 +93,11 @@ static int
ProcXDGAOpenFramebuffer(ClientPtr client) ProcXDGAOpenFramebuffer(ClientPtr client)
{ {
REQUEST(xXDGAOpenFramebufferReq); REQUEST(xXDGAOpenFramebufferReq);
xXDGAOpenFramebufferReply rep; xXDGAOpenFramebufferReply rep = {
.type = X_Reply,
.length = 0,
.sequenceNumber = client->sequence
};
char *deviceName; char *deviceName;
int nameSize; int nameSize;
@ -104,10 +109,6 @@ ProcXDGAOpenFramebuffer(ClientPtr client)
if (!DGAAvailable(stuff->screen)) if (!DGAAvailable(stuff->screen))
return DGAErrorBase + XF86DGANoDirectVideoMode; return DGAErrorBase + XF86DGANoDirectVideoMode;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (!DGAOpenFramebuffer(stuff->screen, &deviceName, if (!DGAOpenFramebuffer(stuff->screen, &deviceName,
(unsigned char **) (&rep.mem1), (unsigned char **) (&rep.mem1),
(int *) &rep.size, (int *) &rep.offset, (int *) &rep.size, (int *) &rep.offset,
@ -149,7 +150,12 @@ ProcXDGAQueryModes(ClientPtr client)
int i, num, size; int i, num, size;
REQUEST(xXDGAQueryModesReq); REQUEST(xXDGAQueryModesReq);
xXDGAQueryModesReply rep; xXDGAQueryModesReply rep = {
.type = X_Reply,
.length = 0,
.number = 0,
.sequenceNumber = client->sequence
};
xXDGAModeInfo info; xXDGAModeInfo info;
XDGAModePtr mode; XDGAModePtr mode;
@ -158,11 +164,6 @@ ProcXDGAQueryModes(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens) if (stuff->screen >= screenInfo.numScreens)
return BadValue; return BadValue;
rep.type = X_Reply;
rep.length = 0;
rep.number = 0;
rep.sequenceNumber = client->sequence;
if (!DGAAvailable(stuff->screen)) { if (!DGAAvailable(stuff->screen)) {
rep.number = 0; rep.number = 0;
rep.length = 0; rep.length = 0;
@ -262,7 +263,13 @@ static int
ProcXDGASetMode(ClientPtr client) ProcXDGASetMode(ClientPtr client)
{ {
REQUEST(xXDGASetModeReq); REQUEST(xXDGASetModeReq);
xXDGASetModeReply rep; xXDGASetModeReply rep = {
.type = X_Reply,
.length = 0,
.offset = 0,
.flags = 0,
.sequenceNumber = client->sequence
};
XDGAModeRec mode; XDGAModeRec mode;
xXDGAModeInfo info; xXDGAModeInfo info;
PixmapPtr pPix; PixmapPtr pPix;
@ -275,12 +282,6 @@ ProcXDGASetMode(ClientPtr client)
return BadValue; return BadValue;
owner = DGA_GETCLIENT(stuff->screen); owner = DGA_GETCLIENT(stuff->screen);
rep.type = X_Reply;
rep.length = 0;
rep.offset = 0;
rep.flags = 0;
rep.sequenceNumber = client->sequence;
if (!DGAAvailable(stuff->screen)) if (!DGAAvailable(stuff->screen))
return DGAErrorBase + XF86DGANoDirectVideoMode; return DGAErrorBase + XF86DGANoDirectVideoMode;
@ -482,7 +483,11 @@ static int
ProcXDGAGetViewportStatus(ClientPtr client) ProcXDGAGetViewportStatus(ClientPtr client)
{ {
REQUEST(xXDGAGetViewportStatusReq); REQUEST(xXDGAGetViewportStatusReq);
xXDGAGetViewportStatusReply rep; xXDGAGetViewportStatusReply rep = {
.type = X_Reply,
.length = 0,
.sequenceNumber = client->sequence
};
REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq); REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
@ -492,10 +497,6 @@ ProcXDGAGetViewportStatus(ClientPtr client)
if (DGA_GETCLIENT(stuff->screen) != client) if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.status = DGAGetViewportStatus(stuff->screen); rep.status = DGAGetViewportStatus(stuff->screen);
WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), &rep); WriteToClient(client, sizeof(xXDGAGetViewportStatusReply), &rep);
@ -506,7 +507,11 @@ static int
ProcXDGASync(ClientPtr client) ProcXDGASync(ClientPtr client)
{ {
REQUEST(xXDGASyncReq); REQUEST(xXDGASyncReq);
xXDGASyncReply rep; xXDGASyncReply rep = {
.type = X_Reply,
.length = 0,
.sequenceNumber = client->sequence
};
REQUEST_SIZE_MATCH(xXDGASyncReq); REQUEST_SIZE_MATCH(xXDGASyncReq);
@ -516,10 +521,6 @@ ProcXDGASync(ClientPtr client)
if (DGA_GETCLIENT(stuff->screen) != client) if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
DGASync(stuff->screen); DGASync(stuff->screen);
WriteToClient(client, sizeof(xXDGASyncReply), &rep); WriteToClient(client, sizeof(xXDGASyncReply), &rep);
@ -562,18 +563,19 @@ ProcXDGAChangePixmapMode(ClientPtr client)
if (DGA_GETCLIENT(stuff->screen) != client) if (DGA_GETCLIENT(stuff->screen) != client)
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
x = stuff->x; x = stuff->x;
y = stuff->y; y = stuff->y;
if (!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags)) if (!DGAChangePixmapMode(stuff->screen, &x, &y, stuff->flags))
return BadMatch; return BadMatch;
rep.x = x; rep = (xXDGAChangePixmapModeReply) {
rep.y = y; .type = X_Reply,
.length = 0,
.sequenceNumber = client->sequence,
.x = x,
.y = y
};
WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), &rep); WriteToClient(client, sizeof(xXDGAChangePixmapModeReply), &rep);
return Success; return Success;
@ -616,7 +618,11 @@ static int
ProcXF86DGAGetVideoLL(ClientPtr client) ProcXF86DGAGetVideoLL(ClientPtr client)
{ {
REQUEST(xXF86DGAGetVideoLLReq); REQUEST(xXF86DGAGetVideoLLReq);
xXF86DGAGetVideoLLReply rep; xXF86DGAGetVideoLLReply rep = {
.type = X_Reply,
.length = 0,
.sequenceNumber = client->sequence
};
XDGAModeRec mode; XDGAModeRec mode;
int num, offset, flags; int num, offset, flags;
char *name; char *name;
@ -626,10 +632,6 @@ ProcXF86DGAGetVideoLL(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens) if (stuff->screen >= screenInfo.numScreens)
return BadValue; return BadValue;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (!DGAAvailable(stuff->screen)) if (!DGAAvailable(stuff->screen))
return DGAErrorBase + XF86DGANoDirectVideoMode; return DGAErrorBase + XF86DGANoDirectVideoMode;
@ -726,10 +728,6 @@ ProcXF86DGAGetViewPortSize(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens) if (stuff->screen >= screenInfo.numScreens)
return BadValue; return BadValue;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (!DGAAvailable(stuff->screen)) if (!DGAAvailable(stuff->screen))
return DGAErrorBase + XF86DGANoDirectVideoMode; return DGAErrorBase + XF86DGANoDirectVideoMode;
@ -738,8 +736,13 @@ ProcXF86DGAGetViewPortSize(ClientPtr client)
DGAGetModeInfo(stuff->screen, &mode, num); DGAGetModeInfo(stuff->screen, &mode, num);
rep.width = mode.viewportWidth; rep = (xXF86DGAGetViewPortSizeReply) {
rep.height = mode.viewportHeight; .type = X_Reply,
.length = 0,
.sequenceNumber = client->sequence,
.width = mode.viewportWidth,
.height = mode.viewportHeight
};
WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), &rep); WriteToClient(client, SIZEOF(xXF86DGAGetViewPortSizeReply), &rep);
return Success; return Success;
@ -775,18 +778,18 @@ static int
ProcXF86DGAGetVidPage(ClientPtr client) ProcXF86DGAGetVidPage(ClientPtr client)
{ {
REQUEST(xXF86DGAGetVidPageReq); REQUEST(xXF86DGAGetVidPageReq);
xXF86DGAGetVidPageReply rep; xXF86DGAGetVidPageReply rep = {
.type = X_Reply,
.length = 0,
.sequenceNumber = client->sequence,
.vpage = 0 /* silently fail */
};
REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq); REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
if (stuff->screen >= screenInfo.numScreens) if (stuff->screen >= screenInfo.numScreens)
return BadValue; return BadValue;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.vpage = 0; /* silently fail */
WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), &rep); WriteToClient(client, SIZEOF(xXF86DGAGetVidPageReply), &rep);
return Success; return Success;
} }
@ -840,18 +843,18 @@ static int
ProcXF86DGAQueryDirectVideo(ClientPtr client) ProcXF86DGAQueryDirectVideo(ClientPtr client)
{ {
REQUEST(xXF86DGAQueryDirectVideoReq); REQUEST(xXF86DGAQueryDirectVideoReq);
xXF86DGAQueryDirectVideoReply rep; xXF86DGAQueryDirectVideoReply rep = {
.type = X_Reply,
.length = 0,
.sequenceNumber = client->sequence,
.flags = 0
};
REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq); REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
if (stuff->screen >= screenInfo.numScreens) if (stuff->screen >= screenInfo.numScreens)
return BadValue; return BadValue;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.flags = 0;
if (DGAAvailable(stuff->screen)) if (DGAAvailable(stuff->screen))
rep.flags = XF86DGADirectPresent; rep.flags = XF86DGADirectPresent;
@ -863,7 +866,12 @@ static int
ProcXF86DGAViewPortChanged(ClientPtr client) ProcXF86DGAViewPortChanged(ClientPtr client)
{ {
REQUEST(xXF86DGAViewPortChangedReq); REQUEST(xXF86DGAViewPortChangedReq);
xXF86DGAViewPortChangedReply rep; xXF86DGAViewPortChangedReply rep = {
.type = X_Reply,
.length = 0,
.sequenceNumber = client->sequence,
.result = 1
};
REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq); REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
@ -876,11 +884,6 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
if (!DGAActive(stuff->screen)) if (!DGAActive(stuff->screen))
return DGAErrorBase + XF86DGADirectNotActivated; return DGAErrorBase + XF86DGADirectNotActivated;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.result = 1;
WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), &rep); WriteToClient(client, SIZEOF(xXF86DGAViewPortChangedReply), &rep);
return Success; return Success;
} }

View File

@ -282,16 +282,18 @@ SXF86VidModeNotifyEvent(xXF86VidModeNotifyEvent * from,
static int static int
ProcXF86VidModeQueryVersion(ClientPtr client) ProcXF86VidModeQueryVersion(ClientPtr client)
{ {
xXF86VidModeQueryVersionReply rep; xXF86VidModeQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION,
.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION
};
DEBUG_P("XF86VidModeQueryVersion"); DEBUG_P("XF86VidModeQueryVersion");
REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq); REQUEST_SIZE_MATCH(xXF86VidModeQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = SERVER_XF86VIDMODE_MAJOR_VERSION;
rep.minorVersion = SERVER_XF86VIDMODE_MINOR_VERSION;
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
swapl(&rep.length); swapl(&rep.length);
@ -306,8 +308,10 @@ static int
ProcXF86VidModeGetModeLine(ClientPtr client) ProcXF86VidModeGetModeLine(ClientPtr client)
{ {
REQUEST(xXF86VidModeGetModeLineReq); REQUEST(xXF86VidModeGetModeLineReq);
xXF86VidModeGetModeLineReply rep; xXF86VidModeGetModeLineReply rep = {
xXF86OldVidModeGetModeLineReply oldrep; .type = X_Reply,
.sequenceNumber = client->sequence
};
pointer mode; pointer mode;
int dotClock; int dotClock;
int ver; int ver;
@ -316,7 +320,7 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
ver = ClientMajorVersion(client); ver = ClientMajorVersion(client);
REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq); REQUEST_SIZE_MATCH(xXF86VidModeGetModeLineReq);
rep.type = X_Reply;
if (ver < 2) { if (ver < 2) {
rep.length = bytes_to_int32(SIZEOF(xXF86OldVidModeGetModeLineReply) - rep.length = bytes_to_int32(SIZEOF(xXF86OldVidModeGetModeLineReply) -
SIZEOF(xGenericReply)); SIZEOF(xGenericReply));
@ -325,7 +329,6 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetModeLineReply) - rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetModeLineReply) -
SIZEOF(xGenericReply)); SIZEOF(xGenericReply));
} }
rep.sequenceNumber = client->sequence;
if (stuff->screen >= screenInfo.numScreens) if (stuff->screen >= screenInfo.numScreens)
return BadValue; return BadValue;
@ -379,20 +382,22 @@ ProcXF86VidModeGetModeLine(ClientPtr client)
swapl(&rep.privsize); swapl(&rep.privsize);
} }
if (ver < 2) { if (ver < 2) {
oldrep.type = rep.type; xXF86OldVidModeGetModeLineReply oldrep = {
oldrep.sequenceNumber = rep.sequenceNumber; .type = rep.type,
oldrep.length = rep.length; .sequenceNumber = rep.sequenceNumber,
oldrep.dotclock = rep.dotclock; .length = rep.length,
oldrep.hdisplay = rep.hdisplay; .dotclock = rep.dotclock,
oldrep.hsyncstart = rep.hsyncstart; .hdisplay = rep.hdisplay,
oldrep.hsyncend = rep.hsyncend; .hsyncstart = rep.hsyncstart,
oldrep.htotal = rep.htotal; .hsyncend = rep.hsyncend,
oldrep.vdisplay = rep.vdisplay; .htotal = rep.htotal,
oldrep.vsyncstart = rep.vsyncstart; .vdisplay = rep.vdisplay,
oldrep.vsyncend = rep.vsyncend; .vsyncstart = rep.vsyncstart,
oldrep.vtotal = rep.vtotal; .vsyncend = rep.vsyncend,
oldrep.flags = rep.flags; .vtotal = rep.vtotal,
oldrep.privsize = rep.privsize; .flags = rep.flags,
.privsize = rep.privsize
};
WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply), &oldrep); WriteToClient(client, sizeof(xXF86OldVidModeGetModeLineReply), &oldrep);
} }
else { else {
@ -406,8 +411,6 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
{ {
REQUEST(xXF86VidModeGetAllModeLinesReq); REQUEST(xXF86VidModeGetAllModeLinesReq);
xXF86VidModeGetAllModeLinesReply rep; xXF86VidModeGetAllModeLinesReply rep;
xXF86VidModeModeInfo mdinf;
xXF86OldVidModeModeInfo oldmdinf;
pointer mode; pointer mode;
int modecount, dotClock; int modecount, dotClock;
int ver; int ver;
@ -428,16 +431,18 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock)) if (!VidModeGetFirstModeline(stuff->screen, &mode, &dotClock))
return BadValue; return BadValue;
rep.type = X_Reply; rep = (xXF86VidModeGetAllModeLinesReply) {
rep.length = SIZEOF(xXF86VidModeGetAllModeLinesReply) - .type = X_Reply,
SIZEOF(xGenericReply); .length = SIZEOF(xXF86VidModeGetAllModeLinesReply) -
SIZEOF(xGenericReply),
.sequenceNumber = client->sequence,
.modecount = modecount
};
if (ver < 2) if (ver < 2)
rep.length += modecount * sizeof(xXF86OldVidModeModeInfo); rep.length += modecount * sizeof(xXF86OldVidModeModeInfo);
else else
rep.length += modecount * sizeof(xXF86VidModeModeInfo); rep.length += modecount * sizeof(xXF86VidModeModeInfo);
rep.length >>= 2; rep.length >>= 2;
rep.sequenceNumber = client->sequence;
rep.modecount = modecount;
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
swapl(&rep.length); swapl(&rep.length);
@ -446,18 +451,20 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), &rep); WriteToClient(client, sizeof(xXF86VidModeGetAllModeLinesReply), &rep);
do { do {
mdinf.dotclock = dotClock; xXF86VidModeModeInfo mdinf = {
mdinf.hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY); .dotclock = dotClock,
mdinf.hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART); .hdisplay = VidModeGetModeValue(mode, VIDMODE_H_DISPLAY),
mdinf.hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND); .hsyncstart = VidModeGetModeValue(mode, VIDMODE_H_SYNCSTART),
mdinf.htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL); .hsyncend = VidModeGetModeValue(mode, VIDMODE_H_SYNCEND),
mdinf.hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW); .htotal = VidModeGetModeValue(mode, VIDMODE_H_TOTAL),
mdinf.vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY); .hskew = VidModeGetModeValue(mode, VIDMODE_H_SKEW),
mdinf.vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART); .vdisplay = VidModeGetModeValue(mode, VIDMODE_V_DISPLAY),
mdinf.vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND); .vsyncstart = VidModeGetModeValue(mode, VIDMODE_V_SYNCSTART),
mdinf.vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL); .vsyncend = VidModeGetModeValue(mode, VIDMODE_V_SYNCEND),
mdinf.flags = VidModeGetModeValue(mode, VIDMODE_FLAGS); .vtotal = VidModeGetModeValue(mode, VIDMODE_V_TOTAL),
mdinf.privsize = 0; .flags = VidModeGetModeValue(mode, VIDMODE_FLAGS),
.privsize = 0
};
if (client->swapped) { if (client->swapped) {
swapl(&mdinf.dotclock); swapl(&mdinf.dotclock);
swaps(&mdinf.hdisplay); swaps(&mdinf.hdisplay);
@ -473,17 +480,19 @@ ProcXF86VidModeGetAllModeLines(ClientPtr client)
swapl(&mdinf.privsize); swapl(&mdinf.privsize);
} }
if (ver < 2) { if (ver < 2) {
oldmdinf.dotclock = mdinf.dotclock; xXF86OldVidModeModeInfo oldmdinf = {
oldmdinf.hdisplay = mdinf.hdisplay; .dotclock = mdinf.dotclock,
oldmdinf.hsyncstart = mdinf.hsyncstart; .hdisplay = mdinf.hdisplay,
oldmdinf.hsyncend = mdinf.hsyncend; .hsyncstart = mdinf.hsyncstart,
oldmdinf.htotal = mdinf.htotal; .hsyncend = mdinf.hsyncend,
oldmdinf.vdisplay = mdinf.vdisplay; .htotal = mdinf.htotal,
oldmdinf.vsyncstart = mdinf.vsyncstart; .vdisplay = mdinf.vdisplay,
oldmdinf.vsyncend = mdinf.vsyncend; .vsyncstart = mdinf.vsyncstart,
oldmdinf.vtotal = mdinf.vtotal; .vsyncend = mdinf.vsyncend,
oldmdinf.flags = mdinf.flags; .vtotal = mdinf.vtotal,
oldmdinf.privsize = mdinf.privsize; .flags = mdinf.flags,
.privsize = mdinf.privsize
};
WriteToClient(client, sizeof(xXF86OldVidModeModeInfo), &oldmdinf); WriteToClient(client, sizeof(xXF86OldVidModeModeInfo), &oldmdinf);
} }
else { else {
@ -1027,11 +1036,13 @@ ProcXF86VidModeValidateModeLine(ClientPtr client)
status_reply: status_reply:
free(modetmp); free(modetmp);
rep.type = X_Reply; rep = (xXF86VidModeValidateModeLineReply) {
rep.length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply) .type = X_Reply,
- SIZEOF(xGenericReply)); .sequenceNumber = client->sequence,
rep.sequenceNumber = client->sequence; .length = bytes_to_int32(SIZEOF(xXF86VidModeValidateModeLineReply)
rep.status = status; - SIZEOF(xGenericReply)),
.status = status
};
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
swapl(&rep.length); swapl(&rep.length);
@ -1186,7 +1197,10 @@ static int
ProcXF86VidModeGetMonitor(ClientPtr client) ProcXF86VidModeGetMonitor(ClientPtr client)
{ {
REQUEST(xXF86VidModeGetMonitorReq); REQUEST(xXF86VidModeGetMonitorReq);
xXF86VidModeGetMonitorReply rep; xXF86VidModeGetMonitorReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence
};
CARD32 *hsyncdata, *vsyncdata; CARD32 *hsyncdata, *vsyncdata;
int i, nHsync, nVrefresh; int i, nHsync, nVrefresh;
pointer monitor; pointer monitor;
@ -1204,7 +1218,6 @@ ProcXF86VidModeGetMonitor(ClientPtr client)
nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i; nHsync = VidModeGetMonitorValue(monitor, VIDMODE_MON_NHSYNC, 0).i;
nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i; nVrefresh = VidModeGetMonitorValue(monitor, VIDMODE_MON_NVREFRESH, 0).i;
rep.type = X_Reply;
if ((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr) if ((char *) (VidModeGetMonitorValue(monitor, VIDMODE_MON_VENDOR, 0)).ptr)
rep.vendorLength = strlen((char *) (VidModeGetMonitorValue(monitor, rep.vendorLength = strlen((char *) (VidModeGetMonitorValue(monitor,
VIDMODE_MON_VENDOR, VIDMODE_MON_VENDOR,
@ -1223,7 +1236,6 @@ ProcXF86VidModeGetMonitor(ClientPtr client)
nVrefresh) * sizeof(CARD32) + nVrefresh) * sizeof(CARD32) +
pad_to_int32(rep.vendorLength) + pad_to_int32(rep.vendorLength) +
pad_to_int32(rep.modelLength)); pad_to_int32(rep.modelLength));
rep.sequenceNumber = client->sequence;
rep.nhsync = nHsync; rep.nhsync = nHsync;
rep.nvsync = nVrefresh; rep.nvsync = nVrefresh;
hsyncdata = malloc(nHsync * sizeof(CARD32)); hsyncdata = malloc(nHsync * sizeof(CARD32));
@ -1289,13 +1301,15 @@ ProcXF86VidModeGetViewPort(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens) if (stuff->screen >= screenInfo.numScreens)
return BadValue; return BadValue;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
VidModeGetViewPort(stuff->screen, &x, &y); VidModeGetViewPort(stuff->screen, &x, &y);
rep.x = x;
rep.y = y; rep = (xXF86VidModeGetViewPortReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.x = x,
.y = y
};
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
@ -1345,13 +1359,15 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg); numClocks = VidModeGetNumOfClocks(stuff->screen, &ClockProg);
rep.type = X_Reply; rep = (xXF86VidModeGetDotClocksReply) {
rep.length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply) .type = X_Reply,
- SIZEOF(xGenericReply) + numClocks); .sequenceNumber = client->sequence,
rep.sequenceNumber = client->sequence; .length = bytes_to_int32(SIZEOF(xXF86VidModeGetDotClocksReply)
rep.clocks = numClocks; - SIZEOF(xGenericReply) + numClocks),
rep.maxclocks = MAXCLOCKS; .clocks = numClocks,
rep.flags = 0; .maxclocks = MAXCLOCKS,
.flags = 0
};
if (!ClockProg) { if (!ClockProg) {
Clocks = calloc(numClocks, sizeof(int)); Clocks = calloc(numClocks, sizeof(int));
@ -1423,14 +1439,16 @@ ProcXF86VidModeGetGamma(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens) if (stuff->screen >= screenInfo.numScreens)
return BadValue; return BadValue;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (!VidModeGetGamma(stuff->screen, &red, &green, &blue)) if (!VidModeGetGamma(stuff->screen, &red, &green, &blue))
return BadValue; return BadValue;
rep.red = (CARD32) (red * 10000.); rep = (xXF86VidModeGetGammaReply) {
rep.green = (CARD32) (green * 10000.); .type = X_Reply,
rep.blue = (CARD32) (blue * 10000.); .sequenceNumber = client->sequence,
.length = 0,
.red = (CARD32) (red * 10000.),
.green = (CARD32) (green * 10000.),
.blue = (CARD32) (blue * 10000.)
};
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
swapl(&rep.length); swapl(&rep.length);
@ -1502,10 +1520,12 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
return BadValue; return BadValue;
} }
} }
rep.type = X_Reply; rep = (xXF86VidModeGetGammaRampReply) {
rep.length = (length >> 1) * 3; .type = X_Reply,
rep.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
rep.size = stuff->size; .length = (length >> 1) * 3,
.size = stuff->size
};
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
swapl(&rep.length); swapl(&rep.length);
@ -1534,10 +1554,12 @@ ProcXF86VidModeGetGammaRampSize(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens) if (stuff->screen >= screenInfo.numScreens)
return BadValue; return BadValue;
rep.type = X_Reply; rep = (xXF86VidModeGetGammaRampSizeReply) {
rep.length = 0; .type = X_Reply,
rep.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
rep.size = VidModeGetGammaRampSize(stuff->screen); .length = 0,
.size = VidModeGetGammaRampSize(stuff->screen)
};
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
swapl(&rep.length); swapl(&rep.length);
@ -1551,7 +1573,12 @@ ProcXF86VidModeGetGammaRampSize(ClientPtr client)
static int static int
ProcXF86VidModeGetPermissions(ClientPtr client) ProcXF86VidModeGetPermissions(ClientPtr client)
{ {
xXF86VidModeGetPermissionsReply rep; xXF86VidModeGetPermissionsReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.permissions = XF86VM_READ_PERMISSION
};
REQUEST(xXF86VidModeGetPermissionsReq); REQUEST(xXF86VidModeGetPermissionsReq);
@ -1560,10 +1587,6 @@ ProcXF86VidModeGetPermissions(ClientPtr client)
if (stuff->screen >= screenInfo.numScreens) if (stuff->screen >= screenInfo.numScreens)
return BadValue; return BadValue;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.permissions = XF86VM_READ_PERMISSION;
if (xf86GetVidModeEnabled() && if (xf86GetVidModeEnabled() &&
(xf86GetVidModeAllowNonLocal() || LocalClient(client))) { (xf86GetVidModeAllowNonLocal() || LocalClient(client))) {
rep.permissions |= XF86VM_WRITE_PERMISSION; rep.permissions |= XF86VM_WRITE_PERMISSION;

View File

@ -78,15 +78,16 @@ XF86DRIResetProc(ExtensionEntry * extEntry)
static int static int
ProcXF86DRIQueryVersion(register ClientPtr client) ProcXF86DRIQueryVersion(register ClientPtr client)
{ {
xXF86DRIQueryVersionReply rep; xXF86DRIQueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = SERVER_XF86DRI_MAJOR_VERSION,
.minorVersion = SERVER_XF86DRI_MINOR_VERSION,
.patchVersion = SERVER_XF86DRI_PATCH_VERSION
};
REQUEST_SIZE_MATCH(xXF86DRIQueryVersionReq); 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) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
swapl(&rep.length); swapl(&rep.length);
@ -111,18 +112,20 @@ ProcXF86DRIQueryDirectRenderingCapable(register ClientPtr client)
return BadValue; return BadValue;
} }
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (!DRIQueryDirectRenderingCapable(screenInfo.screens[stuff->screen], if (!DRIQueryDirectRenderingCapable(screenInfo.screens[stuff->screen],
&isCapable)) { &isCapable)) {
return BadValue; return BadValue;
} }
rep.isCapable = isCapable;
if (!LocalClient(client) || client->swapped) if (!LocalClient(client) || client->swapped)
rep.isCapable = 0; isCapable = 0;
rep = (xXF86DRIQueryDirectRenderingCapableReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.isCapable = isCapable
};
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
@ -158,20 +161,21 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
if (busIdString) if (busIdString)
busIdStringLength = strlen(busIdString); busIdStringLength = strlen(busIdString);
rep.type = X_Reply; rep = (xXF86DRIOpenConnectionReply) {
rep.sequenceNumber = client->sequence; .type = X_Reply,
rep.busIdStringLength = busIdStringLength; .sequenceNumber = client->sequence,
rep.length = .length = bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
bytes_to_int32(SIZEOF(xXF86DRIOpenConnectionReply) -
SIZEOF(xGenericReply) + SIZEOF(xGenericReply) +
pad_to_int32(rep.busIdStringLength)); pad_to_int32(busIdStringLength)),
.busIdStringLength = busIdStringLength,
rep.hSAREALow = (CARD32) (hSAREA & 0xffffffff); .hSAREALow = (CARD32) (hSAREA & 0xffffffff),
#if defined(LONG64) && !defined(__linux__) #if defined(LONG64) && !defined(__linux__)
rep.hSAREAHigh = (CARD32) (hSAREA >> 32); .hSAREAHigh = (CARD32) (hSAREA >> 32),
#else #else
rep.hSAREAHigh = 0; .hSAREAHigh = 0
#endif #endif
};
WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep); WriteToClient(client, sizeof(xXF86DRIOpenConnectionReply), &rep);
if (busIdStringLength) if (busIdStringLength)
@ -182,7 +186,12 @@ ProcXF86DRIOpenConnection(register ClientPtr client)
static int static int
ProcXF86DRIAuthConnection(register ClientPtr client) ProcXF86DRIAuthConnection(register ClientPtr client)
{ {
xXF86DRIAuthConnectionReply rep; xXF86DRIAuthConnectionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.authenticated = 1
};
REQUEST(xXF86DRIAuthConnectionReq); REQUEST(xXF86DRIAuthConnectionReq);
REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq); REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq);
@ -191,11 +200,6 @@ ProcXF86DRIAuthConnection(register ClientPtr client)
return BadValue; return BadValue;
} }
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.authenticated = 1;
if (!DRIAuthConnection(screenInfo.screens[stuff->screen], stuff->magic)) { if (!DRIAuthConnection(screenInfo.screens[stuff->screen], stuff->magic)) {
ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic); ErrorF("Failed to authenticate %lu\n", (unsigned long) stuff->magic);
rep.authenticated = 0; rep.authenticated = 0;
@ -222,7 +226,11 @@ ProcXF86DRICloseConnection(register ClientPtr client)
static int static int
ProcXF86DRIGetClientDriverName(register ClientPtr client) ProcXF86DRIGetClientDriverName(register ClientPtr client)
{ {
xXF86DRIGetClientDriverNameReply rep; xXF86DRIGetClientDriverNameReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.clientDriverNameLength = 0
};
char *clientDriverName; char *clientDriverName;
REQUEST(xXF86DRIGetClientDriverNameReq); REQUEST(xXF86DRIGetClientDriverNameReq);
@ -238,9 +246,6 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
(int *) &rep.ddxDriverPatchVersion, (int *) &rep.ddxDriverPatchVersion,
&clientDriverName); &clientDriverName);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.clientDriverNameLength = 0;
if (clientDriverName) if (clientDriverName)
rep.clientDriverNameLength = strlen(clientDriverName); rep.clientDriverNameLength = strlen(clientDriverName);
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) - rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetClientDriverNameReply) -
@ -256,7 +261,11 @@ ProcXF86DRIGetClientDriverName(register ClientPtr client)
static int static int
ProcXF86DRICreateContext(register ClientPtr client) ProcXF86DRICreateContext(register ClientPtr client)
{ {
xXF86DRICreateContextReply rep; xXF86DRICreateContextReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0
};
ScreenPtr pScreen; ScreenPtr pScreen;
REQUEST(xXF86DRICreateContextReq); REQUEST(xXF86DRICreateContextReq);
@ -266,10 +275,6 @@ ProcXF86DRICreateContext(register ClientPtr client)
return BadValue; return BadValue;
} }
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
pScreen = screenInfo.screens[stuff->screen]; pScreen = screenInfo.screens[stuff->screen];
if (!DRICreateContext(pScreen, if (!DRICreateContext(pScreen,
@ -302,7 +307,11 @@ ProcXF86DRIDestroyContext(register ClientPtr client)
static int static int
ProcXF86DRICreateDrawable(ClientPtr client) ProcXF86DRICreateDrawable(ClientPtr client)
{ {
xXF86DRICreateDrawableReply rep; xXF86DRICreateDrawableReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0
};
DrawablePtr pDrawable; DrawablePtr pDrawable;
int rc; int rc;
@ -313,10 +322,6 @@ ProcXF86DRICreateDrawable(ClientPtr client)
return BadValue; return BadValue;
} }
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess); DixReadAccess);
if (rc != Success) if (rc != Success)
@ -361,7 +366,11 @@ ProcXF86DRIDestroyDrawable(register ClientPtr client)
static int static int
ProcXF86DRIGetDrawableInfo(register ClientPtr client) ProcXF86DRIGetDrawableInfo(register ClientPtr client)
{ {
xXF86DRIGetDrawableInfoReply rep; xXF86DRIGetDrawableInfoReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0
};
DrawablePtr pDrawable; DrawablePtr pDrawable;
int X, Y, W, H; int X, Y, W, H;
drm_clip_rect_t *pClipRects, *pClippedRects; drm_clip_rect_t *pClipRects, *pClippedRects;
@ -375,10 +384,6 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
return BadValue; return BadValue;
} }
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
DixReadAccess); DixReadAccess);
if (rc != Success) if (rc != Success)
@ -466,7 +471,11 @@ ProcXF86DRIGetDrawableInfo(register ClientPtr client)
static int static int
ProcXF86DRIGetDeviceInfo(register ClientPtr client) ProcXF86DRIGetDeviceInfo(register ClientPtr client)
{ {
xXF86DRIGetDeviceInfoReply rep; xXF86DRIGetDeviceInfoReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0
};
drm_handle_t hFrameBuffer; drm_handle_t hFrameBuffer;
void *pDevPrivate; void *pDevPrivate;
@ -477,10 +486,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
return BadValue; return BadValue;
} }
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
if (!DRIGetDeviceInfo(screenInfo.screens[stuff->screen], if (!DRIGetDeviceInfo(screenInfo.screens[stuff->screen],
&hFrameBuffer, &hFrameBuffer,
(int *) &rep.framebufferOrigin, (int *) &rep.framebufferOrigin,
@ -497,7 +502,6 @@ ProcXF86DRIGetDeviceInfo(register ClientPtr client)
rep.hFrameBufferHigh = 0; rep.hFrameBufferHigh = 0;
#endif #endif
rep.length = 0;
if (rep.devPrivateSize) { if (rep.devPrivateSize) {
rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) - rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) -
SIZEOF(xGenericReply) + SIZEOF(xGenericReply) +

View File

@ -71,17 +71,18 @@ static int
ProcDRI2QueryVersion(ClientPtr client) ProcDRI2QueryVersion(ClientPtr client)
{ {
REQUEST(xDRI2QueryVersionReq); REQUEST(xDRI2QueryVersionReq);
xDRI2QueryVersionReply rep; xDRI2QueryVersionReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.majorVersion = dri2_major,
.minorVersion = dri2_minor
};
if (client->swapped) if (client->swapped)
swaps(&stuff->length); swaps(&stuff->length);
REQUEST_SIZE_MATCH(xDRI2QueryVersionReq); REQUEST_SIZE_MATCH(xDRI2QueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = dri2_major;
rep.minorVersion = dri2_minor;
if (client->swapped) { if (client->swapped) {
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
@ -99,7 +100,13 @@ static int
ProcDRI2Connect(ClientPtr client) ProcDRI2Connect(ClientPtr client)
{ {
REQUEST(xDRI2ConnectReq); REQUEST(xDRI2ConnectReq);
xDRI2ConnectReply rep; xDRI2ConnectReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.driverNameLength = 0,
.deviceNameLength = 0
};
DrawablePtr pDraw; DrawablePtr pDraw;
int fd, status; int fd, status;
const char *driverName; const char *driverName;
@ -110,12 +117,6 @@ ProcDRI2Connect(ClientPtr client)
&pDraw, &status)) &pDraw, &status))
return status; return status;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.driverNameLength = 0;
rep.deviceNameLength = 0;
if (!DRI2Connect(client, pDraw->pScreen, if (!DRI2Connect(client, pDraw->pScreen,
stuff->driverType, &fd, &driverName, &deviceName)) stuff->driverType, &fd, &driverName, &deviceName))
goto fail; goto fail;
@ -146,10 +147,12 @@ ProcDRI2Authenticate(ClientPtr client)
&pDraw, &status)) &pDraw, &status))
return status; return status;
rep.type = X_Reply; rep = (xDRI2AuthenticateReply) {
rep.sequenceNumber = client->sequence; .type = X_Reply,
rep.length = 0; .sequenceNumber = client->sequence,
rep.authenticated = DRI2Authenticate(client, pDraw->pScreen, stuff->magic); .length = 0,
.authenticated = DRI2Authenticate(client, pDraw->pScreen, stuff->magic)
};
WriteToClient(client, sizeof(xDRI2AuthenticateReply), &rep); WriteToClient(client, sizeof(xDRI2AuthenticateReply), &rep);
return Success; return Success;
@ -225,12 +228,14 @@ send_buffers_reply(ClientPtr client, DrawablePtr pDrawable,
} }
} }
rep.type = X_Reply; rep = (xDRI2GetBuffersReply) {
rep.length = (count - skip) * sizeof(xDRI2Buffer) / 4; .type = X_Reply,
rep.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
rep.width = width; .length = (count - skip) * sizeof(xDRI2Buffer) / 4,
rep.height = height; .width = width,
rep.count = count - skip; .height = height,
.count = count - skip
};
WriteToClient(client, sizeof(xDRI2GetBuffersReply), &rep); WriteToClient(client, sizeof(xDRI2GetBuffersReply), &rep);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
@ -330,9 +335,11 @@ ProcDRI2CopyRegion(ClientPtr client)
* that yet. * that yet.
*/ */
rep.type = X_Reply; rep = (xDRI2CopyRegionReply) {
rep.length = 0; .type = X_Reply,
rep.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
.length = 0
};
WriteToClient(client, sizeof(xDRI2CopyRegionReply), &rep); WriteToClient(client, sizeof(xDRI2CopyRegionReply), &rep);
@ -375,7 +382,11 @@ static int
ProcDRI2SwapBuffers(ClientPtr client) ProcDRI2SwapBuffers(ClientPtr client)
{ {
REQUEST(xDRI2SwapBuffersReq); REQUEST(xDRI2SwapBuffersReq);
xDRI2SwapBuffersReply rep; xDRI2SwapBuffersReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0
};
DrawablePtr pDrawable; DrawablePtr pDrawable;
CARD64 target_msc, divisor, remainder, swap_target; CARD64 target_msc, divisor, remainder, swap_target;
int status; int status;
@ -402,9 +413,6 @@ ProcDRI2SwapBuffers(ClientPtr client)
if (status != Success) if (status != Success)
return BadDrawable; return BadDrawable;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
load_swap_reply(&rep, swap_target); load_swap_reply(&rep, swap_target);
WriteToClient(client, sizeof(xDRI2SwapBuffersReply), &rep); WriteToClient(client, sizeof(xDRI2SwapBuffersReply), &rep);
@ -427,7 +435,11 @@ static int
ProcDRI2GetMSC(ClientPtr client) ProcDRI2GetMSC(ClientPtr client)
{ {
REQUEST(xDRI2GetMSCReq); REQUEST(xDRI2GetMSCReq);
xDRI2MSCReply rep; xDRI2MSCReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0
};
DrawablePtr pDrawable; DrawablePtr pDrawable;
CARD64 ust, msc, sbc; CARD64 ust, msc, sbc;
int status; int status;
@ -442,9 +454,6 @@ ProcDRI2GetMSC(ClientPtr client)
if (status != Success) if (status != Success)
return status; return status;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
load_msc_reply(&rep, ust, msc, sbc); load_msc_reply(&rep, ust, msc, sbc);
WriteToClient(client, sizeof(xDRI2MSCReply), &rep); WriteToClient(client, sizeof(xDRI2MSCReply), &rep);
@ -482,11 +491,12 @@ ProcDRI2WaitMSC(ClientPtr client)
int int
ProcDRI2WaitMSCReply(ClientPtr client, CARD64 ust, CARD64 msc, CARD64 sbc) ProcDRI2WaitMSCReply(ClientPtr client, CARD64 ust, CARD64 msc, CARD64 sbc)
{ {
xDRI2MSCReply rep; xDRI2MSCReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0
};
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
load_msc_reply(&rep, ust, msc, sbc); load_msc_reply(&rep, ust, msc, sbc);
WriteToClient(client, sizeof(xDRI2MSCReply), &rep); WriteToClient(client, sizeof(xDRI2MSCReply), &rep);
@ -614,7 +624,13 @@ static int
SProcDRI2Connect(ClientPtr client) SProcDRI2Connect(ClientPtr client)
{ {
REQUEST(xDRI2ConnectReq); REQUEST(xDRI2ConnectReq);
xDRI2ConnectReply rep; xDRI2ConnectReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = 0,
.driverNameLength = 0,
.deviceNameLength = 0
};
/* If the client is swapped, it's not local. Talk to the hand. */ /* If the client is swapped, it's not local. Talk to the hand. */
@ -622,12 +638,7 @@ SProcDRI2Connect(ClientPtr client)
if (sizeof(*stuff) / 4 != client->req_len) if (sizeof(*stuff) / 4 != client->req_len)
return BadLength; return BadLength;
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
swaps(&rep.sequenceNumber); swaps(&rep.sequenceNumber);
rep.length = 0;
rep.driverNameLength = 0;
rep.deviceNameLength = 0;
WriteToClient(client, sizeof(xDRI2ConnectReply), &rep); WriteToClient(client, sizeof(xDRI2ConnectReply), &rep);