[Spice-devel] [spice-server 2/4] Use bool rather than int return values when appropriate

Christophe Fergeau cfergeau at redhat.com
Thu Mar 9 13:38:40 UTC 2017


This commit changes all functions returning TRUE/FALSE from having an
'int' return value to 'bool'.
This way it's obvious that such a function is not going to return
anything else than TRUE or FALSE.
---
 server/char-device.c              | 20 +++++++++----------
 server/char-device.h              | 18 ++++++++---------
 server/common-graphics-channel.c  |  2 +-
 server/common-graphics-channel.h  |  2 +-
 server/dcc-send.c                 | 36 +++++++++++++++++-----------------
 server/dcc.c                      | 41 +++++++++++++++++++--------------------
 server/dcc.h                      | 12 ++++++------
 server/display-channel.c          | 16 +++++++--------
 server/display-channel.h          |  2 +-
 server/glz-encoder-dict.c         |  4 ++--
 server/glz-encoder.c              |  2 +-
 server/image-cache.c              |  2 +-
 server/image-encoders.c           | 30 ++++++++++++++--------------
 server/image-encoders.h           | 28 +++++++++++++-------------
 server/inputs-channel.c           | 12 ++++++------
 server/main-channel-client.c      |  4 ++--
 server/main-channel.c             | 10 +++++-----
 server/mjpeg-encoder.c            |  4 ++--
 server/pixmap-cache.c             |  2 +-
 server/pixmap-cache.h             |  2 +-
 server/red-channel-client.c       | 16 +++++++--------
 server/red-channel-client.h       | 14 ++++++-------
 server/red-channel.c              | 18 ++++++++---------
 server/red-channel.h              | 30 ++++++++++++++--------------
 server/red-parse-qxl.c            |  2 +-
 server/red-worker.c               |  2 +-
 server/reds-stream.c              |  2 +-
 server/reds-stream.h              |  2 +-
 server/reds.c                     | 12 ++++++------
 server/reds.h                     |  4 ++--
 server/smartcard-channel-client.c | 16 +++++++--------
 server/smartcard-channel-client.h | 16 +++++++--------
 server/sound.c                    | 38 ++++++++++++++++++------------------
 server/spicevmc.c                 | 18 ++++++++---------
 server/stream.c                   | 12 ++++++------
 server/tree.c                     |  2 +-
 server/tree.h                     |  2 +-
 37 files changed, 227 insertions(+), 228 deletions(-)

diff --git a/server/char-device.c b/server/char-device.c
index c40ed65..d325932 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -306,7 +306,7 @@ static void red_char_device_send_msg_to_clients(RedCharDevice *dev,
     }
 }
 
