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>
This commit is contained in:
Bryce W. Harrington 2013-06-20 03:17:38 +00:00 committed by Chris Wilson
parent 27cb80b848
commit aa764a3bbc

View file

@ -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;