From 636bbd1d63b1603ce499b85b83b9ec7f0f59661b Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 11 Apr 2025 15:02:34 +0100 Subject: [PATCH] gobject: Fix several int/unsigned conversions with atomics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unfortunately the signatures of our atomic functions alternate between using signed and unsigned integers across different functions, so we can’t just use one type as input. Add some explicit casts to fix harmless `-Wsign-conversion` warnings. Signed-off-by: Philip Withnall Helps: #3405 --- gobject/gobject.c | 6 +++--- gobject/gsignal.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gobject/gobject.c b/gobject/gobject.c index cd4769ec0..f14c5112e 100644 --- a/gobject/gobject.c +++ b/gobject/gobject.c @@ -1657,21 +1657,21 @@ g_object_interface_list_properties (gpointer g_iface, static inline guint object_get_optional_flags (GObject *object) { - return g_atomic_int_get (object_get_optional_flags_p (object)); + return (guint) g_atomic_int_get ((gint *) object_get_optional_flags_p (object)); } static inline void object_set_optional_flags (GObject *object, guint flags) { - g_atomic_int_or (object_get_optional_flags_p (object), flags); + g_atomic_int_or ((gint *) object_get_optional_flags_p (object), (int) flags); } static inline void object_unset_optional_flags (GObject *object, guint flags) { - g_atomic_int_and (object_get_optional_flags_p (object), ~flags); + g_atomic_int_and ((gint *) object_get_optional_flags_p (object), (int) ~flags); } gboolean diff --git a/gobject/gsignal.c b/gobject/gsignal.c index 27484b3a0..914038963 100644 --- a/gobject/gsignal.c +++ b/gobject/gsignal.c @@ -3853,9 +3853,9 @@ signal_emit_unlocked_R (SignalNode *node, if (!(old_flags & G_HOOK_FLAG_IN_CALL)) { - g_atomic_int_compare_and_exchange (&hook->flags, - old_flags | G_HOOK_FLAG_IN_CALL, - old_flags); + g_atomic_int_compare_and_exchange ((gint *) &hook->flags, + (gint) old_flags | G_HOOK_FLAG_IN_CALL, + (gint) old_flags); } hook_returns[i] = !!need_destroy;