gobject-introspection r134 - in trunk: girepository tools



Author: johan
Date: Mon Mar 10 17:47:26 2008
New Revision: 134
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=134&view=rev

Log:
2008-02-21  Mark Doffman  <mark doffman codethink co uk>

    * girepository/ginfo.c
    * tools/generate.c

    Change the way that external references with no namespace
    are dealt with. External references with no namespace
    are placed into the XML as-if they are a local reference.
    This is temporary, but helps with roundtrip tests.

WARNING: This commit does not compile. It is a partial change.


Modified:
   trunk/girepository/ginfo.c
   trunk/tools/generate.c

Modified: trunk/girepository/ginfo.c
==============================================================================
--- trunk/girepository/ginfo.c	(original)
+++ trunk/girepository/ginfo.c	Mon Mar 10 17:47:26 2008
@@ -161,29 +161,35 @@
 {
   GIBaseInfo *result;
   DirEntry *entry = g_metadata_get_dir_entry (metadata, index);
-  
+
   if (entry->local)
     result = g_info_new (entry->blob_type, NULL, metadata, entry->offset);
-  else 
+  else
     {
-      const gchar *namespace = g_metadata_get_string (metadata, entry->offset);
-      const gchar *name = g_metadata_get_string (metadata, entry->name);
-      
+      const gchar *namespace = NULL;
+      const gchar *name = NULL;
       GIRepository *repository = g_irepository_get_default ();
-      
+
+      namespace = g_metadata_get_string (metadata, entry->offset);
+      name = g_metadata_get_string (metadata, entry->name);
+
       result = g_irepository_find_by_name (repository, namespace, name);
       if (result == NULL)
 	{
 	  GIUnresolvedInfo *unresolved;
-
 	  unresolved = g_new0 (GIUnresolvedInfo, 1);
-	  
 	  unresolved->type = GI_INFO_TYPE_UNRESOLVED;
 	  unresolved->ref_count = 1;
 	  unresolved->container = NULL;
 	  unresolved->name = name;
-	  unresolved->namespace = namespace;
-
+	  if (entry->offset)
+	    {
+	      unresolved->namespace = namespace;
+	    }
+	  else
+	    {
+	      unresolved->namespace = NULL;
+	    }
 	  result = (GIBaseInfo*)unresolved;
 	}
     }

Modified: trunk/tools/generate.c
==============================================================================
--- trunk/tools/generate.c	(original)
+++ trunk/tools/generate.c	Mon Mar 10 17:47:26 2008
@@ -39,7 +39,8 @@
 		 GIBaseInfo  *info,
 		 FILE        *file)
 {
-  if (strcmp (namespace, g_base_info_get_namespace (info)) != 0)
+  if (g_base_info_get_namespace (info) != 0 &&
+      strcmp (namespace, g_base_info_get_namespace (info)) != 0)
     g_fprintf (file, "%s.", g_base_info_get_namespace (info));
 
   g_fprintf (file, "%s", g_base_info_get_name (info));



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