Bug 571373 - Add padding to typelib objects
authorColin Walters <walters@verbum.org>
Thu, 12 Feb 2009 20:17:25 +0000 (15:17 -0500)
committerColin Walters <walters@verbum.org>
Thu, 19 Feb 2009 02:54:04 +0000 (21:54 -0500)
Expand various typelib objects to ensure we have at least 16 bits
left for each one to add another string indirection or directory offset,
and also that we have at least a few bits for more flags.

girepository/gtypelib.c
girepository/gtypelib.h

index 6de6217..673436a 100644 (file)
@@ -175,18 +175,18 @@ g_typelib_check_sanity (void)
   CHECK_SIZE (ErrorTypeBlob, 4);
   CHECK_SIZE (ErrorDomainBlob, 16);
   CHECK_SIZE (ValueBlob, 12);
-  CHECK_SIZE (FieldBlob, 12);
+  CHECK_SIZE (FieldBlob, 16);
   CHECK_SIZE (RegisteredTypeBlob, 16);
-  CHECK_SIZE (StructBlob, 24);
-  CHECK_SIZE (EnumBlob, 20);
-  CHECK_SIZE (PropertyBlob, 12);
-  CHECK_SIZE (SignalBlob, 12);
-  CHECK_SIZE (VFuncBlob, 16);
-  CHECK_SIZE (ObjectBlob, 36);
-  CHECK_SIZE (InterfaceBlob, 28);
-  CHECK_SIZE (ConstantBlob, 20);
+  CHECK_SIZE (StructBlob, 32);
+  CHECK_SIZE (EnumBlob, 24);
+  CHECK_SIZE (PropertyBlob, 16);
+  CHECK_SIZE (SignalBlob, 16);
+  CHECK_SIZE (VFuncBlob, 20);
+  CHECK_SIZE (ObjectBlob, 44);
+  CHECK_SIZE (InterfaceBlob, 36);
+  CHECK_SIZE (ConstantBlob, 24);
   CHECK_SIZE (AnnotationBlob, 12);
-  CHECK_SIZE (UnionBlob, 32);
+  CHECK_SIZE (UnionBlob, 40);
 #undef CHECK_SIZE
 
   g_assert (size_check_ok);
index 5ab2acb..9a78873 100644 (file)
@@ -622,7 +622,9 @@ typedef struct {
   guint8         reserved :6;
   guint8         bits;
 
-  guint16        struct_offset;      
+  guint16        struct_offset;
+
+  guint32        reserved2;
 
   SimpleTypeBlob type;
 } FieldBlob;
@@ -678,6 +680,9 @@ typedef struct {
   guint16   n_fields;
   guint16   n_methods;
 
+  guint32   reserved2;
+  guint32   reserved3;
+
 #if 0
   /* variable-length parts of the blob */
   FieldBlob    fields[];   
@@ -719,6 +724,9 @@ typedef struct {
   guint16      n_fields;
   guint16      n_functions;
 
+  guint32      reserved2;
+  guint32      reserved3;
+
   gint32       discriminator_offset; 
   SimpleTypeBlob discriminator_type;
 
@@ -755,6 +763,8 @@ typedef struct {
   guint16   n_values;
   guint16   reserved2;
 
+  guint32   reserved3;
+
   ValueBlob values[];    
 } EnumBlob;
 
@@ -777,8 +787,9 @@ typedef struct {
   guint32        construct_only : 1;
   guint32        reserved       :27;
 
-  SimpleTypeBlob type;
+  guint32        reserved2;
 
+  SimpleTypeBlob type;
 } PropertyBlob;
 
 /**
@@ -815,6 +826,8 @@ typedef struct {
 
   guint32 name;
 
+  guint32 reserved2;
+
   guint32 signature;
 } SignalBlob;
 
@@ -847,6 +860,8 @@ typedef struct {
 
   guint16 struct_offset;
   guint16 reserved2;
+
+  guint32 reserved3;
   guint32 signature;
 } VFuncBlob;
 
@@ -886,7 +901,6 @@ typedef struct {
 
   guint16   parent;
   guint16   class_struct;
-  guint16   reserved2;
 
   guint16   n_interfaces;
   guint16   n_fields;
@@ -895,6 +909,10 @@ typedef struct {
   guint16   n_signals;
   guint16   n_vfuncs;
   guint16   n_constants;
+  guint16   reserved2;
+
+  guint32   reserved3;
+  guint32   reserved4;
 
   guint16   interfaces[];
  
@@ -942,6 +960,9 @@ typedef struct {
   guint16 n_vfuncs;
   guint16 n_constants;  
 
+  guint32 reserved2;
+  guint32 reserved3;
+
   guint16 prerequisites[];
 
 #if 0 
@@ -971,6 +992,8 @@ typedef struct {
 
   guint32        size;
   guint32        offset;
+
+  guint32        reserved2;
 } ConstantBlob;
 
 /**