gobject: Fix several int/unsigned conversions with atomics

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 <pwithnall@gnome.org>

Helps: #3405
This commit is contained in:
Philip Withnall 2025-04-11 15:02:34 +01:00
parent efed9028fa
commit 636bbd1d63
No known key found for this signature in database
GPG Key ID: C5C42CFB268637CA
2 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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;