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

RAVI NANJUNDAPPA nravi.n at samsung.com
Mon May 5 00:11:02 PDT 2014


Hello Bryce, 

Thanks for pointing out the trailing whitespaces. Since I'm using VI editor
I've searched for the whitespaces 
(I've referred to the links provided by you) and removed them from the
patch.
The attached patch seems to be fine without these glitches. 
Please review the same and provide your inputs.

Thanks and Best Regards, 
N Ravi

> -----Original Message-----
> From: Bryce W. Harrington [mailto:b.harrington at samsung.com]
> Sent: Thursday, May 01, 2014 12:59 AM
> To: Ravi Nanjundappa
> Cc: cairo at cairographics.org
> Subject: Re: [cairo] [PATCH] boilerplate: Maintain consistency in the
usage of
> switch cases
> 
> On Tue, Apr 29, 2014 at 12:31:12PM +0530, Ravi Nanjundappa wrote:
> > 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.
> 
> Hi Ravi, this looks good except there is some trailing whitespace added:
> 
> humber:~/src/Cairo/cairo$ git am
> /tmp/cairo_PATCH_boilerplate_Maintain_consistency_in_the_usage_of_sw
> itch_cases.mbox
> Applying: boilerplate: Maintain consistency in the usage of switch cases
> /home/bryce/src/Cairo/cairo/.git/rebase-apply/patch:17: trailing
> whitespace.
>     case CAIRO_CONTENT_ALPHA:
> /home/bryce/src/Cairo/cairo/.git/rebase-apply/patch:18: trailing
> whitespace.
>         format = CAIRO_FORMAT_A8;
> /home/bryce/src/Cairo/cairo/.git/rebase-apply/patch:20: trailing
> whitespace.
>     case CAIRO_CONTENT_COLOR:
> /home/bryce/src/Cairo/cairo/.git/rebase-apply/patch:21: trailing
> whitespace.
>         format = CAIRO_FORMAT_RGB24;
> /home/bryce/src/Cairo/cairo/.git/rebase-apply/patch:23: trailing
> whitespace.
>     case CAIRO_CONTENT_COLOR_ALPHA:
> warning: squelched 22 whitespace errors
> warning: 27 lines add whitespace errors.
> 
> Could you re-post the patch with the trailing whitespace removed?
> 
> Btw, in emacs, you can toggle on showing whitespace via:
>   M-x toggle-show-trailing-whitespace-show-ws
> 
> Or to set it in your .emacs see:
>   http://stackoverflow.com/questions/11700934/emacs-set-and-toggle-
> show-trailing-whitespace
> 
> If you use vim, see:
>   http://stackoverflow.com/questions/4617059/showing-trailing-spaces-in-
> vim
> 
> If you're using a different editor, check the manual for that editor if it
has a
> way to show trailing whitespace.
> 
> You can also have git help detect whitespace via:
>   git config --global core.whitespace trailing-space,space-before-tab
> 
> Bryce
> 
> > Signed-off-by: Ravi Nanjundappa <nravi.n at samsung.com>
> > ---
> >  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
> > cairo at cairographics.org
> > http://lists.cairographics.org/mailman/listinfo/cairo=
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-boilerplate-Maintain-consistency-in-the-usage-of-swi.patch
Type: application/octet-stream
Size: 5523 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20140505/c45ed587/attachment.obj>


More information about the cairo mailing list