[cairo] [PATCH] Initialize ax and bx to quell warnings.

Bryce W. Harrington b.harrington at samsung.com
Mon Jun 10 12:00:04 PDT 2013


Compiler warns about ax and bx possibly being used uninitialized.  The
code logic as currently written doesn't permit this, so initializing the
variables is just to stifle warnings in six places.

Signed-off-by: Bryce Harrington <b.harrington at samsung.com>
---
 src/cairo-bentley-ottmann.c      |    3 ++-
 src/cairo-botor-scan-converter.c |    3 ++-
 src/cairo-polygon-intersect.c    |    3 ++-
 src/cairo-polygon-reduce.c       |    3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/cairo-bentley-ottmann.c b/src/cairo-bentley-ottmann.c
index 0e1a3f5..b596ced 100644
--- a/src/cairo-bentley-ottmann.c
+++ b/src/cairo-bentley-ottmann.c
@@ -526,7 +526,8 @@ edges_compare_x_for_y (const cairo_bo_edge_t *a,
        HAVE_BX      = 0x2,
        HAVE_BOTH    = HAVE_AX | HAVE_BX
     } have_ax_bx = HAVE_BOTH;
-    int32_t ax, bx;
+    int32_t ax = 0;
+    int32_t bx = 0;
 
     if (y == a->edge.line.p1.y)
 	ax = a->edge.line.p1.x;
diff --git a/src/cairo-botor-scan-converter.c b/src/cairo-botor-scan-converter.c
index 515305b..65993c6 100644
--- a/src/cairo-botor-scan-converter.c
+++ b/src/cairo-botor-scan-converter.c
@@ -456,7 +456,8 @@ edges_compare_x_for_y (const cairo_edge_t *a,
        HAVE_BX      = 0x2,
        HAVE_BOTH    = HAVE_AX | HAVE_BX
     } have_ax_bx = HAVE_BOTH;
-    int32_t ax, bx;
+    int32_t ax = 0;
+    int32_t bx = 0;
 
     /* XXX given we have x and dx? */
 
diff --git a/src/cairo-polygon-intersect.c b/src/cairo-polygon-intersect.c
index 2cd73d2..defcfc4 100644
--- a/src/cairo-polygon-intersect.c
+++ b/src/cairo-polygon-intersect.c
@@ -444,7 +444,8 @@ edges_compare_x_for_y (const cairo_bo_edge_t *a,
        HAVE_BX      = 0x2,
        HAVE_BOTH    = HAVE_AX | HAVE_BX
     } have_ax_bx = HAVE_BOTH;
-    int32_t ax, bx;
+    int32_t ax = 0;
+    int32_t bx = 0;
 
     if (y == a->edge.line.p1.y)
 	ax = a->edge.line.p1.x;
diff --git a/src/cairo-polygon-reduce.c b/src/cairo-polygon-reduce.c
index ea457fe..437764e 100644
--- a/src/cairo-polygon-reduce.c
+++ b/src/cairo-polygon-reduce.c
@@ -445,7 +445,8 @@ edges_compare_x_for_y (const cairo_bo_edge_t *a,
        HAVE_BX      = 0x2,
        HAVE_BOTH    = HAVE_AX | HAVE_BX
     } have_ax_bx = HAVE_BOTH;
-    int32_t ax, bx;
+    int32_t ax = 0;
+    int32_t bx = 0;
 
     if (y == a->edge.line.p1.y)
 	ax = a->edge.line.p1.x;
-- 
1.7.9.5


More information about the cairo mailing list