[Spice-devel] bool or gboolean

Christophe Fergeau cfergeau at redhat.com
Wed Feb 15 17:01:15 UTC 2017


On Wed, Feb 15, 2017 at 11:39:32AM -0500, Frediano Ziglio wrote:
> Hi,
>   question was raised recently on the ML and IRC.
> 
> Some time ago we decided to use gboolean but some of us would like
> to discuss again.

So... As said a few times, I would have preferred to wait for a bit to
have that discussion as I have a concrete patch which it would go well
with...

This started with Jonathon's comment in
https://lists.freedesktop.org/archives/spice-devel/2017-February/035579.html
where I returned -1 from a function which should be returning a boolean.
The function was declared as 'int foo()', so it was not clear from its
prototype that it's returning a bool, and I had totally missed that.
So I decided to go ahead and grep'ed for 'return (TRUE|FALSE)' over the
code base, and make sure all these functions don't return int.


I started with 'gboolean', but then realized that using 'bool', the
compiler would be able to help me.

static int foo(void);

static gboolean foo(void)
{ }

does not raise warnings while

static int foo(void);

static bool foo(void)
{ }

does raise a warning, and it's the same with function pointers (see
attached bool.c file for a test case)


So after realizing that, I'd favour bool over gboolean, at least in
function prototypes, as it gives us slightly stronger typing.

Regarding TRUE vs true, I don't really care, I'd stick with TRUE as that
means less churn on the codebase, but I agree it's not really nice.

In addition to the testcase, I'm attaching that s/int/bool patch even
though this version is not going to apply on git master, and is not
tested.

Christophe
-------------- next part --------------
From db86accb52c56067fdf2707d53c7ecb4570db446 Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cfergeau at redhat.com>
Date: Mon, 13 Feb 2017 14:55:08 +0100
Subject: [spice-server] s/int/bool

---
 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                      | 40 +++++++++++++++++++--------------------
 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       | 20 ++++++++++----------
 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, 229 insertions(+), 229 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 a076111..2e2ce53 100644
--- a/server/common-graphics-channel.c
+++ b/server/common-graphics-channel.c
@@ -109,7 +109,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 4d88148..7467643 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 4181b6d..6720e66 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -190,7 +190,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;
@@ -209,8 +209,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;
@@ -538,7 +538,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;
@@ -950,8 +950,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;
@@ -1016,7 +1016,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));
@@ -1039,8 +1039,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;
 
@@ -1084,8 +1084,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:
@@ -1105,7 +1105,7 @@ static int dcc_handle_preferred_compression(DisplayChannelClient *dcc,
     return TRUE;
 }
 
-static int dcc_handle_gl_draw_done(DisplayChannelClient *dcc)
+static bool dcc_handle_gl_draw_done(DisplayChannelClient *dcc)
 {
     DisplayChannel *display = DCC_TO_DC(dcc);
 
@@ -1121,7 +1121,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);
 
@@ -1149,7 +1149,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. */
@@ -1161,8 +1161,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;
 
@@ -1176,8 +1176,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;
 
@@ -1201,7 +1201,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;
@@ -1309,7 +1309,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 ebdbb8d..e390918 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -143,10 +143,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,
@@ -168,7 +168,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);
@@ -179,10 +179,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);
@@ -202,7 +202,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);
 
 G_END_DECLS
diff --git a/server/display-channel.c b/server/display-channel.c
index 51e58f6..1c2830c 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -469,7 +469,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;
@@ -679,7 +679,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
@@ -722,7 +722,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;
@@ -1001,7 +1001,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;
 
@@ -1039,7 +1039,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;
@@ -1188,7 +1188,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;
@@ -1946,7 +1946,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);
 
@@ -1963,7 +1963,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 0d57260..a3761a4 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 b4e3e45..3a07ba9 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -274,8 +274,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);
@@ -534,15 +534,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 16eb3ec..1bbf846 100644
--- a/server/main-channel-client.c
+++ b/server/main-channel-client.c
@@ -224,7 +224,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)
 {
@@ -272,7 +272,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 ceb4ef6..041da1bf 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -123,8 +123,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);
@@ -179,8 +179,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);
@@ -277,7 +277,7 @@ static void main_channel_release_msg_rcv_buf(RedChannelClient *rcc,
     }
 }
 
-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 e5fa82a..af8b0a3 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -1071,7 +1071,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;
 }
@@ -1235,8 +1235,8 @@ static uint8_t *red_channel_client_parse(RedChannelClient *rcc, uint8_t *message
     return parsed_message;
 }
 
