Re: [PATCH spice-server 2/2] glz-encoder-dict: Remove a warning compiling with CentOS 7

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 11, 2018 at 09:06:08AM +0100, Frediano Ziglio wrote:
> CentOS 7 compiler generate this warning:
> 
> glz-encoder-dict.c: In function 'glz_dictionary_pre_encode':
> glz-encoder-dict.c:516:30: error: 'prev_seg_id' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>              dict->window.segs[prev_seg_id].next = seg_id;
>                               ^
> glz-encoder-dict.c:492:22: note: 'prev_seg_id' was declared here
>      uint32_t seg_id, prev_seg_id;
>                       ^
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  server/glz-encoder-dict.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/server/glz-encoder-dict.c b/server/glz-encoder-dict.c
> index 4b0a422a6..780085209 100644
> --- a/server/glz-encoder-dict.c
> +++ b/server/glz-encoder-dict.c
> @@ -489,7 +489,7 @@ static WindowImage *glz_dictionary_window_add_image(SharedDictionary *dict, LzIm
>  {
>      unsigned int num_lines = num_first_lines;
>      unsigned int row;
> -    uint32_t seg_id, prev_seg_id;
> +    uint32_t seg_id, prev_seg_id = 0;

I would split the declarations on 2 lines here.

With or without this change,

Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>


>      uint8_t* lines = first_lines;
>      // alloc image info,update used head tail,  if used_head null - update  head
>      WindowImage *image = __glz_dictionary_window_alloc_image(dict);
> -- 
> 2.17.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]