From patchwork Sat Jun 22 09:24:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 253398 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7B4032C0416 for ; Sat, 22 Jun 2013 19:28:00 +1000 (EST) Received: from localhost ([::1]:56984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UqK6w-0003tI-9U for incoming@patchwork.ozlabs.org; Sat, 22 Jun 2013 05:27:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UqK6V-0003oq-MU for qemu-devel@nongnu.org; Sat, 22 Jun 2013 05:27:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UqK6U-0006Ah-NH for qemu-devel@nongnu.org; Sat, 22 Jun 2013 05:27:31 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:49975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UqK6U-0006AX-GN for qemu-devel@nongnu.org; Sat, 22 Jun 2013 05:27:30 -0400 Received: from gandalf.tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by isrv.corpit.ru (Postfix) with ESMTP id D438C41E3F; Sat, 22 Jun 2013 13:27:29 +0400 (MSK) Received: by gandalf.tls.msk.ru (Postfix, from userid 1000) id E3DD7567; Sat, 22 Jun 2013 13:24:39 +0400 (MSK) From: Michael Tokarev To: Anthony Liguori Date: Sat, 22 Jun 2013 13:24:31 +0400 Message-Id: <1371893076-9643-13-git-send-email-mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1371893076-9643-1-git-send-email-mjt@msgid.tls.msk.ru> References: <1371893076-9643-1-git-send-email-mjt@msgid.tls.msk.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 86.62.121.231 Cc: Michael Tokarev , qemu-devel@nongnu.org, liguang Subject: [Qemu-devel] [PULL 12/17] vnc: use booleans for vnc_connect, vnc_listen_read and vnc_display_add_client X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Some arguments to these functions are booleans - either by declaration, or by actual usage, but sometimes value of 0 or 1 is passed for a bool, and sometimes it is declared as int but a bool value, or true/false, is passed to it instead. Clean it up a bit. Cc: liguang Signed-off-by: Michael Tokarev --- include/ui/console.h | 2 +- ui/vnc.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index f1d79f9..98edf41 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -314,7 +314,7 @@ void cocoa_display_init(DisplayState *ds, int full_screen); /* vnc.c */ void vnc_display_init(DisplayState *ds); void vnc_display_open(DisplayState *ds, const char *display, Error **errp); -void vnc_display_add_client(DisplayState *ds, int csock, int skipauth); +void vnc_display_add_client(DisplayState *ds, int csock, bool skipauth); char *vnc_display_local_addr(DisplayState *ds); #ifdef CONFIG_VNC int vnc_display_password(DisplayState *ds, const char *password); diff --git a/ui/vnc.c b/ui/vnc.c index dfc7459..5601cc3 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2771,7 +2771,8 @@ static void vnc_refresh(DisplayChangeListener *dcl) } } -static void vnc_connect(VncDisplay *vd, int csock, int skipauth, bool websocket) +static void vnc_connect(VncDisplay *vd, int csock, + bool skipauth, bool websocket) { VncState *vs = g_malloc0(sizeof(VncState)); int i; @@ -2883,19 +2884,19 @@ static void vnc_listen_read(void *opaque, bool websocket) } if (csock != -1) { - vnc_connect(vs, csock, 0, websocket); + vnc_connect(vs, csock, false, websocket); } } static void vnc_listen_regular_read(void *opaque) { - vnc_listen_read(opaque, 0); + vnc_listen_read(opaque, false); } #ifdef CONFIG_VNC_WS static void vnc_listen_websocket_read(void *opaque) { - vnc_listen_read(opaque, 1); + vnc_listen_read(opaque, true); } #endif /* CONFIG_VNC_WS */ @@ -3283,7 +3284,7 @@ void vnc_display_open(DisplayState *ds, const char *display, Error **errp) if (csock < 0) { goto fail; } - vnc_connect(vs, csock, 0, 0); + vnc_connect(vs, csock, false, false); } else { /* listen for connects */ char *dpy; @@ -3341,9 +3342,9 @@ fail: #endif /* CONFIG_VNC_WS */ } -void vnc_display_add_client(DisplayState *ds, int csock, int skipauth) +void vnc_display_add_client(DisplayState *ds, int csock, bool skipauth) { VncDisplay *vs = vnc_display; - vnc_connect(vs, csock, skipauth, 0); + vnc_connect(vs, csock, skipauth, false); }