mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-12-08 01:24:49 +01:00
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:
committed by
Philip Withnall
parent
4b111f1650
commit
d0e03f0930
@@ -1208,7 +1208,7 @@ g_value_set_gtype (GValue *value,
|
||||
{
|
||||
g_return_if_fail (G_VALUE_HOLDS_GTYPE (value));
|
||||
|
||||
value->data[0].v_pointer = GSIZE_TO_POINTER (v_gtype);
|
||||
value->data[0].v_pointer = GTYPE_TO_POINTER (v_gtype);
|
||||
|
||||
}
|
||||
|
||||
@@ -1227,7 +1227,7 @@ g_value_get_gtype (const GValue *value)
|
||||
{
|
||||
g_return_val_if_fail (G_VALUE_HOLDS_GTYPE (value), 0);
|
||||
|
||||
return GPOINTER_TO_SIZE (value->data[0].v_pointer);
|
||||
return GPOINTER_TO_TYPE (value->data[0].v_pointer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user