[Spice-devel] [PATCH spice-common] Add missing struct field initializers

Christophe Fergeau cfergeau at redhat.com
Wed Apr 25 06:01:53 PDT 2012


On Wed, Apr 25, 2012 at 10:58:05AM +0100, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>

Is that causing issues with newer GCCs? Iirc the rest of the structure is
supposed to be initialized to 0 when it's only partially initialized.

Christophe

> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  common/canvas_base.c |    4 +++-
>  common/sw_canvas.c   |    6 +++---
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/common/canvas_base.c b/common/canvas_base.c
> index 8f5b0c8..4f40306 100644
> --- a/common/canvas_base.c
> +++ b/common/canvas_base.c
> @@ -2988,7 +2988,7 @@ static void canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox,
>  {
>      CanvasBase *canvas = (CanvasBase *)spice_canvas;
>      SpiceCanvas *surface_canvas = NULL;
> -    StrokeGC gc = { { 0 } };
> +    StrokeGC gc;
>      lineGCOps ops = {
>          stroke_fill_spans,
>          stroke_fill_rects
> @@ -2997,6 +2997,8 @@ static void canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox,
>      unsigned int i;
>      int dashed;
>  
> +    memset(&gc, 0, sizeof(gc));
> +
>      pixman_region32_init_rect(&gc.dest_region,
>                                bbox->left, bbox->top,
>                                bbox->right - bbox->left,
> diff --git a/common/sw_canvas.c b/common/sw_canvas.c
> index 2c1782b..4b10383 100644
> --- a/common/sw_canvas.c
> +++ b/common/sw_canvas.c
> @@ -659,7 +659,7 @@ static void __blend_image(SpiceCanvas *spice_canvas,
>  
>      mask = NULL;
>      if (overall_alpha != 0xff) {
> -        pixman_color_t color = { 0 };
> +        pixman_color_t color = { 0, 0, 0, 0 };
>          color.alpha = overall_alpha * 0x101;
>          mask = pixman_image_create_solid_fill(&color);
>      }
> @@ -752,7 +752,7 @@ static void __blend_scale_image(SpiceCanvas *spice_canvas,
>  
>      mask = NULL;
>      if (overall_alpha != 0xff) {
> -        pixman_color_t color = { 0 };
> +        pixman_color_t color = { 0, 0, 0, 0 };
>          color.alpha = overall_alpha * 0x101;
>          mask = pixman_image_create_solid_fill(&color);
>      }
> @@ -1044,7 +1044,7 @@ static void canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox,
>      pixman_region32_t dest_region;
>      pixman_image_t *str_mask, *brush;
>      SpiceString *str;
> -    SpicePoint pos = { 0, };
> +    SpicePoint pos = { 0, 0 };
>      int depth;
>  
>      pixman_region32_init_rect(&dest_region,
> -- 
> 1.7.7.6
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20120425/a7f0a034/attachment.pgp>


More information about the Spice-devel mailing list