mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-10-31 16:32:18 +01:00 
			
		
		
		
	Fix regression in g_irepository_get_info
Commit f97cc8687469f25752f79275 broke the lookup in g_irepository_get_info; the passed offset is 0-based, then we convert it to 1-based (and then back to 0 later...which needs to be fixed).
This commit is contained in:
		| @@ -519,11 +519,13 @@ g_irepository_get_n_infos (GIRepository *repository, | ||||
|  * g_irepository_get_info: | ||||
|  * @repository: (allow-none): A #GIRepository, may be %NULL for the default | ||||
|  * @namespace_: Namespace to inspect | ||||
|  * @index: Offset into namespace metadata for entry | ||||
|  * @index: 0-based offset into namespace metadata for entry | ||||
|  * | ||||
|  * This function returns a particular metadata entry in the | ||||
|  * given namespace @namespace_.  The namespace must have | ||||
|  * already been loaded before calling this function. | ||||
|  * See g_irepository_get_n_infos() to find the maximum number of | ||||
|  * entries. | ||||
|  * | ||||
|  * Returns: (transfer full): #GIBaseInfo containing metadata | ||||
|  */ | ||||
| @@ -543,7 +545,7 @@ g_irepository_get_info (GIRepository *repository, | ||||
|  | ||||
|   g_return_val_if_fail (typelib != NULL, NULL); | ||||
|  | ||||
|   entry = g_typelib_get_dir_entry (typelib, index); | ||||
|   entry = g_typelib_get_dir_entry (typelib, index + 1); | ||||
|   if (entry == NULL) | ||||
|     return NULL; | ||||
|   return _g_info_new_full (entry->blob_type, | ||||
|   | ||||
| @@ -1349,6 +1349,7 @@ gir_writer_write (const char *filename, | ||||
|       const gchar *c_prefix; | ||||
|       const char *ns = namespace; | ||||
|       const char *version; | ||||
|       gint n_infos; | ||||
|  | ||||
|       version = g_irepository_get_version (repository, ns); | ||||
|  | ||||
| @@ -1361,7 +1362,8 @@ gir_writer_write (const char *filename, | ||||
|       if (c_prefix) | ||||
|         xml_printf (xml, " c:prefix=\"%s\"", c_prefix); | ||||
|  | ||||
|       for (j = 0; j < g_irepository_get_n_infos (repository, ns); j++) | ||||
|       n_infos = g_irepository_get_n_infos (repository, ns); | ||||
|       for (j = 0; j < n_infos; j++) | ||||
| 	{ | ||||
| 	  GIBaseInfo *info = g_irepository_get_info (repository, ns, j); | ||||
| 	  switch (g_base_info_get_type (info)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user