]> git.proxmox.com Git - mirror_qemu.git/commitdiff
vnc: tight: don't forget last pixel in tight_encode_indexed_rect
authorCorentin Chary <corentincj@iksaif.net>
Tue, 1 Jun 2010 21:05:42 +0000 (23:05 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 1 Jun 2010 21:15:51 +0000 (16:15 -0500)
A simple patch would have been to just remove count -= 1, but this
one also replace the while (count--) with a for(i = 0; i < count; i++)
which I believe is more easy to understand.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vnc-encoding-tight.c

index 50be44e4a78313eabba75d06a0389c4a6d56f247..7bde44db0a615e0c5893de2e88249fbbbc4e8927 100644 (file)
@@ -249,17 +249,16 @@ static void print_palette(const char *key, QObject *obj, void *opaque)
         uint##bpp##_t *src;                                             \
         uint##bpp##_t rgb;                                              \
         uint8_t key[6];                                                 \
-        int rep = 0;                                                    \
+        int i, rep;                                                     \
         uint8_t idx;                                                    \
                                                                         \
         src = (uint##bpp##_t *) buf;                                    \
                                                                         \
-        count -= 1;                                                     \
-        while (count--) {                                               \
+        for (i = 0; i < count; i++) {                                   \
             rgb = *src++;                                               \
             rep = 0;                                                    \
-            while (count && *src == rgb) {                              \
-                rep++, src++, count--;                                  \
+            while (i < count && *src == rgb) {                          \
+                rep++, src++, i++;                                      \
             }                                                           \
             tight_palette_rgb2buf(rgb, bpp, key);                       \
             if (!qdict_haskey(palette, (char *)key)) {                  \