From patchwork Wed Aug 11 05:49:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Chary X-Patchwork-Id: 61454 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EDC2CB70A8 for ; Wed, 11 Aug 2010 16:25:40 +1000 (EST) Received: from localhost ([127.0.0.1]:35880 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oj4Yf-0008AX-6c for incoming@patchwork.ozlabs.org; Wed, 11 Aug 2010 02:13:01 -0400 Received: from [140.186.70.92] (port=37928 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oj4D3-0005xy-NN for qemu-devel@nongnu.org; Wed, 11 Aug 2010 01:50:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oj4D2-0007TZ-Ii for qemu-devel@nongnu.org; Wed, 11 Aug 2010 01:50:41 -0400 Received: from relay1-v.mail.gandi.net ([217.70.178.75]:51429 helo=mrelay1-v.mgt.gandi.net) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oj4D2-0007TR-C1 for qemu-devel@nongnu.org; Wed, 11 Aug 2010 01:50:40 -0400 X-Originating-IP: 217.70.178.41 Received: from mfilter1-d.gandi.net (mfilter1-d.gandi.net [217.70.178.41]) by mrelay1-v.mgt.gandi.net (Postfix) with ESMTP id E683D362B8; Wed, 11 Aug 2010 07:50:39 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at gandi.net Received: from mrelay1-v.mgt.gandi.net ([217.70.178.75]) by mfilter1-d.gandi.net (mfilter1-d.gandi.net [217.70.178.41]) (amavisd-new, port 10024) with ESMTP id x+vnUgyuUVM0; Wed, 11 Aug 2010 07:50:39 +0200 (CEST) X-Originating-IP: 82.241.209.44 Received: from tartiflon (falgoret.iksaif.net [82.241.209.44]) (Authenticated sender: fake@iksaif.net) by mrelay1-v.mgt.gandi.net (Postfix) with ESMTPSA id D323F362C3; Wed, 11 Aug 2010 07:50:33 +0200 (CEST) From: Corentin Chary To: Qemu-development List Date: Wed, 11 Aug 2010 07:49:39 +0200 Message-Id: <1281505785-22523-10-git-send-email-corentincj@iksaif.net> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1281505785-22523-1-git-send-email-corentincj@iksaif.net> References: <1281505785-22523-1-git-send-email-corentincj@iksaif.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Corentin Chary , Anthony Liguori , Alexander Graf , Andre Przywara Subject: [Qemu-devel] [PATCH 09/15] vnc: fix uint8_t comparisons with negative values X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Corentin Chary --- 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) {