summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2016-01-22 10:58:04 +0100
committerFabiano FidĂȘncio <fidencio@redhat.com>2016-02-12 10:39:17 +0100
commitcd0c1008316e90bce925e1448ffcabb366e88f8f (patch)
tree02a5a63fd09e36fe8807b23430a266f2e68f4f39
parent57df040cc5df1c4748bb19eef23e6c13efb7eb93 (diff)
downloadspice-gtk-cd0c1008316e90bce925e1448ffcabb366e88f8f.tar.gz
spice-gtk-cd0c1008316e90bce925e1448ffcabb366e88f8f.tar.xz
spice-gtk-cd0c1008316e90bce925e1448ffcabb366e88f8f.zip
Use #ifdef {HAVE,USE}_FOO instead of #if {HAVE,USE}_FOO
While "#if USE_FOO" checks for the value of the variable USE_FOO, "#ifdef" checks whether USE_FOO is defined or not. It means, if we had something like: #define USE_FOO 0, we would have: #if USE_FOO /* Any code in here would NOT be compiled */ #endif #ifdef USE_FOO /* Any code in here would be compiled */ #endif No problem was faced on spice-gtk till now because either USE_FOO is not defined or defined as 1, but let's try to have it standardized. Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
-rw-r--r--src/channel-smartcard.c2
-rw-r--r--src/channel-usbredir.c18
-rw-r--r--src/spice-channel.c20
-rw-r--r--src/spice-client-glib-usb-acl-helper.c4
-rw-r--r--src/spice-gtk-session.c4
-rw-r--r--src/spice-widget.c2
-rw-r--r--src/usb-device-manager.c2
7 files changed, 26 insertions, 26 deletions
diff --git a/src/channel-smartcard.c b/src/channel-smartcard.c
index e2e1aad..7f3306e 100644
--- a/src/channel-smartcard.c
+++ b/src/channel-smartcard.c
@@ -244,7 +244,7 @@ smartcard_message_free(SpiceSmartcardChannelMessage *message)
g_free(message);
}
-#if USE_SMARTCARD
+#ifdef USE_SMARTCARD
static gboolean is_attached_to_server(VReader *reader)
{
return (vreader_get_id(reader) != (vreader_id_t)-1);
diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index 0be72ba..a9942b2 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -24,7 +24,7 @@
#ifdef USE_USBREDIR
#include <glib/gi18n.h>
#include <usbredirhost.h>
-#if USE_POLKIT
+#ifdef USE_POLKIT
#include "usb-acl-helper.h"
#endif
#include "channel-usbredir-priv.h"
@@ -57,7 +57,7 @@
enum SpiceUsbredirChannelState {
STATE_DISCONNECTED,
-#if USE_POLKIT
+#ifdef USE_POLKIT
STATE_WAITING_FOR_ACL_HELPER,
#endif
STATE_CONNECTED,
@@ -75,7 +75,7 @@ struct _SpiceUsbredirChannelPrivate {
const uint8_t *read_buf;
int read_buf_size;
enum SpiceUsbredirChannelState state;
-#if USE_POLKIT
+#ifdef USE_POLKIT
GSimpleAsyncResult *result;
SpiceUsbAclHelper *acl_helper;
#endif
@@ -241,7 +241,7 @@ static gboolean spice_usbredir_channel_open_device(
int rc, status;
g_return_val_if_fail(priv->state == STATE_DISCONNECTED
-#if USE_POLKIT
+#ifdef USE_POLKIT
|| priv->state == STATE_WAITING_FOR_ACL_HELPER
#endif
, FALSE);
@@ -275,7 +275,7 @@ static gboolean spice_usbredir_channel_open_device(
return TRUE;
}
-#if USE_POLKIT
+#ifdef USE_POLKIT
static void spice_usbredir_channel_open_acl_cb(
GObject *gobject, GAsyncResult *acl_res, gpointer user_data)
{
@@ -325,8 +325,8 @@ void spice_usbredir_channel_connect_device_async(
gpointer user_data)
{
SpiceUsbredirChannelPrivate *priv = channel->priv;
- GSimpleAsyncResult *result;
-#if ! USE_POLKIT
+ GTask *task;
+#ifndef USE_POLKIT
GError *err = NULL;
#endif
@@ -358,7 +358,7 @@ void spice_usbredir_channel_connect_device_async(
priv->device = libusb_ref_device(device);
priv->spice_device = g_boxed_copy(spice_usb_device_get_type(),
spice_device);
-#if USE_POLKIT
+#ifdef USE_POLKIT
priv->result = result;
priv->state = STATE_WAITING_FOR_ACL_HELPER;
priv->acl_helper = spice_usb_acl_helper_new();
@@ -415,7 +415,7 @@ void spice_usbredir_channel_disconnect_device(SpiceUsbredirChannel *channel)
case STATE_DISCONNECTED:
case STATE_DISCONNECTING:
break;
-#if USE_POLKIT
+#ifdef USE_POLKIT
case STATE_WAITING_FOR_ACL_HELPER:
priv->state = STATE_DISCONNECTING;
/* We're still waiting for the acl helper -> cancel it */
diff --git a/src/spice-channel.c b/src/spice-channel.c
index ff85715..1941b1b 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -119,7 +119,7 @@ static void spice_channel_init(SpiceChannel *channel)
c->remote_common_caps = g_array_new(FALSE, TRUE, sizeof(guint32));
spice_channel_set_common_capability(channel, SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION);
spice_channel_set_common_capability(channel, SPICE_COMMON_CAP_MINI_HEADER);
-#if HAVE_SASL
+#ifdef HAVE_SASL
spice_channel_set_common_capability(channel, SPICE_COMMON_CAP_AUTH_SASL);
#endif
g_queue_init(&c->xmit_queue);
@@ -802,7 +802,7 @@ static void spice_channel_flush_wire(SpiceChannel *channel,
}
}
-#if HAVE_SASL
+#ifdef HAVE_SASL
/*
* Encode all buffered data, write all encrypted data out
* to the wire
@@ -830,7 +830,7 @@ static void spice_channel_flush_sasl(SpiceChannel *channel, const void *data, si
/* coroutine context */
static void spice_channel_write(SpiceChannel *channel, const void *data, size_t len)
{
-#if HAVE_SASL
+#ifdef HAVE_SASL
SpiceChannelPrivate *c = channel->priv;
if (c->sasl_conn)
@@ -932,7 +932,7 @@ reread:
return ret;
}
-#if HAVE_SASL
+#ifdef HAVE_SASL
/*
* Read at least 1 more byte of data out of the SASL decrypted
* data buffer, into the internal read buffer
@@ -994,7 +994,7 @@ static int spice_channel_read(SpiceChannel *channel, void *data, size_t length)
while (len > 0) {
if (c->has_error) return 0; /* has_error is set by disconnect(), return no error */
-#if HAVE_SASL
+#ifdef HAVE_SASL
if (c->sasl_conn)
ret = spice_channel_read_sasl(channel, data, len);
else
@@ -1268,7 +1268,7 @@ error:
return FALSE;
}
-#if HAVE_SASL
+#ifdef HAVE_SASL
/*
* NB, keep in sync with similar method in spice/server/reds.c
*/
@@ -1795,7 +1795,7 @@ static gboolean spice_channel_recv_link_msg(SpiceChannel *channel)
} else {
SpiceLinkAuthMechanism auth = { 0, };
-#if HAVE_SASL
+#ifdef HAVE_SASL
if (spice_channel_test_common_capability(channel, SPICE_COMMON_CAP_AUTH_SASL)) {
CHANNEL_DEBUG(channel, "Choosing SASL mechanism");
auth.auth_mechanism = SPICE_COMMON_CAP_AUTH_SASL;
@@ -2167,7 +2167,7 @@ static void spice_channel_iterate_read(SpiceChannel *channel)
) { do
spice_channel_recv_msg(channel,
(handler_msg_in)SPICE_CHANNEL_GET_CLASS(channel)->handle_msg, NULL);
-#if HAVE_SASL
+#ifdef HAVE_SASL
/* flush the sasl buffer too */
while (c->sasl_decoded != NULL);
#else
@@ -2632,7 +2632,7 @@ static void channel_reset(SpiceChannel *channel, gboolean migrating)
c->connect_delayed_id = 0;
}
-#if HAVE_SASL
+#ifdef HAVE_SASL
if (c->sasl_conn) {
sasl_dispose(&c->sasl_conn);
c->sasl_conn = NULL;
@@ -2906,7 +2906,7 @@ void spice_channel_swap(SpiceChannel *channel, SpiceChannel *swap, gboolean swap
SWAP(common_caps);
SWAP(remote_caps);
SWAP(remote_common_caps);
-#if HAVE_SASL
+#ifdef HAVE_SASL
SWAP(sasl_conn);
SWAP(sasl_decoded);
SWAP(sasl_decoded_length);
diff --git a/src/spice-client-glib-usb-acl-helper.c b/src/spice-client-glib-usb-acl-helper.c
index bc09776..3c5de05 100644
--- a/src/spice-client-glib-usb-acl-helper.c
+++ b/src/spice-client-glib-usb-acl-helper.c
@@ -161,7 +161,7 @@ static void cleanup(void)
}
/* Not available in polkit < 0.101 */
-#if !HAVE_POLKIT_AUTHORIZATION_RESULT_GET_DISMISSED
+#ifndef HAVE_POLKIT_AUTHORIZATION_RESULT_GET_DISMISSED
static gboolean
polkit_authorization_result_get_dismissed(PolkitAuthorizationResult *result)
{
@@ -296,7 +296,7 @@ static void stdin_read_complete(GObject *src, GAsyncResult *res, gpointer data)
}
/* Fix for polkit 0.97 and later */
-#if !HAVE_POLKIT_AUTHORITY_GET_SYNC
+#ifndef HAVE_POLKIT_AUTHORITY_GET_SYNC
static PolkitAuthority *
polkit_authority_get_sync (GCancellable *cancellable, GError **error)
{
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 9ea28c4..4201ee0 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -19,7 +19,7 @@
#include <glib.h>
-#if HAVE_X11_XKBLIB_H
+#ifdef HAVE_X11_XKBLIB_H
#include <X11/XKBlib.h>
#include <gdk/gdkx.h>
#endif
@@ -139,7 +139,7 @@ static guint32 get_keyboard_lock_modifiers(void)
modifiers |= SPICE_INPUTS_SCROLL_LOCK;
}
#else
-#if HAVE_X11_XKBLIB_H
+#ifdef HAVE_X11_XKBLIB_H
Display *x_display = NULL;
XKeyboardState keyboard_state;
diff --git a/src/spice-widget.c b/src/spice-widget.c
index a1a68a6..19753e7 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -20,7 +20,7 @@
#include <math.h>
#include <glib.h>
-#if HAVE_X11_XKBLIB_H
+#ifdef HAVE_X11_XKBLIB_H
#include <X11/XKBlib.h>
#include <gdk/gdkx.h>
#endif
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 647edd0..6e12602 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -393,7 +393,7 @@ static void spice_usb_device_manager_get_property(GObject *gobject,
break;
case PROP_FREE_CHANNELS: {
int free_channels = 0;
-#if USE_USBREDIR
+#ifdef USE_USBREDIR
int i;
for (i = 0; i < priv->channels->len; i++) {
SpiceUsbredirChannel *channel = g_ptr_array_index(priv->channels, i);