Re: [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect
On Thu, May 27, 2010 at 4:28 PM, Richard Henderson r...@twiddle.net wrote: On 05/26/2010 11:21 PM, Corentin Chary wrote: - int rep = 0; \ + int i = 0, rep = 0; \ Dead initialization. r~ Good catch, I'll re-send this set. -- Corentin Chary http://xf.iksaif.net
[Qemu-devel] [PATCH 1/3] 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 corenti...@iksaif.net --- 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,18 +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)) { \ -- 1.7.1
Re: [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect
On 06/01/2010 04:05 PM, Corentin Chary wrote: 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 Charycorenti...@iksaif.net Applied all. Thanks. Regards, Anthony Liguori --- 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,18 +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)) { \
[Qemu-devel] [PATCH 1/3] 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 corenti...@iksaif.net --- 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
Re: [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect
On 05/26/2010 11:21 PM, Corentin Chary wrote: -int rep = 0;\ +int i = 0, rep = 0; \ Dead initialization. r~