gobject-introspection r888 - in trunk: . girepository



Author: otaylor
Date: Tue Nov 11 21:10:12 2008
New Revision: 888
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=888&view=rev

Log:
2008-11-11  Owen Taylor  <otaylor redhat com>

        Compute field offsets and overall size for object structures

        Bug 560326 â Fails to build Gtk-2.0.typelib with "Unexpected non-pointer
        field of type object in structure"

        Do basic computation of field offsets for objects and interfaces;
        this doesn't attempt to address all of the "mess" for virtual
        functions described in Bug 560281.

Modified:
   trunk/ChangeLog
   trunk/girepository/girnode.h
   trunk/girepository/giroffsets.c

Modified: trunk/girepository/girnode.h
==============================================================================
--- trunk/girepository/girnode.h	(original)
+++ trunk/girepository/girnode.h	Tue Nov 11 21:10:12 2008
@@ -228,6 +228,9 @@
   GList *interfaces;
   GList *prerequisites;
 
+  gint alignment;
+  gint size;
+  
   GList *members;
 };
 

Modified: trunk/girepository/giroffsets.c
==============================================================================
--- trunk/girepository/giroffsets.c	(original)
+++ trunk/girepository/giroffsets.c	Tue Nov 11 21:10:12 2008
@@ -150,6 +150,14 @@
 	*alignment = struct_->alignment;
 	break;
       }
+    case G_IR_NODE_OBJECT:
+    case G_IR_NODE_INTERFACE:
+      {
+	GIrNodeInterface *interface = (GIrNodeInterface *)iface;
+	*size = interface->size;
+	*alignment = interface->alignment;
+	break;
+      }
     case G_IR_NODE_UNION:
       {
 	GIrNodeUnion *union_ = (GIrNodeUnion *)iface;
@@ -426,6 +434,19 @@
 				      &struct_->size, &struct_->alignment);
 	break;
       }
+    case G_IR_NODE_OBJECT:
+    case G_IR_NODE_INTERFACE:
+      {
+	GIrNodeInterface *iface = (GIrNodeInterface *)node;
+
+	if (!check_needs_computation (node, module, iface->alignment))
+	  return;
+
+	compute_struct_field_offsets (node, iface->members,
+				      module, modules,
+				      &iface->size, &iface->alignment);
+	break;
+      }
     case G_IR_NODE_UNION:
       {
 	GIrNodeUnion *union_ = (GIrNodeUnion *)node;



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