* [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect
2010-06-01 21:05 [Qemu-devel] [PATCH 0/3] Small tight fixes Corentin Chary
@ 2010-06-01 21:05 ` Corentin Chary
2010-06-01 21:17 ` Anthony Liguori
2010-06-01 21:05 ` [Qemu-devel] [PATCH 2/3] vnc: tight: don't forget the third color Corentin Chary
2010-06-01 21:05 ` [Qemu-devel] [PATCH 3/3] vnc: add missing target for vnc-encodings-*.o Corentin Chary
2 siblings, 1 reply; 5+ messages in thread
From: Corentin Chary @ 2010-06-01 21:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Corentin Chary, Anthony Liguori, Alexander Graf, Adam Litke
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>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect
2010-06-01 21:05 ` [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect Corentin Chary
@ 2010-06-01 21:17 ` Anthony Liguori
0 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2010-06-01 21:17 UTC (permalink / raw)
To: Corentin Chary; +Cc: Adam Litke, qemu-devel, Alexander Graf
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 Chary<corentincj@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)) { \
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 2/3] vnc: tight: don't forget the third color
2010-06-01 21:05 [Qemu-devel] [PATCH 0/3] Small tight fixes Corentin Chary
2010-06-01 21:05 ` [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect Corentin Chary
@ 2010-06-01 21:05 ` Corentin Chary
2010-06-01 21:05 ` [Qemu-devel] [PATCH 3/3] vnc: add missing target for vnc-encodings-*.o Corentin Chary
2 siblings, 0 replies; 5+ messages in thread
From: Corentin Chary @ 2010-06-01 21:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Corentin Chary, Anthony Liguori, Alexander Graf, Adam Litke
While couting color, if the third color was only present one
time it wasn't added to the palette.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
vnc-encoding-tight.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/vnc-encoding-tight.c b/vnc-encoding-tight.c
index c8effe6..efb57e7 100644
--- a/vnc-encoding-tight.c
+++ b/vnc-encoding-tight.c
@@ -177,6 +177,7 @@ static int tight_palette_insert(QDict *palette, uint32_t rgb, int bpp, int max)
*palette = qdict_new(); \
tight_palette_insert(*palette, c0, bpp, max); \
tight_palette_insert(*palette, c1, bpp, max); \
+ tight_palette_insert(*palette, ci, bpp, max); \
\
for (i++; i < count; i++) { \
if (data[i] == ci) { \
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH 3/3] vnc: add missing target for vnc-encodings-*.o
2010-06-01 21:05 [Qemu-devel] [PATCH 0/3] Small tight fixes Corentin Chary
2010-06-01 21:05 ` [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect Corentin Chary
2010-06-01 21:05 ` [Qemu-devel] [PATCH 2/3] vnc: tight: don't forget the third color Corentin Chary
@ 2010-06-01 21:05 ` Corentin Chary
2 siblings, 0 replies; 5+ messages in thread
From: Corentin Chary @ 2010-06-01 21:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Corentin Chary, Anthony Liguori, Alexander Graf, Adam Litke
vnc-encodings-*.c dependencies where missing.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
Makefile | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index cc5fc45..221fbd8 100644
--- a/Makefile
+++ b/Makefile
@@ -120,11 +120,11 @@ vnc-auth-vencrypt.o: vnc-auth-vencrypt.c vnc.h
vnc-auth-sasl.o: vnc-auth-sasl.c vnc.h
-vnc-encoding-zlib.o: vnc.h
+vnc-encoding-zlib.o: vnc-encoding-zlib.c vnc.h
-vnc-encoding-hextile.o: vnc.h
+vnc-encoding-hextile.o: vnc-encoding-hextile.c vnc.h
-vnc-encoding-tight.o: vnc.h vnc-encoding-tight.h
+vnc-encoding-tight.o: vnc-encoding-tight.c vnc.h vnc-encoding-tight.h
curses.o: curses.c keymaps.h curses_keys.h
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread