From 7ee94c0285b0f7352506622d16aff9339ba65d0c Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 31 Jul 2006 12:03:40 -0700 Subject: [PATCH] Squelch an annoying -Wswitch-enum warning by not using switch --- src/cairo-pattern.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 14adfd19f..6bf869765 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -68,17 +68,17 @@ static const cairo_solid_pattern_t cairo_pattern_nil_read_error = { static const cairo_pattern_t * _cairo_pattern_nil_for_status (cairo_status_t status) { - switch (status) { - case CAIRO_STATUS_NULL_POINTER: + /* A switch statement would be more natural here, but we're + * avoiding that to prevent a "false positive" warning from + * -Wswitch-enum, (and I don't want to maintain a list of all + * status values here). */ + if (status == CAIRO_STATUS_NULL_POINTER) return &cairo_pattern_nil_null_pointer.base; - case CAIRO_STATUS_FILE_NOT_FOUND: + if (status == CAIRO_STATUS_FILE_NOT_FOUND) return &cairo_pattern_nil_file_not_found.base; - case CAIRO_STATUS_READ_ERROR: + if (status == CAIRO_STATUS_READ_ERROR) return &cairo_pattern_nil_read_error.base; - case CAIRO_STATUS_NO_MEMORY: - default: - return &cairo_pattern_nil.base; - } + return &cairo_pattern_nil.base; } /**