qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 09/15] vnc: fix uint8_t comparisons with negative va


From: Corentin Chary
Subject: [Qemu-devel] [PATCH 09/15] vnc: fix uint8_t comparisons with negative values
Date: Wed, 11 Aug 2010 07:49:39 +0200

Signed-off-by: Corentin Chary <address@hidden>
---
 ui/vnc-enc-tight.c |    6 +++---
 ui/vnc-enc-zrle.c  |    3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c
index 5ca4342..9f83235 100644
--- a/ui/vnc-enc-tight.c
+++ b/ui/vnc-enc-tight.c
@@ -1546,7 +1546,7 @@ static int send_sub_rect(VncState *vs, int x, int y, int 
w, int h)
     vnc_tight_stop(vs);
 
 #ifdef CONFIG_VNC_JPEG
-    if (vs->tight.quality != -1) {
+    if (vs->tight.quality != (uint8_t)-1) {
         double freq = vnc_update_freq(vs, x, y, w, h);
 
         if (freq < tight_jpeg_conf[vs->tight.quality].jpeg_freq_min) {
@@ -1562,7 +1562,7 @@ static int send_sub_rect(VncState *vs, int x, int y, int 
w, int h)
     colors = tight_fill_palette(vs, x, y, w * h, &fg, &bg, &palette);
 
 #ifdef CONFIG_VNC_JPEG
-    if (allow_jpeg && vs->tight.quality != -1) {
+    if (allow_jpeg && vs->tight.quality != (uint8_t)-1) {
         ret = send_sub_rect_jpeg(vs, x, y, w, h, bg, fg, colors, palette,
                                  force_jpeg);
     } else {
@@ -1711,7 +1711,7 @@ static int tight_send_framebuffer_update(VncState *vs, 
int x, int y,
         vs->tight.pixel24 = false;
     }
 
-    if (vs->tight.quality != -1) {
+    if (vs->tight.quality != (uint8_t)-1) {
         double freq = vnc_update_freq(vs, x, y, w, h);
 
         if (freq > tight_jpeg_conf[vs->tight.quality].jpeg_freq_threshold) {
diff --git a/ui/vnc-enc-zrle.c b/ui/vnc-enc-zrle.c
index 4460890..b5a245a 100644
--- a/ui/vnc-enc-zrle.c
+++ b/ui/vnc-enc-zrle.c
@@ -284,7 +284,8 @@ static int zrle_send_framebuffer_update(VncState *vs, int 
x, int y,
   int zywrle_level;
 
   if (vs->zrle.type == VNC_ENCODING_ZYWRLE) {
-      if (!vs->vd->lossy || vs->tight.quality < 0 || vs->tight.quality == 9) {
+      if (!vs->vd->lossy || vs->tight.quality == (uint8_t)-1
+          || vs->tight.quality == 9) {
           zywrle_level = 0;
           vs->zrle.type = VNC_ENCODING_ZRLE;
       } else if (vs->tight.quality < 3) {
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]