summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-14 10:02:52 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-16 21:24:49 -0700
commitfb73f7f40fa46458990038332017d4496caa0691 (patch)
treec6a0401445ec6bd9ce2b4b9dc41cae22ce4a47d2
parent5884e7dedecdd82ddbb037360cf9c85143e094b5 (diff)
Fix two more C99 initialization mistakes using members of same struct
Similar to 34cf559bcf99dad, use temporary variables instead of referencing members of the struct being initialized in the middle of the initialization. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r--Xext/panoramiX.c5
-rw-r--r--Xext/xvmc.c8
2 files changed, 8 insertions, 5 deletions
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 5653c08e1..1c7197d5d 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -1056,11 +1056,12 @@ int
ProcXineramaQueryScreens(ClientPtr client)
{
/* REQUEST(xXineramaQueryScreensReq); */
+ CARD32 number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
xXineramaQueryScreensReply rep = {
.type = X_Reply,
.sequenceNumber = client->sequence,
- .length = bytes_to_int32(rep.number * sz_XineramaScreenInfo),
- .number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens
+ .length = bytes_to_int32(number * sz_XineramaScreenInfo),
+ .number = number
};
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index 8d93cc3b0..5f0123b32 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -135,6 +135,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
xvmcSurfaceInfo info;
XvMCAdaptorPtr adaptor = NULL;
XvMCSurfaceInfoPtr surface;
+ int num_surfaces;
REQUEST(xvmcListSurfaceTypesReq);
REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq);
@@ -154,16 +155,17 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
}
}
+ num_surfaces = (adaptor) ? adaptor->num_surfaces : 0;
rep = (xvmcListSurfaceTypesReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
- .num = (adaptor) ? adaptor->num_surfaces : 0,
- .length = bytes_to_int32(rep.num * sizeof(xvmcSurfaceInfo)),
+ .num = num_surfaces,
+ .length = bytes_to_int32(num_surfaces * sizeof(xvmcSurfaceInfo)),
};
WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep);
- for (i = 0; i < rep.num; i++) {
+ for (i = 0; i < num_surfaces; i++) {
surface = adaptor->surfaces[i];
info.surface_type_id = surface->surface_type_id;
info.chroma_format = surface->chroma_format;