GType: introduce GTYPE_TO_POINTER/GPOINTER_TO_TYPE

On CHERI-enabled systems we use uintptr_t as the underlying storage for
GType and therefore casting to gsize strips the upper bits from a pointer.
Fix this by casting via uintptr_t instead and introduce a new set of
macros to convert between GType and pointers.
This commit is contained in:
Alex Richardson
2022-12-14 23:55:19 +00:00
committed by Philip Withnall
parent 4b111f1650
commit d0e03f0930
9 changed files with 53 additions and 16 deletions

View File

@@ -1234,7 +1234,7 @@ g_param_spec_pool_list_owned (GParamSpecPool *pool,
g_mutex_lock (&pool->mutex);
data[0] = NULL;
data[1] = (gpointer) owner_type;
data[1] = GTYPE_TO_POINTER (owner_type);
g_hash_table_foreach (pool->hash_table, pool_list, &data);
g_mutex_unlock (&pool->mutex);
@@ -1373,7 +1373,7 @@ g_param_spec_pool_list (GParamSpecPool *pool,
d = g_type_depth (owner_type);
slists = g_new0 (GSList*, d);
data[0] = slists;
data[1] = (gpointer) owner_type;
data[1] = GTYPE_TO_POINTER (owner_type);
data[2] = pool->hash_table;
data[3] = &n_pspecs;