From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=49510 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PlGfN-0003qc-Fl for qemu-devel@nongnu.org; Fri, 04 Feb 2011 03:05:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PlGfM-0001nU-Dx for qemu-devel@nongnu.org; Fri, 04 Feb 2011 03:05:17 -0500 Received: from smtp5-g21.free.fr ([212.27.42.5]:52260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PlGfL-0001nC-Nj for qemu-devel@nongnu.org; Fri, 04 Feb 2011 03:05:16 -0500 From: Corentin Chary Date: Fri, 4 Feb 2011 09:06:02 +0100 Message-Id: <1296806768-27787-11-git-send-email-corentincj@iksaif.net> In-Reply-To: <1296806768-27787-1-git-send-email-corentincj@iksaif.net> References: <1296806768-27787-1-git-send-email-corentincj@iksaif.net> Subject: [Qemu-devel] [PATCH v3 10/16] vnc: fix uint8_t comparisons with negative values List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Corentin Chary , Andre Przywara , Qemu-development List , Alexander Graf Signed-off-by: Corentin Chary --- ui/vnc-enc-tight.c | 4 ++-- ui/vnc-enc-zrle.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c index ad9a9a8..81024d5 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) { @@ -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 016a406..917d384 100644 --- a/ui/vnc-enc-zrle.c +++ b/ui/vnc-enc-zrle.c @@ -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) { -- 1.7.3.4