[glib] gdbus-codegen: improve casting a tiny wee bit



commit c09bf3e6b935d5e5ef0ecf2bb88788537c3ebecd
Author: David Zeuthen <zeuthen gmail com>
Date:   Sat Jul 7 17:10:46 2012 -0400

    gdbus-codegen: improve casting a tiny wee bit
    
    The in commit b79fbc5c3fc8d7093919dde2dc244d26a97596c3 for fixing
    -Wstrict-aliasing warnings was a little too brutal, make it a bit
    better.
    
    Signed-off-by: David Zeuthen <zeuthen gmail com>

 gio/gdbus-2.0/codegen/codegen.py |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gio/gdbus-2.0/codegen/codegen.py b/gio/gdbus-2.0/codegen/codegen.py
index e81980c..2f5ba83 100644
--- a/gio/gdbus-2.0/codegen/codegen.py
+++ b/gio/gdbus-2.0/codegen/codegen.py
@@ -954,7 +954,7 @@ class CodeGenerator:
             self.c.write('GDBusInterfaceInfo *\n'
                          '%s_interface_info (void)\n'
                          '{\n'
-                         '  return (gpointer) &_%s_interface_info;\n'
+                         '  return (GDBusInterfaceInfo *) &_%s_interface_info.parent_struct;\n'
                          '}\n'
                          '\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_DBUS_CALL_FLAGS_NONE,\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'
                          %(len(i.properties), i.name_lower, i.name, i.name_lower))
         self.c.write('}\n'
@@ -1672,7 +1672,7 @@ class CodeGenerator:
                      '  guint n;\n'
                      '  guint signal_id;\n');
         # 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'
                      '    return;\n'
                      %(i.name_lower))
@@ -1721,7 +1721,7 @@ class CodeGenerator:
                      '  g_variant_get (changed_properties, "a{sv}", &iter);\n'
                      '  while (g_variant_iter_next (iter, "{&sv}", &key, NULL))\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'
                      '      if (info != NULL)\n'
                      '        g_object_notify (G_OBJECT (proxy), info->hyphen_name);\n'
@@ -1729,7 +1729,7 @@ class CodeGenerator:
                      '  g_variant_iter_free (iter);\n'
                      '  for (n = 0; invalidated_properties[n] != NULL; 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'
                      '      if (info != NULL)\n'
                      '        g_object_notify (G_OBJECT (proxy), info->hyphen_name);\n'
@@ -2157,7 +2157,7 @@ class CodeGenerator:
                      '  GVariant *ret;\n'
                      %(i.name_lower, i.camel_name, i.ns_upper, i.name_upper))
         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'
                      '  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);\n'
                      '  if (pspec == NULL)\n'
@@ -2194,7 +2194,7 @@ class CodeGenerator:
                      '  gboolean ret;\n'
                      %(i.name_lower, i.camel_name, i.ns_upper, i.name_upper))
         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'
                      '  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);\n'
                      '  if (pspec == NULL)\n'



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]