From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=52317 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGaSo-0000HP-Ts for qemu-devel@nongnu.org; Thu, 11 Nov 2010 11:57:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGaSl-0005ej-U7 for qemu-devel@nongnu.org; Thu, 11 Nov 2010 11:57:28 -0500 Received: from relay2-v.mail.gandi.net ([217.70.178.76]:36797) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGaSl-0005ec-Jy for qemu-devel@nongnu.org; Thu, 11 Nov 2010 11:57:27 -0500 From: Corentin Chary Date: Thu, 11 Nov 2010 17:56:58 +0100 Message-Id: <1289494624-12807-10-git-send-email-corentincj@iksaif.net> In-Reply-To: <1289494624-12807-1-git-send-email-corentincj@iksaif.net> References: <1289494624-12807-1-git-send-email-corentincj@iksaif.net> Subject: [Qemu-devel] [PATCH v2 09/15] 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: Qemu-development List Cc: Corentin Chary , Anthony Liguori , Alexander Graf , Andre Przywara 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 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.3.2