Blob Blame History Raw
From cfdd652f50ed8281da176b084a4d58f895a47586 Mon Sep 17 00:00:00 2001
From: Uri Lublin <uril@redhat.com>
Date: Mon, 26 Jan 2015 12:35:39 +0200
Subject: [PATCH] uxa: fix compiler warnings (initialize width, height,
 [xy]Dst_copy)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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(-)

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);
 
-- 
2.4.3