[PATCH] boilerplate: Maintain consistency in the usage of switch cases

Ravi Nanjundappa <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Some of the switch cases used in boilerplate are not consistent
across other source files in the same module. This patch fixes the
consistency issues of switch case usage in the boilerplate module.

Signed-off-by: Ravi Nanjundappa <[email protected]>
---
 boilerplate/cairo-boilerplate-drm.c  |   12 ++++++--
 boilerplate/cairo-boilerplate-xlib.c |   12 ++++++--
 boilerplate/cairo-boilerplate.c      |   53 ++++++++++++++++++++++++----------
 3 files changed, 55 insertions(+), 22 deletions(-)

diff --git a/boilerplate/cairo-boilerplate-drm.c b/boilerplate/cairo-boilerplate-drm.c
index 214ce50..150cb0f 100644
--- a/boilerplate/cairo-boilerplate-drm.c
+++ b/boilerplate/cairo-boilerplate-drm.c
@@ -52,10 +52,16 @@ _cairo_boilerplate_drm_create_surface (const char		 *name,
 	return NULL; /* skip tests if no supported h/w found */
 
     switch (content) {
-    case CAIRO_CONTENT_ALPHA: format = CAIRO_FORMAT_A8; break;
-    case CAIRO_CONTENT_COLOR: format = CAIRO_FORMAT_RGB24; break;
+    case CAIRO_CONTENT_ALPHA: 
+        format = CAIRO_FORMAT_A8; 
+        break;
+    case CAIRO_CONTENT_COLOR: 
+        format = CAIRO_FORMAT_RGB24; 
+        break;
+    case CAIRO_CONTENT_COLOR_ALPHA: 
     default:
-    case CAIRO_CONTENT_COLOR_ALPHA: format = CAIRO_FORMAT_ARGB32; break;
+        format = CAIRO_FORMAT_ARGB32; 
+        break;
     }
 
     return *closure = cairo_drm_surface_create (device, format, width, height);
diff --git a/boilerplate/cairo-boilerplate-xlib.c b/boilerplate/cairo-boilerplate-xlib.c
index aed075f..f3d5598 100644
--- a/boilerplate/cairo-boilerplate-xlib.c
+++ b/boilerplate/cairo-boilerplate-xlib.c
@@ -248,10 +248,16 @@ _cairo_boilerplate_xlib_create_similar (cairo_surface_t		*other,
     similar->dpy = cairo_xlib_surface_get_display (other);
 
     switch (content) {
+    case CAIRO_CONTENT_COLOR:
+        format = PictStandardRGB24;
+        break;
+    case CAIRO_CONTENT_ALPHA:
+        format = PictStandardA8;
+        break;
+    case CAIRO_CONTENT_COLOR_ALPHA:
     default:
-    case CAIRO_CONTENT_COLOR_ALPHA: format = PictStandardARGB32; break;
-    case CAIRO_CONTENT_COLOR: format = PictStandardRGB24; break;
-    case CAIRO_CONTENT_ALPHA: format = PictStandardA8; break;
+        format = PictStandardARGB32;
+        break;
     }
 
     xrender_format = XRenderFindStandardFormat (similar->dpy, format);
diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index 674c8d0..b8a6f74 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -112,13 +112,19 @@ cairo_boilerplate_format_from_content (cairo_content_t content)
     cairo_format_t format;
 
     switch (content) {
-	case CAIRO_CONTENT_COLOR: format = CAIRO_FORMAT_RGB24; break;
-	case CAIRO_CONTENT_COLOR_ALPHA: format = CAIRO_FORMAT_ARGB32; break;
-	case CAIRO_CONTENT_ALPHA: format = CAIRO_FORMAT_A8; break;
-	default:
-	    assert (0); /* not reached */
-	    format = CAIRO_FORMAT_INVALID;
-	    break;
+    case CAIRO_CONTENT_COLOR: 
+        format = CAIRO_FORMAT_RGB24; 
+        break;
+    case CAIRO_CONTENT_COLOR_ALPHA: 
+        format = CAIRO_FORMAT_ARGB32; 
+        break;
+    case CAIRO_CONTENT_ALPHA: 
+        format = CAIRO_FORMAT_A8; 
+        break;
+    default:
+        assert (0); /* not reached */
+        format = CAIRO_FORMAT_INVALID;
+        break;
     }
 
     return format;
@@ -163,10 +169,16 @@ _cairo_boilerplate_image_create_similar (cairo_surface_t *other,
     void *ptr;
 
     switch (content) {
-    case CAIRO_CONTENT_ALPHA: format = CAIRO_FORMAT_A8; break;
-    case CAIRO_CONTENT_COLOR: format = CAIRO_FORMAT_RGB24; break;
+    case CAIRO_CONTENT_ALPHA: 
+        format = CAIRO_FORMAT_A8; 
+        break;
+    case CAIRO_CONTENT_COLOR: 
+        format = CAIRO_FORMAT_RGB24; 
+        break;
+    case CAIRO_CONTENT_COLOR_ALPHA: 
     default:
-    case CAIRO_CONTENT_COLOR_ALPHA: format = CAIRO_FORMAT_ARGB32; break;
+        format = CAIRO_FORMAT_ARGB32; 
+        break;
     }
 
     stride = cairo_format_stride_for_width(format, width);
@@ -206,10 +218,16 @@ _cairo_boilerplate_image16_create_similar (cairo_surface_t *other,
     void *ptr;
 
     switch (content) {
-    case CAIRO_CONTENT_ALPHA: format = CAIRO_FORMAT_A8; break;
-    case CAIRO_CONTENT_COLOR: format = CAIRO_FORMAT_RGB16_565; break;
+    case CAIRO_CONTENT_ALPHA: 
+        format = CAIRO_FORMAT_A8; 
+        break;
+    case CAIRO_CONTENT_COLOR: 
+        format = CAIRO_FORMAT_RGB16_565; 
+        break;
+    case CAIRO_CONTENT_COLOR_ALPHA: 
     default:
-    case CAIRO_CONTENT_COLOR_ALPHA: format = CAIRO_FORMAT_ARGB32; break;
+        format = CAIRO_FORMAT_ARGB32; 
+        break;
     }
 
     stride = cairo_format_stride_for_width(format, width);
@@ -681,10 +699,13 @@ cairo_boilerplate_get_image_target (cairo_content_t content)
 	_cairo_boilerplate_register_all ();
 
     switch (content) {
+    case CAIRO_CONTENT_COLOR: 
+        return &builtin_targets[1];
+    case CAIRO_CONTENT_COLOR_ALPHA: 
+        return &builtin_targets[0];
+    case CAIRO_CONTENT_ALPHA: 
     default:
-    case CAIRO_CONTENT_ALPHA: return NULL;
-    case CAIRO_CONTENT_COLOR: return &builtin_targets[1];
-    case CAIRO_CONTENT_COLOR_ALPHA: return &builtin_targets[0];
+        return NULL;
     }
 }
 
-- 
1.7.9.5

-- 
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.