]> git.proxmox.com Git - qemu.git/commitdiff
vnc: fix uint8_t comparisons with negative values
authorCorentin Chary <corentincj@iksaif.net>
Fri, 4 Feb 2011 08:06:02 +0000 (09:06 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 23 Feb 2011 22:28:28 +0000 (16:28 -0600)
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
ui/vnc-enc-tight.c
ui/vnc-enc-zrle.c

index ad9a9a8a32ec489863693775481f7c753d5e6673..81024d5f14663997613fd228a188cd5a08d5d8d2 100644 (file)
@@ -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) {
@@ -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) {
index 016a406eec9e55767baa64ca6f722264f1046f30..917d384f57fd08431a8109e5e776cc1216635066 100644 (file)
@@ -260,7 +260,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) {