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

Frediano Ziglio fziglio at redhat.com
Wed Jul 11 08:06:08 UTC 2018


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



More information about the Spice-devel mailing list