[virt-tools-list] [virt-viewer PATCH] Fix building with older spice-gtk
Martin Kletzander
mkletzan at redhat.com
Thu Mar 13 09:16:08 UTC 2014
Due to spice-gtk-0.23 missing SPICE_GTK_CHECK_VERSION macro, the
condition:
causes the following error due to gcc not doing short-circuit evaluation:
virt-viewer-session-spice.c: In function 'virt_viewer_session_spice_main_channel_event':
virt-viewer-session-spice.c:525:64: error: missing binary operator before token "("
#if defined(SPICE_GTK_CHECK_VERSION) && SPICE_GTK_CHECK_VERSION(0, 23, 21)
^
Also one more warning is fixed in this patch:
virt-viewer-session-spice.c:476:19: warning: unused variable 'error'
[-Wunused-variable] const GError *error;
^
Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
src/virt-viewer-session-spice.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 1740ba3..fb63c9c 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -1,7 +1,7 @@
/*
* Virt Viewer: A virtual machine console viewer
*
- * Copyright (C) 2007-2012 Red Hat, Inc.
+ * Copyright (C) 2007-2012, 2014 Red Hat, Inc.
* Copyright (C) 2009-2012 Daniel P. Berrange
* Copyright (C) 2010 Marc-André Lureau
*
@@ -473,7 +473,6 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel G_GNUC_UNUSED
SpiceChannelEvent event,
VirtViewerSession *session)
{
- const GError *error;
VirtViewerSessionSpice *self = VIRT_VIEWER_SESSION_SPICE(session);
gchar *password = NULL, *user = NULL;
int ret;
@@ -522,8 +521,10 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel G_GNUC_UNUSED
}
break;
case SPICE_CHANNEL_ERROR_CONNECT:
-#if defined(SPICE_GTK_CHECK_VERSION) && SPICE_GTK_CHECK_VERSION(0, 23, 21)
- error = spice_channel_get_error(channel);
+#if defined(SPICE_GTK_CHECK_VERSION)
+# if SPICE_GTK_CHECK_VERSION(0, 23, 21)
+ {
+ const GError *error = spice_channel_get_error(channel);
DEBUG_LOG("main channel: failed to connect %s", error ? error->message : "");
@@ -545,6 +546,11 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel G_GNUC_UNUSED
} else {
g_signal_emit_by_name(session, "session-disconnected");
}
+ }
+# else
+ DEBUG_LOG("main channel: failed to connect");
+ g_signal_emit_by_name(session, "session-disconnected");
+# endif
#else
DEBUG_LOG("main channel: failed to connect");
g_signal_emit_by_name(session, "session-disconnected");
--
1.9.0
More information about the virt-tools-list
mailing list