gobject-introspection r620 - trunk/girepository



Author: walters
Date: Fri Sep 19 23:43:38 2008
New Revision: 620
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=620&view=rev

Log:
Strengthen check for interface vs basic types

Previously we were just checking "reserved", but to be more correct
we should check whether reserved2 is zero as well because it is
possible for offsets to have reserved = 0 but reserved2 != 0.


Modified:
   trunk/girepository/ginfo.c
   trunk/girepository/gtypelib.c

Modified: trunk/girepository/ginfo.c
==============================================================================
--- trunk/girepository/ginfo.c	(original)
+++ trunk/girepository/ginfo.c	Fri Sep 19 23:43:38 2008
@@ -548,7 +548,7 @@
   SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset];
 
   return (GITypeInfo *) g_info_new (GI_INFO_TYPE_TYPE, container, typelib, 
-				    type->reserved == 0 ? offset : type->offset);
+				    (type->reserved == 0 && type->reserved2 == 0) ? offset : type->offset);
 }
 
 /**
@@ -735,7 +735,7 @@
   GIBaseInfo *base = (GIBaseInfo *)info;
   SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
   
-  if (type->reserved == 0)
+  if (type->reserved == 0 && type->reserved2 == 0)
     return type->pointer;
   else
     {
@@ -751,7 +751,7 @@
   GIBaseInfo *base = (GIBaseInfo *)info;
   SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
 
-  if (type->reserved == 0)
+  if (type->reserved == 0 && type->reserved2 == 0)
     return type->tag;
   else
     {
@@ -768,7 +768,7 @@
   GIBaseInfo *base = (GIBaseInfo *)info;
   SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
   
-  if (type->reserved != 0)
+  if (!(type->reserved == 0 && type->reserved2 == 0))
     {
       ParamTypeBlob *param = (ParamTypeBlob *)&base->typelib->data[base->offset];
 
@@ -794,7 +794,7 @@
   GIBaseInfo *base = (GIBaseInfo *)info;
   SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
   
-  if (type->reserved != 0)
+  if (!(type->reserved == 0 && type->reserved2 == 0))
     {
       InterfaceTypeBlob *blob = (InterfaceTypeBlob *)&base->typelib->data[base->offset];
       
@@ -811,7 +811,7 @@
   GIBaseInfo *base = (GIBaseInfo *)info;
   SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
   
-  if (type->reserved != 0)
+  if (!(type->reserved == 0 && type->reserved2 == 0))
     {
       ArrayTypeBlob *blob = (ArrayTypeBlob *)&base->typelib->data[base->offset];
 
@@ -831,7 +831,7 @@
   GIBaseInfo *base = (GIBaseInfo *)info;
   SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
   
-  if (type->reserved != 0)
+  if (!(type->reserved == 0 && type->reserved2 == 0))
     {
       ArrayTypeBlob *blob = (ArrayTypeBlob *)&base->typelib->data[base->offset];
 
@@ -848,7 +848,7 @@
   GIBaseInfo *base = (GIBaseInfo *)info;
   SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
   
-  if (type->reserved != 0)
+  if (!(type->reserved == 0 && type->reserved2 == 0))
     {
       ErrorTypeBlob *blob = (ErrorTypeBlob *)&base->typelib->data[base->offset];
 
@@ -866,7 +866,7 @@
   GIBaseInfo *base = (GIBaseInfo *)info;
   SimpleTypeBlob *type = (SimpleTypeBlob *)&base->typelib->data[base->offset];
   
-  if (type->reserved != 0)
+  if (!(type->reserved == 0 && type->reserved2 == 0))
     {
       ErrorTypeBlob *blob = (ErrorTypeBlob *)&base->typelib->data[base->offset];
 
@@ -1679,7 +1679,7 @@
   ConstantBlob *blob = (ConstantBlob *)&base->typelib->data[base->offset];
 
   /* FIXME non-basic types ? */
-  if (blob->type.reserved == 0)
+  if (blob->type.reserved == 0 && blob->type.reserved2 == 0)
     {
       if (blob->type.pointer)
 	value->v_pointer = g_memdup (&base->typelib->data[blob->offset], blob->size);

Modified: trunk/girepository/gtypelib.c
==============================================================================
--- trunk/girepository/gtypelib.c	(original)
+++ trunk/girepository/gtypelib.c	Fri Sep 19 23:43:38 2008
@@ -968,7 +968,7 @@
     }
   
   type = (SimpleTypeBlob *)&typelib->data[offset + G_STRUCT_OFFSET (ConstantBlob, type)];
-  if (type->reserved == 0)
+  if (type->reserved == 0 && type->reserved2 == 0)
     {
       if (type->tag == 0)
 	{



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