[PATCH] pdf: Assure compiler that data, data_size will always be initialized

"Bryce W. Harrington" <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <5A5FB412583EA944A1D0228D52A9C5726392C5@sisaex02sj>
There are only three possible color states:  COLOR, GRAYSCALE, or
MONOCHROME thus data and data_size will always be set to some value,
so assert the default is never reached.

Fixes these warning:
  cairo-pdf-surface.c:2517:32: warning: ‘data_size’ may be used
   uninitialized in this function [-Wuninitialized]
  cairo-pdf-surface.c:2338:19: note: ‘data_size’ was declared here
  cairo-pdf-surface.c:2446:11: warning: ‘data’ may be used uninitialized
   in this function [-Wuninitialized]
  cairo-pdf-surface.c:2337:11: note: ‘data’ was declared here

Signed-off-by: Bryce Harrington <[email protected]>
---
 src/cairo-pdf-surface.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 133f6f2..707ba97 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -2403,6 +2403,9 @@ _cairo_pdf_surface_emit_image (cairo_pdf_surface_t     *surface,
 	    data_size = (image->width + 7) / 8 * image->height;
 	    data = _cairo_malloc_ab ((image->width+7) / 8, image->height);
 	    break;
+        default:
+	    ASSERT_NOT_REACHED;
+	    break;
     }
     if (unlikely (data == NULL)) {
 	status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
-- 
1.7.9.5


--
Bryce Harrington
Senior Open Source Developer  -  [email protected]
Open Source Group             -  Samsung Research America

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.