gobject-introspection r525 - trunk/girepository



Author: walters
Date: Fri Aug 29 18:49:22 2008
New Revision: 525
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=525&view=rev

Log:
More context information in validate

	* girepository/gtypelib.c: Add more context
	during validate.


Modified:
   trunk/girepository/gtypelib.c

Modified: trunk/girepository/gtypelib.c
==============================================================================
--- trunk/girepository/gtypelib.c	(original)
+++ trunk/girepository/gtypelib.c	Fri Aug 29 18:49:22 2008
@@ -1246,11 +1246,12 @@
 }
 
 static gboolean
-validate_enum_blob (GTypelib     *typelib,
+validate_enum_blob (ValidateContext *ctx,
 		    guint32        offset,
 		    guint16        blob_type,
 		    GError       **error)
 {
+  GTypelib *typelib = ctx->typelib;
   EnumBlob *blob;
   ValueBlob *v1, *v2;
   gint i, j; 
@@ -1307,6 +1308,8 @@
 		   "The buffer is too short");
       return FALSE;
     }
+
+  push_context (ctx, get_string_nofail (typelib, blob->name));
   
   for (i = 0; i < blob->n_values; i++)
     {
@@ -1337,6 +1340,8 @@
 	}
 #endif      
     }
+
+  pop_context (ctx);
   
   return TRUE;
 }
@@ -1382,7 +1387,7 @@
   
   if (!validate_name (typelib, "object", typelib->data, blob->name, error))
     return FALSE; 
-  
+
   if (blob->parent > header->n_entries)
     {
       g_set_error (error,
@@ -1457,6 +1462,8 @@
 
   offset2 += 2 * (blob->n_interfaces %2);
 
+  push_context (ctx, get_string_nofail (typelib, blob->name));
+  
   for (i = 0; i < blob->n_fields; i++, offset2 += sizeof (FieldBlob))
     {
       if (!validate_field_blob (typelib, offset2, error))
@@ -1493,6 +1500,8 @@
 	return FALSE;
     }
 
+  pop_context (ctx);
+
   return TRUE;
 }
 
@@ -1586,6 +1595,8 @@
 
   offset2 += 2 * (blob->n_prerequisites % 2);
 
+  push_context (ctx, get_string_nofail (typelib, blob->name));
+  
   for (i = 0; i < blob->n_properties; i++, offset2 += sizeof (PropertyBlob))
     {
       if (!validate_property_blob (typelib, offset2, error))
@@ -1616,6 +1627,8 @@
 	return FALSE;
     }
 
+  pop_context (ctx);
+
   return TRUE;
 }
 
@@ -1671,7 +1684,7 @@
       break;
     case BLOB_TYPE_ENUM:
     case BLOB_TYPE_FLAGS:
-      if (!validate_enum_blob (typelib, offset, common->blob_type, error))
+      if (!validate_enum_blob (ctx, offset, common->blob_type, error))
 	return FALSE;
       break;
     case BLOB_TYPE_OBJECT:



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