-static int red_char_device_read_from_device(RedCharDevice *dev)
+static bool red_char_device_read_from_device(RedCharDevice *dev)
 {
     uint64_t max_send_tokens;
     int did_read = FALSE;
@@ -720,13 +720,13 @@ static RedCharDeviceClient *red_char_device_client_new(RedClient *client,
     return dev_client;
 }
 
-int red_char_device_client_add(RedCharDevice *dev,
-                               RedClient *client,
-                               int do_flow_control,
-                               uint32_t max_send_queue_size,
-                               uint32_t num_client_tokens,
-                               uint32_t num_send_tokens,
-                               int wait_for_migrate_data)
+bool red_char_device_client_add(RedCharDevice *dev,
+                                RedClient *client,
+                                int do_flow_control,
+                                uint32_t max_send_queue_size,
+                                uint32_t num_client_tokens,
+                                uint32_t num_send_tokens,
+                                int wait_for_migrate_data)
 {
     RedCharDeviceClient *dev_client;
 
@@ -921,8 +921,8 @@ void red_char_device_migrate_data_marshall(RedCharDevice *dev,
                 dev, *write_to_dev_size_ptr, *write_to_dev_tokens_ptr);
 }
 
-int red_char_device_restore(RedCharDevice *dev,
-                            SpiceMigrateDataCharDevice *mig_data)
+bool red_char_device_restore(RedCharDevice *dev,
+                             SpiceMigrateDataCharDevice *mig_data)
 {
     RedCharDeviceClient *dev_client;
     uint32_t client_tokens_window;
diff --git a/server/char-device.h b/server/char-device.h
index 3b87023..26360e1 100644
--- a/server/char-device.h
+++ b/server/char-device.h
@@ -166,8 +166,8 @@ void red_char_device_migrate_data_marshall(RedCharDevice *dev,
                                            SpiceMarshaller *m);
 void red_char_device_migrate_data_marshall_empty(SpiceMarshaller *m);
 
-int red_char_device_restore(RedCharDevice *dev,
-                            SpiceMigrateDataCharDevice *mig_data);
+bool red_char_device_restore(RedCharDevice *dev,
+                             SpiceMigrateDataCharDevice *mig_data);
 
 /*
  * Resets write/read queues, and moves that state to being stopped.
@@ -186,13 +186,13 @@ void red_char_device_reset(RedCharDevice *dev);
 
 /* max_send_queue_size = how many messages we can read from the device and enqueue for this client,
  * when we have tokens for other clients and no tokens for this one */
-int red_char_device_client_add(RedCharDevice *dev,
-                               RedClient *client,
-                               int do_flow_control,
-                               uint32_t max_send_queue_size,
-                               uint32_t num_client_tokens,
-                               uint32_t num_send_tokens,
-                               int wait_for_migrate_data);
+bool red_char_device_client_add(RedCharDevice *dev,
+                                RedClient *client,
+                                int do_flow_control,
+                                uint32_t max_send_queue_size,
+                                uint32_t num_client_tokens,
+                                uint32_t num_send_tokens,
+                                int wait_for_migrate_data);
 
 void red_char_device_client_remove(RedCharDevice *dev,
                                    RedClient *client);
diff --git a/server/common-graphics-channel.c b/server/common-graphics-channel.c
index 394a68e..0bb363b 100644
--- a/server/common-graphics-channel.c
+++ b/server/common-graphics-channel.c
@@ -120,7 +120,7 @@ common_graphics_channel_set_property(GObject *object,
     }
 }
 
-int common_channel_config_socket(RedChannelClient *rcc)
+bool common_channel_config_socket(RedChannelClient *rcc)
 {
     RedClient *client = red_channel_client_get_client(rcc);
     MainChannelClient *mcc = red_client_get_main(client);
diff --git a/server/common-graphics-channel.h b/server/common-graphics-channel.h
index bdcb2c8..9939a98 100644
--- a/server/common-graphics-channel.h
+++ b/server/common-graphics-channel.h
@@ -25,7 +25,7 @@
 
 G_BEGIN_DECLS
 
-int common_channel_config_socket(RedChannelClient *rcc);
+bool common_channel_config_socket(RedChannelClient *rcc);
 
 #define COMMON_CLIENT_TIMEOUT (NSEC_PER_SEC * 30)
 
diff --git a/server/dcc-send.c b/server/dcc-send.c
index b9244a6..3c95776 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -85,8 +85,8 @@ static int dcc_pixmap_cache_hit(DisplayChannelClient *dcc, uint64_t id, int *los
 }
 
 /* set area=NULL for testing the whole surface */
-static int is_surface_area_lossy(DisplayChannelClient *dcc, uint32_t surface_id,
-                                 const SpiceRect *area, SpiceRect *out_lossy_area)
+static bool is_surface_area_lossy(DisplayChannelClient *dcc, uint32_t surface_id,
+                                  const SpiceRect *area, SpiceRect *out_lossy_area)
 {
     RedSurface *surface;
     QRegion *surface_lossy_region;
@@ -127,8 +127,8 @@ static int is_surface_area_lossy(DisplayChannelClient *dcc, uint32_t surface_id,
    to the client, returns false. "area" is for surfaces. If area = NULL,
    all the surface is considered. out_lossy_data will hold info about the bitmap, and its lossy
    area in case it is lossy and part of a surface. */
-static int is_bitmap_lossy(RedChannelClient *rcc, SpiceImage *image, SpiceRect *area,
-                           BitmapData *out_data)
+static bool is_bitmap_lossy(RedChannelClient *rcc, SpiceImage *image, SpiceRect *area,
+                            BitmapData *out_data)
 {
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
 
@@ -163,8 +163,8 @@ static int is_bitmap_lossy(RedChannelClient *rcc, SpiceImage *image, SpiceRect *
                                  area, &out_data->lossy_rect);
 }
 
-static int is_brush_lossy(RedChannelClient *rcc, SpiceBrush *brush,
-                          BitmapData *out_data)
+static bool is_brush_lossy(RedChannelClient *rcc, SpiceBrush *brush,
+                           BitmapData *out_data)
 {
     if (brush->type == SPICE_BRUSH_TYPE_PATTERN) {
         return is_bitmap_lossy(rcc, brush->u.pattern.pat, NULL,
@@ -607,9 +607,9 @@ static void surface_lossy_region_update(DisplayChannelClient *dcc,
     }
 }
 
-static int drawable_intersects_with_areas(Drawable *drawable, int surface_ids[],
-                                          SpiceRect *surface_areas[],
-                                          int num_surfaces)
+static bool drawable_intersects_with_areas(Drawable *drawable, int surface_ids[],
+                                           SpiceRect *surface_areas[],
+                                               int num_surfaces)
 {
     int i;
     for (i = 0; i < num_surfaces; i++) {
@@ -622,10 +622,10 @@ static int drawable_intersects_with_areas(Drawable *drawable, int surface_ids[],
     return FALSE;
 }
 
-static int pipe_rendered_drawables_intersect_with_areas(DisplayChannelClient *dcc,
-                                                        int surface_ids[],
-                                                        SpiceRect *surface_areas[],
-                                                        int num_surfaces)
+static bool pipe_rendered_drawables_intersect_with_areas(DisplayChannelClient *dcc,
+                                                         int surface_ids[],
+                                                         SpiceRect *surface_areas[],
+                                                         int num_surfaces)
 {
     GList *l;
 
@@ -650,8 +650,8 @@ static int pipe_rendered_drawables_intersect_with_areas(DisplayChannelClient *dc
     return FALSE;
 }
 
-static int drawable_depends_on_areas(Drawable *drawable, int surface_ids[],
-                                     SpiceRect surface_areas[], int num_surfaces)
+static bool drawable_depends_on_areas(Drawable *drawable, int surface_ids[],
+                                      SpiceRect surface_areas[], int num_surfaces)
 {
     int i;
     RedDrawable *red_drawable;
@@ -1680,9 +1680,9 @@ static void red_release_video_encoder_buffer(uint8_t *data, void *opaque)
     buffer->free(buffer);
 }
 
-static int red_marshall_stream_data(RedChannelClient *rcc,
-                                    SpiceMarshaller *base_marshaller,
-                                    Drawable *drawable)
+static bool red_marshall_stream_data(RedChannelClient *rcc,
+                                     SpiceMarshaller *base_marshaller,
+                                     Drawable *drawable)
 {
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
     DisplayChannel *display = DCC_TO_DC(dcc);
diff --git a/server/dcc.c b/server/dcc.c
index 6413126..528ae11 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -200,7 +200,7 @@ static RedSurfaceCreateItem *red_surface_create_item_new(RedChannel* channel,
     return create;
 }
 
-int dcc_drawable_is_in_pipe(DisplayChannelClient *dcc, Drawable *drawable)
+bool dcc_drawable_is_in_pipe(DisplayChannelClient *dcc, Drawable *drawable)
 {
     RedDrawablePipeItem *dpi;
     GList *l;
@@ -219,8 +219,8 @@ int dcc_drawable_is_in_pipe(DisplayChannelClient *dcc, Drawable *drawable)
  * Return: TRUE if wait_if_used == FALSE, or otherwise, if all of the pipe items that
  * are related to the surface have been cleared (or sent) from the pipe.
  */
-int dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surface_id,
-                                          int wait_if_used)
+bool dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surface_id,
+                                           int wait_if_used)
 {
     GList *l;
     int x;
@@ -530,7 +530,7 @@ static void dcc_create_all_streams(DisplayChannelClient *dcc)
 }
 
 /* TODO: this function is evil^Wsynchronous, fix */
-static int display_channel_client_wait_for_init(DisplayChannelClient *dcc)
+static bool display_channel_client_wait_for_init(DisplayChannelClient *dcc)
 {
     dcc->priv->expect_init = TRUE;
     uint64_t end_time = spice_get_monotonic_time_ns() + COMMON_CLIENT_TIMEOUT;
@@ -942,8 +942,8 @@ static void dcc_push_release(DisplayChannelClient *dcc, uint8_t type, uint64_t i
     free_list->res->resources[free_list->res->count++].id = id;
 }
 
-int dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
-                                  uint32_t size, int lossy)
+bool dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
+                                   uint32_t size, int lossy)
 {
     PixmapCache *cache = dcc->priv->pixmap_cache;
     NewCacheItem *item;
@@ -1008,7 +1008,7 @@ int dcc_pixmap_cache_unlocked_add(DisplayChannelClient *dcc, uint64_t id,
     return TRUE;
 }
 
-static int dcc_handle_init(DisplayChannelClient *dcc, SpiceMsgcDisplayInit *init)
+static bool dcc_handle_init(DisplayChannelClient *dcc, SpiceMsgcDisplayInit *init)
 {
     gboolean success;
     RedClient *client = red_channel_client_get_client(RED_CHANNEL_CLIENT(dcc));
@@ -1031,8 +1031,8 @@ static int dcc_handle_init(DisplayChannelClient *dcc, SpiceMsgcDisplayInit *init
     return TRUE;
 }
 
-static int dcc_handle_stream_report(DisplayChannelClient *dcc,
-                                    SpiceMsgcDisplayStreamReport *report)
+static bool dcc_handle_stream_report(DisplayChannelClient *dcc,
+                                     SpiceMsgcDisplayStreamReport *report)
 {
     StreamAgent *agent;
 
@@ -1076,8 +1076,8 @@ static int dcc_handle_stream_report(DisplayChannelClient *dcc,
     return TRUE;
 }
 
-static int dcc_handle_preferred_compression(DisplayChannelClient *dcc,
-        SpiceMsgcDisplayPreferredCompression *pc)
+static bool dcc_handle_preferred_compression(DisplayChannelClient *dcc,
+                                             SpiceMsgcDisplayPreferredCompression *pc)
 {
     switch (pc->image_compression) {
     case SPICE_IMAGE_COMPRESSION_AUTO_LZ:
@@ -1097,7 +1097,6 @@ static int dcc_handle_preferred_compression(DisplayChannelClient *dcc,
     return TRUE;
 }
 
-
 /* TODO: Client preference should only be considered when host has video-codecs
  * with the same priority value. At the moment, the video-codec GArray will be
  * sorted following only the client's preference (@user_data)
@@ -1210,7 +1209,7 @@ GArray *dcc_get_preferred_video_codecs_for_encoding(DisplayChannelClient *dcc)
     return display_channel_get_video_codecs(DCC_TO_DC(dcc));
 }
 
-static int dcc_handle_gl_draw_done(DisplayChannelClient *dcc)
+static bool dcc_handle_gl_draw_done(DisplayChannelClient *dcc)
 {
     DisplayChannel *display = DCC_TO_DC(dcc);
 
@@ -1226,7 +1225,7 @@ static int dcc_handle_gl_draw_done(DisplayChannelClient *dcc)
     return TRUE;
 }
 
-int dcc_handle_message(RedChannelClient *rcc, uint16_t type, uint32_t size, void *msg)
+bool dcc_handle_message(RedChannelClient *rcc, uint16_t type, uint32_t size, void *msg)
 {
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
 
@@ -1257,7 +1256,7 @@ static int dcc_handle_migrate_glz_dictionary(DisplayChannelClient *dcc,
                                                  &migrate->glz_dict_data);
 }
 
-static int restore_surface(DisplayChannelClient *dcc, uint32_t surface_id)
+static bool restore_surface(DisplayChannelClient *dcc, uint32_t surface_id)
 {
     /* we don't process commands till we receive the migration data, thus,
      * we should have not sent any surface to the client. */
@@ -1269,8 +1268,8 @@ static int restore_surface(DisplayChannelClient *dcc, uint32_t surface_id)
     return TRUE;
 }
 
-static int restore_surfaces_lossless(DisplayChannelClient *dcc,
-                                         MigrateDisplaySurfacesAtClientLossless *mig_surfaces)
+static bool restore_surfaces_lossless(DisplayChannelClient *dcc,
+                                      MigrateDisplaySurfacesAtClientLossless *mig_surfaces)
 {
     uint32_t i;
 
@@ -1284,8 +1283,8 @@ static int restore_surfaces_lossless(DisplayChannelClient *dcc,
     return TRUE;
 }
 
-static int restore_surfaces_lossy(DisplayChannelClient *dcc,
-                                  MigrateDisplaySurfacesAtClientLossy *mig_surfaces)
+static bool restore_surfaces_lossy(DisplayChannelClient *dcc,
+                                   MigrateDisplaySurfacesAtClientLossy *mig_surfaces)
 {
     uint32_t i;
 
@@ -1309,7 +1308,7 @@ static int restore_surfaces_lossy(DisplayChannelClient *dcc,
     return TRUE;
 }
 
-int dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *message)
+bool dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *message)
 {
     DisplayChannel *display = DCC_TO_DC(dcc);
     int surfaces_restored = FALSE;
@@ -1417,7 +1416,7 @@ void dcc_set_max_stream_bit_rate(DisplayChannelClient *dcc, uint64_t rate)
     dcc->priv->streams_max_bit_rate = rate;
 }
 
-int dcc_config_socket(RedChannelClient *rcc)
+bool dcc_config_socket(RedChannelClient *rcc)
 {
     RedClient *client = red_channel_client_get_client(rcc);
     MainChannelClient *mcc = red_client_get_main(client);
diff --git a/server/dcc.h b/server/dcc.h
index 31e25b5..c6c6979 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -138,10 +138,10 @@ DisplayChannelClient*      dcc_new                                   (DisplayCha
                                                                       spice_wan_compression_t zlib_glz_state);
 void                       dcc_start                                 (DisplayChannelClient *dcc);
 void                       dcc_stop                                  (DisplayChannelClient *dcc);
-int                        dcc_handle_message                        (RedChannelClient *rcc,
+bool                       dcc_handle_message                        (RedChannelClient *rcc,
                                                                       uint16_t type,
                                                                       uint32_t size, void *msg);
-int                        dcc_handle_migrate_data                   (DisplayChannelClient *dcc,
+bool                       dcc_handle_migrate_data                   (DisplayChannelClient *dcc,
                                                                       uint32_t size, void *message);
 void                       dcc_push_monitors_config                  (DisplayChannelClient *dcc);
 void                       dcc_destroy_surface                       (DisplayChannelClient *dcc,
@@ -163,7 +163,7 @@ void                       dcc_palette_cache_reset                   (DisplayCha
 void                       dcc_palette_cache_palette                 (DisplayChannelClient *dcc,
                                                                       SpicePalette *palette,
                                                                       uint8_t *flags);
-int                        dcc_pixmap_cache_unlocked_add             (DisplayChannelClient *dcc,
+bool                       dcc_pixmap_cache_unlocked_add             (DisplayChannelClient *dcc,
                                                                       uint64_t id, uint32_t size, int lossy);
 void                       dcc_prepend_drawable                      (DisplayChannelClient *dcc,
                                                                       Drawable *drawable);
@@ -174,10 +174,10 @@ void                       dcc_add_drawable_after                    (DisplayCha
                                                                       RedPipeItem *pos);
 void                       dcc_send_item                             (RedChannelClient *dcc,
                                                                       RedPipeItem *item);
-int                        dcc_clear_surface_drawables_from_pipe     (DisplayChannelClient *dcc,
+bool                       dcc_clear_surface_drawables_from_pipe     (DisplayChannelClient *dcc,
                                                                       int surface_id,
                                                                       int wait_if_used);
-int                        dcc_drawable_is_in_pipe                   (DisplayChannelClient *dcc,
+bool                       dcc_drawable_is_in_pipe                   (DisplayChannelClient *dcc,
                                                                       Drawable *drawable);
 RedPipeItem *              dcc_gl_scanout_item_new                   (RedChannelClient *rcc,
                                                                       void *data, int num);
@@ -197,7 +197,7 @@ uint32_t dcc_get_max_stream_latency(DisplayChannelClient *dcc);
 void dcc_set_max_stream_latency(DisplayChannelClient *dcc, uint32_t latency);
 uint64_t dcc_get_max_stream_bit_rate(DisplayChannelClient *dcc);
 void dcc_set_max_stream_bit_rate(DisplayChannelClient *dcc, uint64_t rate);
-int dcc_config_socket(RedChannelClient *rcc);
+bool dcc_config_socket(RedChannelClient *rcc);
 gboolean dcc_is_low_bandwidth(DisplayChannelClient *dcc);
 GArray *dcc_get_preferred_video_codecs_for_encoding(DisplayChannelClient *dcc);
 
diff --git a/server/display-channel.c b/server/display-channel.c
index 67a77ef..46235fd 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -473,7 +473,7 @@ static void current_remove_all(DisplayChannel *display, int surface_id)
     }
 }
 
-static int current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *other)
+static bool current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem *other)
 {
     DrawItem *other_draw_item;
     Drawable *drawable;
@@ -683,7 +683,7 @@ static void exclude_region(DisplayChannel *display, Ring *ring, RingItem *ring_i
     }
 }
 
-static int current_add_with_shadow(DisplayChannel *display, Ring *ring, Drawable *item)
+static bool current_add_with_shadow(DisplayChannel *display, Ring *ring, Drawable *item)
 {
     stat_start(&display->priv->add_stat, start_time);
 #ifdef RED_WORKER_STAT
@@ -726,7 +726,7 @@ static int current_add_with_shadow(DisplayChannel *display, Ring *ring, Drawable
     return TRUE;
 }
 
-static int current_add(DisplayChannel *display, Ring *ring, Drawable *drawable)
+static bool current_add(DisplayChannel *display, Ring *ring, Drawable *drawable)
 {
     DrawItem *item = &drawable->tree_item;
     RingItem *now;
@@ -1005,7 +1005,7 @@ static void surface_add_reverse_dependency(DisplayChannel *display, int surface_
     ring_add(&surface->depend_on_me, &depend_item->ring_item);
 }
 
-static int handle_surface_deps(DisplayChannel *display, Drawable *drawable)
+static bool handle_surface_deps(DisplayChannel *display, Drawable *drawable)
 {
     int x;
 
@@ -1043,7 +1043,7 @@ static void draw_depend_on_me(DisplayChannel *display, uint32_t surface_id)
     }
 }
 
-static int validate_drawable_bbox(DisplayChannel *display, RedDrawable *drawable)
+static bool validate_drawable_bbox(DisplayChannel *display, RedDrawable *drawable)
 {
         DrawContext *context;
         uint32_t surface_id = drawable->surface_id;
@@ -1192,7 +1192,7 @@ void display_channel_process_draw(DisplayChannel *display, RedDrawable *red_draw
     drawable_unref(drawable);
 }
 
-int display_channel_wait_for_migrate_data(DisplayChannel *display)
+bool display_channel_wait_for_migrate_data(DisplayChannel *display)
 {
     uint64_t end_time = spice_get_monotonic_time_ns() + DISPLAY_CLIENT_MIGRATE_DATA_TIMEOUT;
     RedChannelClient *rcc;
@@ -1950,7 +1950,7 @@ static void on_disconnect(RedChannelClient *rcc)
                 display->priv->encoder_shared_data.glz_drawable_count);
 }
 
-static int handle_migrate_flush_mark(RedChannelClient *rcc)
+static bool handle_migrate_flush_mark(RedChannelClient *rcc)
 {
     RedChannel *channel = red_channel_client_get_channel(rcc);
 
@@ -1967,7 +1967,7 @@ static uint64_t handle_migrate_data_get_serial(RedChannelClient *rcc, uint32_t s
     return migrate_data->message_serial;
 }
 
-static int handle_migrate_data(RedChannelClient *rcc, uint32_t size, void *message)
+static bool handle_migrate_data(RedChannelClient *rcc, uint32_t size, void *message)
 {
     return dcc_handle_migrate_data(DISPLAY_CHANNEL_CLIENT(rcc), size, message);
 }
diff --git a/server/display-channel.h b/server/display-channel.h
index 3d4accf..4414de1 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -236,7 +236,7 @@ void                       display_channel_surface_unref             (DisplayCha
                                                                       uint32_t surface_id);
 void                       display_channel_current_flush             (DisplayChannel *display,
                                                                       int surface_id);
-int                        display_channel_wait_for_migrate_data     (DisplayChannel *display);
+bool                       display_channel_wait_for_migrate_data     (DisplayChannel *display);
 void                       display_channel_flush_all_surfaces        (DisplayChannel *display);
 void                       display_channel_free_glz_drawables_to_free(DisplayChannel *display);
 void                       display_channel_free_glz_drawables        (DisplayChannel *display);
diff --git a/server/glz-encoder-dict.c b/server/glz-encoder-dict.c
index af74736..1f81a6d 100644
--- a/server/glz-encoder-dict.c
+++ b/server/glz-encoder-dict.c
@@ -46,7 +46,7 @@ static inline void __glz_dictionary_window_reset_images(SharedDictionary *dict)
 }
 
 /* allocate window fields (no reset)*/
-static int glz_dictionary_window_create(SharedDictionary *dict, uint32_t size)
+static bool glz_dictionary_window_create(SharedDictionary *dict, uint32_t size)
 {
     if (size > LZ_MAX_WINDOW_SIZE) {
         return FALSE;
@@ -424,7 +424,7 @@ static WindowImage *glz_dictionary_window_get_new_head(SharedDictionary *dict, i
     return cur_head;
 }
 
-static inline int glz_dictionary_is_in_use(SharedDictionary *dict)
+static inline bool glz_dictionary_is_in_use(SharedDictionary *dict)
 {
     uint32_t i = 0;
     for (i = 0; i < dict->max_encoders; i++) {
diff --git a/server/glz-encoder.c b/server/glz-encoder.c
index f761330..c258726 100644
--- a/server/glz-encoder.c
+++ b/server/glz-encoder.c
@@ -108,7 +108,7 @@ static inline void compress_output_prev(Encoder *encoder)
     GLZ_ASSERT(encoder->usr, encoder->io.now == encoder->io.last_copy)
 }
 
-static int encoder_reset(Encoder *encoder, uint8_t *io_ptr, uint8_t *io_ptr_end)
+static bool encoder_reset(Encoder *encoder, uint8_t *io_ptr, uint8_t *io_ptr_end)
 {
     GLZ_ASSERT(encoder->usr, io_ptr <= io_ptr_end);
     encoder->io.bytes_count = io_ptr_end - io_ptr;
diff --git a/server/image-cache.c b/server/image-cache.c
index 7005814..bd888be 100644
--- a/server/image-cache.c
+++ b/server/image-cache.c
@@ -35,7 +35,7 @@ static ImageCacheItem *image_cache_find(ImageCache *cache, uint64_t id)
     return NULL;
 }
 
-static int image_cache_hit(ImageCache *cache, uint64_t id)
+static bool image_cache_hit(ImageCache *cache, uint64_t id)
 {
     ImageCacheItem *item;
     if (!(item = image_cache_find(cache, id))) {
diff --git a/server/image-encoders.c b/server/image-encoders.c
index bfc93b2..cf66896 100644
--- a/server/image-encoders.c
+++ b/server/image-encoders.c
@@ -827,8 +827,8 @@ static void image_encoders_release_glz(ImageEncoders *enc)
     free(shared_dict);
 }
 
-int image_encoders_compress_quic(ImageEncoders *enc, SpiceImage *dest,
-                                 SpiceBitmap *src, compress_send_data_t* o_comp_data)
+bool image_encoders_compress_quic(ImageEncoders *enc, SpiceImage *dest,
+                                  SpiceBitmap *src, compress_send_data_t* o_comp_data)
 {
     QuicData *quic_data = &enc->quic_data;
     QuicContext *quic = enc->quic;
@@ -914,9 +914,9 @@ static const LzImageType bitmap_fmt_to_lz_image_type[] = {
     LZ_IMAGE_TYPE_A8
 };
 
-int image_encoders_compress_lz(ImageEncoders *enc,
-                               SpiceImage *dest, SpiceBitmap *src,
-                               compress_send_data_t* o_comp_data)
+bool image_encoders_compress_lz(ImageEncoders *enc,
+                                SpiceImage *dest, SpiceBitmap *src,
+                                compress_send_data_t* o_comp_data)
 {
     LzData *lz_data = &enc->lz_data;
     LzContext *lz = enc->lz;
@@ -979,8 +979,8 @@ int image_encoders_compress_lz(ImageEncoders *enc,
     return TRUE;
 }
 
-int image_encoders_compress_jpeg(ImageEncoders *enc, SpiceImage *dest,
-                                 SpiceBitmap *src, compress_send_data_t* o_comp_data)
+bool image_encoders_compress_jpeg(ImageEncoders *enc, SpiceImage *dest,
+                                  SpiceBitmap *src, compress_send_data_t* o_comp_data)
 {
     JpegData *jpeg_data = &enc->jpeg_data;
     LzData *lz_data = &enc->lz_data;
@@ -1105,8 +1105,8 @@ int image_encoders_compress_jpeg(ImageEncoders *enc, SpiceImage *dest,
 }
 
 #ifdef USE_LZ4
-int image_encoders_compress_lz4(ImageEncoders *enc, SpiceImage *dest,
-                                SpiceBitmap *src, compress_send_data_t* o_comp_data)
+bool image_encoders_compress_lz4(ImageEncoders *enc, SpiceImage *dest,
+                                 SpiceBitmap *src, compress_send_data_t* o_comp_data)
 {
     Lz4Data *lz4_data = &enc->lz4_data;
     Lz4EncoderContext *lz4 = enc->lz4;
@@ -1208,12 +1208,12 @@ static GlzDrawableInstanceItem *add_glz_drawable_instance(RedGlzDrawable *glz_dr
 
 #define MIN_GLZ_SIZE_FOR_ZLIB 100
 
-int image_encoders_compress_glz(ImageEncoders *enc,
-                                SpiceImage *dest, SpiceBitmap *src,
-                                RedDrawable *red_drawable,
-                                GlzImageRetention *glz_retention,
-                                compress_send_data_t* o_comp_data,
-                                gboolean enable_zlib_glz_wrap)
+bool image_encoders_compress_glz(ImageEncoders *enc,
+                                 SpiceImage *dest, SpiceBitmap *src,
+                                 RedDrawable *red_drawable,
+                                 GlzImageRetention *glz_retention,
+                                 compress_send_data_t* o_comp_data,
+                                 gboolean enable_zlib_glz_wrap)
 {
     stat_start_time_t start_time;
     stat_start_time_init(&start_time, &enc->shared_data->zlib_glz_stat);
diff --git a/server/image-encoders.h b/server/image-encoders.h
index a755bf3..c1ee341 100644
--- a/server/image-encoders.h
+++ b/server/image-encoders.h
@@ -196,22 +196,22 @@ typedef struct compress_send_data_t {
     gboolean is_lossy;
 } compress_send_data_t;
 
-int image_encoders_compress_quic(ImageEncoders *enc, SpiceImage *dest,
-                                 SpiceBitmap *src, compress_send_data_t* o_comp_data);
-int image_encoders_compress_lz(ImageEncoders *enc, SpiceImage *dest,
-                               SpiceBitmap *src, compress_send_data_t* o_comp_data);
-int image_encoders_compress_jpeg(ImageEncoders *enc, SpiceImage *dest,
-                                 SpiceBitmap *src, compress_send_data_t* o_comp_data);
-#ifdef USE_LZ4
-int image_encoders_compress_lz4(ImageEncoders *enc, SpiceImage *dest,
+bool image_encoders_compress_quic(ImageEncoders *enc, SpiceImage *dest,
+                                  SpiceBitmap *src, compress_send_data_t* o_comp_data);
+bool image_encoders_compress_lz(ImageEncoders *enc, SpiceImage *dest,
                                 SpiceBitmap *src, compress_send_data_t* o_comp_data);
+bool image_encoders_compress_jpeg(ImageEncoders *enc, SpiceImage *dest,
+                                  SpiceBitmap *src, compress_send_data_t* o_comp_data);
+#ifdef USE_LZ4
+bool image_encoders_compress_lz4(ImageEncoders *enc, SpiceImage *dest,
+                                 SpiceBitmap *src, compress_send_data_t* o_comp_data);
 #endif
-int image_encoders_compress_glz(ImageEncoders *enc, SpiceImage *dest,
-                                SpiceBitmap *src,
-                                RedDrawable *red_drawable,
-                                GlzImageRetention *glz_retention,
-                                compress_send_data_t* o_comp_data,
-                                gboolean enable_zlib_glz_wrap);
+bool image_encoders_compress_glz(ImageEncoders *enc, SpiceImage *dest,
+                                 SpiceBitmap *src,
+                                 RedDrawable *red_drawable,
+                                 GlzImageRetention *glz_retention,
+                                 compress_send_data_t* o_comp_data,
+                                 gboolean enable_zlib_glz_wrap);
 
 #define RED_RELEASE_BUNCH_SIZE 64
 
diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index 84056ad..073dc41 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -242,8 +242,8 @@ static void inputs_channel_send_item(RedChannelClient *rcc, RedPipeItem *base)
     red_channel_client_begin_send_message(rcc);
 }
 
-static int inputs_channel_handle_message(RedChannelClient *rcc, uint16_t type,
-                                         uint32_t size, void *message)
+static bool inputs_channel_handle_message(RedChannelClient *rcc, uint16_t type,
+                                          uint32_t size, void *message)
 {
     InputsChannel *inputs_channel = INPUTS_CHANNEL(red_channel_client_get_channel(rcc));
     InputsChannelClient *icc = INPUTS_CHANNEL_CLIENT(rcc);
@@ -498,15 +498,15 @@ static void key_modifiers_sender(void *opaque)
     inputs_channel_push_keyboard_modifiers(inputs, kbd_get_leds(inputs_channel_get_keyboard(inputs)));
 }
 
-static int inputs_channel_handle_migrate_flush_mark(RedChannelClient *rcc)
+static bool inputs_channel_handle_migrate_flush_mark(RedChannelClient *rcc)
 {
     red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_MIGRATE_DATA);
     return TRUE;
 }
 
-static int inputs_channel_handle_migrate_data(RedChannelClient *rcc,
-                                              uint32_t size,
-                                              void *message)
+static bool inputs_channel_handle_migrate_data(RedChannelClient *rcc,
+                                               uint32_t size,
+                                               void *message)
 {
     InputsChannelClient *icc = INPUTS_CHANNEL_CLIENT(rcc);
     InputsChannel *inputs = INPUTS_CHANNEL(red_channel_client_get_channel(rcc));
diff --git a/server/main-channel-client.c b/server/main-channel-client.c
index 23457d3..8d3d9a4 100644
--- a/server/main-channel-client.c
+++ b/server/main-channel-client.c
@@ -260,7 +260,7 @@ static void main_channel_client_init(MainChannelClient *self)
     self->priv->bitrate_per_sec = ~0;
 }
 
-static int main_channel_client_push_ping(MainChannelClient *mcc, int size);
+static bool main_channel_client_push_ping(MainChannelClient *mcc, int size);
 
 static void main_notify_item_free(RedPipeItem *base)
 {
@@ -308,7 +308,7 @@ static RedPipeItem *red_ping_item_new(int size)
     return &item->base;
 }
 
-static int main_channel_client_push_ping(MainChannelClient *mcc, int size)
+static bool main_channel_client_push_ping(MainChannelClient *mcc, int size)
 {
     RedPipeItem *item;
 
diff --git a/server/main-channel.c b/server/main-channel.c
index ffbce4a..be4f758 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -118,8 +118,8 @@ static void main_channel_push_migrate_data_item(MainChannel *main_chan)
     red_channel_pipes_add_type(RED_CHANNEL(main_chan), RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_DATA);
 }
 
-static int main_channel_handle_migrate_data(RedChannelClient *rcc,
-    uint32_t size, void *message)
+static bool main_channel_handle_migrate_data(RedChannelClient *rcc,
+                                             uint32_t size, void *message)
 {
     RedChannel *channel = red_channel_client_get_channel(rcc);
     MainChannelClient *mcc = MAIN_CHANNEL_CLIENT(rcc);
@@ -174,8 +174,8 @@ void main_channel_migrate_switch(MainChannel *main_chan, RedsMigSpice *mig_targe
     red_channel_pipes_add_type(RED_CHANNEL(main_chan), RED_PIPE_ITEM_TYPE_MAIN_MIGRATE_SWITCH_HOST);
 }
 
-static int main_channel_handle_message(RedChannelClient *rcc, uint16_t type,
-                                       uint32_t size, void *message)
+static bool main_channel_handle_message(RedChannelClient *rcc, uint16_t type,
+                                        uint32_t size, void *message)
 {
     RedChannel *channel = red_channel_client_get_channel(rcc);
     MainChannel *main_chan = MAIN_CHANNEL(channel);
@@ -243,7 +243,7 @@ static int main_channel_handle_message(RedChannelClient *rcc, uint16_t type,
     return TRUE;
 }
 
-static int main_channel_handle_migrate_flush_mark(RedChannelClient *rcc)
+static bool main_channel_handle_migrate_flush_mark(RedChannelClient *rcc)
 {
     RedChannel *channel = red_channel_client_get_channel(rcc);
     spice_debug(NULL);
diff --git a/server/mjpeg-encoder.c b/server/mjpeg-encoder.c
index 3578a5a..92801f1 100644
--- a/server/mjpeg-encoder.c
+++ b/server/mjpeg-encoder.c
@@ -896,8 +896,8 @@ static inline uint8_t *get_image_line(SpiceChunks *chunks, size_t *offset,
     return ret;
 }
 
-static int encode_frame(MJpegEncoder *encoder, const SpiceRect *src,
-                        const SpiceBitmap *image, int top_down)
+static bool encode_frame(MJpegEncoder *encoder, const SpiceRect *src,
+                         const SpiceBitmap *image, int top_down)
 {
     SpiceChunks *chunks;
     uint32_t image_stride;
diff --git a/server/pixmap-cache.c b/server/pixmap-cache.c
index 5a5eba7..f8b8a8a 100644
--- a/server/pixmap-cache.c
+++ b/server/pixmap-cache.c
@@ -57,7 +57,7 @@ void pixmap_cache_clear(PixmapCache *cache)
     cache->items = 0;
 }
 
-int pixmap_cache_freeze(PixmapCache *cache)
+bool pixmap_cache_freeze(PixmapCache *cache)
 {
     pthread_mutex_lock(&cache->lock);
 
diff --git a/server/pixmap-cache.h b/server/pixmap-cache.h
index dbcdcb4..f6e58e0 100644
--- a/server/pixmap-cache.h
+++ b/server/pixmap-cache.h
@@ -68,6 +68,6 @@ PixmapCache *pixmap_cache_get(RedClient *client, uint8_t id, int64_t size);
 void         pixmap_cache_unref(PixmapCache *cache);
 void         pixmap_cache_clear(PixmapCache *cache);
 int          pixmap_cache_unlocked_set_lossy(PixmapCache *cache, uint64_t id, int lossy);
-int          pixmap_cache_freeze(PixmapCache *cache);
+bool         pixmap_cache_freeze(PixmapCache *cache);
 
 #endif /* _PIXMAP_CACHE_H */
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 807a61f..63877ab 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -1014,7 +1014,7 @@ void red_channel_client_semi_seamless_migration_complete(RedChannelClient *rcc)
     }
 }
 
-int red_channel_client_is_waiting_for_migrate_data(RedChannelClient *rcc)
+bool red_channel_client_is_waiting_for_migrate_data(RedChannelClient *rcc)
 {
     return rcc->priv->wait_migrate_data;
 }
@@ -1446,8 +1446,8 @@ static void red_channel_client_handle_migrate_data(RedChannelClient *rcc,
 }
 
 
-int red_channel_client_handle_message(RedChannelClient *rcc, uint16_t type,
-                                      uint32_t size, void *message)
+bool red_channel_client_handle_message(RedChannelClient *rcc, uint16_t type,
+                                       uint32_t size, void *message)
 {
     switch (type) {
     case SPICE_MSGC_ACK_SYNC:
@@ -1775,9 +1775,9 @@ static void marker_pipe_item_free(RedPipeItem *base)
 }
 
 /* TODO: more evil sync stuff. anything with the word wait in it's name. */
-int red_channel_client_wait_pipe_item_sent(RedChannelClient *rcc,
-                                           GList *item_pos,
-                                           int64_t timeout)
+bool red_channel_client_wait_pipe_item_sent(RedChannelClient *rcc,
+                                            GList *item_pos,
+                                            int64_t timeout)
 {
     uint64_t end_time;
     gboolean item_in_pipe;
@@ -1823,8 +1823,8 @@ int red_channel_client_wait_pipe_item_sent(RedChannelClient *rcc,
     }
 }
 
-int red_channel_client_wait_outgoing_item(RedChannelClient *rcc,
-                                          int64_t timeout)
+bool red_channel_client_wait_outgoing_item(RedChannelClient *rcc,
+                                           int64_t timeout)
 {
     uint64_t end_time;
     int blocked;
diff --git a/server/red-channel-client.h b/server/red-channel-client.h
index 397216d..92ceaad 100644
--- a/server/red-channel-client.h
+++ b/server/red-channel-client.h
@@ -54,7 +54,7 @@ RedChannelClient *red_channel_client_create(RedChannel *channel,
 
 gboolean red_channel_client_is_connected(RedChannelClient *rcc);
 void red_channel_client_default_migrate(RedChannelClient *rcc);
-int red_channel_client_is_waiting_for_migrate_data(RedChannelClient *rcc);
+bool red_channel_client_is_waiting_for_migrate_data(RedChannelClient *rcc);
 void red_channel_client_destroy(RedChannelClient *rcc);
 int red_channel_client_test_remote_common_cap(RedChannelClient *rcc, uint32_t cap);
 int red_channel_client_test_remote_cap(RedChannelClient *rcc, uint32_t cap);
@@ -63,8 +63,8 @@ int red_channel_client_test_remote_cap(RedChannelClient *rcc, uint32_t cap);
  * It should be followed by some way to guarantee a disconnection. */
 void red_channel_client_shutdown(RedChannelClient *rcc);
 /* handles general channel msgs from the client */
-int red_channel_client_handle_message(RedChannelClient *rcc, uint16_t type,
-                                      uint32_t size, void *message);
+bool red_channel_client_handle_message(RedChannelClient *rcc, uint16_t type,
+                                       uint32_t size, void *message);
 /* when preparing send_data: should call init and then use marshaller */
 void red_channel_client_init_send_data(RedChannelClient *rcc, uint16_t msg_type);
 
@@ -142,11 +142,11 @@ void red_channel_client_set_header_sub_list(RedChannelClient *rcc, uint32_t sub_
  * Return: TRUE if waiting succeeded. FALSE if timeout expired.
  */
 
-int red_channel_client_wait_pipe_item_sent(RedChannelClient *rcc,
-                                           GList *item_pos,
+bool red_channel_client_wait_pipe_item_sent(RedChannelClient *rcc,
+                                            GList *item_pos,
+                                            int64_t timeout);
+bool red_channel_client_wait_outgoing_item(RedChannelClient *rcc,
                                            int64_t timeout);
-int red_channel_client_wait_outgoing_item(RedChannelClient *rcc,
-                                          int64_t timeout);
 void red_channel_client_disconnect_if_pending_send(RedChannelClient *rcc);
 
 RedChannel* red_channel_client_get_channel(RedChannelClient *rcc);
diff --git a/server/red-channel.c b/server/red-channel.c
index 8ae6ece..ecdcc11 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -314,7 +314,7 @@ void red_channel_add_client(RedChannel *channel, RedChannelClient *rcc)
     channel->priv->clients = g_list_prepend(channel->priv->clients, rcc);
 }
 
-int red_channel_test_remote_common_cap(RedChannel *channel, uint32_t cap)
+bool red_channel_test_remote_common_cap(RedChannel *channel, uint32_t cap)
 {
     GListIter iter;
     RedChannelClient *rcc;
@@ -327,7 +327,7 @@ int red_channel_test_remote_common_cap(RedChannel *channel, uint32_t cap)
     return TRUE;
 }
 
-int red_channel_test_remote_cap(RedChannel *channel, uint32_t cap)
+bool red_channel_test_remote_cap(RedChannel *channel, uint32_t cap)
 {
     GListIter iter;
     RedChannelClient *rcc;
@@ -340,7 +340,7 @@ int red_channel_test_remote_cap(RedChannel *channel, uint32_t cap)
     return TRUE;
 }
 
-int red_channel_is_waiting_for_migrate_data(RedChannel *channel)
+bool red_channel_is_waiting_for_migrate_data(RedChannel *channel)
 {
     RedChannelClient *rcc;
     guint n_clients = g_list_length(channel->priv->clients);
@@ -522,7 +522,7 @@ guint red_channel_get_n_clients(RedChannel *channel)
     return g_list_length(channel->priv->clients);
 }
 
-int red_channel_all_blocked(RedChannel *channel)
+bool red_channel_all_blocked(RedChannel *channel)
 {
     GListIter iter;
     RedChannelClient *rcc;
@@ -538,7 +538,7 @@ int red_channel_all_blocked(RedChannel *channel)
     return TRUE;
 }
 
-int red_channel_any_blocked(RedChannel *channel)
+bool red_channel_any_blocked(RedChannel *channel)
 {
     GListIter iter;
     RedChannelClient *rcc;
@@ -551,7 +551,7 @@ int red_channel_any_blocked(RedChannel *channel)
     return FALSE;
 }
 
-int red_channel_no_item_being_sent(RedChannel *channel)
+bool red_channel_no_item_being_sent(RedChannel *channel)
 {
     GListIter iter;
     RedChannelClient *rcc;
@@ -665,8 +665,8 @@ uint32_t red_channel_sum_pipes_size(RedChannel *channel)
     return sum;
 }
 
-int red_channel_wait_all_sent(RedChannel *channel,
-                              int64_t timeout)
+bool red_channel_wait_all_sent(RedChannel *channel,
+                               int64_t timeout)
 {
     uint64_t end_time;
     uint32_t max_pipe_size;
@@ -709,7 +709,7 @@ SpiceCoreInterfaceInternal* red_channel_get_core_interface(RedChannel *channel)
     return channel->priv->core;
 }
 
-int red_channel_config_socket(RedChannel *self, RedChannelClient *rcc)
+bool red_channel_config_socket(RedChannel *self, RedChannelClient *rcc)
 {
     RedChannelClass *klass = RED_CHANNEL_GET_CLASS(self);
 
diff --git a/server/red-channel.h b/server/red-channel.h
index 44282f6..59859ea 100644
--- a/server/red-channel.h
+++ b/server/red-channel.h
@@ -43,15 +43,15 @@ typedef struct RedChannelClient RedChannelClient;
 typedef struct RedClient RedClient;
 typedef struct MainChannelClient MainChannelClient;
 
-typedef int (*channel_handle_message_proc)(RedChannelClient *rcc, uint16_t type,
-                                           uint32_t size, void *msg);
+typedef bool (*channel_handle_message_proc)(RedChannelClient *rcc, uint16_t type,
+                                            uint32_t size, void *msg);
 typedef void (*channel_disconnect_proc)(RedChannelClient *rcc);
-typedef int (*channel_configure_socket_proc)(RedChannelClient *rcc);
+typedef bool (*channel_configure_socket_proc)(RedChannelClient *rcc);
 typedef void (*channel_send_pipe_item_proc)(RedChannelClient *rcc, RedPipeItem *item);
 
-typedef int (*channel_handle_migrate_flush_mark_proc)(RedChannelClient *base);
-typedef int (*channel_handle_migrate_data_proc)(RedChannelClient *base,
-                                                uint32_t size, void *message);
+typedef bool (*channel_handle_migrate_flush_mark_proc)(RedChannelClient *base);
+typedef bool (*channel_handle_migrate_data_proc)(RedChannelClient *base,
+                                                 uint32_t size, void *message);
 typedef uint64_t (*channel_handle_migrate_data_get_serial_proc)(RedChannelClient *base,
                                             uint32_t size, void *message);
 
@@ -146,7 +146,7 @@ int red_channel_is_connected(RedChannel *channel);
 /* seamless migration is supported for only one client. This routine
  * checks if the only channel client associated with channel is
  * waiting for migration data */
-int red_channel_is_waiting_for_migrate_data(RedChannel *channel);
+bool red_channel_is_waiting_for_migrate_data(RedChannel *channel);
 
 /*
  * the disconnect callback is called from the channel's thread,
@@ -158,8 +158,8 @@ int red_channel_is_waiting_for_migrate_data(RedChannel *channel);
 void red_channel_destroy(RedChannel *channel);
 
 /* return true if all the channel clients support the cap */
-int red_channel_test_remote_common_cap(RedChannel *channel, uint32_t cap);
-int red_channel_test_remote_cap(RedChannel *channel, uint32_t cap);
+bool red_channel_test_remote_common_cap(RedChannel *channel, uint32_t cap);
+bool red_channel_test_remote_cap(RedChannel *channel, uint32_t cap);
 
 /* should be called when a new channel is ready to send messages */
 void red_channel_init_outgoing_messages_window(RedChannel *channel);
@@ -177,12 +177,12 @@ void red_channel_pipes_add_type(RedChannel *channel, int pipe_item_type);
 void red_channel_pipes_add_empty_msg(RedChannel *channel, int msg_type);
 
 /* return TRUE if all of the connected clients to this channel are blocked */
-int red_channel_all_blocked(RedChannel *channel);
+bool red_channel_all_blocked(RedChannel *channel);
 
 /* return TRUE if any of the connected clients to this channel are blocked */
-int red_channel_any_blocked(RedChannel *channel);
+bool red_channel_any_blocked(RedChannel *channel);
 
-int red_channel_no_item_being_sent(RedChannel *channel);
+bool red_channel_no_item_being_sent(RedChannel *channel);
 
 // TODO: unstaticed for display/cursor channels. they do some specific pushes not through
 // adding elements or on events. but not sure if this is actually required (only result
@@ -224,7 +224,7 @@ struct RedsState* red_channel_get_server(RedChannel *channel);
 SpiceCoreInterfaceInternal* red_channel_get_core_interface(RedChannel *channel);
 
 /* channel callback function */
-int red_channel_config_socket(RedChannel *self, RedChannelClient *rcc);
+bool red_channel_config_socket(RedChannel *self, RedChannelClient *rcc);
 void red_channel_on_disconnect(RedChannel *self, RedChannelClient *rcc);
 void red_channel_send_item(RedChannel *self, RedChannelClient *rcc, RedPipeItem *item);
 void red_channel_reset_thread_id(RedChannel *self);
@@ -240,8 +240,8 @@ const RedChannelCapabilities* red_channel_get_local_capabilities(RedChannel *sel
  * Return: TRUE if waiting succeeded. FALSE if timeout expired.
  */
 
-int red_channel_wait_all_sent(RedChannel *channel,
-                              int64_t timeout);
+bool red_channel_wait_all_sent(RedChannel *channel,
+                               int64_t timeout);
 
 /* wrappers for client callbacks */
 void red_channel_migrate_client(RedChannel *channel, RedChannelClient *rcc);
diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c
index d0d7d6d..a3c897d 100644
--- a/server/red-parse-qxl.c
+++ b/server/red-parse-qxl.c
@@ -429,7 +429,7 @@ static const char *bitmap_format_to_string(int format)
 static const unsigned int MAP_BITMAP_FMT_TO_BITS_PER_PIXEL[] =
     {0, 1, 1, 4, 4, 8, 16, 24, 32, 32, 8};
 
-static int bitmap_consistent(SpiceBitmap *bitmap)
+static bool bitmap_consistent(SpiceBitmap *bitmap)
 {
     unsigned int bpp;
 
diff --git a/server/red-worker.c b/server/red-worker.c
index c88034b..4876143 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -982,7 +982,7 @@ static void handle_dev_close(void *opaque, void *payload)
     g_main_loop_quit(worker->loop);
 }
 
-static int loadvm_command(RedWorker *worker, QXLCommandExt *ext)
+static bool loadvm_command(RedWorker *worker, QXLCommandExt *ext)
 {
     switch (ext->cmd.type) {
     case QXL_CMD_CURSOR:
diff --git a/server/reds-stream.c b/server/reds-stream.c
index 910385b..096ed43 100644
--- a/server/reds-stream.c
+++ b/server/reds-stream.c
@@ -238,7 +238,7 @@ int reds_stream_get_family(const RedsStream *s)
     return s->priv->info->laddr_ext.ss_family;
 }
 
-int reds_stream_is_plain_unix(const RedsStream *s)
+bool reds_stream_is_plain_unix(const RedsStream *s)
 {
     spice_return_val_if_fail(s != NULL, FALSE);
 
diff --git a/server/reds-stream.h b/server/reds-stream.h
index b6aa338..d5bd682 100644
--- a/server/reds-stream.h
+++ b/server/reds-stream.h
@@ -71,7 +71,7 @@ bool reds_stream_is_ssl(RedsStream *stream);
 RedsStreamSslStatus reds_stream_ssl_accept(RedsStream *stream);
 int reds_stream_enable_ssl(RedsStream *stream, SSL_CTX *ctx);
 int reds_stream_get_family(const RedsStream *stream);
-int reds_stream_is_plain_unix(const RedsStream *stream);
+bool reds_stream_is_plain_unix(const RedsStream *stream);
 int reds_stream_send_msgfd(RedsStream *stream, int fd);
 
 typedef enum {
diff --git a/server/reds.c b/server/reds.c
index 30d6372..a165a9b 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -916,7 +916,7 @@ SPICE_GNUC_VISIBLE int spice_server_get_num_clients(SpiceServer *reds)
     return reds_get_n_clients(reds);
 }
 
-static int channel_supports_multiple_clients(RedChannel *channel)
+static bool channel_supports_multiple_clients(RedChannel *channel)
 {
     uint32_t type;
     g_object_get(channel, "channel-type", &type, NULL);
@@ -1379,8 +1379,8 @@ static int reds_agent_state_restore(RedsState *reds, SpiceMigrateDataMain *mig_d
  * attached only after the vm is started. It might be attached before or after
  * the migration data has reached the server.
  */
-int reds_handle_migrate_data(RedsState *reds, MainChannelClient *mcc,
-                             SpiceMigrateDataMain *mig_data, uint32_t size)
+bool reds_handle_migrate_data(RedsState *reds, MainChannelClient *mcc,
+                              SpiceMigrateDataMain *mig_data, uint32_t size)
 {
     RedCharDeviceVDIPort *agent_dev = reds->agent_dev;
 
@@ -1456,7 +1456,7 @@ static bool red_link_info_test_capability(const RedLinkInfo *link, uint32_t cap)
 }
 
 
-static int reds_send_link_ack(RedsState *reds, RedLinkInfo *link)
+static bool reds_send_link_ack(RedsState *reds, RedLinkInfo *link)
 {
     struct {
         SpiceLinkHeader header;
@@ -1652,7 +1652,7 @@ static void reds_mig_target_client_disconnect_all(RedsState *reds)
     }
 }
 
-static int reds_find_client(RedsState *reds, RedClient *client)
+static bool reds_find_client(RedsState *reds, RedClient *client)
 {
     GListIter iter;
     RedClient *list_client;
@@ -1828,7 +1828,7 @@ static void reds_channel_do_link(RedChannel *channel, RedClient *client,
  * not lose any data, we activate the target channels before
  * migration completes, as soon as we receive SPICE_MSGC_MAIN_MIGRATE_DST_DO_SEAMLESS
  */
-static int reds_link_mig_target_channels(RedsState *reds, RedClient *client)
+static bool reds_link_mig_target_channels(RedsState *reds, RedClient *client)
 {
     RedsMigTargetClient *mig_client;
     GList *item;
diff --git a/server/reds.h b/server/reds.h
index 2748102..8a1fdfa 100644
--- a/server/reds.h
+++ b/server/reds.h
@@ -82,8 +82,8 @@ void reds_release_agent_data_buffer(RedsState *reds, uint8_t *buf);
 void reds_on_main_agent_data(RedsState *reds, MainChannelClient *mcc, void *message, size_t size);
 void reds_on_main_migrate_connected(RedsState *reds, int seamless); //should be called when all the clients
                                                    // are connected to the target
-int reds_handle_migrate_data(RedsState *recs, MainChannelClient *mcc,
-                             SpiceMigrateDataMain *mig_data, uint32_t size);
+bool reds_handle_migrate_data(RedsState *recs, MainChannelClient *mcc,
+                              SpiceMigrateDataMain *mig_data, uint32_t size);
 void reds_on_main_mouse_mode_request(RedsState *reds, void *message, size_t size);
 /* migration dest side: returns whether it can support seamless migration
  * with the given src migration protocol version */
diff --git a/server/smartcard-channel-client.c b/server/smartcard-channel-client.c
index 1e649cb..bfd05bf 100644
--- a/server/smartcard-channel-client.c
+++ b/server/smartcard-channel-client.c
@@ -283,10 +283,10 @@ static void smartcard_channel_client_write_to_reader(SmartCardChannelClient *scc
 }
 
 
-int smartcard_channel_client_handle_message(RedChannelClient *rcc,
-                                            uint16_t type,
-                                            uint32_t size,
-                                            void *message)
+bool smartcard_channel_client_handle_message(RedChannelClient *rcc,
+                                             uint16_t type,
+                                             uint32_t size,
+                                             void *message)
 {
     uint8_t *msg = message;
     VSCMsgHeader* vheader = message;
@@ -334,9 +334,9 @@ int smartcard_channel_client_handle_message(RedChannelClient *rcc,
     return TRUE;
 }
 
-int smartcard_channel_client_handle_migrate_data(RedChannelClient *rcc,
-                                                 uint32_t size,
-                                                 void *message)
+bool smartcard_channel_client_handle_migrate_data(RedChannelClient *rcc,
+                                                  uint32_t size,
+                                                  void *message)
 {
     SmartCardChannelClient *scc;
     SpiceMigrateDataHeader *header;
@@ -376,7 +376,7 @@ int smartcard_channel_client_handle_migrate_data(RedChannelClient *rcc,
                                                      mig_data);
 }
 
-int smartcard_channel_client_handle_migrate_flush_mark(RedChannelClient *rcc)
+bool smartcard_channel_client_handle_migrate_flush_mark(RedChannelClient *rcc)
 {
     red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_SMARTCARD_MIGRATE_DATA);
     return TRUE;
diff --git a/server/smartcard-channel-client.h b/server/smartcard-channel-client.h
index 6248a98..612f9f8 100644
--- a/server/smartcard-channel-client.h
+++ b/server/smartcard-channel-client.h
@@ -60,7 +60,7 @@ SmartCardChannelClient* smartcard_channel_client_create(RedChannel *channel,
                                                         int monitor_latency,
                                                         RedChannelCapabilities *caps);
 
-int smartcard_channel_client_handle_migrate_flush_mark(RedChannelClient *rcc);
+bool smartcard_channel_client_handle_migrate_flush_mark(RedChannelClient *rcc);
 
 void smartcard_channel_client_on_disconnect(RedChannelClient *rcc);
 
@@ -73,14 +73,14 @@ void smartcard_channel_client_send_error(RedChannelClient *rcc,
                                          SpiceMarshaller *m,
                                          RedPipeItem *item);
 
-int smartcard_channel_client_handle_message(RedChannelClient *rcc,
-                                            uint16_t type,
-                                            uint32_t size,
-                                            void *msg);
+bool smartcard_channel_client_handle_message(RedChannelClient *rcc,
+                                             uint16_t type,
+                                             uint32_t size,
+                                             void *msg);
 
-int smartcard_channel_client_handle_migrate_data(RedChannelClient *rcc,
-                                                 uint32_t size,
-                                                 void *message);
+bool smartcard_channel_client_handle_migrate_data(RedChannelClient *rcc,
+                                                  uint32_t size,
+                                                  void *message);
 
 void smartcard_channel_client_set_char_device(SmartCardChannelClient *scc,
                                               RedCharDeviceSmartcard *device);
diff --git a/server/sound.c b/server/sound.c
index 118f439..d311b0f 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -269,7 +269,7 @@ static void snd_playback_on_message_done(SndChannelClient *client)
     }
 }
 
-static int snd_record_handle_write(RecordChannelClient *record_client, size_t size, void *message)
+static bool snd_record_handle_write(RecordChannelClient *record_client, size_t size, void *message)
 {
     SpiceMsgcRecordPacket *packet;
     uint32_t write_pos;
@@ -314,7 +314,7 @@ static int snd_record_handle_write(RecordChannelClient *record_client, size_t si
     return TRUE;
 }
 
-static int
+static bool
 record_channel_handle_message(RedChannelClient *rcc, uint16_t type, uint32_t size, void *message)
 {
     RecordChannelClient *record_client = RECORD_CHANNEL_CLIENT(rcc);
@@ -357,7 +357,7 @@ record_channel_handle_message(RedChannelClient *rcc, uint16_t type, uint32_t siz
     return TRUE;
 }
 
-static int snd_channel_send_migrate(SndChannelClient *client)
+static bool snd_channel_send_migrate(SndChannelClient *client)
 {
     RedChannelClient *rcc = RED_CHANNEL_CLIENT(client);
     SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
@@ -371,12 +371,12 @@ static int snd_channel_send_migrate(SndChannelClient *client)
     return TRUE;
 }
 
-static int snd_playback_send_migrate(PlaybackChannelClient *client)
+static bool snd_playback_send_migrate(PlaybackChannelClient *client)
 {
     return snd_channel_send_migrate(SND_CHANNEL_CLIENT(client));
 }
 
-static int snd_send_volume(SndChannelClient *client, uint32_t cap, int msg)
+static bool snd_send_volume(SndChannelClient *client, uint32_t cap, int msg)
 {
     SpiceMsgAudioVolume *vol;
     uint8_t c;
@@ -402,13 +402,13 @@ static int snd_send_volume(SndChannelClient *client, uint32_t cap, int msg)
     return TRUE;
 }
 
-static int snd_playback_send_volume(PlaybackChannelClient *playback_client)
+static bool snd_playback_send_volume(PlaybackChannelClient *playback_client)
 {
     return snd_send_volume(SND_CHANNEL_CLIENT(playback_client), SPICE_PLAYBACK_CAP_VOLUME,
                            SPICE_MSG_PLAYBACK_VOLUME);
 }
 
-static int snd_send_mute(SndChannelClient *client, uint32_t cap, int msg)
+static bool snd_send_mute(SndChannelClient *client, uint32_t cap, int msg)
 {
     SpiceMsgAudioMute mute;
     RedChannelClient *rcc = RED_CHANNEL_CLIENT(client);
@@ -428,13 +428,13 @@ static int snd_send_mute(SndChannelClient *client, uint32_t cap, int msg)
     return TRUE;
 }
 
-static int snd_playback_send_mute(PlaybackChannelClient *playback_client)
+static bool snd_playback_send_mute(PlaybackChannelClient *playback_client)
 {
     return snd_send_mute(SND_CHANNEL_CLIENT(playback_client), SPICE_PLAYBACK_CAP_VOLUME,
                          SPICE_MSG_PLAYBACK_MUTE);
 }
 
-static int snd_playback_send_latency(PlaybackChannelClient *playback_client)
+static bool snd_playback_send_latency(PlaybackChannelClient *playback_client)
 {
     RedChannelClient *rcc = RED_CHANNEL_CLIENT(playback_client);
     SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
@@ -449,7 +449,7 @@ static int snd_playback_send_latency(PlaybackChannelClient *playback_client)
     return TRUE;
 }
 
-static int snd_playback_send_start(PlaybackChannelClient *playback_client)
+static bool snd_playback_send_start(PlaybackChannelClient *playback_client)
 {
     RedChannelClient *rcc = RED_CHANNEL_CLIENT(playback_client);
     SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
@@ -467,7 +467,7 @@ static int snd_playback_send_start(PlaybackChannelClient *playback_client)
     return TRUE;
 }
 
-static int snd_playback_send_stop(PlaybackChannelClient *playback_client)
+static bool snd_playback_send_stop(PlaybackChannelClient *playback_client)
 {
     RedChannelClient *rcc = RED_CHANNEL_CLIENT(playback_client);
 
@@ -488,7 +488,7 @@ static int snd_playback_send_ctl(PlaybackChannelClient *playback_client)
     }
 }
 
-static int snd_record_send_start(RecordChannelClient *record_client)
+static bool snd_record_send_start(RecordChannelClient *record_client)
 {
     RedChannelClient *rcc = RED_CHANNEL_CLIENT(record_client);
     SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
@@ -506,7 +506,7 @@ static int snd_record_send_start(RecordChannelClient *record_client)
     return TRUE;
 }
 
-static int snd_record_send_stop(RecordChannelClient *record_client)
+static bool snd_record_send_stop(RecordChannelClient *record_client)
 {
     RedChannelClient *rcc = RED_CHANNEL_CLIENT(record_client);
 
@@ -527,19 +527,19 @@ static int snd_record_send_ctl(RecordChannelClient *record_client)
     }
 }
 
-static int snd_record_send_volume(RecordChannelClient *record_client)
+static bool snd_record_send_volume(RecordChannelClient *record_client)
 {
     return snd_send_volume(SND_CHANNEL_CLIENT(record_client), SPICE_RECORD_CAP_VOLUME,
                            SPICE_MSG_RECORD_VOLUME);
 }
 
-static int snd_record_send_mute(RecordChannelClient *record_client)
+static bool snd_record_send_mute(RecordChannelClient *record_client)
 {
     return snd_send_mute(SND_CHANNEL_CLIENT(record_client), SPICE_RECORD_CAP_VOLUME,
                          SPICE_MSG_RECORD_MUTE);
 }
 
-static int snd_record_send_migrate(RecordChannelClient *record_client)
+static bool snd_record_send_migrate(RecordChannelClient *record_client)
 {
     /* No need for migration data: if recording has started before migration,
      * the client receives RECORD_STOP from the src before the migration completion
@@ -548,7 +548,7 @@ static int snd_record_send_migrate(RecordChannelClient *record_client)
     return snd_channel_send_migrate(SND_CHANNEL_CLIENT(record_client));
 }
 
-static int snd_playback_send_write(PlaybackChannelClient *playback_client)
+static bool snd_playback_send_write(PlaybackChannelClient *playback_client)
 {
     RedChannelClient *rcc = RED_CHANNEL_CLIENT(playback_client);
     SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
@@ -586,7 +586,7 @@ static int snd_playback_send_write(PlaybackChannelClient *playback_client)
     return TRUE;
 }
 
-static int playback_send_mode(PlaybackChannelClient *playback_client)
+static bool playback_send_mode(PlaybackChannelClient *playback_client)
 {
     RedChannelClient *rcc = RED_CHANNEL_CLIENT(playback_client);
     SpiceMarshaller *m = red_channel_client_get_marshaller(rcc);
@@ -732,7 +732,7 @@ static void record_channel_send_item(RedChannelClient *rcc, G_GNUC_UNUSED RedPip
     snd_send(client);
 }
 
-static int snd_channel_config_socket(RedChannelClient *rcc)
+static bool snd_channel_config_socket(RedChannelClient *rcc)
 {
     int delay_val;
 #ifdef SO_PRIORITY
diff --git a/server/spicevmc.c b/server/spicevmc.c
index f61ffc9..cd22a2c 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -512,14 +512,14 @@ static void spicevmc_red_channel_client_on_disconnect(RedChannelClient *rcc)
     }
 }
 
-static int spicevmc_channel_client_handle_migrate_flush_mark(RedChannelClient *rcc)
+static bool spicevmc_channel_client_handle_migrate_flush_mark(RedChannelClient *rcc)
 {
     red_channel_client_pipe_add_type(rcc, RED_PIPE_ITEM_TYPE_SPICEVMC_MIGRATE_DATA);
     return TRUE;
 }
 
-static int spicevmc_channel_client_handle_migrate_data(RedChannelClient *rcc,
-                                                       uint32_t size, void *message)
+static bool spicevmc_channel_client_handle_migrate_data(RedChannelClient *rcc,
+                                                            uint32_t size, void *message)
 {
     SpiceMigrateDataHeader *header;
     SpiceMigrateDataSpiceVmc *mig_data;
@@ -540,8 +540,8 @@ static int spicevmc_channel_client_handle_migrate_data(RedChannelClient *rcc,
     return red_char_device_restore(channel->chardev, &mig_data->base);
 }
 
-static int handle_compressed_msg(RedVmcChannel *channel, RedChannelClient *rcc,
-                                 SpiceMsgCompressedData *compressed_data_msg)
+static bool handle_compressed_msg(RedVmcChannel *channel, RedChannelClient *rcc,
+                                      SpiceMsgCompressedData *compressed_data_msg)
 {
     /* NOTE: *decompressed is free by the char-device */
     int decompressed_size;
@@ -582,10 +582,10 @@ static int handle_compressed_msg(RedVmcChannel *channel, RedChannelClient *rcc,
     return TRUE;
 }
 
-static int spicevmc_red_channel_client_handle_message(RedChannelClient *rcc,
-                                                      uint16_t type,
-                                                      uint32_t size,
-                                                      void *msg)
+static bool spicevmc_red_channel_client_handle_message(RedChannelClient *rcc,
+                                                           uint16_t type,
+                                                           uint32_t size,
+                                                           void *msg)
 {
     /* NOTE: *msg free by free() (when cb to spicevmc_red_channel_release_msg_rcv_buf
      * with the compressed msg type) */
diff --git a/server/stream.c b/server/stream.c
index 6e753a9..04af050 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -429,12 +429,12 @@ static void display_channel_create_stream(DisplayChannel *display, Drawable *dra
 }
 
 // returns whether a stream was created
-static int stream_add_frame(DisplayChannel *display,
-                            Drawable *frame_drawable,
-                            red_time_t first_frame_time,
-                            int frames_count,
-                            int gradual_frames_count,
-                            int last_gradual_frame)
+static bool stream_add_frame(DisplayChannel *display,
+                             Drawable *frame_drawable,
+                             red_time_t first_frame_time,
+                             int frames_count,
+                             int gradual_frames_count,
+                             int last_gradual_frame)
 {
     update_copy_graduality(display, frame_drawable);
     frame_drawable->first_frame_time = first_frame_time;
diff --git a/server/tree.c b/server/tree.c
index ea11000..55ebf0c 100644
--- a/server/tree.c
+++ b/server/tree.c
@@ -273,7 +273,7 @@ Ring *tree_item_container_items(TreeItem *item, Ring *ring)
     return (item->container) ? &item->container->items : ring;
 }
 
-int tree_item_contained_by(TreeItem *item, Ring *ring)
+bool tree_item_contained_by(TreeItem *item, Ring *ring)
 {
     spice_assert(item && ring);
     do {
diff --git a/server/tree.h b/server/tree.h
index 35b78ab..6be29e8 100644
--- a/server/tree.h
+++ b/server/tree.h
@@ -81,7 +81,7 @@ static inline int is_opaque_item(TreeItem *item)
 
 void       tree_item_dump                           (TreeItem *item);
 Shadow*    tree_item_find_shadow                    (TreeItem *item);
-int        tree_item_contained_by                   (TreeItem *item, Ring *ring);
+bool       tree_item_contained_by                   (TreeItem *item, Ring *ring);
 Ring*      tree_item_container_items                (TreeItem *item, Ring *ring);
 
 void       draw_item_remove_shadow                  (DrawItem *item);
-- 
2.9.3



More information about the Spice-devel mailing list