-static int red_channel_client_handle_message(RedChannelClient *rcc, uint16_t type,
-                                             uint32_t size, void *message)
+static bool red_channel_client_handle_message(RedChannelClient *rcc, uint16_t type,
+                                              uint32_t size, void *message)
 {
     RedChannel *channel = red_channel_client_get_channel(rcc);
     RedChannelClass *klass = RED_CHANNEL_GET_CLASS(channel);
@@ -1504,8 +1504,8 @@ static void red_channel_client_handle_migrate_data(RedChannelClient *rcc,
 }
 
 
-int red_channel_client_default_handle_message(RedChannelClient *rcc, uint16_t type,
-                                              uint32_t size, void *message)
+bool red_channel_client_default_handle_message(RedChannelClient *rcc, uint16_t type,
+                                               uint32_t size, void *message)
 {
     switch (type) {
     case SPICE_MSGC_ACK_SYNC:
@@ -1847,9 +1847,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;
@@ -1895,8 +1895,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 5accfe4..1d1bd0b 100644
--- a/server/red-channel-client.h
+++ b/server/red-channel-client.h
@@ -77,7 +77,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);
@@ -86,8 +86,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_default_handle_message(RedChannelClient *rcc, uint16_t type,
-                                              uint32_t size, void *message);
+bool red_channel_client_default_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);
 
@@ -166,11 +166,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 9ea55c5..a5aca6c 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -332,7 +332,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;
@@ -345,7 +345,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;
@@ -358,7 +358,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);
@@ -536,7 +536,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;
@@ -552,7 +552,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;
@@ -565,7 +565,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;
@@ -680,8 +680,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;
@@ -724,7 +724,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 fe497ae..356bcee 100644
--- a/server/red-channel.h
+++ b/server/red-channel.h
@@ -44,17 +44,17 @@ typedef struct MainChannelClient MainChannelClient;
 
 typedef uint8_t *(*channel_alloc_msg_recv_buf_proc)(RedChannelClient *channel,
                                                     uint16_t type, uint32_t size);
-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_release_msg_recv_buf_proc)(RedChannelClient *channel,
                                                   uint16_t type, uint32_t size, uint8_t *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);
 
@@ -154,7 +154,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,
@@ -166,8 +166,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);
@@ -185,12 +185,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
@@ -232,7 +232,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);
@@ -248,8 +248,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 ecaa13a..bbb1817 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -986,7 +986,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 f1952cc..d3cca1b 100644
--- a/server/reds-stream.c
+++ b/server/reds-stream.c
@@ -239,7 +239,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 83fcfd6..0cbd0c7 100644
--- a/server/reds-stream.h
+++ b/server/reds-stream.h
@@ -72,7 +72,7 @@ RedsStreamSslStatus reds_stream_ssl_accept(RedsStream *stream);
 int reds_stream_enable_ssl(RedsStream *stream, SSL_CTX *ctx);
 void reds_stream_set_info_flag(RedsStream *stream, unsigned int flag);
 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);
 bool reds_stream_set_no_delay(RedsStream *stream, bool no_delay);
 int reds_stream_send_msgfd(RedsStream *stream, int fd);
 
diff --git a/server/reds.c b/server/reds.c
index 87acdfb..c2f70d4 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)
 {
     SpiceLinkHeader header;
     SpiceLinkReply ack;
@@ -1651,7 +1651,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;
@@ -1810,7 +1810,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 28e3444..30ae392 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 cfcda2f..9afcfba 100644
--- a/server/smartcard-channel-client.c
+++ b/server/smartcard-channel-client.c
@@ -292,10 +292,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;
@@ -343,9 +343,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;
@@ -385,7 +385,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 9350d7a..e2aa744 100644
--- a/server/smartcard-channel-client.h
+++ b/server/smartcard-channel-client.h
@@ -70,7 +70,7 @@ void smartcard_channel_client_release_msg_rcv_buf(RedChannelClient *rcc,
                                                   uint32_t size,
                                                   uint8_t *msg);
 
-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);
 
@@ -83,14 +83,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 4b2fc55..849c65d 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -274,7 +274,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;
@@ -319,7 +319,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);
@@ -362,7 +362,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);
@@ -376,12 +376,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;
@@ -407,13 +407,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);
@@ -433,13 +433,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);
@@ -454,7 +454,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);
@@ -472,7 +472,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);
 
@@ -493,7 +493,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);
@@ -511,7 +511,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);
 
@@ -532,19 +532,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
@@ -553,7 +553,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);
@@ -591,7 +591,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);
@@ -737,7 +737,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)
 {
 #ifdef SO_PRIORITY
     int priority;
diff --git a/server/spicevmc.c b/server/spicevmc.c
index e84df8d..fdbcc24 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -472,14 +472,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;
@@ -500,8 +500,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;
@@ -542,10 +542,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 e2cd66e..208f012 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -428,12 +428,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

-------------- next part --------------
#include <glib.h>
#include <stdbool.h>

static bool test_bool(void) { return 0; }
static int test_int(void) { return 0; }
static gboolean test_gboolean(void) { return 0; }

static int wrong_prototype_gboolean(void);
/* No error */
static gboolean wrong_prototype_gboolean(void) { return 0; }

static int wrong_prototype_bool(void);
/* Error, conflicting types */
static bool wrong_prototype_bool(void) { return 0; }

int main(void)
{
    static bool (*vfunc_bool)(void);
    static int (*vfunc_int)(void);

    /* no warning */
    vfunc_bool = test_bool;
    /* -Wincompatible-pointer-types warning */
    vfunc_bool = test_int;
    /* -Wincompatible-pointer-types warning */
    vfunc_bool = test_gboolean;

    /* -Wincompatible-pointer-types warning */
    vfunc_int = test_bool;
    /* no warning */
    vfunc_int = test_int;
    /* no warning */
    vfunc_int = test_gboolean;

    return 0;
}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170215/f9b791af/attachment-0001.sig>


More information about the Spice-devel mailing list