[Spice-devel,Xspice,07/11] uxa: fix compiler warnings (initialize width, height, [xy]Dst_copy)

Submitted by Uri Lublin on Jan. 26, 2015, 10:35 a.m.

Details

Message ID 4b2801150cbc67c8d3825efc4cc6f068eddee58f.1422267879.git.uril@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Uri Lublin Jan. 26, 2015, 10:35 a.m.
Some compiler warnings for example:
uxa-glyphs.c:1045: warning: ‘width’ may be used uninitialized in this function
uxa-glyphs.c:1045: warning: ‘height’ may be used uninitialized in this function
uxa-render.c:1090: warning: ‘xDst_copy’ may be used uninitialized in this function
uxa-render.c:1090: warning: ‘yDst_copy’ may be used uninitialized in this function

I think these can never actually happen as the code protects use of
those uninitialized variables, but I'd not "argue" with the compiler.
---
 src/uxa/uxa-glyphs.c |    2 +-
 src/uxa/uxa-render.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/uxa/uxa-glyphs.c b/src/uxa/uxa-glyphs.c
index fe3d6e8..4b25837 100644
--- a/src/uxa/uxa-glyphs.c
+++ b/src/uxa/uxa-glyphs.c
@@ -1042,7 +1042,7 @@  uxa_glyphs(CARD8 op,
 	int xDst = list->xOff, yDst = list->yOff;
 	BoxRec extents = { 0, 0, 0, 0 };
 	Bool have_extents = FALSE;
-	int width, height, ret;
+	int width = 0, height = 0, ret;
 	PicturePtr localDst = pDst;
 
 	if (!uxa_screen->info->prepare_composite ||
diff --git a/src/uxa/uxa-render.c b/src/uxa/uxa-render.c
index 937ac2e..7d535ec 100644
--- a/src/uxa/uxa-render.c
+++ b/src/uxa/uxa-render.c
@@ -1087,7 +1087,7 @@  uxa_try_driver_composite(CARD8 op,
 	RegionRec region;
 	BoxPtr pbox;
 	int nbox;
-	int xDst_copy, yDst_copy;
+	int xDst_copy = 0, yDst_copy = 0;
 	int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
 	PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
 	PicturePtr localSrc, localMask = NULL;
@@ -1353,7 +1353,7 @@  uxa_try_magic_two_pass_composite_helper(CARD8 op,
 	ScreenPtr screen = pDst->pDrawable->pScreen;
 	uxa_screen_t *uxa_screen = uxa_get_screen(screen);
 	PicturePtr localDst = pDst;
-	int xDst_copy, yDst_copy;
+	int xDst_copy = 0, yDst_copy = 0;
 
 	assert(op == PictOpOver);