Merge branch 'wip/smcv/css-endian' into 'main'

CSS: Fix test failures on 64-bit big-endian machines

See merge request GNOME/gtk!7672
This commit is contained in:
Matthias Clasen
2024-08-31 11:04:45 +00:00
2 changed files with 10 additions and 5 deletions

View File

@@ -1660,16 +1660,18 @@ compare_properties (gconstpointer a, gconstpointer b, gpointer style)
_gtk_style_property_get_name (GTK_STYLE_PROPERTY (styles[*ub].property)));
}
/* This is looking into a GPtrArray where each "pointer" is actually
* GINT_TO_POINTER (id), so a and b are pointers to pointer-sized quantities */
static int
compare_custom_properties (gconstpointer a, gconstpointer b, gpointer user_data)
{
GtkCssCustomPropertyPool *pool = user_data;
int id1 = GPOINTER_TO_INT (*((const int *) a));
int id2 = GPOINTER_TO_INT (*((const int *) b));
const void * const *ap = a;
const void * const *bp = b;
const char *name1, *name2;
name1 = gtk_css_custom_property_pool_get_name (pool, id1);
name2 = gtk_css_custom_property_pool_get_name (pool, id2);
name1 = gtk_css_custom_property_pool_get_name (pool, GPOINTER_TO_INT (*ap));
name2 = gtk_css_custom_property_pool_get_name (pool, GPOINTER_TO_INT (*bp));
return strcmp (name1, name2);
}

View File

@@ -309,7 +309,10 @@ gtk_css_variable_set_list_ids (GtkCssVariableSet *self)
g_hash_table_iter_init (&iter, all_ids);
while (g_hash_table_iter_next (&iter, &id, NULL))
g_array_append_val (ret, id);
{
int value = GPOINTER_TO_INT (id);
g_array_append_val (ret, value);
}
g_hash_table_unref (all_ids);