diff options
author | Corentin Chary <corentincj@iksaif.net> | 2010-06-01 23:05:42 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-06-01 16:15:51 -0500 |
commit | 54d43eacc5ca300d5a5ce5a83abe75e0167946b5 (patch) | |
tree | 5199251812ee587f82015ffbe0dfa6e5cf041713 /vnc-encoding-tight.c | |
parent | 637503d122eb7656d91a8489e254d9e880be7504 (diff) | |
download | qemu-54d43eacc5ca300d5a5ce5a83abe75e0167946b5.zip qemu-54d43eacc5ca300d5a5ce5a83abe75e0167946b5.tar.gz qemu-54d43eacc5ca300d5a5ce5a83abe75e0167946b5.tar.bz2 |
vnc: tight: don't forget last pixel in tight_encode_indexed_rect
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>
Diffstat (limited to 'vnc-encoding-tight.c')
-rw-r--r-- | vnc-encoding-tight.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/vnc-encoding-tight.c b/vnc-encoding-tight.c index 50be44e..7bde44d 100644 --- a/vnc-encoding-tight.c +++ b/vnc-encoding-tight.c @@ -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)) { \ |