[Spice-devel,spice-server,18/22] reds: use bool for RedServerConfig fields

Submitted by Frediano Ziglio on June 16, 2017, 9:13 a.m.

Details

Message ID 20170616091334.31475-19-fziglio@redhat.com
State New
Headers show
Series "reds: Use bool for boolean types" ( rev: 6 5 4 3 2 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio June 16, 2017, 9:13 a.m.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 server/reds.c | 38 +++++++++++++++++++-------------------
 server/reds.h |  2 +-
 2 files changed, 20 insertions(+), 20 deletions(-)

Patch hide | download patch | download mbox

diff --git a/server/reds.c b/server/reds.c
index b95043b..67ba900 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -178,7 +178,7 @@  struct RedServerConfig {
     bool spice_uuid_is_set;
     uint8_t spice_uuid[16];
 
-    gboolean ticketing_enabled;
+    bool ticketing_enabled;
     uint32_t streaming_video;
     GArray* video_codecs;
     SpiceImageCompression image_compression;
@@ -186,10 +186,10 @@  struct RedServerConfig {
     spice_wan_compression_t jpeg_state;
     spice_wan_compression_t zlib_glz_state;
 
-    gboolean agent_mouse;
-    gboolean agent_copypaste;
-    gboolean agent_file_xfer;
-    gboolean exit_on_disconnect;
+    bool agent_mouse;
+    bool agent_copypaste;
+    bool agent_file_xfer;
+    bool exit_on_disconnect;
 
     RedSSLParameters ssl_parameters;
 };
@@ -620,7 +620,7 @@  static void reds_set_mouse_mode(RedsState *reds, uint32_t mode)
     main_channel_push_mouse_mode(reds->main_channel, reds->mouse_mode, reds->is_client_mouse_allowed);
 }
 
-gboolean reds_config_get_agent_mouse(const RedsState *reds)
+bool reds_config_get_agent_mouse(const RedsState *reds)
 {
     return reds->config->agent_mouse;
 }
@@ -3466,19 +3466,19 @@  SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
 #if HAVE_SASL
     reds->config->sasl_appname = NULL; // default to "spice" if NULL
 #endif
-    reds->config->spice_uuid_is_set = FALSE;
+    reds->config->spice_uuid_is_set = false;
     memset(reds->config->spice_uuid, 0, sizeof(reds->config->spice_uuid));
-    reds->config->ticketing_enabled = TRUE; /* ticketing enabled by default */
+    reds->config->ticketing_enabled = true; /* ticketing enabled by default */
     reds->config->streaming_video = SPICE_STREAM_VIDEO_FILTER;
     reds->config->video_codecs = g_array_new(FALSE, FALSE, sizeof(RedVideoCodec));
     reds->config->image_compression = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
-    reds->config->playback_compression = TRUE;
+    reds->config->playback_compression = true;
     reds->config->jpeg_state = SPICE_WAN_COMPRESSION_AUTO;
     reds->config->zlib_glz_state = SPICE_WAN_COMPRESSION_AUTO;
-    reds->config->agent_mouse = TRUE;
-    reds->config->agent_copypaste = TRUE;
-    reds->config->agent_file_xfer = TRUE;
-    reds->config->exit_on_disconnect = FALSE;
+    reds->config->agent_mouse = true;
+    reds->config->agent_copypaste = true;
+    reds->config->agent_file_xfer = true;
+    reds->config->exit_on_disconnect = false;
 #ifdef RED_STATISTICS
     reds->stat_file = stat_file_new(REDS_MAX_STAT_NODES);
     /* Create an initial node. This will be the 0 node making easier
@@ -3776,7 +3776,7 @@  SPICE_GNUC_VISIBLE int spice_server_set_exit_on_disconnect(SpiceServer *s, int f
 SPICE_GNUC_VISIBLE int spice_server_set_noauth(SpiceServer *s)
 {
     memset(s->config->taTicket.password, 0, sizeof(s->config->taTicket.password));
-    s->config->ticketing_enabled = FALSE;
+    s->config->ticketing_enabled = false;
     return 0;
 }
 
@@ -3810,7 +3810,7 @@  SPICE_GNUC_VISIBLE void spice_server_set_name(SpiceServer *s, const char *name)
 SPICE_GNUC_VISIBLE void spice_server_set_uuid(SpiceServer *s, const uint8_t uuid[16])
 {
     memcpy(s->config->spice_uuid, uuid, sizeof(s->config->spice_uuid));
-    s->config->spice_uuid_is_set = TRUE;
+    s->config->spice_uuid_is_set = true;
 }
 
 SPICE_GNUC_VISIBLE int spice_server_set_ticket(SpiceServer *reds,
@@ -3828,7 +3828,7 @@  SPICE_GNUC_VISIBLE int spice_server_set_ticket(SpiceServer *reds,
     }
 
     on_activating_ticketing(reds);
-    reds->config->ticketing_enabled = TRUE;
+    reds->config->ticketing_enabled = true;
     if (lifetime == 0) {
         reds->config->taTicket.expiration_time = INT_MAX;
     } else {
@@ -4034,21 +4034,21 @@  SPICE_GNUC_VISIBLE int spice_server_set_playback_compression(SpiceServer *reds,
 
 SPICE_GNUC_VISIBLE int spice_server_set_agent_mouse(SpiceServer *reds, int enable)
 {
-    reds->config->agent_mouse = enable;
+    reds->config->agent_mouse = !!enable;
     reds_update_mouse_mode(reds);
     return 0;
 }
 
 SPICE_GNUC_VISIBLE int spice_server_set_agent_copypaste(SpiceServer *reds, int enable)
 {
-    reds->config->agent_copypaste = enable;
+    reds->config->agent_copypaste = !!enable;
     reds_update_agent_properties(reds);
     return 0;
 }
 
 SPICE_GNUC_VISIBLE int spice_server_set_agent_file_xfer(SpiceServer *reds, int enable)
 {
-    reds->config->agent_file_xfer = enable;
+    reds->config->agent_file_xfer = !!enable;
     reds_update_agent_properties(reds);
     return 0;
 }
diff --git a/server/reds.h b/server/reds.h
index 2fc50f8..b887a12 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -49,7 +49,7 @@  void reds_register_channel(RedsState *reds, RedChannel *channel);
 void reds_unregister_channel(RedsState *reds, RedChannel *channel);
 RedChannel *reds_find_channel(RedsState *reds, uint32_t type, uint32_t id);
 int reds_get_mouse_mode(RedsState *reds); // used by inputs_channel
-gboolean reds_config_get_agent_mouse(const RedsState *reds); // used by inputs_channel
+bool reds_config_get_agent_mouse(const RedsState *reds); // used by inputs_channel
 int reds_has_vdagent(RedsState *reds); // used by inputs channel
 bool reds_config_get_playback_compression(RedsState *reds); // used by playback channel