From patchwork Wed Sep 28 12:01:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 77080 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp390268qgf; Wed, 28 Sep 2016 05:04:39 -0700 (PDT) X-Received: by 10.55.126.193 with SMTP id z184mr35556009qkc.320.1475064279718; Wed, 28 Sep 2016 05:04:39 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x32si4984848qtd.35.2016.09.28.05.04.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 28 Sep 2016 05:04:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:58308 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpDbL-00050g-7t for patch@linaro.org; Wed, 28 Sep 2016 08:04:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpDYu-0003SR-BN for qemu-devel@nongnu.org; Wed, 28 Sep 2016 08:02:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpDYo-0001O6-Do for qemu-devel@nongnu.org; Wed, 28 Sep 2016 08:02:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50162) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpDYo-0001Nb-7h for qemu-devel@nongnu.org; Wed, 28 Sep 2016 08:02:02 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 478BF3F1EC; Wed, 28 Sep 2016 12:02:01 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-31.ams2.redhat.com [10.36.116.31]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8SC202J024122; Wed, 28 Sep 2016 08:02:00 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 8A85680BAB; Wed, 28 Sep 2016 14:01:59 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 28 Sep 2016 14:01:57 +0200 Message-Id: <1475064117-11571-5-git-send-email-kraxel@redhat.com> In-Reply-To: <1475064117-11571-1-git-send-email-kraxel@redhat.com> References: <1475064117-11571-1-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 28 Sep 2016 12:02:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/4] ui/vnc-enc-tight: remove switch and have single return X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée When enabling the sanitizer build it will complain about control reaching a non-void function. Normally the compiler should detect that there is only one possible exit given a static VNC_SERVER_FB_BYTES. As we always expect a static VNC_SERVER_FB_BYTES I've added a compile time assert and just called the sub-function directly. Signed-off-by: Alex Bennée Reviewed-by: Marc-André Lureau Signed-off-by: Gerd Hoffmann --- ui/vnc-enc-tight.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 1.8.3.1 diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c index 49df85e..1e53b1c 100644 --- a/ui/vnc-enc-tight.c +++ b/ui/vnc-enc-tight.c @@ -707,10 +707,8 @@ check_solid_tile32(VncState *vs, int x, int y, int w, int h, static bool check_solid_tile(VncState *vs, int x, int y, int w, int h, uint32_t* color, bool samecolor) { - switch (VNC_SERVER_FB_BYTES) { - case 4: - return check_solid_tile32(vs, x, y, w, h, color, samecolor); - } + QEMU_BUILD_BUG_ON(VNC_SERVER_FB_BYTES != 4); + return check_solid_tile32(vs, x, y, w, h, color, samecolor); } static void find_best_solid_area(VncState *vs, int x, int y, int w, int h,