gobject: Cast various inverted bitfield constants to unsigned

This fixes `-Wsign-conversion` warnings, though I’m not sure why the
compiler is emitting them. The signed/unsigned status of flag enum
members is not particularly well defined in the C standard (and even
less well understood by me), so just do what seems necessary to shut the
compiler up.

The benefits of enabling `-Wsign-conversion` across the codebase
hopefully outweighs this noise.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3405
This commit is contained in:
Philip Withnall
2025-04-11 15:08:16 +01:00
parent 70ddc35340
commit 633e49c8d1
6 changed files with 16 additions and 16 deletions

View File

@@ -775,7 +775,7 @@ param_string_validate (GParamSpec *pspec,
{
value->data[0].v_pointer = g_strdup (string);
string = value->data[0].v_pointer;
value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
value->data[1].v_uint &= (unsigned) ~G_VALUE_NOCOPY_CONTENTS;
}
string[0] = sspec->substitutor;
n_changed++;
@@ -789,7 +789,7 @@ param_string_validate (GParamSpec *pspec,
value->data[0].v_pointer = g_strdup (string);
s = (gchar*) value->data[0].v_pointer + (s - string);
string = value->data[0].v_pointer;
value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
value->data[1].v_uint &= (unsigned) ~G_VALUE_NOCOPY_CONTENTS;
}
*s = sspec->substitutor;
n_changed++;
@@ -800,14 +800,14 @@ param_string_validate (GParamSpec *pspec,
if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
g_free (value->data[0].v_pointer);
else
value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
value->data[1].v_uint &= (unsigned) ~G_VALUE_NOCOPY_CONTENTS;
value->data[0].v_pointer = NULL;
n_changed++;
string = value->data[0].v_pointer;
}
if (sspec->ensure_non_null && !string)
{
value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS;
value->data[1].v_uint &= (unsigned) ~G_VALUE_NOCOPY_CONTENTS;
value->data[0].v_pointer = g_strdup ("");
n_changed++;
string = value->data[0].v_pointer;