summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryce W. Harrington <b.harrington@samsung.com>2013-06-20 03:17:38 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-06-20 11:00:23 +0100
commitaa764a3bbc3fe43191d877aaec42b73c7d55d040 (patch)
treea7cc38ec43bc87d1b6175c3640c31a2402e77ef6 /src
parent27cb80b84834f7262d70cd1f95dd6e940059f75a (diff)
pdf: Assure compiler that data, data_size will always be initialized
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 <b.harrington@samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/cairo-pdf-surface.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 1b76ca9ac..a9c12074a 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -2389,8 +2389,10 @@ _cairo_pdf_surface_emit_image (cairo_pdf_surface_t *surface,
color = _cairo_image_analyze_color (image);
switch (color) {
- case CAIRO_IMAGE_IS_COLOR:
+ default:
case CAIRO_IMAGE_UNKNOWN_COLOR:
+ ASSERT_NOT_REACHED;
+ case CAIRO_IMAGE_IS_COLOR:
data_size = image->height * image->width * 3;
data = _cairo_malloc_abc (image->width, image->height, 3);
break;