girepository/ginfo.c girepository/girepository.h tools/generate.c

2008-02-21  Mark Doffman  <mark.doffman@codethink.co.uk>

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

      Add a function to check if an enum is registered or not.
      Previously anything testing this relied on the g-type
      string offset having a value of 0.

    * girepository/gmetadata.c
    * girepository/gmetadata.h
    * tools/generate.c

      Remove unneccesary or erroneous checks. There were two
      metadata validation checks which made sure that the blob
      sizes were the same as some magic numbers compiled into the code.
      This is wrong as it breaks any forwards compatibility that may
      be possible.

      Checks were also present that made sure that unregistered type
      blobs had a value of 0 in the g-type offset field. This is
      unneccessary. If a type blob is unregistered then any value
      in its g-type field is simply invalid.

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

svn path=/trunk/; revision=132
This commit is contained in:
Mark Doffman 2008-03-10 17:47:20 +00:00 committed by Philip Withnall
parent 9e6472853a
commit e56744c907

View File

@ -574,16 +574,22 @@ write_enum_info (const gchar *namespace,
FILE *file)
{
const gchar *name;
const gchar *type_name;
const gchar *type_init;
const gchar *type_name = NULL;
const gchar *type_init = NULL;
gboolean deprecated;
gint i;
name = g_base_info_get_name ((GIBaseInfo *)info);
deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
/* Make sure this is a registered enum before filling out the
* GType information
*/
if (g_enum_info_is_registered ((GIEnumInfo *)info))
{
type_name = g_registered_type_info_get_type_name ((GIRegisteredTypeInfo*)info);
type_init = g_registered_type_info_get_type_init ((GIRegisteredTypeInfo*)info);
}
if (g_base_info_get_type ((GIBaseInfo *)info) == GI_INFO_TYPE_ENUM)
g_fprintf (file, " <enum ");
@ -1148,8 +1154,6 @@ main (int argc, char *argv[])
g_type_init ();
g_metadata_check_sanity ();
context = g_option_context_new ("");
g_option_context_add_main_entries (context, options, NULL);
g_option_context_parse (context, &argc, &argv, &error);