From: Michael Tokarev <mjt@tls.msk.ru>
To: liguang <lig.fnst@cn.fujitsu.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [PATCH 1/5] vnc: pass bool pararmeter for vnc_connect
Date: Tue, 11 Jun 2013 15:50:41 +0400 [thread overview]
Message-ID: <51B70F11.7090101@msgid.tls.msk.ru> (raw)
In-Reply-To: <1370927720-4348-1-git-send-email-lig.fnst@cn.fujitsu.com>
11.06.2013 09:15, liguang wrote:
> type last parameter of vnc_connect if bool,
> so pass 'false' instead of '0' for it.
There's another parameter in here, `skipauth', which should be
bool in vnc_connect(), and should be bool in vnc_display_add_client()
too.
Also, there's no big point in splitting 1/5 and 2/5 (vnc_listen_read),
I think.
Does something like the below look ok? (not even compile-tested)
(and I'd really rename `skipauth' to `doauth' everywhere, to mean
exactly the opposite so that we don't have double negatives, but
it is too late already)
From: Michael Tokarev <mjt@tls.msk.ru>
Date: Tue Jun 11 15:42:44 2013 +0400
vnc: use booleans for vnc_connect, vnc_listen_read and vnc_display_add_client
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 <lig.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
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);
}
next prev parent reply other threads:[~2013-06-11 11:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-11 5:15 [Qemu-trivial] [PATCH 1/5] vnc: pass bool pararmeter for vnc_connect liguang
2013-06-11 5:15 ` [Qemu-trivial] [PATCH 2/5] vnc: pass bool parameter for vnc_listen_read liguang
2013-06-11 11:36 ` [Qemu-trivial] [Qemu-devel] " Andreas Färber
2013-06-11 5:15 ` [Qemu-trivial] [PATCH 3/5] qemu-char: pass bool parameter for qemu_opt_get_bool liguang
2013-06-11 11:35 ` Michael Tokarev
2013-06-18 2:33 ` [Qemu-trivial] [Qemu-devel] " li guang
2013-06-11 5:15 ` [Qemu-trivial] [PATCH 4/5] memory: use '=' instead of '|=' for memory_region_update_pending liguang
2013-06-11 11:34 ` Michael Tokarev
2013-06-18 2:32 ` [Qemu-trivial] [Qemu-devel] " li guang
2013-06-18 3:50 ` Michael Tokarev
2013-06-18 4:08 ` li guang
2013-06-11 5:15 ` [Qemu-trivial] [PATCH 5/5] sd: pass bool parameter for sd_init liguang
2013-06-11 11:39 ` [Qemu-trivial] [Qemu-devel] [PATCH 1/5] vnc: pass bool pararmeter for vnc_connect Andreas Färber
2013-06-11 11:50 ` Michael Tokarev [this message]
2013-06-18 2:34 ` li guang
2013-06-18 2:35 ` [Qemu-trivial] " Michael Tokarev
2013-06-18 2:36 ` li guang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51B70F11.7090101@msgid.tls.msk.ru \
--to=mjt@tls.msk.ru \
--cc=lig.fnst@cn.fujitsu.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.