gitypes: Fix integer values of GIInfoType

This effectively reverts commit 0910e2f6ad. I thought that `GIInfoType`
was decoupled from `GITypelibBlobType`, but it turns out that
`girepository.c` calls `gi_info_new_full()` with blob types, implicitly
converting them to info types.

This was causing anything with a type higher than the `INVALID_0` value
to be loaded as the wrong type.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
This commit is contained in:
Philip Withnall 2024-02-06 13:40:20 +00:00
parent e286497c1f
commit c8946b8a92
2 changed files with 15 additions and 11 deletions

View File

@ -179,6 +179,7 @@ Changes since 0.1:
* Since: 2.80 * Since: 2.80
*/ */
typedef enum { typedef enum {
/* The values here must be kept in sync with GIInfoType */
BLOB_TYPE_INVALID, BLOB_TYPE_INVALID,
BLOB_TYPE_FUNCTION, BLOB_TYPE_FUNCTION,
BLOB_TYPE_CALLBACK, BLOB_TYPE_CALLBACK,

View File

@ -241,6 +241,7 @@ typedef union _GIArgument GIArgument;
*/ */
typedef enum typedef enum
{ {
/* The values here must be kept in sync with GITypelibBlobType */
GI_INFO_TYPE_INVALID, GI_INFO_TYPE_INVALID,
GI_INFO_TYPE_FUNCTION, GI_INFO_TYPE_FUNCTION,
GI_INFO_TYPE_CALLBACK, GI_INFO_TYPE_CALLBACK,
@ -251,17 +252,19 @@ typedef enum
GI_INFO_TYPE_OBJECT, GI_INFO_TYPE_OBJECT,
GI_INFO_TYPE_INTERFACE, GI_INFO_TYPE_INTERFACE,
GI_INFO_TYPE_CONSTANT, GI_INFO_TYPE_CONSTANT,
GI_INFO_TYPE_UNION, /* 10 */ /* 10 is skipped, it used to be used, but was removed before girepository-2.0
GI_INFO_TYPE_VALUE, * It is, however, part of the binary format in GITypelibBlobType */
GI_INFO_TYPE_SIGNAL, GI_INFO_TYPE_UNION = 11,
GI_INFO_TYPE_VFUNC, GI_INFO_TYPE_VALUE = 12,
GI_INFO_TYPE_PROPERTY, GI_INFO_TYPE_SIGNAL = 13,
GI_INFO_TYPE_FIELD, /* 15 */ GI_INFO_TYPE_VFUNC = 14,
GI_INFO_TYPE_ARG, GI_INFO_TYPE_PROPERTY = 15,
GI_INFO_TYPE_TYPE, GI_INFO_TYPE_FIELD = 16,
GI_INFO_TYPE_UNRESOLVED, GI_INFO_TYPE_ARG = 17,
GI_INFO_TYPE_CALLABLE, GI_INFO_TYPE_TYPE = 18,
GI_INFO_TYPE_REGISTERED_TYPE, /* 20 */ GI_INFO_TYPE_UNRESOLVED = 19,
GI_INFO_TYPE_CALLABLE = 20,
GI_INFO_TYPE_REGISTERED_TYPE = 21,
/* keep GI_INFO_TYPE_N_TYPES in sync with this */ /* keep GI_INFO_TYPE_N_TYPES in sync with this */
} GIInfoType; } GIInfoType;