mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-26 20:07:51 +02: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
@@ -5160,12 +5160,12 @@ class CodeGenerator:
|
||||
)
|
||||
for i in self.ifaces:
|
||||
self.outfile.write(
|
||||
' g_hash_table_insert (lookup_hash, (gpointer) "%s", GSIZE_TO_POINTER (%sTYPE_%s_PROXY));\n'
|
||||
' g_hash_table_insert (lookup_hash, (gpointer) "%s", (gpointer) (guintptr) (%sTYPE_%s_PROXY));\n'
|
||||
% (i.name, i.ns_upper, i.name_upper)
|
||||
)
|
||||
self.outfile.write(" g_once_init_leave (&once_init_value, 1);\n" " }\n")
|
||||
self.outfile.write(
|
||||
" ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));\n"
|
||||
" ret = (GType) (guintptr) (g_hash_table_lookup (lookup_hash, interface_name));\n"
|
||||
" if (ret == (GType) 0)\n"
|
||||
" ret = G_TYPE_DBUS_PROXY;\n"
|
||||
)
|
||||
|
Reference in New Issue
Block a user