qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect
  2010-05-19  7:24 [Qemu-devel] [PATCH v3 00/12] *** SUBJECT HERE *** Corentin Chary
@ 2010-05-27  6:21 ` Corentin Chary
  2010-05-27 14:28   ` Richard Henderson
  0 siblings, 1 reply; 8+ messages in thread
From: Corentin Chary @ 2010-05-27  6:21 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,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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect
  2010-05-27  6:21 ` [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect Corentin Chary
@ 2010-05-27 14:28   ` Richard Henderson
  2010-06-01 21:01     ` Corentin Chary
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Henderson @ 2010-05-27 14:28 UTC (permalink / raw)
  To: Corentin Chary; +Cc: Anthony Liguori, Adam Litke, qemu-devel, Alexander Graf

On 05/26/2010 11:21 PM, Corentin Chary wrote:
> -        int rep = 0;                                                    \
> +        int i = 0, rep = 0;                                             \

Dead initialization.


r~

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect
  2010-05-27 14:28   ` Richard Henderson
@ 2010-06-01 21:01     ` Corentin Chary
  0 siblings, 0 replies; 8+ messages in thread
From: Corentin Chary @ 2010-06-01 21:01 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Anthony Liguori, Adam Litke, qemu-devel, Alexander Graf

On Thu, May 27, 2010 at 4:28 PM, Richard Henderson <rth@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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH 0/3] Small tight fixes
@ 2010-06-01 21:05 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
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ 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

Hi,
Here is two small tight fix and another small patch related to vnc encodings.
Thanks,

Corentin Chary (3):
  vnc: tight: don't forget last pixel in tight_encode_indexed_rect
  vnc: tight: don't forget the third color
  vnc: add missing target for vnc-encodings-*.o

 Makefile             |    6 +++---
 vnc-encoding-tight.c |   10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [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; 8+ 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] 8+ 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; 8+ 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] 8+ 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; 8+ 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] 8+ 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; 8+ 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] 8+ messages in thread

end of thread, other threads:[~2010-06-01 21:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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: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
  -- strict thread matches above, loose matches on Subject: below --
2010-05-19  7:24 [Qemu-devel] [PATCH v3 00/12] *** SUBJECT HERE *** Corentin Chary
2010-05-27  6:21 ` [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect Corentin Chary
2010-05-27 14:28   ` Richard Henderson
2010-06-01 21:01     ` Corentin Chary

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).