summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-09 19:12:43 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-09 19:58:30 -0700
commit6a721e3af5e11bae1d59ca551a02470f35d9e844 (patch)
treeb95dd0d69fca66321f010959e69c44f781452c1f
parentd792ac125a0462a04a930af543cbc732f8cdab7d (diff)
Use C99 designated initializers in Xext Replies
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r--Xext/bigreq.c11
-rw-r--r--Xext/dpms.c55
-rw-r--r--Xext/geext.c18
-rw-r--r--Xext/panoramiX.c78
-rw-r--r--Xext/panoramiXprocs.c42
-rw-r--r--Xext/saver.c24
-rw-r--r--Xext/security.c26
-rw-r--r--Xext/shape.c50
-rw-r--r--Xext/shm.c47
-rw-r--r--Xext/sync.c95
-rw-r--r--Xext/xcmisc.c36
-rw-r--r--Xext/xf86bigfont.c30
-rw-r--r--Xext/xres.c69
-rw-r--r--Xext/xselinux_ext.c34
-rw-r--r--Xext/xtest.c24
-rw-r--r--Xext/xvdisp.c112
-rw-r--r--Xext/xvmc.c98
17 files changed, 471 insertions, 378 deletions
diff --git a/Xext/bigreq.c b/Xext/bigreq.c
index 9bb1c8616..d61ff3c7b 100644
--- a/Xext/bigreq.c
+++ b/Xext/bigreq.c
@@ -55,11 +55,12 @@ ProcBigReqDispatch(ClientPtr client)
return BadRequest;
REQUEST_SIZE_MATCH(xBigReqEnableReq);
client->big_requests = TRUE;
- memset(&rep, 0, sizeof(xBigReqEnableReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.max_request_size = maxBigRequestSize;
+ rep = (xBigReqEnableReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .max_request_size = maxBigRequestSize
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.max_request_size);
diff --git a/Xext/dpms.c b/Xext/dpms.c
index 35be966c6..8ec32eac2 100644
--- a/Xext/dpms.c
+++ b/Xext/dpms.c
@@ -45,15 +45,16 @@ static int
ProcDPMSGetVersion(ClientPtr client)
{
/* REQUEST(xDPMSGetVersionReq); */
- xDPMSGetVersionReply rep;
+ xDPMSGetVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = DPMSMajorVersion,
+ .minorVersion = DPMSMinorVersion
+ };
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = DPMSMajorVersion;
- rep.minorVersion = DPMSMinorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
@@ -67,15 +68,15 @@ static int
ProcDPMSCapable(ClientPtr client)
{
/* REQUEST(xDPMSCapableReq); */
- xDPMSCapableReply rep;
+ xDPMSCapableReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .capable = DPMSCapableFlag
+ };
REQUEST_SIZE_MATCH(xDPMSCapableReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.capable = DPMSCapableFlag;
-
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
@@ -87,17 +88,17 @@ static int
ProcDPMSGetTimeouts(ClientPtr client)
{
/* REQUEST(xDPMSGetTimeoutsReq); */
- xDPMSGetTimeoutsReply rep;
+ xDPMSGetTimeoutsReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .standby = DPMSStandbyTime / MILLI_PER_SECOND,
+ .suspend = DPMSSuspendTime / MILLI_PER_SECOND,
+ .off = DPMSOffTime / MILLI_PER_SECOND
+ };
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.standby = DPMSStandbyTime / MILLI_PER_SECOND;
- rep.suspend = DPMSSuspendTime / MILLI_PER_SECOND;
- rep.off = DPMSOffTime / MILLI_PER_SECOND;
-
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.standby);
@@ -188,16 +189,16 @@ static int
ProcDPMSInfo(ClientPtr client)
{
/* REQUEST(xDPMSInfoReq); */
- xDPMSInfoReply rep;
+ xDPMSInfoReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .power_level = DPMSPowerLevel,
+ .state = DPMSEnabled
+ };
REQUEST_SIZE_MATCH(xDPMSInfoReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.power_level = DPMSPowerLevel;
- rep.state = DPMSEnabled;
-
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.power_level);
diff --git a/Xext/geext.c b/Xext/geext.c
index 7bdd873c6..fc16b8afd 100644
--- a/Xext/geext.c
+++ b/Xext/geext.c
@@ -65,14 +65,16 @@ ProcGEQueryVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
- rep.repType = X_Reply;
- rep.RepType = X_GEQueryVersion;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
- /* return the supported version by the server */
- rep.majorVersion = SERVER_GE_MAJOR_VERSION;
- rep.minorVersion = SERVER_GE_MINOR_VERSION;
+ rep = (xGEQueryVersionReply) {
+ .repType = X_Reply,
+ .RepType = X_GEQueryVersion,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+
+ /* return the supported version by the server */
+ .majorVersion = SERVER_GE_MAJOR_VERSION,
+ .minorVersion = SERVER_GE_MINOR_VERSION
+ };
/* Remember version the client requested */
pGEClient->major_version = stuff->majorVersion;
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 98c612a33..bb253c393 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -904,14 +904,15 @@ int
ProcPanoramiXQueryVersion(ClientPtr client)
{
/* REQUEST(xPanoramiXQueryVersionReq); */
- xPanoramiXQueryVersionReply rep;
+ xPanoramiXQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_PANORAMIX_MAJOR_VERSION,
+ .minorVersion = SERVER_PANORAMIX_MINOR_VERSION
+ };
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION;
- rep.minorVersion = SERVER_PANORAMIX_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -935,11 +936,13 @@ ProcPanoramiXGetState(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.state = !noPanoramiXExtension;
- rep.window = stuff->window;
+ rep = (xPanoramiXGetStateReply) {
+ .type = X_Reply,
+ .state = !noPanoramiXExtension,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .window = stuff->window
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -963,11 +966,13 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.ScreenCount = PanoramiXNumScreens;
- rep.window = stuff->window;
+ rep = (xPanoramiXGetScreenCountReply) {
+ .type = X_Reply,
+ .ScreenCount = PanoramiXNumScreens,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .window = stuff->window
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -993,14 +998,16 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xPanoramiXGetScreenSizeReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
/* screen dimensions */
- rep.width = screenInfo.screens[stuff->screen]->width;
- rep.height = screenInfo.screens[stuff->screen]->height;
- rep.window = stuff->window;
- rep.screen = stuff->screen;
+ .width = screenInfo.screens[stuff->screen]->width,
+ .height = screenInfo.screens[stuff->screen]->height,
+ .window = stuff->window,
+ .screen = stuff->screen
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -1021,18 +1028,18 @@ ProcXineramaIsActive(ClientPtr client)
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xXineramaIsActiveReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
#if 1
- {
/* The following hack fools clients into thinking that Xinerama
* is disabled even though it is not. */
- rep.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack;
- }
+ .state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack
#else
- rep.state = !noPanoramiXExtension;
+ .state = !noPanoramiXExtension;
#endif
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -1046,14 +1053,15 @@ int
ProcXineramaQueryScreens(ClientPtr client)
{
/* REQUEST(xXineramaQueryScreensReq); */
- xXineramaQueryScreensReply rep;
+ xXineramaQueryScreensReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(rep.number * sz_XineramaScreenInfo),
+ .number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens
+ };
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
- rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index bdabfbf03..576844cbf 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -566,14 +566,18 @@ PanoramiXGetGeometry(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.root = screenInfo.screens[0]->root->drawable.id;
- rep.depth = pDraw->depth;
- rep.width = pDraw->width;
- rep.height = pDraw->height;
- rep.x = rep.y = rep.borderWidth = 0;
+ rep = (xGetGeometryReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .root = screenInfo.screens[0]->root->drawable.id,
+ .depth = pDraw->depth,
+ .width = pDraw->width,
+ .height = pDraw->height,
+ .x = 0,
+ .y = 0,
+ .borderWidth = 0
+ };
if (stuff->id == rep.root) {
xWindowRoot *root = (xWindowRoot *)
@@ -617,11 +621,13 @@ PanoramiXTranslateCoords(ClientPtr client)
rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.sameScreen = xTrue;
- rep.child = None;
+ rep = (xTranslateCoordsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .sameScreen = xTrue,
+ .child = None
+ };
if ((pWin == screenInfo.screens[0]->root) ||
(pWin->drawable.id == screenInfo.screens[0]->screensaver.wid)) {
@@ -1954,10 +1960,12 @@ PanoramiXGetImage(ClientPtr client)
return rc;
}
- xgi.visual = wVisual(((WindowPtr) pDraw));
- xgi.type = X_Reply;
- xgi.sequenceNumber = client->sequence;
- xgi.depth = pDraw->depth;
+ xgi = (xGetImageReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .visual = wVisual(((WindowPtr) pDraw)),
+ .depth = pDraw->depth
+ };
if (format == ZPixmap) {
widthBytesLine = PixmapBytePad(w, pDraw->depth);
length = widthBytesLine * h;
diff --git a/Xext/saver.c b/Xext/saver.c
index 60c02fffa..e1e86c0d4 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -634,14 +634,16 @@ ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force)
static int
ProcScreenSaverQueryVersion(ClientPtr client)
{
- xScreenSaverQueryVersionReply rep;
+ xScreenSaverQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_SAVER_MAJOR_VERSION,
+ .minorVersion = SERVER_SAVER_MINOR_VERSION
+ };
REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_SAVER_MAJOR_VERSION;
- rep.minorVersion = SERVER_SAVER_MINOR_VERSION;
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -677,10 +679,12 @@ ProcScreenSaverQueryInfo(ClientPtr client)
UpdateCurrentTime();
lastInput = GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.window = pSaver->wid;
+ rep = (xScreenSaverQueryInfoReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .window = pSaver->wid
+ };
if (screenIsSaved != SCREEN_SAVER_OFF) {
rep.state = ScreenSaverOn;
if (ScreenSaverTime)
diff --git a/Xext/security.c b/Xext/security.c
index fd63571b9..4144d859d 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -338,14 +338,16 @@ static int
ProcSecurityQueryVersion(ClientPtr client)
{
/* REQUEST(xSecurityQueryVersionReq); */
- xSecurityQueryVersionReply rep;
+ xSecurityQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_SECURITY_MAJOR_VERSION,
+ .minorVersion = SERVER_SECURITY_MINOR_VERSION
+ };
REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.majorVersion = SERVER_SECURITY_MAJOR_VERSION;
- rep.minorVersion = SERVER_SECURITY_MINOR_VERSION;
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
@@ -527,11 +529,13 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
/* tell client the auth id and data */
- rep.type = X_Reply;
- rep.length = bytes_to_int32(authdata_len);
- rep.sequenceNumber = client->sequence;
- rep.authId = authId;
- rep.dataLength = authdata_len;
+ rep = (xSecurityGenerateAuthorizationReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(authdata_len),
+ .authId = authId,
+ .dataLength = authdata_len
+ };
if (client->swapped) {
swapl(&rep.length);
diff --git a/Xext/shape.c b/Xext/shape.c
index 7724e7bb2..ecc6c8817 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -204,15 +204,16 @@ CreateClipShape(WindowPtr pWin)
static int
ProcShapeQueryVersion(ClientPtr client)
{
- xShapeQueryVersionReply rep;
+ xShapeQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_SHAPE_MAJOR_VERSION,
+ .minorVersion = SERVER_SHAPE_MINOR_VERSION
+ };
REQUEST_SIZE_MATCH(xShapeQueryVersionReq);
- memset(&rep, 0, sizeof(xShapeQueryVersionReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION;
- rep.minorVersion = SERVER_SHAPE_MINOR_VERSION;
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -631,12 +632,13 @@ ProcShapeQueryExtents(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
- memset(&rep, 0, sizeof(xShapeQueryExtentsReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.boundingShaped = (wBoundingShape(pWin) != 0);
- rep.clipShaped = (wClipShape(pWin) != 0);
+ rep = (xShapeQueryExtentsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .boundingShaped = (wBoundingShape(pWin) != 0),
+ .clipShaped = (wClipShape(pWin) != 0)
+ };
if ((region = wBoundingShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
pExtents = RegionExtents(region);
@@ -920,10 +922,12 @@ ProcShapeInputSelected(ClientPtr client)
}
}
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.enabled = enabled;
+ rep = (xShapeInputSelectedReply) {
+ .type = X_Reply,
+ .enabled = enabled,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -1001,11 +1005,13 @@ ProcShapeGetRectangles(ClientPtr client)
rects[i].height = box->y2 - box->y1;
}
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = bytes_to_int32(nrects * sizeof(xRectangle));
- rep.ordering = YXBanded;
- rep.nrects = nrects;
+ rep = (xShapeGetRectanglesReply) {
+ .type = X_Reply,
+ .ordering = YXBanded,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(nrects * sizeof(xRectangle)),
+ .nrects = nrects
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
diff --git a/Xext/shm.c b/Xext/shm.c
index a7321703a..6c9b16d57 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -285,19 +285,20 @@ ShmRegisterFbFuncs(ScreenPtr pScreen)
static int
ProcShmQueryVersion(ClientPtr client)
{
- xShmQueryVersionReply rep;
+ xShmQueryVersionReply rep = {
+ .type = X_Reply,
+ .sharedPixmaps = sharedPixmaps,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_SHM_MAJOR_VERSION,
+ .minorVersion = SERVER_SHM_MINOR_VERSION,
+ .uid = geteuid(),
+ .gid = getegid(),
+ .pixmapFormat = sharedPixmaps ? ZPixmap : 0
+ };
REQUEST_SIZE_MATCH(xShmQueryVersionReq);
- memset(&rep, 0, sizeof(xShmQueryVersionReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.sharedPixmaps = sharedPixmaps;
- rep.pixmapFormat = sharedPixmaps ? ZPixmap : 0;
- rep.majorVersion = SERVER_SHM_MAJOR_VERSION;
- rep.minorVersion = SERVER_SHM_MINOR_VERSION;
- rep.uid = geteuid();
- rep.gid = getegid();
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -656,11 +657,13 @@ ProcShmGetImage(ClientPtr client)
return BadMatch;
visual = None;
}
- xgi.type = X_Reply;
- xgi.length = 0;
- xgi.sequenceNumber = client->sequence;
- xgi.visual = visual;
- xgi.depth = pDraw->depth;
+ xgi = (xShmGetImageReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .visual = visual,
+ .depth = pDraw->depth
+ };
if (stuff->format == ZPixmap) {
length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
}
@@ -832,11 +835,13 @@ ProcPanoramiXShmGetImage(ClientPtr client)
}
}
- xgi.visual = wVisual(((WindowPtr) pDraw));
- xgi.type = X_Reply;
- xgi.length = 0;
- xgi.sequenceNumber = client->sequence;
- xgi.depth = pDraw->depth;
+ xgi = (xShmGetImageReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .visual = wVisual(((WindowPtr) pDraw)),
+ .depth = pDraw->depth
+ };
if (format == ZPixmap) {
widthBytesLine = PixmapBytePad(w, pDraw->depth);
diff --git a/Xext/sync.c b/Xext/sync.c
index fc712cd2e..3ad2b1b51 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -1185,17 +1185,16 @@ FreeAlarmClient(void *value, XID id)
static int
ProcSyncInitialize(ClientPtr client)
{
- xSyncInitializeReply rep;
+ xSyncInitializeReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_SYNC_MAJOR_VERSION,
+ .minorVersion = SERVER_SYNC_MINOR_VERSION,
+ };
REQUEST_SIZE_MATCH(xSyncInitializeReq);
- memset(&rep, 0, sizeof(xSyncInitializeReply));
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_SYNC_MAJOR_VERSION;
- rep.minorVersion = SERVER_SYNC_MINOR_VERSION;
- rep.length = 0;
-
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
@@ -1209,17 +1208,17 @@ ProcSyncInitialize(ClientPtr client)
static int
ProcSyncListSystemCounters(ClientPtr client)
{
- xSyncListSystemCountersReply rep;
+ xSyncListSystemCountersReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .nCounters = 0,
+ };
SysCounterInfo *psci;
int len = 0;
xSyncSystemCounter *list = NULL, *walklist = NULL;
REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.nCounters = 0;
-
xorg_list_for_each_entry(psci, &SysCounterList, entry) {
/* pad to 4 byte boundary */
len += pad_to_int32(sz_xSyncSystemCounter + strlen(psci->name));
@@ -1329,10 +1328,12 @@ ProcSyncGetPriority(ClientPtr client)
return rc;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.priority = priorityclient->priority;
+ rep = (xSyncGetPriorityReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .priority = priorityclient->priority
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
@@ -1606,19 +1607,20 @@ ProcSyncQueryCounter(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
/* if system counter, ask it what the current value is */
-
if (IsSystemCounter(pCounter)) {
(*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter,
&pCounter->value);
}
- rep.value_hi = XSyncValueHigh32(pCounter->value);
- rep.value_lo = XSyncValueLow32(pCounter->value);
+ rep = (xSyncQueryCounterReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .value_hi = XSyncValueHigh32(pCounter->value),
+ .value_lo = XSyncValueLow32(pCounter->value)
+ };
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -1772,32 +1774,33 @@ ProcSyncQueryAlarm(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length =
- bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply));
- rep.sequenceNumber = client->sequence;
-
pTrigger = &pAlarm->trigger;
- rep.counter = (pTrigger->pSync) ? pTrigger->pSync->id : None;
+ rep = (xSyncQueryAlarmReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length =
+ bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)),
+ .counter = (pTrigger->pSync) ? pTrigger->pSync->id : None,
#if 0 /* XXX unclear what to do, depends on whether relative value-types
* are "consumed" immediately and are considered absolute from then
* on.
*/
- rep.value_type = pTrigger->value_type;
- rep.wait_value_hi = XSyncValueHigh32(pTrigger->wait_value);
- rep.wait_value_lo = XSyncValueLow32(pTrigger->wait_value);
+ .value_type = pTrigger->value_type,
+ .wait_value_hi = XSyncValueHigh32(pTrigger->wait_value),
+ .wait_value_lo = XSyncValueLow32(pTrigger->wait_value),
#else
- rep.value_type = XSyncAbsolute;
- rep.wait_value_hi = XSyncValueHigh32(pTrigger->test_value);
- rep.wait_value_lo = XSyncValueLow32(pTrigger->test_value);
+ .value_type = XSyncAbsolute,
+ .wait_value_hi = XSyncValueHigh32(pTrigger->test_value),
+ .wait_value_lo = XSyncValueLow32(pTrigger->test_value),
#endif
- rep.test_type = pTrigger->test_type;
- rep.delta_hi = XSyncValueHigh32(pAlarm->delta);
- rep.delta_lo = XSyncValueLow32(pAlarm->delta);
- rep.events = pAlarm->events;
- rep.state = pAlarm->state;
+ .test_type = pTrigger->test_type,
+ .delta_hi = XSyncValueHigh32(pAlarm->delta),
+ .delta_lo = XSyncValueLow32(pAlarm->delta),
+ .events = pAlarm->events,
+ .state = pAlarm->state
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
@@ -1956,11 +1959,13 @@ ProcSyncQueryFence(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xSyncQueryFenceReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
- rep.triggered = pFence->funcs.CheckTriggered(pFence);
+ .triggered = pFence->funcs.CheckTriggered(pFence)
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
diff --git a/Xext/xcmisc.c b/Xext/xcmisc.c
index 943b424c0..9e4ea896e 100644
--- a/Xext/xcmisc.c
+++ b/Xext/xcmisc.c
@@ -45,14 +45,16 @@ from The Open Group.
static int
ProcXCMiscGetVersion(ClientPtr client)
{
- xXCMiscGetVersionReply rep;
+ xXCMiscGetVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = XCMiscMajorVersion,
+ .minorVersion = XCMiscMinorVersion
+ };
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = XCMiscMajorVersion;
- rep.minorVersion = XCMiscMinorVersion;
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
@@ -70,11 +72,13 @@ ProcXCMiscGetXIDRange(ClientPtr client)
REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq);
GetXIDRange(client->index, FALSE, &min_id, &max_id);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.start_id = min_id;
- rep.count = max_id - min_id + 1;
+ rep = (xXCMiscGetXIDRangeReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .start_id = min_id,
+ .count = max_id - min_id + 1
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.start_id);
@@ -102,10 +106,12 @@ ProcXCMiscGetXIDList(ClientPtr client)
return BadAlloc;
}
count = GetXIDList(client, stuff->count, pids);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = count;
- rep.count = count;
+ rep = (xXCMiscGetXIDListReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = count,
+ .count = count
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index a90286135..d91ff9583 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -277,25 +277,23 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
xXF86BigfontQueryVersionReply reply;
REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq);
- reply.type = X_Reply;
- reply.length = 0;
- reply.sequenceNumber = client->sequence;
- reply.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION;
- reply.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION;
- reply.uid = geteuid();
- reply.gid = getegid();
+ reply = (xXF86BigfontQueryVersionReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION,
+ .minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION,
+ .uid = geteuid(),
+ .gid = getegid(),
#ifdef HAS_SHM
- reply.signature = signature;
+ .signature = signature,
+ .capabilities = (LocalClient(client) && !client->swapped)
+ ? XF86Bigfont_CAP_LocalShm : 0
#else
- reply.signature = 0; /* This is redundant. Avoids uninitialized memory. */
+ .signature = 0,
+ .capabilities = 0
#endif
- reply.capabilities =
-#ifdef HAS_SHM
- (LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
-#else
- 0
-#endif
- ; /* may add more bits here in future versions */
+ };
if (client->swapped) {
char tmp;
diff --git a/Xext/xres.c b/Xext/xres.c
index d207dceb0..25d4417ca 100644
--- a/Xext/xres.c
+++ b/Xext/xres.c
@@ -194,15 +194,16 @@ static int
ProcXResQueryVersion(ClientPtr client)
{
REQUEST(xXResQueryVersionReq);
- xXResQueryVersionReply rep;
+ xXResQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .server_major = SERVER_XRES_MAJOR_VERSION,
+ .server_minor = SERVER_XRES_MINOR_VERSION
+ };
REQUEST_SIZE_MATCH(xXResQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.server_major = SERVER_XRES_MAJOR_VERSION;
- rep.server_minor = SERVER_XRES_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -233,10 +234,12 @@ ProcXResQueryClients(ClientPtr client)
}
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_clients = num_clients;
- rep.length = bytes_to_int32(rep.num_clients * sz_xXResClient);
+ rep = (xXResQueryClientsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(num_clients * sz_xXResClient),
+ .num_clients = num_clients
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -300,10 +303,12 @@ ProcXResQueryClientResources(ClientPtr client)
num_types++;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_types = num_types;
- rep.length = bytes_to_int32(rep.num_types * sz_xXResType);
+ rep = (xXResQueryClientResourcesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(num_types * sz_xXResType),
+ .num_types = num_types
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -470,15 +475,17 @@ ProcXResQueryClientPixmapBytes(ClientPtr client)
(pointer)(&bytes));
#endif
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.bytes = bytes;
+ rep = (xXResQueryClientPixmapBytesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .bytes = bytes,
#ifdef _XSERVER64
- rep.bytes_overflow = bytes >> 32;
+ .bytes_overflow = bytes >> 32
#else
- rep.bytes_overflow = 0;
+ .bytes_overflow = 0
#endif
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -650,7 +657,6 @@ ProcXResQueryClientIds (ClientPtr client)
{
REQUEST(xXResQueryClientIdsReq);
- xXResQueryClientIdsReply rep;
xXResClientIdSpec *specs = (void*) ((char*) stuff + sizeof(*stuff));
int rc;
ConstructClientIdCtx ctx;
@@ -664,12 +670,14 @@ ProcXResQueryClientIds (ClientPtr client)
rc = ConstructClientIds(client, stuff->numSpecs, specs, &ctx);
if (rc == Success) {
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
+ xXResQueryClientIdsReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(ctx.resultBytes),
+ .numIds = ctx.numIds
+ };
assert((ctx.resultBytes & 3) == 0);
- rep.length = bytes_to_int32(ctx.resultBytes);
- rep.numIds = ctx.numIds;
if (client->swapped) {
swaps (&rep.sequenceNumber);
@@ -1028,7 +1036,6 @@ ProcXResQueryResourceBytes (ClientPtr client)
{
REQUEST(xXResQueryResourceBytesReq);
- xXResQueryResourceBytesReply rep;
int rc;
ConstructResourceBytesCtx ctx;
@@ -1046,10 +1053,12 @@ ProcXResQueryResourceBytes (ClientPtr client)
rc = ConstructResourceBytes(stuff->client, &ctx);
if (rc == Success) {
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.numSizes = ctx.numSizes;
- rep.length = bytes_to_int32(ctx.resultBytes);
+ xXResQueryResourceBytesReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(ctx.resultBytes),
+ .numSizes = ctx.numSizes
+ };
if (client->swapped) {
swaps (&rep.sequenceNumber);
diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c
index 881759137..d22c2f1fd 100644
--- a/Xext/xselinux_ext.c
+++ b/Xext/xselinux_ext.c
@@ -63,13 +63,13 @@ SELinuxCopyContext(char *ptr, unsigned len)
static int
ProcSELinuxQueryVersion(ClientPtr client)
{
- SELinuxQueryVersionReply rep;
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.server_major = SELINUX_MAJOR_VERSION;
- rep.server_minor = SELINUX_MINOR_VERSION;
+ SELinuxQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .server_major = SELINUX_MAJOR_VERSION,
+ .server_minor = SELINUX_MINOR_VERSION
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -93,10 +93,12 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
len = strlen(ctx) + 1;
}
- rep.type = X_Reply;
- rep.length = bytes_to_int32(len);
- rep.sequenceNumber = client->sequence;
- rep.context_len = len;
+ rep = (SELinuxGetContextReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(len),
+ .context_len = len
+ };
if (client->swapped) {
swapl(&rep.length);
@@ -372,10 +374,12 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
}
/* Send reply to client */
- rep.type = X_Reply;
- rep.length = size;
- rep.sequenceNumber = client->sequence;
- rep.count = count;
+ rep = (SELinuxListItemsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = size,
+ .count = count
+ };
if (client->swapped) {
swapl(&rep.length);
diff --git a/Xext/xtest.c b/Xext/xtest.c
index 6112c0b7d..c7b087bdf 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -88,14 +88,16 @@ static int XTestSwapFakeInput(ClientPtr /* client */ ,
static int
ProcXTestGetVersion(ClientPtr client)
{
- xXTestGetVersionReply rep;
+ xXTestGetVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = XTestMajorVersion,
+ .minorVersion = XTestMinorVersion
+ };
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = XTestMajorVersion;
- rep.minorVersion = XTestMinorVersion;
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.minorVersion);
@@ -134,10 +136,12 @@ ProcXTestCompareCursor(ClientPtr client)
return rc;
}
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.same = (wCursor(pWin) == pCursor);
+ rep = (xXTestCompareCursorReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .same = (wCursor(pWin) == pCursor)
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index 87302673b..dae977200 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -302,17 +302,17 @@ SWriteListImageFormatsReply(ClientPtr client, xvListImageFormatsReply * rep)
static int
ProcXvQueryExtension(ClientPtr client)
{
- xvQueryExtensionReply rep;
+ xvQueryExtensionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .version = XvVersion,
+ .revision = XvRevision
+ };
/* REQUEST(xvQueryExtensionReq); */
REQUEST_SIZE_MATCH(xvQueryExtensionReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.version = XvVersion;
- rep.revision = XvRevision;
-
_WriteQueryExtensionReply(client, &rep);
return Success;
@@ -343,10 +343,12 @@ ProcXvQueryAdaptors(ClientPtr client)
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
XvGetScreenKey());
if (!pxvs) {
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_adaptors = 0;
- rep.length = 0;
+ rep = (xvQueryAdaptorsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .num_adaptors = 0
+ };
_WriteQueryAdaptorsReply(client, &rep);
@@ -355,9 +357,11 @@ ProcXvQueryAdaptors(ClientPtr client)
(*pxvs->ddQueryAdaptors) (pScreen, &pxvs->pAdaptors, &pxvs->nAdaptors);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_adaptors = pxvs->nAdaptors;
+ rep = (xvQueryAdaptorsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .num_adaptors = pxvs->nAdaptors
+ };
/* CALCULATE THE TOTAL SIZE OF THE REPLY IN BYTES */
@@ -429,9 +433,11 @@ ProcXvQueryEncodings(ClientPtr client)
return status;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_encodings = pPort->pAdaptor->nEncodings;
+ rep = (xvQueryEncodingsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .num_encodings = pPort->pAdaptor->nEncodings
+ };
/* FOR EACH ENCODING ADD UP THE BYTES FOR ENCODING NAMES */
@@ -662,11 +668,12 @@ ProcXvGrabPort(ClientPtr client)
if (status != Success) {
return status;
}
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.result = result;
+ rep = (xvGrabPortReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .result = result
+ };
_WriteGrabPortReply(client, &rep);
@@ -777,10 +784,12 @@ ProcXvGetPortAttribute(ClientPtr client)
return status;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.value = value;
+ rep = (xvGetPortAttributeReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .value = value
+ };
_WriteGetPortAttributeReply(client, &rep);
@@ -805,17 +814,18 @@ ProcXvQueryBestSize(ClientPtr client)
return status;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
-
(*pPort->pAdaptor->ddQueryBestSize) (client, pPort, stuff->motion,
stuff->vid_w, stuff->vid_h,
stuff->drw_w, stuff->drw_h,
&actual_width, &actual_height);
- rep.actual_width = actual_width;
- rep.actual_height = actual_height;
+ rep = (xvQueryBestSizeReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .actual_width = actual_width,
+ .actual_height = actual_height
+ };
_WriteQueryBestSizeReply(client, &rep);
@@ -841,10 +851,12 @@ ProcXvQueryPortAttributes(ClientPtr client)
return status;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_attributes = pPort->pAdaptor->nAttributes;
- rep.text_size = 0;
+ rep = (xvQueryPortAttributesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .num_attributes = pPort->pAdaptor->nAttributes,
+ .text_size = 0
+ };
for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
i < pPort->pAdaptor->nAttributes; i++, pAtt++) {
@@ -1089,13 +1101,15 @@ ProcXvQueryImageAttributes(ClientPtr client)
&width, &height, offsets,
pitches);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = planeLength = num_planes << 1;
- rep.num_planes = num_planes;
- rep.width = width;
- rep.height = height;
- rep.data_size = size;
+ rep = (xvQueryImageAttributesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = planeLength = num_planes << 1,
+ .num_planes = num_planes,
+ .width = width,
+ .height = height,
+ .data_size = size
+ };
_WriteQueryImageAttributesReply(client, &rep);
if (client->swapped)
@@ -1122,11 +1136,13 @@ ProcXvListImageFormats(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_formats = pPort->pAdaptor->nImages;
- rep.length =
- bytes_to_int32(pPort->pAdaptor->nImages * sz_xvImageFormatInfo);
+ rep = (xvListImageFormatsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .num_formats = pPort->pAdaptor->nImages,
+ .length =
+ bytes_to_int32(pPort->pAdaptor->nImages * sz_xvImageFormatInfo)
+ };
_WriteListImageFormatsReply(client, &rep);
diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index b008bfe89..d74302bd5 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -109,15 +109,17 @@ XvMCDestroySubpictureRes(pointer data, XID id)
static int
ProcXvMCQueryVersion(ClientPtr client)
{
- xvmcQueryVersionReply rep;
+ xvmcQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .major = SERVER_XVMC_MAJOR_VERSION,
+ .minor = SERVER_XVMC_MINOR_VERSION
+ };
/* REQUEST(xvmcQueryVersionReq); */
REQUEST_SIZE_MATCH(xvmcQueryVersionReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.major = SERVER_XVMC_MAJOR_VERSION;
- rep.minor = SERVER_XVMC_MINOR_VERSION;
+
WriteToClient(client, sizeof(xvmcQueryVersionReply), &rep);
return Success;
}
@@ -151,10 +153,12 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
}
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num = (adaptor) ? adaptor->num_surfaces : 0;
- rep.length = bytes_to_int32(rep.num * sizeof(xvmcSurfaceInfo));
+ rep = (xvmcListSurfaceTypesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .num = (adaptor) ? adaptor->num_surfaces : 0,
+ .length = bytes_to_int32(rep.num * sizeof(xvmcSurfaceInfo)),
+ };
WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep);
@@ -247,12 +251,14 @@ ProcXvMCCreateContext(ClientPtr client)
return result;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.width_actual = pContext->width;
- rep.height_actual = pContext->height;
- rep.flags_return = pContext->flags;
- rep.length = dwords;
+ rep = (xvmcCreateContextReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = dwords,
+ .width_actual = pContext->width,
+ .height_actual = pContext->height,
+ .flags_return = pContext->flags
+ };
WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
if (dwords)
@@ -320,10 +326,11 @@ ProcXvMCCreateSurface(ClientPtr client)
free(pSurface);
return result;
}
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = dwords;
+ rep = (xvmcCreateSurfaceReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = dwords
+ };
WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
if (dwords)
@@ -435,18 +442,19 @@ ProcXvMCCreateSubpicture(ClientPtr client)
free(pSubpicture);
return result;
}
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.width_actual = pSubpicture->width;
- rep.height_actual = pSubpicture->height;
- rep.num_palette_entries = pSubpicture->num_palette_entries;
- rep.entry_bytes = pSubpicture->entry_bytes;
- rep.component_order[0] = pSubpicture->component_order[0];
- rep.component_order[1] = pSubpicture->component_order[1];
- rep.component_order[2] = pSubpicture->component_order[2];
- rep.component_order[3] = pSubpicture->component_order[3];
- rep.length = dwords;
+ rep = (xvmcCreateSubpictureReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = dwords,
+ .width_actual = pSubpicture->width,
+ .height_actual = pSubpicture->height,
+ .num_palette_entries = pSubpicture->num_palette_entries,
+ .entry_bytes = pSubpicture->entry_bytes,
+ .component_order[0] = pSubpicture->component_order[0],
+ .component_order[1] = pSubpicture->component_order[1],
+ .component_order[2] = pSubpicture->component_order[2],
+ .component_order[3] = pSubpicture->component_order[3]
+ };
WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
if (dwords)
@@ -525,9 +533,11 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
if (!surface)
return BadMatch;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num = 0;
+ rep = (xvmcListSubpictureTypesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .num = 0
+ };
if (surface->compatible_subpictures)
rep.num = surface->compatible_subpictures->num_xvimages;
@@ -595,13 +605,16 @@ ProcXvMCGetDRInfo(ClientPtr client)
pScreen = pPort->pAdaptor->pScreen;
pScreenPriv = XVMC_GET_PRIVATE(pScreen);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.major = pScreenPriv->major;
- rep.minor = pScreenPriv->minor;
- rep.patchLevel = pScreenPriv->patchLevel;
- rep.nameLen = bytes_to_int32(strlen(pScreenPriv->clientDriverName) + 1);
- rep.busIDLen = bytes_to_int32(strlen(pScreenPriv->busID) + 1);
+ rep = (xvmcGetDRInfoReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .major = pScreenPriv->major,
+ .minor = pScreenPriv->minor,
+ .patchLevel = pScreenPriv->patchLevel,
+ .nameLen = bytes_to_int32(strlen(pScreenPriv->clientDriverName) + 1),
+ .busIDLen = bytes_to_int32(strlen(pScreenPriv->busID) + 1),
+ .isLocal = 1
+ };
rep.length = rep.nameLen + rep.busIDLen;
rep.nameLen <<= 2;
@@ -612,7 +625,6 @@ ProcXvMCGetDRInfo(ClientPtr client)
* segment she prepared for us.
*/
- rep.isLocal = 1;
#ifdef HAS_XVMCSHM
patternP = (CARD32 *) shmat(stuff->shmKey, NULL, SHM_RDONLY);
if (-1 != (long) patternP) {