summaryrefslogtreecommitdiff
path: root/girepository/girnode.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@src.gnome.org>2008-11-11 05:10:36 +0000
committerOwen Taylor <otaylor@src.gnome.org>2008-11-11 05:10:36 +0000
commit7e1e368b9f09835a4c65c3e8ff7780523893180d (patch)
tree549f6f46dec594ee3429cda80d66abbbda85906b /girepository/girnode.c
parent570088cd5548cdc3e13b85b5e900457c3b5a94ea (diff)
downloadgobject-introspection-7e1e368b9f09835a4c65c3e8ff7780523893180d.tar.gz
Bug 560252 - Compute field offsets before writing typelib
girnode.h: Store the total size and alignment for GIrNodeStruct/Boxed/Union. giroffset.c: New file implementing computation of structure field offsets. girnode.c: Compute structure field offsets before writing types into the typelib. docs/typelib-format.txt: Document that a field offset of 0xFFFF means "unknown". Also fix description of the discriminator_offset field for unions. svn path=/trunk/; revision=876
Diffstat (limited to 'girepository/girnode.c')
-rw-r--r--girepository/girnode.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/girepository/girnode.c b/girepository/girnode.c
index b7f0cb27..87b418c8 100644
--- a/girepository/girnode.c
+++ b/girepository/girnode.c
@@ -1354,6 +1354,8 @@ g_ir_node_build_typelib (GIrNode *node,
node->name ? " " : "",
g_ir_node_type_to_string (node->type));
+ g_ir_node_compute_offsets (node, module, modules);
+
switch (node->type)
{
case G_IR_NODE_TYPE:
@@ -1525,7 +1527,10 @@ g_ir_node_build_typelib (GIrNode *node,
blob->writable = field->writable;
blob->reserved = 0;
blob->bits = 0;
- blob->struct_offset = field->offset;
+ if (field->offset >= 0)
+ blob->struct_offset = field->offset;
+ else
+ blob->struct_offset = 0xFFFF; /* mark as unknown */
g_ir_node_build_typelib ((GIrNode *)field->type,
module, modules, strings, types,