[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_en
From: |
Corentin Chary |
Subject: |
[Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect |
Date: |
Thu, 27 May 2010 08:21:52 +0200 |
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 <address@hidden>
---
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..c8effe6 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 = 0, rep = 0; \
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)) { \
--
1.7.1
- [Qemu-devel] [PATCH v3 05/12] vnc: adjust compression zstream level, (continued)
- [Qemu-devel] [PATCH v3 05/12] vnc: adjust compression zstream level, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 08/12] vnc: remove a memory leak in zlib, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 12/12] vnc: tight: add palette encoding, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 07/12] vnc: add buffer_free(), Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 06/12] vnc: don't clear zlib stream on set_encoding, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 10/12] vnc: add basic tight support, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 11/12] vnc: add support for tight fill encoding, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 09/12] vnc: return the number of rectangles, Corentin Chary, 2010/05/19
- Re: [Qemu-devel] [PATCH v3 00/12] *** SUBJECT HERE ***, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH 3/3] vnc: add missing target for vnc-encodings-*.o, Corentin Chary, 2010/05/27
- [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect,
Corentin Chary <=
- [Qemu-devel] [PATCH 2/3] vnc: tight: don't forget the third color, Corentin Chary, 2010/05/27