From fa49ef81f7b39d32b626ed235958448835e2d2c2 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 17 Sep 2009 13:19:04 +0200 Subject: [PATCH] Add default cases for all switch statements Fixes compilation with -Wswitch-default. Compilation with -Wswitch-enums works fine as is. --- pixman/pixman-bits-image.c | 6 ++++++ pixman/pixman-edge.c | 3 +++ pixman/pixman-image.c | 4 ++++ test/composite.c | 18 ++++++++++++++++++ test/scaling-test.c | 3 +++ 5 files changed, 34 insertions(+) diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c index 4e78ce1..9e93623 100644 --- a/pixman/pixman-bits-image.c +++ b/pixman/pixman-bits-image.c @@ -157,6 +157,9 @@ repeat (pixman_repeat_t repeat, int size, int *coord) case PIXMAN_REPEAT_NONE: break; + + default: + break; } } @@ -339,6 +342,9 @@ bits_image_fetch_pixel_filtered (bits_image_t *image, case PIXMAN_FILTER_CONVOLUTION: return bits_image_fetch_pixel_convolution (image, x, y); break; + + default: + break; } return 0; diff --git a/pixman/pixman-edge.c b/pixman/pixman-edge.c index 81a2e96..ab9bea0 100644 --- a/pixman/pixman-edge.c +++ b/pixman/pixman-edge.c @@ -358,6 +358,9 @@ PIXMAN_RASTERIZE_EDGES (pixman_image_t *image, case 8: rasterize_edges_8 (image, l, r, t, b); break; + + default: + break; } } diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index bba5fd6..59db840 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -593,6 +593,10 @@ _pixman_image_is_opaque (pixman_image_t *image) if (ALPHA_8 (image->solid.color) != 0xff) return FALSE; break; + + default: + return FALSE; + break; } /* Convolution filters can introduce translucency if the sum of the diff --git a/test/composite.c b/test/composite.c index 7996251..594e8cc 100644 --- a/test/composite.c +++ b/test/composite.c @@ -407,6 +407,22 @@ calc_op (pixman_op_t op, double src, double dst, double srca, double dsta) Fb = max (0.0, 1.0 - srca / dsta); return mult_chan (src, dst, Fa, Fb); + case PIXMAN_OP_MULTIPLY: + case PIXMAN_OP_SCREEN: + case PIXMAN_OP_OVERLAY: + case PIXMAN_OP_DARKEN: + case PIXMAN_OP_LIGHTEN: + case PIXMAN_OP_COLOR_DODGE: + case PIXMAN_OP_COLOR_BURN: + case PIXMAN_OP_HARD_LIGHT: + case PIXMAN_OP_SOFT_LIGHT: + case PIXMAN_OP_DIFFERENCE: + case PIXMAN_OP_EXCLUSION: + case PIXMAN_OP_HSL_HUE: + case PIXMAN_OP_HSL_SATURATION: + case PIXMAN_OP_HSL_COLOR: + case PIXMAN_OP_HSL_LUMINOSITY: + case PIXMAN_OP_NONE: default: abort(); } @@ -866,6 +882,8 @@ main (void) ok = composite_test (&dst, op, &src, &mask, mask.size? TRUE : FALSE); break; + default: + break; } group_ok = group_ok && ok; tests_passed += ok; diff --git a/test/scaling-test.c b/test/scaling-test.c index 8899c59..c158c23 100644 --- a/test/scaling-test.c +++ b/test/scaling-test.c @@ -326,6 +326,9 @@ test_composite (uint32_t initcrc, case 3: repeat = PIXMAN_REPEAT_REFLECT; break; + + default: + break; } pixman_image_set_repeat (src_img, repeat); -- 2.7.4