[Spice-devel] [PATCH spice-server 2/2] glz-encoder-dict: Remove a warning compiling with CentOS 7
Christophe Fergeau
cfergeau at redhat.com
Wed Jul 11 09:18:06 UTC 2018
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 at redhat.com>
> ---
> 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 at redhat.com>
> 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 at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180711/7ac9d8d3/attachment.sig>
More information about the Spice-devel
mailing list