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>
This commit is contained in:
parent
637503d122
commit
54d43eacc5
@ -249,17 +249,16 @@ static void print_palette(const char *key, QObject *obj, void *opaque)
|
|||||||
uint##bpp##_t *src; \
|
uint##bpp##_t *src; \
|
||||||
uint##bpp##_t rgb; \
|
uint##bpp##_t rgb; \
|
||||||
uint8_t key[6]; \
|
uint8_t key[6]; \
|
||||||
int rep = 0; \
|
int i, rep; \
|
||||||
uint8_t idx; \
|
uint8_t idx; \
|
||||||
\
|
\
|
||||||
src = (uint##bpp##_t *) buf; \
|
src = (uint##bpp##_t *) buf; \
|
||||||
\
|
\
|
||||||
count -= 1; \
|
for (i = 0; i < count; i++) { \
|
||||||
while (count--) { \
|
|
||||||
rgb = *src++; \
|
rgb = *src++; \
|
||||||
rep = 0; \
|
rep = 0; \
|
||||||
while (count && *src == rgb) { \
|
while (i < count && *src == rgb) { \
|
||||||
rep++, src++, count--; \
|
rep++, src++, i++; \
|
||||||
} \
|
} \
|
||||||
tight_palette_rgb2buf(rgb, bpp, key); \
|
tight_palette_rgb2buf(rgb, bpp, key); \
|
||||||
if (!qdict_haskey(palette, (char *)key)) { \
|
if (!qdict_haskey(palette, (char *)key)) { \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user