gdbus-codegen: improve casting a tiny wee bit

The in commit b79fbc5c3f for fixing
-Wstrict-aliasing warnings was a little too brutal, make it a bit
better.

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
This commit is contained in:
David Zeuthen 2012-07-07 17:10:46 -04:00
parent 53b3175cfa
commit c09bf3e6b9

View File

@ -954,7 +954,7 @@ class CodeGenerator:
self.c.write('GDBusInterfaceInfo *\n' self.c.write('GDBusInterfaceInfo *\n'
'%s_interface_info (void)\n' '%s_interface_info (void)\n'
'{\n' '{\n'
' return (gpointer) &_%s_interface_info;\n' ' return (GDBusInterfaceInfo *) &_%s_interface_info.parent_struct;\n'
'}\n' '}\n'
'\n'%(i.name_lower, i.name_lower)) '\n'%(i.name_lower, i.name_lower))
@ -1651,7 +1651,7 @@ class CodeGenerator:
' g_variant_new ("(ssv)", "%s", info->parent_struct.name, variant),\n' ' g_variant_new ("(ssv)", "%s", info->parent_struct.name, variant),\n'
' G_DBUS_CALL_FLAGS_NONE,\n' ' G_DBUS_CALL_FLAGS_NONE,\n'
' -1,\n' ' -1,\n'
' NULL, (GAsyncReadyCallback) %s_proxy_set_property_cb, (gpointer) info);\n' ' NULL, (GAsyncReadyCallback) %s_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);\n'
' g_variant_unref (variant);\n' ' g_variant_unref (variant);\n'
%(len(i.properties), i.name_lower, i.name, i.name_lower)) %(len(i.properties), i.name_lower, i.name, i.name_lower))
self.c.write('}\n' self.c.write('}\n'
@ -1672,7 +1672,7 @@ class CodeGenerator:
' guint n;\n' ' guint n;\n'
' guint signal_id;\n'); ' guint signal_id;\n');
# Note: info could be NULL if we are talking to a newer version of the interface # Note: info could be NULL if we are talking to a newer version of the interface
self.c.write(' info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((gpointer) &_%s_interface_info, signal_name);\n' self.c.write(' info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_%s_interface_info.parent_struct, signal_name);\n'
' if (info == NULL)\n' ' if (info == NULL)\n'
' return;\n' ' return;\n'
%(i.name_lower)) %(i.name_lower))
@ -1721,7 +1721,7 @@ class CodeGenerator:
' g_variant_get (changed_properties, "a{sv}", &iter);\n' ' g_variant_get (changed_properties, "a{sv}", &iter);\n'
' while (g_variant_iter_next (iter, "{&sv}", &key, NULL))\n' ' while (g_variant_iter_next (iter, "{&sv}", &key, NULL))\n'
' {\n' ' {\n'
' info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((gpointer) &_%s_interface_info, key);\n' ' info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_%s_interface_info.parent_struct, key);\n'
' g_datalist_remove_data (&proxy->priv->qdata, key);\n' ' g_datalist_remove_data (&proxy->priv->qdata, key);\n'
' if (info != NULL)\n' ' if (info != NULL)\n'
' g_object_notify (G_OBJECT (proxy), info->hyphen_name);\n' ' g_object_notify (G_OBJECT (proxy), info->hyphen_name);\n'
@ -1729,7 +1729,7 @@ class CodeGenerator:
' g_variant_iter_free (iter);\n' ' g_variant_iter_free (iter);\n'
' for (n = 0; invalidated_properties[n] != NULL; n++)\n' ' for (n = 0; invalidated_properties[n] != NULL; n++)\n'
' {\n' ' {\n'
' info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((gpointer) &_%s_interface_info, invalidated_properties[n]);\n' ' info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_%s_interface_info.parent_struct, invalidated_properties[n]);\n'
' g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);\n' ' g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);\n'
' if (info != NULL)\n' ' if (info != NULL)\n'
' g_object_notify (G_OBJECT (proxy), info->hyphen_name);\n' ' g_object_notify (G_OBJECT (proxy), info->hyphen_name);\n'
@ -2157,7 +2157,7 @@ class CodeGenerator:
' GVariant *ret;\n' ' GVariant *ret;\n'
%(i.name_lower, i.camel_name, i.ns_upper, i.name_upper)) %(i.name_lower, i.camel_name, i.ns_upper, i.name_upper))
self.c.write(' ret = NULL;\n' self.c.write(' ret = NULL;\n'
' info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((gpointer) &_%s_interface_info, property_name);\n' ' info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_%s_interface_info.parent_struct, property_name);\n'
' g_assert (info != NULL);\n' ' g_assert (info != NULL);\n'
' pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);\n' ' pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);\n'
' if (pspec == NULL)\n' ' if (pspec == NULL)\n'
@ -2194,7 +2194,7 @@ class CodeGenerator:
' gboolean ret;\n' ' gboolean ret;\n'
%(i.name_lower, i.camel_name, i.ns_upper, i.name_upper)) %(i.name_lower, i.camel_name, i.ns_upper, i.name_upper))
self.c.write(' ret = FALSE;\n' self.c.write(' ret = FALSE;\n'
' info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((gpointer) &_%s_interface_info, property_name);\n' ' info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_%s_interface_info.parent_struct, property_name);\n'
' g_assert (info != NULL);\n' ' g_assert (info != NULL);\n'
' pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);\n' ' pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);\n'
' if (pspec == NULL)\n' ' if (pspec == NULL)\n'