From 9f33015a25e725d82c8bb58df725546dd0a29179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 15 Jan 2024 22:20:02 +0100 Subject: [PATCH] girrepository: Use standard int sized types instead of g[u]int* --- girepository/cmph/cmph_types.h | 17 +- girepository/gdump.c | 35 +- girepository/giarginfo.c | 4 +- girepository/giarginfo.h | 4 +- girepository/gibaseinfo.c | 14 +- girepository/gibaseinfo.h | 2 +- girepository/gicallableinfo.c | 40 +- girepository/gicallableinfo.h | 6 +- girepository/giconstantinfo.c | 20 +- girepository/gienuminfo.c | 20 +- girepository/gienuminfo.h | 14 +- girepository/gifieldinfo.c | 46 +-- girepository/gifunctioninfo.c | 6 +- girepository/giinterfaceinfo.c | 42 +-- girepository/giinterfaceinfo.h | 24 +- girepository/ginvoke.c | 2 +- girepository/giobjectinfo.c | 56 +-- girepository/giobjectinfo.h | 28 +- girepository/girepository-private.h | 24 +- girepository/girepository.c | 20 +- girepository/girepository.h | 6 +- girepository/girffi.c | 2 +- girepository/girmodule-private.h | 4 +- girepository/girmodule.c | 46 +-- girepository/girnode-private.h | 58 +-- girepository/girnode.c | 120 +++--- girepository/giroffsets.c | 46 +-- girepository/girparser.c | 32 +- girepository/girwriter.c | 78 ++-- girepository/gistructinfo.c | 24 +- girepository/gistructinfo.h | 8 +- girepository/gitypeinfo.c | 18 +- girepository/gitypeinfo.h | 6 +- girepository/gitypelib-internal.h | 560 ++++++++++++++-------------- girepository/gitypelib.c | 157 ++++---- girepository/gitypelib.h | 4 +- girepository/gitypes.h | 40 +- girepository/giunioninfo.c | 18 +- girepository/giunioninfo.h | 12 +- girepository/givfuncinfo.c | 8 +- girepository/givfuncinfo.h | 2 +- girepository/gthash.c | 58 +-- girepository/tests/cmph-bdz.c | 30 +- girepository/tests/gthash.c | 5 +- 44 files changed, 883 insertions(+), 883 deletions(-) diff --git a/girepository/cmph/cmph_types.h b/girepository/cmph/cmph_types.h index 288323587..d5db4c4b5 100644 --- a/girepository/cmph/cmph_types.h +++ b/girepository/cmph/cmph_types.h @@ -1,19 +1,20 @@ +#include #include #ifndef __CMPH_TYPES_H__ #define __CMPH_TYPES_H__ -typedef gint8 cmph_int8; -typedef guint8 cmph_uint8; +typedef int8_t cmph_int8; +typedef uint8_t cmph_uint8; -typedef gint16 cmph_int16; -typedef guint16 cmph_uint16; +typedef int16_t cmph_int16; +typedef uint16_t cmph_uint16; -typedef gint32 cmph_int32; -typedef guint32 cmph_uint32; +typedef int32_t cmph_int32; +typedef uint32_t cmph_uint32; -typedef gint64 cmph_int64; -typedef guint64 cmph_uint64; +typedef int64_t cmph_int64; +typedef uint64_t cmph_uint64; typedef enum { CMPH_HASH_JENKINS, CMPH_HASH_COUNT } CMPH_HASH; extern const char *cmph_hash_names[]; diff --git a/girepository/gdump.c b/girepository/gdump.c index d7ec6b62f..6877ca24c 100644 --- a/girepository/gdump.c +++ b/girepository/gdump.c @@ -36,6 +36,7 @@ #include #include +#include #include #include @@ -70,12 +71,12 @@ read_line (FILE *input, size_t *len_out) { GByteArray *buffer = g_byte_array_new (); - const guint8 nul = '\0'; + const uint8_t nul = '\0'; while (TRUE) { size_t ret; - guint8 byte; + uint8_t byte; ret = fread (&byte, 1, 1, input); if (ret == 0) @@ -250,8 +251,8 @@ value_to_string (const GValue *value) static void dump_properties (GType type, FILE *out) { - guint i; - guint n_properties = 0; + unsigned int i; + unsigned int n_properties = 0; GParamSpec **props; if (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT) @@ -303,16 +304,16 @@ dump_properties (GType type, FILE *out) static void dump_signals (GType type, FILE *out) { - guint i; - guint n_sigs; - guint *sig_ids; + unsigned int i; + unsigned int n_sigs; + unsigned int *sig_ids; sig_ids = g_signal_list_ids (type, &n_sigs); for (i = 0; i < n_sigs; i++) { - guint sigid; + unsigned int sigid; GSignalQuery query; - guint j; + unsigned int j; sigid = sig_ids[i]; g_signal_query (sigid, &query); @@ -355,8 +356,8 @@ dump_signals (GType type, FILE *out) static void dump_object_type (GType type, const char *symbol, FILE *out) { - guint n_interfaces; - guint i; + unsigned int n_interfaces; + unsigned int i; GType *interfaces; escaped_printf (out, " \n", @@ -449,7 +450,7 @@ dump_boxed_type (GType type, const char *symbol, FILE *out) static void dump_flags_type (GType type, const char *symbol, FILE *out) { - guint i; + unsigned int i; GFlagsClass *klass; klass = g_type_class_ref (type); @@ -469,7 +470,7 @@ dump_flags_type (GType type, const char *symbol, FILE *out) static void dump_enum_type (GType type, const char *symbol, FILE *out) { - guint i; + unsigned int i; GEnumClass *klass; klass = g_type_class_ref (type); @@ -489,8 +490,8 @@ dump_enum_type (GType type, const char *symbol, FILE *out) static void dump_fundamental_type (GType type, const char *symbol, FILE *out) { - guint n_interfaces; - guint i; + unsigned int n_interfaces; + unsigned int i; GType *interfaces; GString *parent_str; GType parent; diff --git a/girepository/giarginfo.c b/girepository/giarginfo.c index 59894c951..a4c690d9a 100644 --- a/girepository/giarginfo.c +++ b/girepository/giarginfo.c @@ -269,7 +269,7 @@ gi_arg_info_get_scope (GIArgInfo *info) * Returns: Index of the user data argument or `-1` if there is none * Since: 2.80 */ -gint +int gi_arg_info_get_closure_index (GIArgInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -294,7 +294,7 @@ gi_arg_info_get_closure_index (GIArgInfo *info) * none * Since: 2.80 */ -gint +int gi_arg_info_get_destroy_index (GIArgInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; diff --git a/girepository/giarginfo.h b/girepository/giarginfo.h index 2564de83e..fcedb5a28 100644 --- a/girepository/giarginfo.h +++ b/girepository/giarginfo.h @@ -69,10 +69,10 @@ GI_AVAILABLE_IN_ALL GIScopeType gi_arg_info_get_scope (GIArgInfo *info); GI_AVAILABLE_IN_ALL -gint gi_arg_info_get_closure_index (GIArgInfo *info); +int gi_arg_info_get_closure_index (GIArgInfo *info); GI_AVAILABLE_IN_ALL -gint gi_arg_info_get_destroy_index (GIArgInfo *info); +int gi_arg_info_get_destroy_index (GIArgInfo *info); GI_AVAILABLE_IN_ALL GITypeInfo * gi_arg_info_get_type_info (GIArgInfo *info); diff --git a/girepository/gibaseinfo.c b/girepository/gibaseinfo.c index 14b3903e5..85bf3c26c 100644 --- a/girepository/gibaseinfo.c +++ b/girepository/gibaseinfo.c @@ -315,7 +315,7 @@ gi_info_new_full (GIInfoType type, GIRepository *repository, GIBaseInfo *container, GITypelib *typelib, - guint32 offset) + uint32_t offset) { GIRealInfo *info; @@ -357,7 +357,7 @@ GIBaseInfo * gi_info_new (GIInfoType type, GIBaseInfo *container, GITypelib *typelib, - guint32 offset) + uint32_t offset) { return gi_info_new_full (type, ((GIRealInfo*)container)->repository, container, typelib, offset); } @@ -382,7 +382,7 @@ gi_info_init (GIRealInfo *info, GIRepository *repository, GIBaseInfo *container, GITypelib *typelib, - guint32 offset) + uint32_t offset) { memset (info, 0, sizeof (GIRealInfo)); @@ -401,7 +401,7 @@ gi_info_init (GIRealInfo *info, GIBaseInfo * gi_info_from_entry (GIRepository *repository, GITypelib *typelib, - guint16 index) + uint16_t index) { GIBaseInfo *result; DirEntry *entry = gi_typelib_get_dir_entry (typelib, index); @@ -438,7 +438,7 @@ gi_info_from_entry (GIRepository *repository, GITypeInfo * gi_type_info_new (GIBaseInfo *container, GITypelib *typelib, - guint32 offset) + uint32_t offset) { SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset]; @@ -450,7 +450,7 @@ void gi_type_info_init (GIBaseInfo *info, GIBaseInfo *container, GITypelib *typelib, - guint32 offset) + uint32_t offset) { GIRealInfo *rinfo = (GIRealInfo*)container; SimpleTypeBlob *type = (SimpleTypeBlob *)&typelib->data[offset]; @@ -800,7 +800,7 @@ cmp_attribute (const void *av, */ AttributeBlob * _attribute_blob_find_first (GIBaseInfo *info, - guint32 blob_offset) + uint32_t blob_offset) { GIRealInfo *rinfo = (GIRealInfo *) info; Header *header = (Header *)rinfo->typelib->data; diff --git a/girepository/gibaseinfo.h b/girepository/gibaseinfo.h index 08feb3223..c6aaee604 100644 --- a/girepository/gibaseinfo.h +++ b/girepository/gibaseinfo.h @@ -96,6 +96,6 @@ GI_AVAILABLE_IN_ALL GIBaseInfo * gi_info_new (GIInfoType type, GIBaseInfo *container, GITypelib *typelib, - guint32 offset); + uint32_t offset); G_END_DECLS diff --git a/girepository/gicallableinfo.c b/girepository/gicallableinfo.c index 3d7e7020f..9eccfc2a7 100644 --- a/girepository/gicallableinfo.c +++ b/girepository/gicallableinfo.c @@ -54,7 +54,7 @@ * Since: 2.80 */ -static guint32 +static uint32_t signature_offset (GICallableInfo *info) { GIRealInfo *rinfo = (GIRealInfo*)info; @@ -78,7 +78,7 @@ signature_offset (GICallableInfo *info) g_assert_not_reached (); } if (sigoff >= 0) - return *(guint32 *)&rinfo->typelib->data[rinfo->offset + sigoff]; + return *(uint32_t *)&rinfo->typelib->data[rinfo->offset + sigoff]; return 0; } @@ -180,7 +180,7 @@ GITypeInfo * gi_callable_info_get_return_type (GICallableInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; - guint32 offset; + uint32_t offset; g_return_val_if_fail (info != NULL, NULL); g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), NULL); @@ -208,7 +208,7 @@ gi_callable_info_load_return_type (GICallableInfo *info, GITypeInfo *type) { GIRealInfo *rinfo = (GIRealInfo *)info; - guint32 offset; + uint32_t offset; g_return_if_fail (info != NULL); g_return_if_fail (GI_IS_CALLABLE_INFO (info)); @@ -331,11 +331,11 @@ gi_callable_info_get_instance_ownership_transfer (GICallableInfo *info) * Returns: The number of arguments this callable expects. * Since: 2.80 */ -guint +unsigned int gi_callable_info_get_n_args (GICallableInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; - gint offset; + uint32_t offset; SignatureBlob *blob; g_return_val_if_fail (info != NULL, -1); @@ -360,11 +360,11 @@ gi_callable_info_get_n_args (GICallableInfo *info) */ GIArgInfo * gi_callable_info_get_arg (GICallableInfo *info, - guint n) + unsigned int n) { GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; - gint offset; + uint32_t offset; g_return_val_if_fail (info != NULL, NULL); g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), NULL); @@ -392,12 +392,12 @@ gi_callable_info_get_arg (GICallableInfo *info, */ void gi_callable_info_load_arg (GICallableInfo *info, - guint n, + unsigned int n, GIArgInfo *arg) { GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; - gint offset; + uint32_t offset; g_return_if_fail (info != NULL); g_return_if_fail (GI_IS_CALLABLE_INFO (info)); @@ -466,7 +466,7 @@ gi_callable_info_iterate_return_attributes (GICallableInfo *info, GIRealInfo *rinfo = (GIRealInfo *)info; Header *header = (Header *)rinfo->typelib->data; AttributeBlob *next, *after; - guint32 blob_offset; + uint32_t blob_offset; after = (AttributeBlob *) &rinfo->typelib->data[header->attributes + header->n_attributes * header->attribute_blob_size]; @@ -518,30 +518,30 @@ gi_type_tag_extract_ffi_return_value (GITypeTag return_tag, { switch (return_tag) { case GI_TYPE_TAG_INT8: - arg->v_int8 = (gint8) ffi_value->v_long; + arg->v_int8 = (int8_t) ffi_value->v_long; break; case GI_TYPE_TAG_UINT8: - arg->v_uint8 = (guint8) ffi_value->v_ulong; + arg->v_uint8 = (uint8_t) ffi_value->v_ulong; break; case GI_TYPE_TAG_INT16: - arg->v_int16 = (gint16) ffi_value->v_long; + arg->v_int16 = (int16_t) ffi_value->v_long; break; case GI_TYPE_TAG_UINT16: - arg->v_uint16 = (guint16) ffi_value->v_ulong; + arg->v_uint16 = (uint16_t) ffi_value->v_ulong; break; case GI_TYPE_TAG_INT32: - arg->v_int32 = (gint32) ffi_value->v_long; + arg->v_int32 = (int32_t) ffi_value->v_long; break; case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_BOOLEAN: case GI_TYPE_TAG_UNICHAR: - arg->v_uint32 = (guint32) ffi_value->v_ulong; + arg->v_uint32 = (uint32_t) ffi_value->v_ulong; break; case GI_TYPE_TAG_INT64: - arg->v_int64 = (gint64) ffi_value->v_int64; + arg->v_int64 = (int64_t) ffi_value->v_int64; break; case GI_TYPE_TAG_UINT64: - arg->v_uint64 = (guint64) ffi_value->v_uint64; + arg->v_uint64 = (uint64_t) ffi_value->v_uint64; break; case GI_TYPE_TAG_FLOAT: arg->v_float = ffi_value->v_float; @@ -553,7 +553,7 @@ gi_type_tag_extract_ffi_return_value (GITypeTag return_tag, switch(interface_type) { case GI_INFO_TYPE_ENUM: case GI_INFO_TYPE_FLAGS: - arg->v_int32 = (gint32) ffi_value->v_long; + arg->v_int32 = (int32_t) ffi_value->v_long; break; default: arg->v_pointer = (void *) ffi_value->v_pointer; diff --git a/girepository/gicallableinfo.h b/girepository/gicallableinfo.h index 9a76457bc..3ff1c0450 100644 --- a/girepository/gicallableinfo.h +++ b/girepository/gicallableinfo.h @@ -80,15 +80,15 @@ GI_AVAILABLE_IN_ALL gboolean gi_callable_info_skip_return (GICallableInfo *info); GI_AVAILABLE_IN_ALL -guint gi_callable_info_get_n_args (GICallableInfo *info); +unsigned int gi_callable_info_get_n_args (GICallableInfo *info); GI_AVAILABLE_IN_ALL GIArgInfo * gi_callable_info_get_arg (GICallableInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL void gi_callable_info_load_arg (GICallableInfo *info, - guint n, + unsigned int n, GIArgInfo *arg); GI_AVAILABLE_IN_ALL diff --git a/girepository/giconstantinfo.c b/girepository/giconstantinfo.c index dd9ed3849..e16aca8fe 100644 --- a/girepository/giconstantinfo.c +++ b/girepository/giconstantinfo.c @@ -145,34 +145,34 @@ gi_constant_info_get_value (GIConstantInfo *info, value->v_boolean = *(gboolean*)&rinfo->typelib->data[blob->offset]; break; case GI_TYPE_TAG_INT8: - value->v_int8 = *(gint8*)&rinfo->typelib->data[blob->offset]; + value->v_int8 = *(int8_t*)&rinfo->typelib->data[blob->offset]; break; case GI_TYPE_TAG_UINT8: - value->v_uint8 = *(guint8*)&rinfo->typelib->data[blob->offset]; + value->v_uint8 = *(uint8_t*)&rinfo->typelib->data[blob->offset]; break; case GI_TYPE_TAG_INT16: - value->v_int16 = *(gint16*)&rinfo->typelib->data[blob->offset]; + value->v_int16 = *(int16_t*)&rinfo->typelib->data[blob->offset]; break; case GI_TYPE_TAG_UINT16: - value->v_uint16 = *(guint16*)&rinfo->typelib->data[blob->offset]; + value->v_uint16 = *(uint16_t*)&rinfo->typelib->data[blob->offset]; break; case GI_TYPE_TAG_INT32: - value->v_int32 = *(gint32*)&rinfo->typelib->data[blob->offset]; + value->v_int32 = *(int32_t*)&rinfo->typelib->data[blob->offset]; break; case GI_TYPE_TAG_UINT32: - value->v_uint32 = *(guint32*)&rinfo->typelib->data[blob->offset]; + value->v_uint32 = *(uint32_t*)&rinfo->typelib->data[blob->offset]; break; case GI_TYPE_TAG_INT64: - DO_ALIGNED_COPY(&value->v_int64, &rinfo->typelib->data[blob->offset], gint64); + DO_ALIGNED_COPY (&value->v_int64, &rinfo->typelib->data[blob->offset], int64_t); break; case GI_TYPE_TAG_UINT64: - DO_ALIGNED_COPY(&value->v_uint64, &rinfo->typelib->data[blob->offset], guint64); + DO_ALIGNED_COPY (&value->v_uint64, &rinfo->typelib->data[blob->offset], uint64_t); break; case GI_TYPE_TAG_FLOAT: - DO_ALIGNED_COPY(&value->v_float, &rinfo->typelib->data[blob->offset], gfloat); + DO_ALIGNED_COPY (&value->v_float, &rinfo->typelib->data[blob->offset], float); break; case GI_TYPE_TAG_DOUBLE: - DO_ALIGNED_COPY(&value->v_double, &rinfo->typelib->data[blob->offset], gdouble); + DO_ALIGNED_COPY (&value->v_double, &rinfo->typelib->data[blob->offset], double); break; default: g_assert_not_reached (); diff --git a/girepository/gienuminfo.c b/girepository/gienuminfo.c index d0bf5105e..1fa346f2e 100644 --- a/girepository/gienuminfo.c +++ b/girepository/gienuminfo.c @@ -55,7 +55,7 @@ * Returns: the number of enumeration values * Since: 2.80 */ -guint +unsigned int gi_enum_info_get_n_values (GIEnumInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -110,11 +110,11 @@ gi_enum_info_get_error_domain (GIEnumInfo *info) */ GIValueInfo * gi_enum_info_get_value (GIEnumInfo *info, - guint n) + unsigned int n) { GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; - gint offset; + int offset; g_return_val_if_fail (info != NULL, NULL); g_return_val_if_fail (GI_IS_ENUM_INFO (info), NULL); @@ -135,7 +135,7 @@ gi_enum_info_get_value (GIEnumInfo *info, * Returns: number of methods * Since: 2.80 */ -guint +unsigned int gi_enum_info_get_n_methods (GIEnumInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -162,9 +162,9 @@ gi_enum_info_get_n_methods (GIEnumInfo *info) */ GIFunctionInfo * gi_enum_info_get_method (GIEnumInfo *info, - guint n) + unsigned int n) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; EnumBlob *blob; @@ -238,11 +238,11 @@ gi_enum_info_class_init (gpointer g_class, * Obtain the enumeration value of the `GIValueInfo`. * * Returns: the enumeration value. This will always be representable - * as a 32-bit signed or unsigned value. The use of `gint64` as the + * as a 32-bit signed or unsigned value. The use of `int64_t` as the * return type is to allow both. * Since: 2.80 */ -gint64 +int64_t gi_value_info_get_value (GIValueInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -254,9 +254,9 @@ gi_value_info_get_value (GIValueInfo *info) blob = (ValueBlob *)&rinfo->typelib->data[rinfo->offset]; if (blob->unsigned_value) - return (gint64)(guint32)blob->value; + return (int64_t)(uint32_t)blob->value; else - return (gint64)blob->value; + return (int64_t)blob->value; } void diff --git a/girepository/gienuminfo.h b/girepository/gienuminfo.h index 344058aa9..ba1d33d09 100644 --- a/girepository/gienuminfo.h +++ b/girepository/gienuminfo.h @@ -57,18 +57,18 @@ G_BEGIN_DECLS GI_AVAILABLE_IN_ALL -guint gi_enum_info_get_n_values (GIEnumInfo *info); +unsigned int gi_enum_info_get_n_values (GIEnumInfo *info); GI_AVAILABLE_IN_ALL -GIValueInfo * gi_enum_info_get_value (GIEnumInfo *info, - guint n); +GIValueInfo * gi_enum_info_get_value (GIEnumInfo *info, + unsigned int n); GI_AVAILABLE_IN_ALL -guint gi_enum_info_get_n_methods (GIEnumInfo *info); +unsigned int gi_enum_info_get_n_methods (GIEnumInfo *info); GI_AVAILABLE_IN_ALL -GIFunctionInfo * gi_enum_info_get_method (GIEnumInfo *info, - guint n); +GIFunctionInfo * gi_enum_info_get_method (GIEnumInfo *info, + unsigned int n); GI_AVAILABLE_IN_ALL GITypeTag gi_enum_info_get_storage_type (GIEnumInfo *info); @@ -78,6 +78,6 @@ const char * gi_enum_info_get_error_domain (GIEnumInfo *info); GI_AVAILABLE_IN_ALL -gint64 gi_value_info_get_value (GIValueInfo *info); +int64_t gi_value_info_get_value (GIValueInfo *info); G_END_DECLS diff --git a/girepository/gifieldinfo.c b/girepository/gifieldinfo.c index 533c2d243..9abc1ae40 100644 --- a/girepository/gifieldinfo.c +++ b/girepository/gifieldinfo.c @@ -222,35 +222,35 @@ gi_field_info_get_field (GIFieldInfo *field_info, break; case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_UINT8: - value->v_uint8 = G_STRUCT_MEMBER (guint8, mem, offset); + value->v_uint8 = G_STRUCT_MEMBER (uint8_t, mem, offset); result = TRUE; break; case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_UINT16: - value->v_uint16 = G_STRUCT_MEMBER (guint16, mem, offset); + value->v_uint16 = G_STRUCT_MEMBER (uint16_t, mem, offset); result = TRUE; break; case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_UNICHAR: - value->v_uint32 = G_STRUCT_MEMBER (guint32, mem, offset); + value->v_uint32 = G_STRUCT_MEMBER (uint32_t, mem, offset); result = TRUE; break; case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_UINT64: - value->v_uint64 = G_STRUCT_MEMBER (guint64, mem, offset); + value->v_uint64 = G_STRUCT_MEMBER (uint64_t, mem, offset); result = TRUE; break; case GI_TYPE_TAG_GTYPE: - value->v_size = G_STRUCT_MEMBER (gsize, mem, offset); + value->v_size = G_STRUCT_MEMBER (size_t, mem, offset); result = TRUE; break; case GI_TYPE_TAG_FLOAT: - value->v_float = G_STRUCT_MEMBER (gfloat, mem, offset); + value->v_float = G_STRUCT_MEMBER (float, mem, offset); result = TRUE; break; case GI_TYPE_TAG_DOUBLE: - value->v_double = G_STRUCT_MEMBER (gdouble, mem, offset); + value->v_double = G_STRUCT_MEMBER (double, mem, offset); result = TRUE; break; case GI_TYPE_TAG_ARRAY: @@ -287,8 +287,8 @@ gi_field_info_get_field (GIFieldInfo *field_info, case GI_INFO_TYPE_FLAGS: { /* FIXME: there's a mismatch here between the value->v_int we use - * here and the gint64 result returned from gi_value_info_get_value(). - * But to switch this to gint64, we'd have to make gi_function_info_invoke() + * here and the int64_t result returned from gi_value_info_get_value(). + * But to switch this to int64_t, we'd have to make gi_function_info_invoke() * translate value->v_int64 to the proper ABI for an enum function * call parameter, which will usually be int, and then fix up language * bindings. @@ -298,22 +298,22 @@ gi_field_info_get_field (GIFieldInfo *field_info, { case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_UINT8: - value->v_int = (gint)G_STRUCT_MEMBER (guint8, mem, offset); + value->v_int = (int)G_STRUCT_MEMBER (uint8_t, mem, offset); result = TRUE; break; case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_UINT16: - value->v_int = (gint)G_STRUCT_MEMBER (guint16, mem, offset); + value->v_int = (int)G_STRUCT_MEMBER (uint16_t, mem, offset); result = TRUE; break; case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_UINT32: - value->v_int = (gint)G_STRUCT_MEMBER (guint32, mem, offset); + value->v_int = (int)G_STRUCT_MEMBER (uint32_t, mem, offset); result = TRUE; break; case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_UINT64: - value->v_int = (gint)G_STRUCT_MEMBER (guint64, mem, offset); + value->v_int = (int)G_STRUCT_MEMBER (uint64_t, mem, offset); result = TRUE; break; default: @@ -413,23 +413,23 @@ gi_field_info_set_field (GIFieldInfo *field_info, break; case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_UINT8: - G_STRUCT_MEMBER (guint8, mem, offset) = value->v_uint8; + G_STRUCT_MEMBER (uint8_t, mem, offset) = value->v_uint8; result = TRUE; break; case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_UINT16: - G_STRUCT_MEMBER (guint16, mem, offset) = value->v_uint16; + G_STRUCT_MEMBER (uint16_t, mem, offset) = value->v_uint16; result = TRUE; break; case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_UNICHAR: - G_STRUCT_MEMBER (guint32, mem, offset) = value->v_uint32; + G_STRUCT_MEMBER (uint32_t, mem, offset) = value->v_uint32; result = TRUE; break; case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_UINT64: - G_STRUCT_MEMBER (guint64, mem, offset) = value->v_uint64; + G_STRUCT_MEMBER (uint64_t, mem, offset) = value->v_uint64; result = TRUE; break; case GI_TYPE_TAG_GTYPE: @@ -437,11 +437,11 @@ gi_field_info_set_field (GIFieldInfo *field_info, result = TRUE; break; case GI_TYPE_TAG_FLOAT: - G_STRUCT_MEMBER (gfloat, mem, offset) = value->v_float; + G_STRUCT_MEMBER (float, mem, offset) = value->v_float; result = TRUE; break; case GI_TYPE_TAG_DOUBLE: - G_STRUCT_MEMBER (gdouble, mem, offset)= value->v_double; + G_STRUCT_MEMBER (double, mem, offset)= value->v_double; result = TRUE; break; case GI_TYPE_TAG_UTF8: @@ -479,22 +479,22 @@ gi_field_info_set_field (GIFieldInfo *field_info, { case GI_TYPE_TAG_INT8: case GI_TYPE_TAG_UINT8: - G_STRUCT_MEMBER (guint8, mem, offset) = (guint8)value->v_int; + G_STRUCT_MEMBER (uint8_t, mem, offset) = (uint8_t)value->v_int; result = TRUE; break; case GI_TYPE_TAG_INT16: case GI_TYPE_TAG_UINT16: - G_STRUCT_MEMBER (guint16, mem, offset) = (guint16)value->v_int; + G_STRUCT_MEMBER (uint16_t, mem, offset) = (uint16_t)value->v_int; result = TRUE; break; case GI_TYPE_TAG_INT32: case GI_TYPE_TAG_UINT32: - G_STRUCT_MEMBER (guint32, mem, offset) = (guint32)value->v_int; + G_STRUCT_MEMBER (uint32_t, mem, offset) = (uint32_t)value->v_int; result = TRUE; break; case GI_TYPE_TAG_INT64: case GI_TYPE_TAG_UINT64: - G_STRUCT_MEMBER (guint64, mem, offset) = (guint64)value->v_int; + G_STRUCT_MEMBER (uint64_t, mem, offset) = (uint64_t)value->v_int; result = TRUE; break; default: diff --git a/girepository/gifunctioninfo.c b/girepository/gifunctioninfo.c index a79e874fe..525cd1ba1 100644 --- a/girepository/gifunctioninfo.c +++ b/girepository/gifunctioninfo.c @@ -50,15 +50,15 @@ GIFunctionInfo * gi_base_info_find_method (GIBaseInfo *base, - guint32 offset, - guint n_methods, + uint32_t offset, + unsigned n_methods, const char *name) { /* FIXME hash */ GIRealInfo *rinfo = (GIRealInfo*)base; Header *header = (Header *)rinfo->typelib->data; - for (guint i = 0; i < n_methods; i++) + for (unsigned i = 0; i < n_methods; i++) { FunctionBlob *fblob = (FunctionBlob *)&rinfo->typelib->data[offset]; const char *fname = (const char *)&rinfo->typelib->data[fblob->name]; diff --git a/girepository/giinterfaceinfo.c b/girepository/giinterfaceinfo.c index aad79cbad..e2eff78f0 100644 --- a/girepository/giinterfaceinfo.c +++ b/girepository/giinterfaceinfo.c @@ -55,7 +55,7 @@ * Returns: number of prerequisites * Since: 2.80 */ -guint +unsigned int gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -82,7 +82,7 @@ gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info) */ GIBaseInfo * gi_interface_info_get_prerequisite (GIInterfaceInfo *info, - guint n) + unsigned int n) { GIRealInfo *rinfo = (GIRealInfo *)info; InterfaceBlob *blob; @@ -106,7 +106,7 @@ gi_interface_info_get_prerequisite (GIInterfaceInfo *info, * Returns: number of properties * Since: 2.80 */ -guint +unsigned int gi_interface_info_get_n_properties (GIInterfaceInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -133,9 +133,9 @@ gi_interface_info_get_n_properties (GIInterfaceInfo *info) */ GIPropertyInfo * gi_interface_info_get_property (GIInterfaceInfo *info, - guint n) + unsigned int n) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; InterfaceBlob *blob; @@ -163,7 +163,7 @@ gi_interface_info_get_property (GIInterfaceInfo *info, * Returns: number of methods * Since: 2.80 */ -guint +unsigned int gi_interface_info_get_n_methods (GIInterfaceInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -190,9 +190,9 @@ gi_interface_info_get_n_methods (GIInterfaceInfo *info) */ GIFunctionInfo * gi_interface_info_get_method (GIInterfaceInfo *info, - guint n) + unsigned int n) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; InterfaceBlob *blob; @@ -230,7 +230,7 @@ GIFunctionInfo * gi_interface_info_find_method (GIInterfaceInfo *info, const char *name) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header = (Header *)rinfo->typelib->data; InterfaceBlob *blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset]; @@ -251,7 +251,7 @@ gi_interface_info_find_method (GIInterfaceInfo *info, * Returns: number of signals * Since: 2.80 */ -guint +unsigned int gi_interface_info_get_n_signals (GIInterfaceInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -278,9 +278,9 @@ gi_interface_info_get_n_signals (GIInterfaceInfo *info) */ GISignalInfo * gi_interface_info_get_signal (GIInterfaceInfo *info, - guint n) + unsigned int n) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; InterfaceBlob *blob; @@ -319,10 +319,10 @@ GISignalInfo * gi_interface_info_find_signal (GIInterfaceInfo *info, const char *name) { - guint n_signals; + unsigned int n_signals; n_signals = gi_interface_info_get_n_signals (info); - for (guint i = 0; i < n_signals; i++) + for (unsigned int i = 0; i < n_signals; i++) { GISignalInfo *siginfo = gi_interface_info_get_signal (info, i); @@ -346,7 +346,7 @@ gi_interface_info_find_signal (GIInterfaceInfo *info, * Returns: number of virtual functions * Since: 2.80 */ -guint +unsigned int gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -373,9 +373,9 @@ gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info) */ GIVFuncInfo * gi_interface_info_get_vfunc (GIInterfaceInfo *info, - guint n) + unsigned int n) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; InterfaceBlob *blob; @@ -416,7 +416,7 @@ GIVFuncInfo * gi_interface_info_find_vfunc (GIInterfaceInfo *info, const char *name) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; InterfaceBlob *blob; @@ -445,7 +445,7 @@ gi_interface_info_find_vfunc (GIInterfaceInfo *info, * Returns: number of constants * Since: 2.80 */ -guint +unsigned int gi_interface_info_get_n_constants (GIInterfaceInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -472,9 +472,9 @@ gi_interface_info_get_n_constants (GIInterfaceInfo *info) */ GIConstantInfo * gi_interface_info_get_constant (GIInterfaceInfo *info, - guint n) + unsigned int n) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; InterfaceBlob *blob; diff --git a/girepository/giinterfaceinfo.h b/girepository/giinterfaceinfo.h index 638f56bd4..798d8bc84 100644 --- a/girepository/giinterfaceinfo.h +++ b/girepository/giinterfaceinfo.h @@ -45,58 +45,58 @@ G_BEGIN_DECLS GI_AVAILABLE_IN_ALL -guint gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info); +unsigned int gi_interface_info_get_n_prerequisites (GIInterfaceInfo *info); GI_AVAILABLE_IN_ALL GIBaseInfo * gi_interface_info_get_prerequisite (GIInterfaceInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL -guint gi_interface_info_get_n_properties (GIInterfaceInfo *info); +unsigned int gi_interface_info_get_n_properties (GIInterfaceInfo *info); GI_AVAILABLE_IN_ALL GIPropertyInfo * gi_interface_info_get_property (GIInterfaceInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL -guint gi_interface_info_get_n_methods (GIInterfaceInfo *info); +unsigned int gi_interface_info_get_n_methods (GIInterfaceInfo *info); GI_AVAILABLE_IN_ALL GIFunctionInfo * gi_interface_info_get_method (GIInterfaceInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL GIFunctionInfo * gi_interface_info_find_method (GIInterfaceInfo *info, const char *name); GI_AVAILABLE_IN_ALL -guint gi_interface_info_get_n_signals (GIInterfaceInfo *info); +unsigned int gi_interface_info_get_n_signals (GIInterfaceInfo *info); GI_AVAILABLE_IN_ALL GISignalInfo * gi_interface_info_get_signal (GIInterfaceInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL GISignalInfo * gi_interface_info_find_signal (GIInterfaceInfo *info, const char *name); GI_AVAILABLE_IN_ALL -guint gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info); +unsigned int gi_interface_info_get_n_vfuncs (GIInterfaceInfo *info); GI_AVAILABLE_IN_ALL GIVFuncInfo * gi_interface_info_get_vfunc (GIInterfaceInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL GIVFuncInfo * gi_interface_info_find_vfunc (GIInterfaceInfo *info, const char *name); GI_AVAILABLE_IN_ALL -guint gi_interface_info_get_n_constants (GIInterfaceInfo *info); +unsigned int gi_interface_info_get_n_constants (GIInterfaceInfo *info); GI_AVAILABLE_IN_ALL GIConstantInfo * gi_interface_info_get_constant (GIInterfaceInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL diff --git a/girepository/ginvoke.c b/girepository/ginvoke.c index 5b9399a20..20d882cdc 100644 --- a/girepository/ginvoke.c +++ b/girepository/ginvoke.c @@ -270,7 +270,7 @@ g_value_from_ffi_value (GValue *gvalue, void gi_cclosure_marshal_generic (GClosure *closure, GValue *return_gvalue, - guint n_param_values, + unsigned int n_param_values, const GValue *param_values, void *invocation_hint, void *marshal_data) diff --git a/girepository/giobjectinfo.c b/girepository/giobjectinfo.c index 097ad5f37..995f489e7 100644 --- a/girepository/giobjectinfo.c +++ b/girepository/giobjectinfo.c @@ -59,20 +59,20 @@ * Returns: field offset, in bytes * Since: 2.80 */ -static gint32 +static uint32_t gi_object_info_get_field_offset (GIObjectInfo *info, - guint n) + unsigned int n) { GIRealInfo *rinfo = (GIRealInfo *)info; Header *header = (Header *)rinfo->typelib->data; ObjectBlob *blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset]; - guint32 offset; + uint32_t offset; FieldBlob *field_blob; offset = rinfo->offset + header->object_blob_size + (blob->n_interfaces + blob->n_interfaces % 2) * 2; - for (guint i = 0; i < n; i++) + for (unsigned int i = 0; i < n; i++) { field_blob = (FieldBlob *)&rinfo->typelib->data[offset]; offset += header->field_blob_size; @@ -241,7 +241,7 @@ gi_object_info_get_type_init_function_name (GIObjectInfo *info) * Returns: number of interfaces * Since: 2.80 */ -guint +unsigned int gi_object_info_get_n_interfaces (GIObjectInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -268,7 +268,7 @@ gi_object_info_get_n_interfaces (GIObjectInfo *info) */ GIInterfaceInfo * gi_object_info_get_interface (GIObjectInfo *info, - guint n) + unsigned int n) { GIRealInfo *rinfo = (GIRealInfo *)info; ObjectBlob *blob; @@ -291,7 +291,7 @@ gi_object_info_get_interface (GIObjectInfo *info, * Returns: number of fields * Since: 2.80 */ -guint +unsigned int gi_object_info_get_n_fields (GIObjectInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -318,9 +318,9 @@ gi_object_info_get_n_fields (GIObjectInfo *info) */ GIFieldInfo * gi_object_info_get_field (GIObjectInfo *info, - guint n) + unsigned int n) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; g_return_val_if_fail (info != NULL, NULL); @@ -340,7 +340,7 @@ gi_object_info_get_field (GIObjectInfo *info, * Returns: number of properties * Since: 2.80 */ -guint +unsigned int gi_object_info_get_n_properties (GIObjectInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -366,9 +366,9 @@ gi_object_info_get_n_properties (GIObjectInfo *info) */ GIPropertyInfo * gi_object_info_get_property (GIObjectInfo *info, - guint n) + unsigned int n) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; ObjectBlob *blob; @@ -398,7 +398,7 @@ gi_object_info_get_property (GIObjectInfo *info, * Returns: number of methods * Since: 2.80 */ -guint +unsigned int gi_object_info_get_n_methods (GIObjectInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -425,9 +425,9 @@ gi_object_info_get_n_methods (GIObjectInfo *info) */ GIFunctionInfo * gi_object_info_get_method (GIObjectInfo *info, - guint n) + unsigned int n) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; ObjectBlob *blob; @@ -468,7 +468,7 @@ GIFunctionInfo * gi_object_info_find_method (GIObjectInfo *info, const char *name) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; ObjectBlob *blob; @@ -559,7 +559,7 @@ gi_object_info_find_method_using_interfaces (GIObjectInfo *info, * Returns: number of signals * Since: 2.80 */ -guint +unsigned int gi_object_info_get_n_signals (GIObjectInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -586,9 +586,9 @@ gi_object_info_get_n_signals (GIObjectInfo *info) */ GISignalInfo * gi_object_info_get_signal (GIObjectInfo *info, - guint n) + unsigned int n) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; ObjectBlob *blob; @@ -629,10 +629,10 @@ GISignalInfo * gi_object_info_find_signal (GIObjectInfo *info, const char *name) { - guint n_signals; + unsigned int n_signals; n_signals = gi_object_info_get_n_signals (info); - for (guint i = 0; i < n_signals; i++) + for (unsigned int i = 0; i < n_signals; i++) { GISignalInfo *siginfo = gi_object_info_get_signal (info, i); @@ -657,7 +657,7 @@ gi_object_info_find_signal (GIObjectInfo *info, * Returns: number of virtual functions * Since: 2.80 */ -guint +unsigned int gi_object_info_get_n_vfuncs (GIObjectInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -684,9 +684,9 @@ gi_object_info_get_n_vfuncs (GIObjectInfo *info) */ GIVFuncInfo * gi_object_info_get_vfunc (GIObjectInfo *info, - guint n) + unsigned int n) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; ObjectBlob *blob; @@ -734,7 +734,7 @@ GIVFuncInfo * gi_object_info_find_vfunc (GIObjectInfo *info, const char *name) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; ObjectBlob *blob; @@ -832,7 +832,7 @@ gi_object_info_find_vfunc_using_interfaces (GIObjectInfo *info, * Returns: number of constants * Since: 2.80 */ -guint +unsigned int gi_object_info_get_n_constants (GIObjectInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -859,9 +859,9 @@ gi_object_info_get_n_constants (GIObjectInfo *info) */ GIConstantInfo * gi_object_info_get_constant (GIObjectInfo *info, - guint n) + unsigned int n) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header; ObjectBlob *blob; diff --git a/girepository/giobjectinfo.h b/girepository/giobjectinfo.h index d0e950403..c8b071d67 100644 --- a/girepository/giobjectinfo.h +++ b/girepository/giobjectinfo.h @@ -106,32 +106,32 @@ GI_AVAILABLE_IN_ALL GIObjectInfo * gi_object_info_get_parent (GIObjectInfo *info); GI_AVAILABLE_IN_ALL -guint gi_object_info_get_n_interfaces (GIObjectInfo *info); +unsigned int gi_object_info_get_n_interfaces (GIObjectInfo *info); GI_AVAILABLE_IN_ALL GIInterfaceInfo * gi_object_info_get_interface (GIObjectInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL -guint gi_object_info_get_n_fields (GIObjectInfo *info); +unsigned int gi_object_info_get_n_fields (GIObjectInfo *info); GI_AVAILABLE_IN_ALL GIFieldInfo * gi_object_info_get_field (GIObjectInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL -guint gi_object_info_get_n_properties (GIObjectInfo *info); +unsigned int gi_object_info_get_n_properties (GIObjectInfo *info); GI_AVAILABLE_IN_ALL GIPropertyInfo * gi_object_info_get_property (GIObjectInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL -guint gi_object_info_get_n_methods (GIObjectInfo *info); +unsigned int gi_object_info_get_n_methods (GIObjectInfo *info); GI_AVAILABLE_IN_ALL GIFunctionInfo * gi_object_info_get_method (GIObjectInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL GIFunctionInfo * gi_object_info_find_method (GIObjectInfo *info, @@ -145,11 +145,11 @@ GIFunctionInfo * gi_object_info_find_method_using_interfaces (GIObjectInfo *in GI_AVAILABLE_IN_ALL -guint gi_object_info_get_n_signals (GIObjectInfo *info); +unsigned int gi_object_info_get_n_signals (GIObjectInfo *info); GI_AVAILABLE_IN_ALL GISignalInfo * gi_object_info_get_signal (GIObjectInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL @@ -158,11 +158,11 @@ GISignalInfo * gi_object_info_find_signal (GIObjectInfo *info, GI_AVAILABLE_IN_ALL -guint gi_object_info_get_n_vfuncs (GIObjectInfo *info); +unsigned int gi_object_info_get_n_vfuncs (GIObjectInfo *info); GI_AVAILABLE_IN_ALL GIVFuncInfo * gi_object_info_get_vfunc (GIObjectInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL GIVFuncInfo * gi_object_info_find_vfunc (GIObjectInfo *info, @@ -174,11 +174,11 @@ GIVFuncInfo * gi_object_info_find_vfunc_using_interfaces (GIObjectInfo *inf GIObjectInfo **implementor); GI_AVAILABLE_IN_ALL -guint gi_object_info_get_n_constants (GIObjectInfo *info); +unsigned int gi_object_info_get_n_constants (GIObjectInfo *info); GI_AVAILABLE_IN_ALL GIConstantInfo * gi_object_info_get_constant (GIObjectInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL GIStructInfo * gi_object_info_get_class_struct (GIObjectInfo *info); diff --git a/girepository/girepository-private.h b/girepository/girepository-private.h index a9fb655ef..f3641ac5f 100644 --- a/girepository/girepository-private.h +++ b/girepository/girepository-private.h @@ -39,7 +39,7 @@ typedef struct _GIBaseInfo GIRealInfo; /* We changed a gint32 -> gint in the structure below, which should be * valid everywhere we care about. */ -G_STATIC_ASSERT (sizeof (int) == sizeof (gint32)); +G_STATIC_ASSERT (sizeof (int) == sizeof (int32_t)); /* * We just use one structure for all of the info object @@ -57,9 +57,9 @@ struct _GIBaseInfo GIBaseInfo *container; GITypelib *typelib; - guint32 offset; + uint32_t offset; - guint32 type_is_embedded : 1; /* Used by GITypeInfo */ + uint32_t type_is_embedded : 1; /* Used by GITypeInfo */ }; /* Subtypes */ @@ -215,33 +215,33 @@ void gi_info_init (GIRealInfo *info, GIRepository *repository, GIBaseInfo *container, GITypelib *typelib, - guint32 offset); + uint32_t offset); GIBaseInfo * gi_info_from_entry (GIRepository *repository, GITypelib *typelib, - guint16 index); + uint16_t index); GIBaseInfo * gi_info_new_full (GIInfoType type, GIRepository *repository, GIBaseInfo *container, GITypelib *typelib, - guint32 offset); + uint32_t offset); GITypeInfo * gi_type_info_new (GIBaseInfo *container, GITypelib *typelib, - guint32 offset); + uint32_t offset); void gi_type_info_init (GIBaseInfo *info, GIBaseInfo *container, GITypelib *typelib, - guint32 offset); + uint32_t offset); GIFunctionInfo * gi_base_info_find_method (GIBaseInfo *base, - guint32 offset, - guint n_methods, + uint32_t offset, + unsigned n_methods, const char *name); GIVFuncInfo * gi_base_info_find_vfunc (GIRealInfo *rinfo, - guint32 offset, - guint n_vfuncs, + uint32_t offset, + unsigned n_vfuncs, const char *name); diff --git a/girepository/girepository.c b/girepository/girepository.c index cd8512448..2d08047af 100644 --- a/girepository/girepository.c +++ b/girepository/girepository.c @@ -69,7 +69,7 @@ static GIRepository *default_repository = NULL; static GPtrArray *typelib_search_path = NULL; typedef struct { - guint n_interfaces; + unsigned int n_interfaces; GIBaseInfo *interfaces[]; } GTypeInterfaceCache; @@ -77,9 +77,8 @@ static void gtype_interface_cache_free (gpointer data) { GTypeInterfaceCache *cache = data; - guint i; - for (i = 0; i < cache->n_interfaces; i++) + for (unsigned int i = 0; i < cache->n_interfaces; i++) gi_base_info_unref ((GIBaseInfo*) cache->interfaces[i]); g_free (cache); } @@ -528,12 +527,11 @@ get_typelib_dependencies_transitive (GIRepository *repository, GITypelib *typelib, GHashTable *transitive_dependencies) { - guint i; char **immediate_dependencies; immediate_dependencies = get_typelib_dependencies (typelib); - for (i = 0; immediate_dependencies != NULL && immediate_dependencies[i]; i++) + for (unsigned int i = 0; immediate_dependencies != NULL && immediate_dependencies[i]; i++) { char *dependency; const char *last_dash; @@ -753,12 +751,12 @@ gi_repository_new (void) * Returns: number of metadata entries * Since: 2.80 */ -guint +unsigned int gi_repository_get_n_infos (GIRepository *repository, const char *namespace) { GITypelib *typelib; - guint n_interfaces = 0; + unsigned int n_interfaces = 0; g_return_val_if_fail (namespace != NULL, -1); @@ -794,7 +792,7 @@ gi_repository_get_n_infos (GIRepository *repository, GIBaseInfo * gi_repository_get_info (GIRepository *repository, const char *namespace, - guint idx) + unsigned int idx) { GITypelib *typelib; DirEntry *entry; @@ -1087,8 +1085,8 @@ gi_repository_get_object_gtype_interfaces (GIRepository *repository, if (cache == NULL) { GType *interfaces; - guint n_interfaces; - guint i; + unsigned int i; + unsigned int n_interfaces; GList *interface_infos = NULL, *iter; interfaces = g_type_interfaces (gtype, &n_interfaces); @@ -1154,7 +1152,7 @@ gi_repository_get_loaded_namespaces (GIRepository *repository) { GList *l, *list = NULL; char **names; - gint i; + int i; repository = get_repository (repository); diff --git a/girepository/girepository.h b/girepository/girepository.h index 6f8883d99..cac9413a8 100644 --- a/girepository/girepository.h +++ b/girepository/girepository.h @@ -169,13 +169,13 @@ void gi_repository_get_object_gtype_interfaces (GIRepository *repo GIInterfaceInfo ***interfaces_out); GI_AVAILABLE_IN_ALL -guint gi_repository_get_n_infos (GIRepository *repository, +unsigned int gi_repository_get_n_infos (GIRepository *repository, const char *namespace_); GI_AVAILABLE_IN_ALL GIBaseInfo * gi_repository_get_info (GIRepository *repository, const char *namespace_, - guint idx); + unsigned int idx); GI_AVAILABLE_IN_ALL GIEnumInfo * gi_repository_find_by_error_domain (GIRepository *repository, @@ -249,7 +249,7 @@ GQuark gi_repository_error_quark (void); GI_AVAILABLE_IN_ALL void gi_cclosure_marshal_generic (GClosure *closure, GValue *return_gvalue, - guint n_param_values, + unsigned int n_param_values, const GValue *param_values, void *invocation_hint, void *marshal_data); diff --git a/girepository/girffi.c b/girepository/girffi.c index 1629cfa16..7532fe3f5 100644 --- a/girepository/girffi.c +++ b/girepository/girffi.c @@ -176,7 +176,7 @@ gi_callable_info_get_ffi_arg_types (GICallableInfo *callable_info, ffi_type **arg_types; gboolean is_method, throws; size_t n_invoke_args; - guint n_args, i, offset; + unsigned int n_args, i, offset; g_return_val_if_fail (callable_info != NULL, NULL); diff --git a/girepository/girmodule-private.h b/girepository/girmodule-private.h index d99a5d3b4..8f1d62887 100644 --- a/girepository/girmodule-private.h +++ b/girepository/girmodule-private.h @@ -36,7 +36,7 @@ struct _GIIrTypelibBuild { GHashTable *strings; GHashTable *types; GList *nodes_with_attributes; - guint32 n_attributes; + uint32_t n_attributes; guchar *data; GList *stack; }; @@ -77,7 +77,7 @@ void gi_ir_module_add_include_module (GIIrModule *module, GITypelib * gi_ir_module_build_typelib (GIIrModule *module); -void gi_ir_module_fatal (GIIrTypelibBuild *build, guint line, const char *msg, ...) G_GNUC_PRINTF (3, 4) G_GNUC_NORETURN; +void gi_ir_module_fatal (GIIrTypelibBuild *build, unsigned int line, const char *msg, ...) G_GNUC_PRINTF (3, 4) G_GNUC_NORETURN; void gi_ir_node_init_stats (void); void gi_ir_node_dump_stats (void); diff --git a/girepository/girmodule.c b/girepository/girmodule.c index f7850632c..20c592aa2 100644 --- a/girepository/girmodule.c +++ b/girepository/girmodule.c @@ -98,7 +98,7 @@ gi_ir_module_free (GIIrModule *module) */ void gi_ir_module_fatal (GIIrTypelibBuild *build, - guint line, + unsigned int line, const char *msg, ...) { @@ -190,19 +190,19 @@ gi_ir_module_add_include_module (GIIrModule *module, struct AttributeWriteData { - guint count; + unsigned int count; guchar *databuf; GIIrNode *node; GHashTable *strings; - guint32 *offset; - guint32 *offset2; + uint32_t *offset; + uint32_t *offset2; }; static void write_attribute (gpointer key, gpointer value, gpointer datap) { struct AttributeWriteData *data = datap; - guint32 old_offset = *(data->offset); + uint32_t old_offset = *(data->offset); AttributeBlob *blob = (AttributeBlob*)&(data->databuf[old_offset]); *(data->offset) += sizeof (AttributeBlob); @@ -214,13 +214,13 @@ write_attribute (gpointer key, gpointer value, gpointer datap) data->count++; } -static guint +static unsigned write_attributes (GIIrModule *module, GIIrNode *node, GHashTable *strings, guchar *data, - guint32 *offset, - guint32 *offset2) + uint32_t *offset, + uint32_t *offset2) { struct AttributeWriteData wdata; wdata.count = 0; @@ -245,7 +245,7 @@ node_cmp_offset_func (const void *a, } static void -alloc_section (guint8 *data, SectionType section_id, guint32 offset) +alloc_section (uint8_t *data, SectionType section_id, uint32_t offset) { int i; Header *header = (Header*)data; @@ -266,21 +266,21 @@ alloc_section (guint8 *data, SectionType section_id, guint32 offset) g_assert_not_reached (); } -static guint8* -add_directory_index_section (guint8 *data, GIIrModule *module, guint32 *offset2) +static uint8_t * +add_directory_index_section (uint8_t *data, GIIrModule *module, uint32_t *offset2) { DirEntry *entry; Header *header = (Header*)data; GITypelibHashBuilder *dirindex_builder; - guint i, n_interfaces; - guint16 required_size; - guint32 new_offset; + uint16_t n_interfaces; + uint16_t required_size; + uint32_t new_offset; dirindex_builder = gi_typelib_hash_builder_new (); n_interfaces = ((Header *)data)->n_local_entries; - for (i = 0; i < n_interfaces; i++) + for (uint16_t i = 0; i < n_interfaces; i++) { const char *str; entry = (DirEntry *)&data[header->directory + (i * header->entry_blob_size)]; @@ -306,7 +306,7 @@ add_directory_index_section (guint8 *data, GIIrModule *module, guint32 *offset2) data = g_realloc (data, new_offset); - gi_typelib_hash_builder_pack (dirindex_builder, ((guint8*)data) + *offset2, required_size); + gi_typelib_hash_builder_pack (dirindex_builder, ((uint8_t*)data) + *offset2, required_size); *offset2 = new_offset; @@ -320,20 +320,20 @@ gi_ir_module_build_typelib (GIIrModule *module) GError *error = NULL; GITypelib *typelib; gsize length; - guint i; + unsigned int i; GList *e; Header *header; DirEntry *entry; - guint32 header_size; - guint32 dir_size; - guint32 n_entries; - guint32 n_local_entries; - guint32 size, offset, offset2, old_offset; + uint32_t header_size; + uint32_t dir_size; + uint32_t n_entries; + uint32_t n_local_entries; + uint32_t size, offset, offset2, old_offset; GHashTable *strings; GHashTable *types; GList *nodes_with_attributes; char *dependencies; - guchar *data; + uint8_t *data; Section *section; header_size = ALIGN_VALUE (sizeof (Header), 4); diff --git a/girepository/girnode-private.h b/girepository/girnode-private.h index 21f034423..8cd5d4a40 100644 --- a/girepository/girnode-private.h +++ b/girepository/girnode-private.h @@ -76,7 +76,7 @@ struct _GIIrNode char *name; GIIrModule *module; - guint32 offset; /* Assigned as we build the typelib */ + uint32_t offset; /* Assigned as we build the typelib */ GHashTable *attributes; }; @@ -122,16 +122,16 @@ struct _GIIrNodeType gboolean is_ghashtable; gboolean is_interface; gboolean is_error; - gint tag; + int tag; char *unparsed; gboolean zero_terminated; gboolean has_length; - gint length; + int length; gboolean has_size; - gint size; - gint array_type; + int size; + int array_type; GIIrNodeType *parameter_type1; GIIrNodeType *parameter_type2; @@ -155,8 +155,8 @@ struct _GIIrNodeParam gboolean shallow_transfer; GIScopeType scope; - gint8 closure; - gint8 destroy; + int8_t closure; + int8_t destroy; GIIrNodeType *type; }; @@ -199,7 +199,7 @@ struct _GIIrNodeSignal gboolean has_class_closure; gboolean true_stops_emit; - gint class_closure; + int class_closure; GList *parameters; GIIrNodeParam *result; @@ -222,7 +222,7 @@ struct _GIIrNodeVFunc GList *parameters; GIIrNodeParam *result; - gint offset; + int offset; }; struct _GIIrNodeField @@ -231,8 +231,8 @@ struct _GIIrNodeField gboolean readable; gboolean writable; - gint bits; - gint offset; + int bits; + int offset; GIIrNodeFunction *callback; GIIrNodeType *type; @@ -261,8 +261,8 @@ struct _GIIrNodeInterface GList *interfaces; GList *prerequisites; - gint alignment; - gint size; + int alignment; + int size; GList *members; }; @@ -273,7 +273,7 @@ struct _GIIrNodeValue gboolean deprecated; - gint64 value; + int64_t value; }; struct _GIIrNodeConstant @@ -292,7 +292,7 @@ struct _GIIrNodeEnum GIIrNode node; gboolean deprecated; - gint storage_type; + int storage_type; char *gtype_name; char *gtype_init; @@ -311,8 +311,8 @@ struct _GIIrNodeBoxed char *gtype_name; char *gtype_init; - gint alignment; - gint size; + int alignment; + int size; GList *members; }; @@ -334,8 +334,8 @@ struct _GIIrNodeStruct char *copy_func; char *free_func; - gint alignment; - gint size; + int alignment; + int size; GList *members; }; @@ -355,10 +355,10 @@ struct _GIIrNodeUnion char *copy_func; char *free_func; - gint alignment; - gint size; + int alignment; + int size; - gint discriminator_offset; + int discriminator_offset; GIIrNodeType *discriminator_type; }; @@ -366,23 +366,23 @@ struct _GIIrNodeUnion GIIrNode *gi_ir_node_new (GIIrNodeTypeId type, GIIrModule *module); void gi_ir_node_free (GIIrNode *node); -guint32 gi_ir_node_get_size (GIIrNode *node); -guint32 gi_ir_node_get_full_size (GIIrNode *node); +uint32_t gi_ir_node_get_size (GIIrNode *node); +uint32_t gi_ir_node_get_full_size (GIIrNode *node); void gi_ir_node_build_typelib (GIIrNode *node, GIIrNode *parent, GIIrTypelibBuild *build, - guint32 *offset, - guint32 *offset2, - guint16 *count2); + uint32_t *offset, + uint32_t *offset2, + uint16_t *count2); int gi_ir_node_cmp (GIIrNode *node, GIIrNode *other); gboolean gi_ir_node_can_have_member (GIIrNode *node); void gi_ir_node_add_member (GIIrNode *node, GIIrNodeFunction *member); -guint32 gi_ir_write_string (const char *str, +uint32_t gi_ir_write_string (const char *str, GHashTable *strings, guchar *data, - guint32 *offset); + uint32_t *offset); const char * gi_ir_node_param_direction_string (GIIrNodeParam * node); const char * gi_ir_node_type_to_string (GIIrNodeTypeId type); diff --git a/girepository/girnode.c b/girepository/girnode.c index 6efa65fd8..b77bbf97f 100644 --- a/girepository/girnode.c +++ b/girepository/girnode.c @@ -431,11 +431,11 @@ gi_ir_node_free (GIIrNode *node) } /* returns the fixed size of the blob */ -guint32 +uint32_t gi_ir_node_get_size (GIIrNode *node) { GList *l; - gint size, n; + int size, n; switch (node->type) { @@ -575,7 +575,7 @@ add_attribute_size (gpointer key, gpointer value, gpointer data) { const char *key_str = key; const char *value_str = value; - gint *size_p = data; + int *size_p = data; *size_p += sizeof (AttributeBlob); *size_p += ALIGN_VALUE (strlen (key_str) + 1, 4); @@ -583,12 +583,12 @@ add_attribute_size (gpointer key, gpointer value, gpointer data) } /* returns the full size of the blob including variable-size parts (including attributes) */ -static guint32 +static uint32_t gi_ir_node_get_full_size_internal (GIIrNode *parent, GIIrNode *node) { GList *l; - gint size, n; + int size, n; if (node == NULL && parent != NULL) g_error ("Caught NULL node, parent=%s", parent->name); @@ -893,7 +893,7 @@ gi_ir_node_get_full_size_internal (GIIrNode *parent, return size; } -guint32 +uint32_t gi_ir_node_get_full_size (GIIrNode *node) { return gi_ir_node_get_full_size_internal (NULL, node); @@ -1009,19 +1009,19 @@ gi_ir_node_param_direction_string (GIIrNodeParam * node) return "in"; } -static gint64 +static int64_t parse_int_value (const char *str) { return g_ascii_strtoll (str, NULL, 0); } -static guint64 +static uint64_t parse_uint_value (const char *str) { return g_ascii_strtoull (str, NULL, 0); } -static gdouble +static double parse_float_value (const char *str) { return g_ascii_strtod (str, NULL); @@ -1042,13 +1042,13 @@ parse_boolean_value (const char *str) static GIIrNode * find_entry_node (GIIrTypelibBuild *build, const char *name, - guint16 *idx) + uint16_t *idx) { GIIrModule *module = build->module; GList *l; - gint i; - gint n_names; + int i; + int n_names; char **names; GIIrNode *result = NULL; @@ -1112,11 +1112,11 @@ find_entry_node (GIIrTypelibBuild *build, return result; } -static guint16 +static uint16_t find_entry (GIIrTypelibBuild *build, const char *name) { - guint16 idx = 0; + uint16_t idx = 0; find_entry_node (build, name, &idx); @@ -1155,7 +1155,7 @@ gi_ir_find_node (GIIrTypelibBuild *build, GList *l; GIIrNode *return_node = NULL; char **names = g_strsplit (name, ".", 0); - gint n_names = g_strv_length (names); + int n_names = g_strv_length (names); const char *target_name; GIIrModule *target_module; @@ -1196,7 +1196,7 @@ get_index_of_member_type (GIIrNodeInterface *node, GIIrNodeTypeId type, const char *name) { - gint index = -1; + int index = -1; GList *l; for (l = node->members; l; l = l->next) @@ -1220,7 +1220,7 @@ serialize_type (GIIrTypelibBuild *build, GIIrNodeType *node, GString *str) { - gint i; + int i; if (GI_TYPE_TAG_IS_BASIC (node->tag)) { @@ -1341,12 +1341,12 @@ serialize_type (GIIrTypelibBuild *build, static void gi_ir_node_build_members (GList **members, GIIrNodeTypeId type, - guint16 *count, + uint16_t *count, GIIrNode *parent, GIIrTypelibBuild *build, - guint32 *offset, - guint32 *offset2, - guint16 *count2) + uint32_t *offset, + uint32_t *offset2, + uint16_t *count2) { GList *l = *members; @@ -1398,17 +1398,17 @@ void gi_ir_node_build_typelib (GIIrNode *node, GIIrNode *parent, GIIrTypelibBuild *build, - guint32 *offset, - guint32 *offset2, - guint16 *count2) + uint32_t *offset, + uint32_t *offset2, + uint16_t *count2) { gboolean appended_stack; GHashTable *strings = build->strings; GHashTable *types = build->types; guchar *data = build->data; GList *l; - guint32 old_offset = *offset; - guint32 old_offset2 = *offset2; + uint32_t old_offset = *offset; + uint32_t old_offset2 = *offset2; g_assert (node != NULL); @@ -1480,7 +1480,7 @@ gi_ir_node_build_typelib (GIIrNode *node, case GI_TYPE_TAG_ARRAY: { ArrayTypeBlob *array = (ArrayTypeBlob *)&data[*offset2]; - guint32 pos; + uint32_t pos; array->pointer = type->is_pointer; array->reserved = 0; @@ -1523,7 +1523,7 @@ gi_ir_node_build_typelib (GIIrNode *node, case GI_TYPE_TAG_GSLIST: { ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2]; - guint32 pos; + uint32_t pos; param->pointer = 1; param->reserved = 0; @@ -1542,7 +1542,7 @@ gi_ir_node_build_typelib (GIIrNode *node, case GI_TYPE_TAG_GHASH: { ParamTypeBlob *param = (ParamTypeBlob *)&data[*offset2]; - guint32 pos; + uint32_t pos; param->pointer = 1; param->reserved = 0; @@ -1653,7 +1653,7 @@ gi_ir_node_build_typelib (GIIrNode *node, g_error ("Unknown setter %s for property %s:%s", prop->setter, parent->name, node->name); } - blob->setter = (guint) index; + blob->setter = (unsigned int) index; } else blob->setter = ACCESSOR_SENTINEL; @@ -1668,7 +1668,7 @@ gi_ir_node_build_typelib (GIIrNode *node, g_error ("Unknown getter %s for property %s:%s", prop->getter, parent->name, node->name); } - blob->getter = (guint) index; + blob->getter = (unsigned int) index; } else blob->getter = ACCESSOR_SENTINEL; @@ -1683,8 +1683,8 @@ gi_ir_node_build_typelib (GIIrNode *node, FunctionBlob *blob = (FunctionBlob *)&data[*offset]; SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2]; GIIrNodeFunction *function = (GIIrNodeFunction *)node; - guint32 signature; - gint n; + uint32_t signature; + int n; signature = *offset2; n = g_list_length (function->parameters); @@ -1717,7 +1717,7 @@ gi_ir_node_build_typelib (GIIrNode *node, blob->setter = function->is_setter; blob->getter = function->is_getter; - blob->index = (guint) index; + blob->index = (unsigned int) index; } /* function->result is special since it doesn't appear in the serialized format but @@ -1759,8 +1759,8 @@ gi_ir_node_build_typelib (GIIrNode *node, CallbackBlob *blob = (CallbackBlob *)&data[*offset]; SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2]; GIIrNodeFunction *function = (GIIrNodeFunction *)node; - guint32 signature; - gint n; + uint32_t signature; + unsigned int n; signature = *offset2; n = g_list_length (function->parameters); @@ -1800,8 +1800,8 @@ gi_ir_node_build_typelib (GIIrNode *node, SignalBlob *blob = (SignalBlob *)&data[*offset]; SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2]; GIIrNodeSignal *signal = (GIIrNodeSignal *)node; - guint32 signature; - gint n; + uint32_t signature; + unsigned int n; signature = *offset2; n = g_list_length (signal->parameters); @@ -1858,8 +1858,8 @@ gi_ir_node_build_typelib (GIIrNode *node, VFuncBlob *blob = (VFuncBlob *)&data[*offset]; SignatureBlob *blob2 = (SignatureBlob *)&data[*offset2]; GIIrNodeVFunc *vfunc = (GIIrNodeVFunc *)node; - guint32 signature; - gint n; + uint32_t signature; + unsigned int n; signature = *offset2; n = g_list_length (vfunc->parameters); @@ -1882,7 +1882,7 @@ gi_ir_node_build_typelib (GIIrNode *node, { g_error ("Unknown member function %s for vfunc %s", vfunc->invoker, node->name); } - blob->invoker = (guint) index; + blob->invoker = (unsigned int) index; } else blob->invoker = 0x3ff; /* max of 10 bits */ @@ -2204,7 +2204,7 @@ gi_ir_node_build_typelib (GIIrNode *node, for (l = object->interfaces; l; l = l->next) { blob->n_interfaces++; - *(guint16*)&data[*offset] = find_entry (build, (char *)l->data); + *(uint16_t *)&data[*offset] = find_entry (build, (char *)l->data); *offset += 2; } @@ -2267,7 +2267,7 @@ gi_ir_node_build_typelib (GIIrNode *node, for (l = iface->prerequisites; l; l = l->next) { blob->n_prerequisites++; - *(guint16*)&data[*offset] = find_entry (build, (char *)l->data); + *(uint16_t *)&data[*offset] = find_entry (build, (char *)l->data); *offset += 2; } @@ -2310,7 +2310,7 @@ gi_ir_node_build_typelib (GIIrNode *node, blob->reserved = 0; blob->unsigned_value = value->value >= 0 ? 1 : 0; blob->name = gi_ir_write_string (node->name, strings, data, offset2); - blob->value = (gint32)value->value; + blob->value = (int32_t) value->value; } break; @@ -2318,7 +2318,7 @@ gi_ir_node_build_typelib (GIIrNode *node, { GIIrNodeConstant *constant = (GIIrNodeConstant *)node; ConstantBlob *blob = (ConstantBlob *)&data[*offset]; - guint32 pos; + uint32_t pos; pos = *offset + G_STRUCT_OFFSET (ConstantBlob, type); *offset += sizeof (ConstantBlob); @@ -2337,43 +2337,43 @@ gi_ir_node_build_typelib (GIIrNode *node, break; case GI_TYPE_TAG_INT8: blob->size = 1; - *(gint8*)&data[blob->offset] = (gint8) parse_int_value (constant->value); + *(int8_t *)&data[blob->offset] = (int8_t) parse_int_value (constant->value); break; case GI_TYPE_TAG_UINT8: blob->size = 1; - *(guint8*)&data[blob->offset] = (guint8) parse_uint_value (constant->value); + *(uint8_t *)&data[blob->offset] = (uint8_t) parse_uint_value (constant->value); break; case GI_TYPE_TAG_INT16: blob->size = 2; - *(gint16*)&data[blob->offset] = (gint16) parse_int_value (constant->value); + *(int16_t *)&data[blob->offset] = (int16_t) parse_int_value (constant->value); break; case GI_TYPE_TAG_UINT16: blob->size = 2; - *(guint16*)&data[blob->offset] = (guint16) parse_uint_value (constant->value); + *(uint16_t *)&data[blob->offset] = (uint16_t) parse_uint_value (constant->value); break; case GI_TYPE_TAG_INT32: blob->size = 4; - *(gint32*)&data[blob->offset] = (gint32) parse_int_value (constant->value); + *(int32_t *)&data[blob->offset] = (int32_t) parse_int_value (constant->value); break; case GI_TYPE_TAG_UINT32: blob->size = 4; - *(guint32*)&data[blob->offset] = (guint32) parse_uint_value (constant->value); + *(uint32_t*)&data[blob->offset] = (uint32_t) parse_uint_value (constant->value); break; case GI_TYPE_TAG_INT64: blob->size = 8; - DO_ALIGNED_COPY(&data[blob->offset], parse_int_value (constant->value), gint64); + DO_ALIGNED_COPY (&data[blob->offset], parse_int_value (constant->value), int64_t); break; case GI_TYPE_TAG_UINT64: blob->size = 8; - DO_ALIGNED_COPY(&data[blob->offset], parse_uint_value (constant->value), guint64); + DO_ALIGNED_COPY (&data[blob->offset], parse_uint_value (constant->value), uint64_t); break; case GI_TYPE_TAG_FLOAT: - blob->size = sizeof (gfloat); - DO_ALIGNED_COPY(&data[blob->offset], parse_float_value (constant->value), gfloat); + blob->size = sizeof (float); + DO_ALIGNED_COPY (&data[blob->offset], parse_float_value (constant->value), float); break; case GI_TYPE_TAG_DOUBLE: - blob->size = sizeof (gdouble); - DO_ALIGNED_COPY(&data[blob->offset], parse_float_value (constant->value), gdouble); + blob->size = sizeof (double); + DO_ALIGNED_COPY (&data[blob->offset], parse_float_value (constant->value), double); break; case GI_TYPE_TAG_UTF8: case GI_TYPE_TAG_FILENAME: @@ -2411,13 +2411,13 @@ gi_ir_node_build_typelib (GIIrNode *node, * to the typelib at offset, put it in the pool and update offset. If the * typelib is not large enough to hold the string, reallocate it. */ -guint32 +uint32_t gi_ir_write_string (const char *str, GHashTable *strings, guchar *data, - guint32 *offset) + uint32_t *offset) { - guint32 start; + uint32_t start; void *value; string_count += 1; diff --git a/girepository/giroffsets.c b/girepository/giroffsets.c index 8031e03a8..91b81cf64 100644 --- a/girepository/giroffsets.c +++ b/girepository/giroffsets.c @@ -54,7 +54,7 @@ typedef enum { } Enum5; typedef enum { - ENUM_6 = ((guint)G_MAXINT) + 1 /* compiler could use uint32 */ + ENUM_6 = ((unsigned int)G_MAXINT) + 1 /* compiler could use uint32 */ } Enum6; typedef enum { @@ -73,8 +73,8 @@ static void compute_enum_storage_type (GIIrNodeEnum *enum_node) { GList *l; - gint64 max_value = 0; - gint64 min_value = 0; + int64_t max_value = 0; + int64_t min_value = 0; int width; gboolean signed_type; @@ -106,32 +106,32 @@ compute_enum_storage_type (GIIrNodeEnum *enum_node) if (max_value <= 127) { width = sizeof (Enum1); - signed_type = (gint64)(Enum1)(-1) < 0; + signed_type = (int64_t)(Enum1)(-1) < 0; } else if (max_value <= 255) { width = sizeof (Enum2); - signed_type = (gint64)(Enum2)(-1) < 0; + signed_type = (int64_t)(Enum2)(-1) < 0; } else if (max_value <= G_MAXSHORT) { width = sizeof (Enum3); - signed_type = (gint64)(Enum3)(-1) < 0; + signed_type = (int64_t)(Enum3)(-1) < 0; } else if (max_value <= G_MAXUSHORT) { width = sizeof (Enum4); - signed_type = (gint64)(Enum4)(-1) < 0; + signed_type = (int64_t)(Enum4)(-1) < 0; } else if (max_value <= G_MAXINT) { width = sizeof (Enum5); - signed_type = (gint64)(Enum5)(-1) < 0; + signed_type = (int64_t)(Enum5)(-1) < 0; } else { width = sizeof (Enum6); - signed_type = (gint64)(Enum6)(-1) < 0; + signed_type = (int64_t)(Enum6)(-1) < 0; } } @@ -149,8 +149,8 @@ compute_enum_storage_type (GIIrNodeEnum *enum_node) static gboolean get_enum_size_alignment (GIIrNodeEnum *enum_node, - gint *size, - gint *alignment) + int *size, + int *alignment) { ffi_type *type_ffi; @@ -188,8 +188,8 @@ get_enum_size_alignment (GIIrNodeEnum *enum_node, static gboolean get_interface_size_alignment (GIIrTypelibBuild *build, GIIrNodeType *type, - gint *size, - gint *alignment, + int *size, + int *alignment, const char *who) { GIIrNode *iface; @@ -265,8 +265,8 @@ get_interface_size_alignment (GIIrTypelibBuild *build, static gboolean get_type_size_alignment (GIIrTypelibBuild *build, GIIrNodeType *type, - gint *size, - gint *alignment, + int *size, + int *alignment, const char *who) { ffi_type *type_ffi; @@ -277,7 +277,7 @@ get_type_size_alignment (GIIrTypelibBuild *build, } else if (type->tag == GI_TYPE_TAG_ARRAY) { - gint elt_size, elt_alignment; + int elt_size, elt_alignment; if (!type->has_size || !get_type_size_alignment(build, type->parameter_type1, @@ -333,8 +333,8 @@ static gboolean get_field_size_alignment (GIIrTypelibBuild *build, GIIrNodeField *field, GIIrNode *parent_node, - gint *size, - gint *alignment) + int *size, + int *alignment) { GIIrModule *module = build->module; char *who; @@ -361,8 +361,8 @@ static gboolean compute_struct_field_offsets (GIIrTypelibBuild *build, GIIrNode *node, GList *members, - gint *size_out, - gint *alignment_out) + int *size_out, + int *alignment_out) { int size = 0; int alignment = 1; @@ -428,8 +428,8 @@ static gboolean compute_union_field_offsets (GIIrTypelibBuild *build, GIIrNode *node, GList *members, - gint *size_out, - gint *alignment_out) + int *size_out, + int *alignment_out) { int size = 0; int alignment = 1; @@ -483,7 +483,7 @@ compute_union_field_offsets (GIIrTypelibBuild *build, static gboolean check_needs_computation (GIIrTypelibBuild *build, GIIrNode *node, - gint alignment) + int alignment) { GIIrModule *module = build->module; /* diff --git a/girepository/girparser.c b/girepository/girparser.c index 1ad0562e5..f0336a2e2 100644 --- a/girepository/girparser.c +++ b/girepository/girparser.c @@ -383,9 +383,7 @@ find_attribute (const char *name, const char **attribute_names, const char **attribute_values) { - gint i; - - for (i = 0; attribute_names[i] != NULL; i++) + for (int i = 0; attribute_names[i] != NULL; i++) if (strcmp (attribute_names[i], name) == 0) return attribute_values[i]; @@ -435,8 +433,8 @@ static GIIrNodeType * parse_type_internal (GIIrModule *module, typedef struct { const char *str; - guint size; - guint is_signed : 1; + unsigned int size; + unsigned int is_signed : 1; } IntegerAliasInfo; static IntegerAliasInfo integer_aliases[] = { @@ -456,7 +454,7 @@ static IntegerAliasInfo integer_aliases[] = { typedef struct { const char *str; - gint tag; + int tag; gboolean pointer; } BasicTypeInfo; @@ -486,8 +484,8 @@ static BasicTypeInfo basic_types[] = { static const BasicTypeInfo * parse_basic (const char *str) { - guint i; - guint n_basic = G_N_ELEMENTS (basic_types); + unsigned int i; + unsigned int n_basic = G_N_ELEMENTS (basic_types); for (i = 0; i < n_basic; i++) { @@ -500,25 +498,25 @@ parse_basic (const char *str) { switch (integer_aliases[i].size) { - case sizeof(guint8): + case sizeof (uint8_t): if (integer_aliases[i].is_signed) return &basic_types[BASIC_TYPE_FIXED_OFFSET]; else return &basic_types[BASIC_TYPE_FIXED_OFFSET+1]; break; - case sizeof(guint16): + case sizeof (uint16_t): if (integer_aliases[i].is_signed) return &basic_types[BASIC_TYPE_FIXED_OFFSET+2]; else return &basic_types[BASIC_TYPE_FIXED_OFFSET+3]; break; - case sizeof(guint32): + case sizeof (uint32_t): if (integer_aliases[i].is_signed) return &basic_types[BASIC_TYPE_FIXED_OFFSET+4]; else return &basic_types[BASIC_TYPE_FIXED_OFFSET+5]; break; - case sizeof(guint64): + case sizeof (uint64_t): if (integer_aliases[i].is_signed) return &basic_types[BASIC_TYPE_FIXED_OFFSET+6]; else @@ -705,7 +703,7 @@ resolve_aliases (ParseContext *ctx, const char *type) if (g_slist_find_custom (seen_values, lookup, (GCompareFunc)strcmp) != NULL) break; - seen_values = g_slist_prepend (seen_values, (gchar*)lookup); + seen_values = g_slist_prepend (seen_values, (char*) lookup); } g_slist_free (seen_values); @@ -1661,7 +1659,7 @@ start_property (GMarkupParseContext *context, return TRUE; } -static gint64 +static int64_t parse_value (const char *str) { char *shift_op; @@ -1671,7 +1669,7 @@ parse_value (const char *str) if (shift_op) { - gint64 base, shift; + int64_t base, shift; base = g_ascii_strtoll (str, NULL, 10); shift = g_ascii_strtoll (shift_op + 3, NULL, 10); @@ -3243,7 +3241,7 @@ start_element_handler (GMarkupParseContext *context, if (*error == NULL && ctx->state != STATE_PASSTHROUGH) { - gint line_number, char_number; + int line_number, char_number; g_markup_parse_context_get_position (context, &line_number, &char_number); if (!g_str_has_prefix (element_name, "c:")) g_printerr ("%s:%d:%d: warning: element %s from state %d is unknown, ignoring\n", @@ -3255,7 +3253,7 @@ start_element_handler (GMarkupParseContext *context, out: if (*error) { - gint line_number, char_number; + int line_number, char_number; g_markup_parse_context_get_position (context, &line_number, &char_number); g_printerr ("%s:%d:%d: error: %s\n", ctx->file_path, line_number, char_number, (*error)->message); diff --git a/girepository/girwriter.c b/girepository/girwriter.c index 5d9763bf7..c9dcc7f0e 100644 --- a/girepository/girwriter.c +++ b/girepository/girwriter.c @@ -45,7 +45,7 @@ typedef struct { typedef struct { char *name; - guint has_children : 1; + unsigned has_children : 1; } XmlElement; static XmlElement * @@ -173,7 +173,7 @@ check_unresolved (GIBaseInfo *info) } static void -write_type_name (const char *ns, +write_type_name (const char *ns, GIBaseInfo *info, Xml *file) { @@ -184,7 +184,7 @@ write_type_name (const char *ns, } static void -write_type_name_attribute (const char *ns, +write_type_name_attribute (const char *ns, GIBaseInfo *info, const char *attr_name, Xml *file) @@ -215,11 +215,11 @@ write_ownership_transfer (GITransfer transfer, } static void -write_type_info (const char *ns, +write_type_info (const char *ns, GITypeInfo *info, Xml *file) { - gint tag; + int tag; GITypeInfo *type; gboolean is_pointer; @@ -244,7 +244,7 @@ write_type_info (const char *ns, } else if (tag == GI_TYPE_TAG_ARRAY) { - gint length; + int length; gssize size; const char *name = NULL; @@ -379,7 +379,7 @@ write_return_value_attributes (Xml *file, } static void -write_constant_value (const char *ns, +write_constant_value (const char *ns, GITypeInfo *info, GIArgument *argument, Xml *file); @@ -390,15 +390,15 @@ write_callback_info (const char *ns, Xml *file); static void -write_field_info (const char *ns, +write_field_info (const char *ns, GIFieldInfo *info, GIConstantInfo *branch, Xml *file) { const char *name; GIFieldInfoFlags flags; - gint size; - gint offset; + int size; + int offset; GITypeInfo *type; GIBaseInfo *interface; GIArgument value; @@ -490,7 +490,7 @@ write_callable_info (const char *ns, return; xml_start_element (file, "parameters"); - for (guint i = 0; i < gi_callable_info_get_n_args (info); i++) + for (unsigned int i = 0; i < gi_callable_info_get_n_args (info); i++) { GIArgInfo *arg = gi_callable_info_get_arg (info, i); @@ -568,7 +568,7 @@ write_callable_info (const char *ns, } static void -write_function_info (const char *ns, +write_function_info (const char *ns, GIFunctionInfo *info, Xml *file) { @@ -651,8 +651,8 @@ write_struct_info (const char *ns, gboolean deprecated; gboolean is_gtype_struct; gboolean foreign; - gint size; - guint n_elts; + int size; + unsigned int n_elts; name = gi_base_info_get_name ((GIBaseInfo *)info); deprecated = gi_base_info_is_deprecated ((GIBaseInfo *)info); @@ -702,14 +702,14 @@ write_struct_info (const char *ns, n_elts = gi_struct_info_get_n_fields (info) + gi_struct_info_get_n_methods (info); if (n_elts > 0) { - for (guint i = 0; i < gi_struct_info_get_n_fields (info); i++) + for (unsigned int i = 0; i < gi_struct_info_get_n_fields (info); i++) { GIFieldInfo *field = gi_struct_info_get_field (info, i); write_field_info (ns, field, NULL, file); gi_base_info_unref ((GIBaseInfo *)field); } - for (guint i = 0; i < gi_struct_info_get_n_methods (info); i++) + for (unsigned int i = 0; i < gi_struct_info_get_n_methods (info); i++) { GIFunctionInfo *function = gi_struct_info_get_method (info, i); write_function_info (ns, function, file); @@ -722,12 +722,12 @@ write_struct_info (const char *ns, } static void -write_value_info (const char *ns, +write_value_info (const char *ns, GIValueInfo *info, Xml *file) { const char *name; - gint64 value; + int64_t value; char *value_str; gboolean deprecated; @@ -863,7 +863,7 @@ write_enum_info (const char *ns, write_attributes (file, (GIBaseInfo*) info); - for (guint i = 0; i < gi_enum_info_get_n_values (info); i++) + for (unsigned int i = 0; i < gi_enum_info_get_n_values (info); i++) { GIValueInfo *value = gi_enum_info_get_value (info, i); write_value_info (ns, value, file); @@ -925,7 +925,7 @@ write_vfunc_info (const char *ns, const char *name; GIFunctionInfo *invoker; gboolean deprecated; - gint offset; + int offset; name = gi_base_info_get_name ((GIBaseInfo *)info); flags = gi_vfunc_info_get_flags (info); @@ -1100,7 +1100,7 @@ write_object_info (const char *ns, if (gi_object_info_get_n_interfaces (info) > 0) { - for (guint i = 0; i < gi_object_info_get_n_interfaces (info); i++) + for (unsigned int i = 0; i < gi_object_info_get_n_interfaces (info); i++) { GIInterfaceInfo *imp = gi_object_info_get_interface (info, i); xml_start_element (file, "implements"); @@ -1110,42 +1110,42 @@ write_object_info (const char *ns, } } - for (guint i = 0; i < gi_object_info_get_n_fields (info); i++) + for (unsigned int i = 0; i < gi_object_info_get_n_fields (info); i++) { GIFieldInfo *field = gi_object_info_get_field (info, i); write_field_info (ns, field, NULL, file); gi_base_info_unref ((GIBaseInfo *)field); } - for (guint i = 0; i < gi_object_info_get_n_methods (info); i++) + for (unsigned int i = 0; i < gi_object_info_get_n_methods (info); i++) { GIFunctionInfo *function = gi_object_info_get_method (info, i); write_function_info (ns, function, file); gi_base_info_unref ((GIBaseInfo *)function); } - for (guint i = 0; i < gi_object_info_get_n_properties (info); i++) + for (unsigned int i = 0; i < gi_object_info_get_n_properties (info); i++) { GIPropertyInfo *prop = gi_object_info_get_property (info, i); write_property_info (ns, prop, file); gi_base_info_unref ((GIBaseInfo *)prop); } - for (guint i = 0; i < gi_object_info_get_n_signals (info); i++) + for (unsigned int i = 0; i < gi_object_info_get_n_signals (info); i++) { GISignalInfo *signal = gi_object_info_get_signal (info, i); write_signal_info (ns, signal, file); gi_base_info_unref ((GIBaseInfo *)signal); } - for (guint i = 0; i < gi_object_info_get_n_vfuncs (info); i++) + for (unsigned int i = 0; i < gi_object_info_get_n_vfuncs (info); i++) { GIVFuncInfo *vfunc = gi_object_info_get_vfunc (info, i); write_vfunc_info (ns, vfunc, file); gi_base_info_unref ((GIBaseInfo *)vfunc); } - for (guint i = 0; i < gi_object_info_get_n_constants (info); i++) + for (unsigned int i = 0; i < gi_object_info_get_n_constants (info); i++) { GIConstantInfo *constant = gi_object_info_get_constant (info, i); write_constant_info (ns, constant, file); @@ -1189,7 +1189,7 @@ write_interface_info (const char *ns, if (gi_interface_info_get_n_prerequisites (info) > 0) { - for (guint i = 0; i < gi_interface_info_get_n_prerequisites (info); i++) + for (unsigned int i = 0; i < gi_interface_info_get_n_prerequisites (info); i++) { GIBaseInfo *req = gi_interface_info_get_prerequisite (info, i); @@ -1201,35 +1201,35 @@ write_interface_info (const char *ns, } } - for (guint i = 0; i < gi_interface_info_get_n_methods (info); i++) + for (unsigned int i = 0; i < gi_interface_info_get_n_methods (info); i++) { GIFunctionInfo *function = gi_interface_info_get_method (info, i); write_function_info (ns, function, file); gi_base_info_unref ((GIBaseInfo *)function); } - for (guint i = 0; i < gi_interface_info_get_n_properties (info); i++) + for (unsigned int i = 0; i < gi_interface_info_get_n_properties (info); i++) { GIPropertyInfo *prop = gi_interface_info_get_property (info, i); write_property_info (ns, prop, file); gi_base_info_unref ((GIBaseInfo *)prop); } - for (guint i = 0; i < gi_interface_info_get_n_signals (info); i++) + for (unsigned int i = 0; i < gi_interface_info_get_n_signals (info); i++) { GISignalInfo *signal = gi_interface_info_get_signal (info, i); write_signal_info (ns, signal, file); gi_base_info_unref ((GIBaseInfo *)signal); } - for (guint i = 0; i < gi_interface_info_get_n_vfuncs (info); i++) + for (unsigned int i = 0; i < gi_interface_info_get_n_vfuncs (info); i++) { GIVFuncInfo *vfunc = gi_interface_info_get_vfunc (info, i); write_vfunc_info (ns, vfunc, file); gi_base_info_unref ((GIBaseInfo *)vfunc); } - for (guint i = 0; i < gi_interface_info_get_n_constants (info); i++) + for (unsigned int i = 0; i < gi_interface_info_get_n_constants (info); i++) { GIConstantInfo *constant = gi_interface_info_get_constant (info, i); write_constant_info (ns, constant, file); @@ -1240,7 +1240,7 @@ write_interface_info (const char *ns, } static void -write_union_info (const char *ns, +write_union_info (const char *ns, GIUnionInfo *info, Xml *file) { @@ -1282,7 +1282,7 @@ write_union_info (const char *ns, if (gi_union_info_is_discriminated (info)) { - guint offset; + unsigned int offset; GITypeInfo *type; offset = gi_union_info_get_discriminator_offset (info); @@ -1295,7 +1295,7 @@ write_union_info (const char *ns, gi_base_info_unref ((GIBaseInfo *)type); } - for (guint i = 0; i < gi_union_info_get_n_fields (info); i++) + for (unsigned int i = 0; i < gi_union_info_get_n_fields (info); i++) { GIFieldInfo *field = gi_union_info_get_field (info, i); GIConstantInfo *constant = gi_union_info_get_discriminator (info, i); @@ -1305,7 +1305,7 @@ write_union_info (const char *ns, gi_base_info_unref ((GIBaseInfo *)constant); } - for (guint i = 0; i < gi_union_info_get_n_methods (info); i++) + for (unsigned int i = 0; i < gi_union_info_get_n_methods (info); i++) { GIFunctionInfo *function = gi_union_info_get_method (info, i); write_function_info (ns, function, file); @@ -1335,7 +1335,7 @@ gi_ir_writer_write (const char *filename, gboolean show_all) { FILE *ofile; - gint i, j; + int i, j; char **dependencies; GIRepository *repository; Xml *xml; @@ -1394,7 +1394,7 @@ gi_ir_writer_write (const char *filename, const char *c_prefix; const char *cur_ns = ns; const char *cur_version; - gint n_infos; + int n_infos; cur_version = gi_repository_get_version (repository, cur_ns); diff --git a/girepository/gistructinfo.c b/girepository/gistructinfo.c index 37edd0009..e06e78d8a 100644 --- a/girepository/gistructinfo.c +++ b/girepository/gistructinfo.c @@ -53,7 +53,7 @@ * Returns: number of fields * Since: 2.80 */ -guint +unsigned int gi_struct_info_get_n_fields (GIStructInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -72,16 +72,16 @@ gi_struct_info_get_n_fields (GIStructInfo *info) * Returns: field offset, in bytes * Since: 2.80 */ -static gint32 +static int32_t gi_struct_get_field_offset (GIStructInfo *info, - guint n) + unsigned int n) { GIRealInfo *rinfo = (GIRealInfo *)info; Header *header = (Header *)rinfo->typelib->data; - guint32 offset = rinfo->offset + header->struct_blob_size; + uint32_t offset = rinfo->offset + header->struct_blob_size; FieldBlob *field_blob; - for (guint i = 0; i < n; i++) + for (unsigned int i = 0; i < n; i++) { field_blob = (FieldBlob *)&rinfo->typelib->data[offset]; offset += header->field_blob_size; @@ -105,7 +105,7 @@ gi_struct_get_field_offset (GIStructInfo *info, */ GIFieldInfo * gi_struct_info_get_field (GIStructInfo *info, - guint n) + unsigned int n) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -132,8 +132,8 @@ gi_struct_info_find_field (GIStructInfo *info, GIRealInfo *rinfo = (GIRealInfo *)info; StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset]; Header *header = (Header *)rinfo->typelib->data; - guint32 offset = rinfo->offset + header->struct_blob_size; - gint i; + uint32_t offset = rinfo->offset + header->struct_blob_size; + int i; for (i = 0; i < blob->n_fields; i++) { @@ -165,7 +165,7 @@ gi_struct_info_find_field (GIStructInfo *info, * Returns: number of methods * Since: 2.80 */ -guint +unsigned int gi_struct_info_get_n_methods (GIStructInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -187,12 +187,12 @@ gi_struct_info_get_n_methods (GIStructInfo *info) */ GIFunctionInfo * gi_struct_info_get_method (GIStructInfo *info, - guint n) + unsigned int n) { GIRealInfo *rinfo = (GIRealInfo *)info; StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset]; Header *header = (Header *)rinfo->typelib->data; - gint offset; + int offset; offset = gi_struct_get_field_offset (info, blob->n_fields) + n * header->function_blob_size; return (GIFunctionInfo *) gi_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info, @@ -215,7 +215,7 @@ GIFunctionInfo * gi_struct_info_find_method (GIStructInfo *info, const char *name) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; StructBlob *blob = (StructBlob *)&rinfo->typelib->data[rinfo->offset]; diff --git a/girepository/gistructinfo.h b/girepository/gistructinfo.h index d8e04fd28..95a30d80e 100644 --- a/girepository/gistructinfo.h +++ b/girepository/gistructinfo.h @@ -45,22 +45,22 @@ G_BEGIN_DECLS GI_AVAILABLE_IN_ALL -guint gi_struct_info_get_n_fields (GIStructInfo *info); +unsigned int gi_struct_info_get_n_fields (GIStructInfo *info); GI_AVAILABLE_IN_ALL GIFieldInfo * gi_struct_info_get_field (GIStructInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL GIFieldInfo * gi_struct_info_find_field (GIStructInfo *info, const char *name); GI_AVAILABLE_IN_ALL -guint gi_struct_info_get_n_methods (GIStructInfo *info); +unsigned int gi_struct_info_get_n_methods (GIStructInfo *info); GI_AVAILABLE_IN_ALL GIFunctionInfo * gi_struct_info_get_method (GIStructInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL GIFunctionInfo * gi_struct_info_find_method (GIStructInfo *info, diff --git a/girepository/gitypeinfo.c b/girepository/gitypeinfo.c index 13957f772..349e0f879 100644 --- a/girepository/gitypeinfo.c +++ b/girepository/gitypeinfo.c @@ -135,8 +135,8 @@ gi_type_info_get_tag (GITypeInfo *info) * Since: 2.80 */ GITypeInfo * -gi_type_info_get_param_type (GITypeInfo *info, - guint n) +gi_type_info_get_param_type (GITypeInfo *info, + unsigned int n) { GIRealInfo *rinfo = (GIRealInfo *)info; SimpleTypeBlob *type; @@ -241,7 +241,7 @@ gi_type_info_get_interface (GITypeInfo *info) * or it has no length argument * Since: 2.80 */ -gint +int gi_type_info_get_array_length_index (GITypeInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -435,23 +435,23 @@ gi_type_tag_argument_from_hash_pointer (GITypeTag storage_type, arg->v_boolean = !!GPOINTER_TO_INT (hash_pointer); break; case GI_TYPE_TAG_INT8: - arg->v_int8 = (gint8)GPOINTER_TO_INT (hash_pointer); + arg->v_int8 = (int8_t) GPOINTER_TO_INT (hash_pointer); break; case GI_TYPE_TAG_UINT8: - arg->v_uint8 = (guint8)GPOINTER_TO_UINT (hash_pointer); + arg->v_uint8 = (uint8_t) GPOINTER_TO_UINT (hash_pointer); break; case GI_TYPE_TAG_INT16: - arg->v_int16 = (gint16)GPOINTER_TO_INT (hash_pointer); + arg->v_int16 = (int16_t) GPOINTER_TO_INT (hash_pointer); break; case GI_TYPE_TAG_UINT16: - arg->v_uint16 = (guint16)GPOINTER_TO_UINT (hash_pointer); + arg->v_uint16 = (uint16_t) GPOINTER_TO_UINT (hash_pointer); break; case GI_TYPE_TAG_INT32: - arg->v_int32 = (gint32)GPOINTER_TO_INT (hash_pointer); + arg->v_int32 = (int32_t) GPOINTER_TO_INT (hash_pointer); break; case GI_TYPE_TAG_UINT32: case GI_TYPE_TAG_UNICHAR: - arg->v_uint32 = (guint32)GPOINTER_TO_UINT (hash_pointer); + arg->v_uint32 = (uint32_t) GPOINTER_TO_UINT (hash_pointer); break; case GI_TYPE_TAG_GTYPE: arg->v_size = GPOINTER_TO_SIZE (hash_pointer); diff --git a/girepository/gitypeinfo.h b/girepository/gitypeinfo.h index c6b99f056..56a5c7c24 100644 --- a/girepository/gitypeinfo.h +++ b/girepository/gitypeinfo.h @@ -89,14 +89,14 @@ GI_AVAILABLE_IN_ALL GITypeTag gi_type_info_get_tag (GITypeInfo *info); GI_AVAILABLE_IN_ALL -GITypeInfo * gi_type_info_get_param_type (GITypeInfo *info, - guint n); +GITypeInfo * gi_type_info_get_param_type (GITypeInfo *info, + unsigned int n); GI_AVAILABLE_IN_ALL GIBaseInfo * gi_type_info_get_interface (GITypeInfo *info); GI_AVAILABLE_IN_ALL -gint gi_type_info_get_array_length_index (GITypeInfo *info); +int gi_type_info_get_array_length_index (GITypeInfo *info); GI_AVAILABLE_IN_ALL gssize gi_type_info_get_array_fixed_size (GITypeInfo *info); diff --git a/girepository/gitypelib-internal.h b/girepository/gitypelib-internal.h index 0600ef320..6e7a1e8f6 100644 --- a/girepository/gitypelib-internal.h +++ b/girepository/gitypelib-internal.h @@ -288,46 +288,46 @@ _blob_is_registered_type (GITypelibBlobType blob_type) */ typedef struct { char magic[16]; - guint8 major_version; - guint8 minor_version; - guint16 reserved; - guint16 n_entries; - guint16 n_local_entries; - guint32 directory; - guint32 n_attributes; - guint32 attributes; + uint8_t major_version; + uint8_t minor_version; + uint16_t reserved; + uint16_t n_entries; + uint16_t n_local_entries; + uint32_t directory; + uint32_t n_attributes; + uint32_t attributes; - guint32 dependencies; + uint32_t dependencies; - guint32 size; - guint32 namespace; - guint32 nsversion; - guint32 shared_library; - guint32 c_prefix; + uint32_t size; + uint32_t namespace; + uint32_t nsversion; + uint32_t shared_library; + uint32_t c_prefix; - guint16 entry_blob_size; - guint16 function_blob_size; - guint16 callback_blob_size; - guint16 signal_blob_size; - guint16 vfunc_blob_size; - guint16 arg_blob_size; - guint16 property_blob_size; - guint16 field_blob_size; - guint16 value_blob_size; - guint16 attribute_blob_size; - guint16 constant_blob_size; - guint16 error_domain_blob_size; + uint16_t entry_blob_size; + uint16_t function_blob_size; + uint16_t callback_blob_size; + uint16_t signal_blob_size; + uint16_t vfunc_blob_size; + uint16_t arg_blob_size; + uint16_t property_blob_size; + uint16_t field_blob_size; + uint16_t value_blob_size; + uint16_t attribute_blob_size; + uint16_t constant_blob_size; + uint16_t error_domain_blob_size; - guint16 signature_blob_size; - guint16 enum_blob_size; - guint16 struct_blob_size; - guint16 object_blob_size; - guint16 interface_blob_size; - guint16 union_blob_size; + uint16_t signature_blob_size; + uint16_t enum_blob_size; + uint16_t struct_blob_size; + uint16_t object_blob_size; + uint16_t interface_blob_size; + uint16_t union_blob_size; - guint32 sections; + uint32_t sections; - guint16 padding[6]; + uint16_t padding[6]; } Header; /** @@ -357,8 +357,8 @@ typedef enum { * Since: 2.80 */ typedef struct { - guint32 id; - guint32 offset; + uint32_t id; + uint32_t offset; } Section; @@ -380,12 +380,12 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint16 blob_type; + uint16_t blob_type; - guint16 local : 1; - guint16 reserved :15; - guint32 name; - guint32 offset; + uint16_t local : 1; + uint16_t reserved :15; + uint32_t name; + uint32_t offset; } DirEntry; /** @@ -401,17 +401,17 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint reserved : 8; - guint reserved2 :16; - guint pointer : 1; - guint reserved3 : 2; - guint tag : 5; + unsigned reserved : 8; + unsigned reserved2 :16; + unsigned pointer : 1; + unsigned reserved3 : 2; + unsigned tag : 5; } SimpleTypeBlobFlags; union _SimpleTypeBlob { SimpleTypeBlobFlags flags; - guint32 offset; + uint32_t offset; }; /** @@ -489,23 +489,23 @@ typedef union _SimpleTypeBlob SimpleTypeBlob; * Since: 2.80 */ typedef struct { - guint32 name; + uint32_t name; - guint in : 1; - guint out : 1; - guint caller_allocates : 1; - guint nullable : 1; - guint optional : 1; - guint transfer_ownership : 1; - guint transfer_container_ownership : 1; - guint return_value : 1; - guint scope : 3; - guint skip : 1; - guint reserved :20; - gint8 closure; - gint8 destroy; + unsigned in : 1; + unsigned out : 1; + unsigned caller_allocates : 1; + unsigned nullable : 1; + unsigned optional : 1; + unsigned transfer_ownership : 1; + unsigned transfer_container_ownership : 1; + unsigned return_value : 1; + unsigned scope : 3; + unsigned skip : 1; + unsigned reserved :20; + int8_t closure; + int8_t destroy; - guint16 padding; + uint16_t padding; SimpleTypeBlob arg_type; } ArgBlob; @@ -538,15 +538,15 @@ typedef struct { typedef struct { SimpleTypeBlob return_type; - guint16 may_return_null : 1; - guint16 caller_owns_return_value : 1; - guint16 caller_owns_return_container : 1; - guint16 skip_return : 1; - guint16 instance_transfer_ownership : 1; - guint16 throws : 1; - guint16 reserved :10; + uint16_t may_return_null : 1; + uint16_t caller_owns_return_value : 1; + uint16_t caller_owns_return_container : 1; + uint16_t skip_return : 1; + uint16_t instance_transfer_ownership : 1; + uint16_t throws : 1; + uint16_t reserved :10; - guint16 n_arguments; + uint16_t n_arguments; ArgBlob arguments[]; } SignatureBlob; @@ -566,11 +566,11 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint16 blob_type; /* 1 */ + uint16_t blob_type; /* 1 */ - guint16 deprecated : 1; - guint16 reserved :15; - guint32 name; + uint16_t deprecated : 1; + uint16_t reserved :15; + uint32_t name; } CommonBlob; /** @@ -605,26 +605,26 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint16 blob_type; /* 1 */ + uint16_t blob_type; /* 1 */ - guint16 deprecated : 1; - guint16 setter : 1; - guint16 getter : 1; - guint16 constructor : 1; - guint16 wraps_vfunc : 1; - guint16 throws : 1; - guint16 index :10; + uint16_t deprecated : 1; + uint16_t setter : 1; + uint16_t getter : 1; + uint16_t constructor : 1; + uint16_t wraps_vfunc : 1; + uint16_t throws : 1; + uint16_t index :10; /* Note the bits above need to match CommonBlob * and are thus exhausted, extend things using * the reserved block below. */ - guint32 name; - guint32 symbol; - guint32 signature; + uint32_t name; + uint32_t symbol; + uint32_t signature; - guint16 is_static : 1; - guint16 reserved : 15; - guint16 reserved2 : 16; + uint16_t is_static : 1; + uint16_t reserved : 15; + uint16_t reserved2 : 16; } FunctionBlob; /** @@ -641,12 +641,12 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint16 blob_type; /* 2 */ + uint16_t blob_type; /* 2 */ - guint16 deprecated : 1; - guint16 reserved :15; - guint32 name; - guint32 signature; + uint16_t deprecated : 1; + uint16_t reserved :15; + uint32_t name; + uint32_t signature; } CallbackBlob; /** @@ -662,11 +662,11 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint8 pointer :1; - guint8 reserved :2; - guint8 tag :5; - guint8 reserved2; - guint16 interface; + uint8_t pointer :1; + uint8_t reserved :2; + uint8_t tag :5; + uint8_t reserved2; + uint16_t interface; } InterfaceTypeBlob; /** @@ -679,8 +679,8 @@ typedef struct { * Since: 2.80 */ typedef union { - guint16 length; - guint16 size; + uint16_t length; + uint16_t size; } ArrayTypeDimension; /** @@ -706,15 +706,15 @@ typedef union { * Since: 2.80 */ typedef struct { - guint16 pointer :1; - guint16 reserved :2; - guint16 tag :5; + uint16_t pointer :1; + uint16_t reserved :2; + uint16_t tag :5; - guint16 zero_terminated :1; - guint16 has_length :1; - guint16 has_size :1; - guint16 array_type :2; - guint16 reserved2 :3; + uint16_t zero_terminated :1; + uint16_t has_length :1; + uint16_t has_size :1; + uint16_t array_type :2; + uint16_t reserved2 :3; ArrayTypeDimension dimensions; @@ -735,12 +735,12 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint8 pointer :1; - guint8 reserved :2; - guint8 tag :5; + uint8_t pointer :1; + uint8_t reserved :2; + uint8_t tag :5; - guint8 reserved2; - guint16 n_types; + uint8_t reserved2; + uint16_t n_types; SimpleTypeBlob type[]; } ParamTypeBlob; @@ -759,20 +759,20 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint8 pointer :1; - guint8 reserved :2; - guint8 tag :5; + uint8_t pointer :1; + uint8_t reserved :2; + uint8_t tag :5; - guint8 reserved2; + uint8_t reserved2; - guint16 n_domains; /* Must be 0 */ - guint16 domains[]; + uint16_t n_domains; /* Must be 0 */ + uint16_t domains[]; } ErrorTypeBlob; /** * ValueBlob: * @deprecated: Whether this value is deprecated - * @unsigned_value: if set, value is a 32-bit unsigned integer cast to gint32 + * @unsigned_value: if set, value is a 32-bit unsigned integer cast to int32_t * @reserved: Reserved for future use. * @name: Name of blob * @value: The numerical value @@ -782,11 +782,11 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint32 deprecated : 1; - guint32 unsigned_value : 1; - guint32 reserved :30; - guint32 name; - gint32 value; + uint32_t deprecated : 1; + uint32_t unsigned_value : 1; + uint32_t reserved :30; + uint32_t name; + int32_t value; } ValueBlob; /** @@ -808,17 +808,17 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint32 name; + uint32_t name; - guint8 readable :1; - guint8 writable :1; - guint8 has_embedded_type :1; - guint8 reserved :5; - guint8 bits; + uint8_t readable :1; + uint8_t writable :1; + uint8_t has_embedded_type :1; + uint8_t reserved :5; + uint8_t bits; - guint16 struct_offset; + uint16_t struct_offset; - guint32 reserved2; + uint32_t reserved2; SimpleTypeBlob type; } FieldBlob; @@ -839,14 +839,14 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint16 blob_type; - guint16 deprecated : 1; - guint16 unregistered : 1; - guint16 reserved :14; - guint32 name; + uint16_t blob_type; + uint16_t deprecated : 1; + uint16_t unregistered : 1; + uint16_t reserved :14; + uint32_t name; - guint32 gtype_name; - guint32 gtype_init; + uint32_t gtype_name; + uint32_t gtype_init; } RegisteredTypeBlob; /** @@ -876,27 +876,27 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint16 blob_type; + uint16_t blob_type; - guint16 deprecated : 1; - guint16 unregistered : 1; - guint16 is_gtype_struct : 1; - guint16 alignment : 6; - guint16 foreign : 1; - guint16 reserved : 6; + uint16_t deprecated : 1; + uint16_t unregistered : 1; + uint16_t is_gtype_struct : 1; + uint16_t alignment : 6; + uint16_t foreign : 1; + uint16_t reserved : 6; - guint32 name; + uint32_t name; - guint32 gtype_name; - guint32 gtype_init; + uint32_t gtype_name; + uint32_t gtype_init; - guint32 size; + uint32_t size; - guint16 n_fields; - guint16 n_methods; + uint16_t n_fields; + uint16_t n_methods; - guint32 copy_func; - guint32 free_func; + uint32_t copy_func; + uint32_t free_func; } StructBlob; /** @@ -927,26 +927,26 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint16 blob_type; - guint16 deprecated : 1; - guint16 unregistered : 1; - guint16 discriminated : 1; - guint16 alignment : 6; - guint16 reserved : 7; - guint32 name; + uint16_t blob_type; + uint16_t deprecated : 1; + uint16_t unregistered : 1; + uint16_t discriminated : 1; + uint16_t alignment : 6; + uint16_t reserved : 7; + uint32_t name; - guint32 gtype_name; - guint32 gtype_init; + uint32_t gtype_name; + uint32_t gtype_init; - guint32 size; + uint32_t size; - guint16 n_fields; - guint16 n_functions; + uint16_t n_fields; + uint16_t n_functions; - guint32 copy_func; - guint32 free_func; + uint32_t copy_func; + uint32_t free_func; - gint32 discriminator_offset; + int32_t discriminator_offset; SimpleTypeBlob discriminator_type; } UnionBlob; @@ -971,22 +971,22 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint16 blob_type; + uint16_t blob_type; - guint16 deprecated : 1; - guint16 unregistered : 1; - guint16 storage_type : 5; - guint16 reserved : 9; + uint16_t deprecated : 1; + uint16_t unregistered : 1; + uint16_t storage_type : 5; + uint16_t reserved : 9; - guint32 name; + uint32_t name; - guint32 gtype_name; - guint32 gtype_init; + uint32_t gtype_name; + uint32_t gtype_init; - guint16 n_values; - guint16 n_methods; + uint16_t n_values; + uint16_t n_methods; - guint32 error_domain; + uint32_t error_domain; ValueBlob values[]; } EnumBlob; @@ -1021,20 +1021,20 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint32 name; + uint32_t name; - guint32 deprecated : 1; - guint32 readable : 1; - guint32 writable : 1; - guint32 construct : 1; - guint32 construct_only : 1; - guint32 transfer_ownership : 1; - guint32 transfer_container_ownership : 1; - guint32 setter :10; - guint32 getter :10; - guint32 reserved : 5; + uint32_t deprecated : 1; + uint32_t readable : 1; + uint32_t writable : 1; + uint32_t construct : 1; + uint32_t construct_only : 1; + uint32_t transfer_ownership : 1; + uint32_t transfer_container_ownership : 1; + uint32_t setter :10; + uint32_t getter :10; + uint32_t reserved : 5; - guint32 reserved2; + uint32_t reserved2; SimpleTypeBlob type; } PropertyBlob; @@ -1064,25 +1064,25 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint16 deprecated : 1; - guint16 run_first : 1; - guint16 run_last : 1; - guint16 run_cleanup : 1; - guint16 no_recurse : 1; - guint16 detailed : 1; - guint16 action : 1; - guint16 no_hooks : 1; - guint16 has_class_closure : 1; - guint16 true_stops_emit : 1; - guint16 reserved : 6; + uint16_t deprecated : 1; + uint16_t run_first : 1; + uint16_t run_last : 1; + uint16_t run_cleanup : 1; + uint16_t no_recurse : 1; + uint16_t detailed : 1; + uint16_t action : 1; + uint16_t no_hooks : 1; + uint16_t has_class_closure : 1; + uint16_t true_stops_emit : 1; + uint16_t reserved : 6; - guint16 class_closure; + uint16_t class_closure; - guint32 name; + uint32_t name; - guint32 reserved2; + uint32_t reserved2; - guint32 signature; + uint32_t signature; } SignalBlob; /** @@ -1115,22 +1115,22 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint32 name; + uint32_t name; - guint16 must_chain_up : 1; - guint16 must_be_implemented : 1; - guint16 must_not_be_implemented : 1; - guint16 class_closure : 1; - guint16 throws : 1; - guint16 reserved :11; - guint16 signal; + uint16_t must_chain_up : 1; + uint16_t must_be_implemented : 1; + uint16_t must_not_be_implemented : 1; + uint16_t class_closure : 1; + uint16_t throws : 1; + uint16_t reserved :11; + uint16_t signal; - guint16 struct_offset; - guint16 invoker : 10; /* Number of bits matches @index in FunctionBlob */ - guint16 reserved2 : 6; + uint16_t struct_offset; + uint16_t invoker : 10; /* Number of bits matches @index in FunctionBlob */ + uint16_t reserved2 : 6; - guint32 reserved3; - guint32 signature; + uint32_t reserved3; + uint32_t signature; } VFuncBlob; /** @@ -1177,38 +1177,38 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint16 blob_type; /* 7 */ - guint16 deprecated : 1; - guint16 abstract : 1; - guint16 fundamental : 1; - guint16 final_ : 1; - guint16 reserved :12; - guint32 name; + uint16_t blob_type; /* 7 */ + uint16_t deprecated : 1; + uint16_t abstract : 1; + uint16_t fundamental : 1; + uint16_t final_ : 1; + uint16_t reserved :12; + uint32_t name; - guint32 gtype_name; - guint32 gtype_init; + uint32_t gtype_name; + uint32_t gtype_init; - guint16 parent; - guint16 gtype_struct; + uint16_t parent; + uint16_t gtype_struct; - guint16 n_interfaces; - guint16 n_fields; - guint16 n_properties; - guint16 n_methods; - guint16 n_signals; - guint16 n_vfuncs; - guint16 n_constants; - guint16 n_field_callbacks; + uint16_t n_interfaces; + uint16_t n_fields; + uint16_t n_properties; + uint16_t n_methods; + uint16_t n_signals; + uint16_t n_vfuncs; + uint16_t n_constants; + uint16_t n_field_callbacks; - guint32 ref_func; - guint32 unref_func; - guint32 set_value_func; - guint32 get_value_func; + uint32_t ref_func; + uint32_t unref_func; + uint32_t set_value_func; + uint32_t get_value_func; - guint32 reserved3; - guint32 reserved4; + uint32_t reserved3; + uint32_t reserved4; - guint16 interfaces[]; + uint16_t interfaces[]; } ObjectBlob; /** @@ -1239,28 +1239,28 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint16 blob_type; - guint16 deprecated : 1; - guint16 reserved :15; - guint32 name; + uint16_t blob_type; + uint16_t deprecated : 1; + uint16_t reserved :15; + uint32_t name; - guint32 gtype_name; - guint32 gtype_init; - guint16 gtype_struct; + uint32_t gtype_name; + uint32_t gtype_init; + uint16_t gtype_struct; - guint16 n_prerequisites; - guint16 n_properties; - guint16 n_methods; - guint16 n_signals; - guint16 n_vfuncs; - guint16 n_constants; + uint16_t n_prerequisites; + uint16_t n_properties; + uint16_t n_methods; + uint16_t n_signals; + uint16_t n_vfuncs; + uint16_t n_constants; - guint16 padding; + uint16_t padding; - guint32 reserved2; - guint32 reserved3; + uint32_t reserved2; + uint32_t reserved3; - guint16 prerequisites[]; + uint16_t prerequisites[]; } InterfaceBlob; /** @@ -1280,17 +1280,17 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint16 blob_type; - guint16 deprecated : 1; - guint16 reserved :15; - guint32 name; + uint16_t blob_type; + uint16_t deprecated : 1; + uint16_t reserved :15; + uint32_t name; SimpleTypeBlob type; - guint32 size; - guint32 offset; + uint32_t size; + uint32_t offset; - guint32 reserved2; + uint32_t reserved2; } ConstantBlob; /** @@ -1306,9 +1306,9 @@ typedef struct { * Since: 2.80 */ typedef struct { - guint32 offset; - guint32 name; - guint32 value; + uint32_t offset; + uint32_t name; + uint32_t value; } AttributeBlob; struct _GITypelib { @@ -1322,7 +1322,7 @@ struct _GITypelib { }; DirEntry *gi_typelib_get_dir_entry (GITypelib *typelib, - guint16 index); + uint16_t index); DirEntry *gi_typelib_get_dir_entry_by_name (GITypelib *typelib, const char *name); @@ -1393,7 +1393,7 @@ gboolean gi_typelib_validate (GITypelib *typelib, /* defined in gibaseinfo.c */ AttributeBlob *_attribute_blob_find_first (GIBaseInfo *info, - guint32 blob_offset); + uint32_t blob_offset); /** * GITypelibHashBuilder: @@ -1406,17 +1406,17 @@ typedef struct _GITypelibHashBuilder GITypelibHashBuilder; GITypelibHashBuilder * gi_typelib_hash_builder_new (void); -void gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder, const char *str, guint16 value); +void gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder, const char *str, uint16_t value); gboolean gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder); -guint32 gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder); +uint32_t gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder); -void gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint32 size); +void gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, uint8_t* mem, uint32_t size); void gi_typelib_hash_builder_destroy (GITypelibHashBuilder *builder); -guint16 gi_typelib_hash_search (guint8* memory, const char *str, guint n_entries); +uint16_t gi_typelib_hash_search (uint8_t* memory, const char *str, uint32_t n_entries); G_END_DECLS diff --git a/girepository/gitypelib.c b/girepository/gitypelib.c index 4f733c37d..6f5f1c9ae 100644 --- a/girepository/gitypelib.c +++ b/girepository/gitypelib.c @@ -65,16 +65,16 @@ pop_context (ValidateContext *ctx) static gboolean validate_interface_blob (ValidateContext *ctx, - guint32 offset, + uint32_t offset, GError **error); static DirEntry * get_dir_entry_checked (GITypelib *typelib, - guint16 index, + uint16_t index, GError **error) { Header *header = (Header *)typelib->data; - guint32 offset; + uint32_t offset; if (index == 0 || index > header->n_entries) { @@ -102,7 +102,7 @@ get_dir_entry_checked (GITypelib *typelib, static CommonBlob * get_blob (GITypelib *typelib, - guint32 offset, + uint32_t offset, GError **error) { if (typelib->len < offset + sizeof (CommonBlob)) @@ -155,7 +155,7 @@ get_type_blob (GITypelib *typelib, */ DirEntry * gi_typelib_get_dir_entry (GITypelib *typelib, - guint16 index) + uint16_t index) { Header *header = (Header *)typelib->data; @@ -198,7 +198,7 @@ gi_typelib_get_dir_entry_by_name (GITypelib *typelib, const char *name) { Section *dirindex; - gint i, n_entries; + int i, n_entries; const char *entry_name; DirEntry *entry; @@ -218,8 +218,8 @@ gi_typelib_get_dir_entry_by_name (GITypelib *typelib, } else { - guint8 *hash = (guint8*) &typelib->data[dirindex->offset]; - guint16 index; + uint8_t *hash = (uint8_t *) &typelib->data[dirindex->offset]; + uint16_t index; index = gi_typelib_hash_search (hash, name, n_entries); entry = gi_typelib_get_dir_entry (typelib, index + 1); @@ -247,7 +247,7 @@ gi_typelib_get_dir_entry_by_gtype_name (GITypelib *typelib, const char *gtype_name) { Header *header = (Header *)typelib->data; - guint i; + unsigned int i; for (i = 1; i <= header->n_local_entries; i++) { @@ -400,12 +400,11 @@ gi_typelib_get_dir_entry_by_error_domain (GITypelib *typelib, GQuark error_domain) { Header *header = (Header *)typelib->data; - guint n_entries = header->n_local_entries; + unsigned int n_entries = header->n_local_entries; const char *domain_string = g_quark_to_string (error_domain); DirEntry *entry; - guint i; - for (i = 1; i <= n_entries; i++) + for (unsigned int i = 1; i <= n_entries; i++) { EnumBlob *blob; const char *enum_domain_string; @@ -490,7 +489,7 @@ gi_typelib_check_format (void) static gboolean -is_aligned (guint32 offset) +is_aligned (uint32_t offset) { return offset == ALIGN_VALUE (offset, 4); } @@ -498,7 +497,7 @@ is_aligned (guint32 offset) #define MAX_NAME_LEN 2048 static const char * -get_string (GITypelib *typelib, guint32 offset, GError **error) +get_string (GITypelib *typelib, uint32_t offset, GError **error) { if (typelib->len < offset) { @@ -513,7 +512,7 @@ get_string (GITypelib *typelib, guint32 offset, GError **error) } static const char * -get_string_nofail (GITypelib *typelib, guint32 offset) +get_string_nofail (GITypelib *typelib, uint32_t offset) { const char *ret = get_string (typelib, offset, NULL); g_assert (ret); @@ -523,7 +522,8 @@ get_string_nofail (GITypelib *typelib, guint32 offset) static gboolean validate_name (GITypelib *typelib, const char *msg, - const guchar *data, guint32 offset, + const guchar *data, + uint32_t offset, GError **error) { const char *name; @@ -557,7 +557,7 @@ validate_name (GITypelib *typelib, /* Fast path sanity check, operates on a memory blob */ static gboolean -validate_header_basic (const guint8 *memory, +validate_header_basic (const uint8_t *memory, gsize len, GError **error) { @@ -695,15 +695,15 @@ validate_header (ValidateContext *ctx, } static gboolean validate_type_blob (GITypelib *typelib, - guint32 offset, - guint32 signature_offset, + uint32_t offset, + uint32_t signature_offset, gboolean return_type, GError **error); static gboolean validate_array_type_blob (GITypelib *typelib, - guint32 offset, - guint32 signature_offset, + uint32_t offset, + uint32_t signature_offset, gboolean return_type, GError **error) { @@ -719,8 +719,8 @@ validate_array_type_blob (GITypelib *typelib, static gboolean validate_iface_type_blob (GITypelib *typelib, - guint32 offset, - guint32 signature_offset, + uint32_t offset, + uint32_t signature_offset, gboolean return_type, GError **error) { @@ -741,14 +741,14 @@ validate_iface_type_blob (GITypelib *typelib, static gboolean validate_param_type_blob (GITypelib *typelib, - guint32 offset, - guint32 signature_offset, + uint32_t offset, + uint32_t signature_offset, gboolean return_type, - gint n_params, + int n_params, GError **error) { ParamTypeBlob *blob; - gint i; + int i; blob = (ParamTypeBlob*)&typelib->data[offset]; @@ -784,8 +784,8 @@ validate_param_type_blob (GITypelib *typelib, static gboolean validate_error_type_blob (GITypelib *typelib, - guint32 offset, - guint32 signature_offset, + uint32_t offset, + uint32_t signature_offset, gboolean return_type, GError **error) { @@ -807,8 +807,8 @@ validate_error_type_blob (GITypelib *typelib, static gboolean validate_type_blob (GITypelib *typelib, - guint32 offset, - guint32 signature_offset, + uint32_t offset, + uint32_t signature_offset, gboolean return_type, GError **error) { @@ -886,8 +886,8 @@ validate_type_blob (GITypelib *typelib, static gboolean validate_arg_blob (GITypelib *typelib, - guint32 offset, - guint32 signature_offset, + uint32_t offset, + uint32_t signature_offset, GError **error) { ArgBlob *blob; @@ -916,7 +916,7 @@ validate_arg_blob (GITypelib *typelib, static SimpleTypeBlob * return_type_from_signature (GITypelib *typelib, - guint32 offset, + uint32_t offset, GError **error) { SignatureBlob *blob; @@ -944,11 +944,10 @@ return_type_from_signature (GITypelib *typelib, static gboolean validate_signature_blob (GITypelib *typelib, - guint32 offset, + uint32_t offset, GError **error) { SignatureBlob *blob; - gint i; if (typelib->len < offset + sizeof (SignatureBlob)) { @@ -969,7 +968,7 @@ validate_signature_blob (GITypelib *typelib, return FALSE; } - for (i = 0; i < blob->n_arguments; i++) + for (int i = 0; i < blob->n_arguments; i++) { if (!validate_arg_blob (typelib, offset + sizeof (SignatureBlob) + @@ -986,8 +985,8 @@ validate_signature_blob (GITypelib *typelib, static gboolean validate_function_blob (ValidateContext *ctx, - guint32 offset, - guint16 container_type, + uint32_t offset, + uint16_t container_type, GError **error) { GITypelib *typelib = ctx->typelib; @@ -1106,7 +1105,7 @@ validate_function_blob (ValidateContext *ctx, static gboolean validate_callback_blob (ValidateContext *ctx, - guint32 offset, + uint32_t offset, GError **error) { GITypelib *typelib = ctx->typelib; @@ -1147,10 +1146,10 @@ validate_callback_blob (ValidateContext *ctx, static gboolean validate_constant_blob (GITypelib *typelib, - guint32 offset, + uint32_t offset, GError **error) { - guint value_size[] = { + unsigned int value_size[] = { 0, /* VOID */ 4, /* BOOLEAN */ 1, /* INT8 */ @@ -1161,8 +1160,8 @@ validate_constant_blob (GITypelib *typelib, 4, /* UINT32 */ 8, /* INT64 */ 8, /* UINT64 */ - sizeof (gfloat), - sizeof (gdouble), + sizeof (float), + sizeof (double), 0, /* GTYPE */ 0, /* UTF8 */ 0, /* FILENAME */ @@ -1244,7 +1243,7 @@ validate_constant_blob (GITypelib *typelib, static gboolean validate_value_blob (GITypelib *typelib, - guint32 offset, + uint32_t offset, GError **error) { ValueBlob *blob; @@ -1268,7 +1267,7 @@ validate_value_blob (GITypelib *typelib, static gboolean validate_field_blob (ValidateContext *ctx, - guint32 offset, + uint32_t offset, GError **error) { GITypelib *typelib = ctx->typelib; @@ -1304,7 +1303,7 @@ validate_field_blob (ValidateContext *ctx, static gboolean validate_property_blob (GITypelib *typelib, - guint32 offset, + uint32_t offset, GError **error) { PropertyBlob *blob; @@ -1333,12 +1332,12 @@ validate_property_blob (GITypelib *typelib, static gboolean validate_signal_blob (GITypelib *typelib, - guint32 offset, - guint32 container_offset, + uint32_t offset, + uint32_t container_offset, GError **error) { SignalBlob *blob; - gint n_signals; + int n_signals; if (typelib->len < offset + sizeof (SignalBlob)) { @@ -1402,12 +1401,12 @@ validate_signal_blob (GITypelib *typelib, static gboolean validate_vfunc_blob (GITypelib *typelib, - guint32 offset, - guint32 container_offset, + uint32_t offset, + uint32_t container_offset, GError **error) { VFuncBlob *blob; - gint n_vfuncs; + int n_vfuncs; if (typelib->len < offset + sizeof (VFuncBlob)) { @@ -1460,14 +1459,14 @@ validate_vfunc_blob (GITypelib *typelib, static gboolean validate_struct_blob (ValidateContext *ctx, - guint32 offset, - guint16 blob_type, - GError **error) + uint32_t offset, + uint16_t blob_type, + GError **error) { GITypelib *typelib = ctx->typelib; StructBlob *blob; - gint i; - guint32 field_offset; + int i; + uint32_t field_offset; if (typelib->len < offset + sizeof (StructBlob)) { @@ -1557,14 +1556,14 @@ validate_struct_blob (ValidateContext *ctx, static gboolean validate_enum_blob (ValidateContext *ctx, - guint32 offset, - guint16 blob_type, + uint32_t offset, + uint16_t blob_type, GError **error) { GITypelib *typelib = ctx->typelib; EnumBlob *blob; - gint i; - guint32 offset2; + int i; + uint32_t offset2; if (typelib->len < offset + sizeof (EnumBlob)) { @@ -1665,15 +1664,15 @@ validate_enum_blob (ValidateContext *ctx, static gboolean validate_object_blob (ValidateContext *ctx, - guint32 offset, + uint32_t offset, GError **error) { GITypelib *typelib = ctx->typelib; Header *header; ObjectBlob *blob; - gint i; - guint32 offset2; - guint16 n_field_callbacks; + int i; + uint32_t offset2; + uint16_t n_field_callbacks; header = (Header *)typelib->data; @@ -1771,10 +1770,10 @@ validate_object_blob (ValidateContext *ctx, for (i = 0; i < blob->n_interfaces; i++, offset2 += 2) { - guint16 iface; + uint16_t iface; DirEntry *entry; - iface = *(guint16*)&typelib->data[offset2]; + iface = *(uint16_t *)&typelib->data[offset2]; if (iface == 0 || iface > header->n_entries) { g_set_error (error, @@ -1867,14 +1866,14 @@ validate_object_blob (ValidateContext *ctx, static gboolean validate_interface_blob (ValidateContext *ctx, - guint32 offset, + uint32_t offset, GError **error) { GITypelib *typelib = ctx->typelib; Header *header; InterfaceBlob *blob; - gint i; - guint32 offset2; + int i; + uint32_t offset2; header = (Header *)typelib->data; @@ -1928,9 +1927,9 @@ validate_interface_blob (ValidateContext *ctx, for (i = 0; i < blob->n_prerequisites; i++, offset2 += 2) { DirEntry *entry; - guint16 req; + uint16_t req; - req = *(guint16*)&typelib->data[offset2]; + req = *(uint16_t *)&typelib->data[offset2]; if (req == 0 || req > header->n_entries) { g_set_error (error, @@ -1994,7 +1993,7 @@ validate_interface_blob (ValidateContext *ctx, static gboolean validate_union_blob (GITypelib *typelib, - guint32 offset, + uint32_t offset, GError **error) { return TRUE; @@ -2002,7 +2001,7 @@ validate_union_blob (GITypelib *typelib, static gboolean validate_blob (ValidateContext *ctx, - guint32 offset, + uint32_t offset, GError **error) { GITypelib *typelib = ctx->typelib; @@ -2073,7 +2072,7 @@ validate_directory (ValidateContext *ctx, GITypelib *typelib = ctx->typelib; Header *header = (Header *)typelib->data; DirEntry *entry; - gint i; + int i; if (typelib->len < header->directory + header->n_entries * sizeof (DirEntry)) { @@ -2343,7 +2342,7 @@ gi_typelib_do_dlopen (GITypelib *typelib) if (shlib_str != NULL && shlib_str[0] != '\0') { char **shlibs; - gint i; + int i; /* shared-library is a comma-separated list of libraries */ shlibs = g_strsplit (shlib_str, ",", 0); @@ -2410,7 +2409,7 @@ gi_typelib_ensure_open (GITypelib *typelib) * Since: 2.80 */ GITypelib * -gi_typelib_new_from_memory (guint8 *memory, +gi_typelib_new_from_memory (uint8_t *memory, gsize len, GError **error) { @@ -2474,7 +2473,7 @@ gi_typelib_new_from_mapped_file (GMappedFile *mfile, GError **error) { GITypelib *meta; - guint8 *data = (guint8 *) g_mapped_file_get_contents (mfile); + uint8_t *data = (uint8_t *) g_mapped_file_get_contents (mfile); gsize len = g_mapped_file_get_length (mfile); if (!validate_header_basic (data, len, error)) diff --git a/girepository/gitypelib.h b/girepository/gitypelib.h index d43e8fd95..dc2499ddd 100644 --- a/girepository/gitypelib.h +++ b/girepository/gitypelib.h @@ -37,12 +37,12 @@ G_BEGIN_DECLS typedef struct _GITypelib GITypelib; GI_AVAILABLE_IN_ALL -GITypelib * gi_typelib_new_from_memory (guint8 *memory, +GITypelib * gi_typelib_new_from_memory (uint8_t *memory, gsize len, GError **error); GI_AVAILABLE_IN_ALL -GITypelib * gi_typelib_new_from_const_memory (const guint8 *memory, +GITypelib * gi_typelib_new_from_const_memory (const uint8_t *memory, gsize len, GError **error); diff --git a/girepository/gitypes.h b/girepository/gitypes.h index 2c8f92b9e..77e64fa5e 100644 --- a/girepository/gitypes.h +++ b/girepository/gitypes.h @@ -28,6 +28,8 @@ #error "Only can be included directly." #endif +#include + #include #include @@ -113,25 +115,25 @@ GI_AVAILABLE_IN_ALL GType gi_unresolved_info_get_type (void); union _GIArgument { - gboolean v_boolean; - gint8 v_int8; - guint8 v_uint8; - gint16 v_int16; - guint16 v_uint16; - gint32 v_int32; - guint32 v_uint32; - gint64 v_int64; - guint64 v_uint64; - gfloat v_float; - gdouble v_double; - gshort v_short; - gushort v_ushort; - gint v_int; - guint v_uint; - glong v_long; - gulong v_ulong; - gssize v_ssize; - gsize v_size; + gboolean v_boolean; + int8_t v_int8; + uint8_t v_uint8; + int16_t v_int16; + uint16_t v_uint16; + int32_t v_int32; + uint32_t v_uint32; + int64_t v_int64; + uint64_t v_uint64; + float v_float; + double v_double; + short v_short; + unsigned short v_ushort; + int v_int; + unsigned int v_uint; + long v_long; + unsigned long v_ulong; + gssize v_ssize; + gsize v_size; char *v_string; void *v_pointer; }; diff --git a/girepository/giunioninfo.c b/girepository/giunioninfo.c index 7c311bad1..e3c4397a4 100644 --- a/girepository/giunioninfo.c +++ b/girepository/giunioninfo.c @@ -53,7 +53,7 @@ * Returns: number of fields * Since: 2.80 */ -guint +unsigned int gi_union_info_get_n_fields (GIUnionInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -75,7 +75,7 @@ gi_union_info_get_n_fields (GIUnionInfo *info) */ GIFieldInfo * gi_union_info_get_field (GIUnionInfo *info, - guint n) + unsigned int n) { GIRealInfo *rinfo = (GIRealInfo *)info; Header *header = (Header *)rinfo->typelib->data; @@ -94,7 +94,7 @@ gi_union_info_get_field (GIUnionInfo *info, * Returns: number of methods * Since: 2.80 */ -guint +unsigned int gi_union_info_get_n_methods (GIUnionInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -116,12 +116,12 @@ gi_union_info_get_n_methods (GIUnionInfo *info) */ GIFunctionInfo * gi_union_info_get_method (GIUnionInfo *info, - guint n) + unsigned int n) { GIRealInfo *rinfo = (GIRealInfo *)info; UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset]; Header *header = (Header *)rinfo->typelib->data; - gint offset; + int offset; offset = rinfo->offset + header->union_blob_size + blob->n_fields * header->field_blob_size @@ -157,7 +157,7 @@ gi_union_info_is_discriminated (GIUnionInfo *info) * Returns: offset, in bytes, of the discriminator * Since: 2.80 */ -guint +unsigned int gi_union_info_get_discriminator_offset (GIUnionInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; @@ -202,7 +202,7 @@ gi_union_info_get_discriminator_type (GIUnionInfo *info) */ GIConstantInfo * gi_union_info_get_discriminator (GIUnionInfo *info, - guint n) + unsigned int n) { GIRealInfo *rinfo = (GIRealInfo *)info; UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset]; @@ -210,7 +210,7 @@ gi_union_info_get_discriminator (GIUnionInfo *info, if (blob->discriminated) { Header *header = (Header *)rinfo->typelib->data; - gint offset; + int offset; offset = rinfo->offset + header->union_blob_size + blob->n_fields * header->field_blob_size @@ -240,7 +240,7 @@ GIFunctionInfo * gi_union_info_find_method (GIUnionInfo *info, const char *name) { - gint offset; + int offset; GIRealInfo *rinfo = (GIRealInfo *)info; Header *header = (Header *)rinfo->typelib->data; UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset]; diff --git a/girepository/giunioninfo.h b/girepository/giunioninfo.h index 6db369d87..df24d0bf4 100644 --- a/girepository/giunioninfo.h +++ b/girepository/giunioninfo.h @@ -44,31 +44,31 @@ G_BEGIN_DECLS (gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_UNION) GI_AVAILABLE_IN_ALL -guint gi_union_info_get_n_fields (GIUnionInfo *info); +unsigned int gi_union_info_get_n_fields (GIUnionInfo *info); GI_AVAILABLE_IN_ALL GIFieldInfo * gi_union_info_get_field (GIUnionInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL -guint gi_union_info_get_n_methods (GIUnionInfo *info); +unsigned int gi_union_info_get_n_methods (GIUnionInfo *info); GI_AVAILABLE_IN_ALL GIFunctionInfo * gi_union_info_get_method (GIUnionInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL gboolean gi_union_info_is_discriminated (GIUnionInfo *info); GI_AVAILABLE_IN_ALL -guint gi_union_info_get_discriminator_offset (GIUnionInfo *info); +unsigned int gi_union_info_get_discriminator_offset (GIUnionInfo *info); GI_AVAILABLE_IN_ALL GITypeInfo * gi_union_info_get_discriminator_type (GIUnionInfo *info); GI_AVAILABLE_IN_ALL GIConstantInfo * gi_union_info_get_discriminator (GIUnionInfo *info, - guint n); + unsigned int n); GI_AVAILABLE_IN_ALL GIFunctionInfo * gi_union_info_find_method (GIUnionInfo *info, diff --git a/girepository/givfuncinfo.c b/girepository/givfuncinfo.c index 38fcc52e7..1ac79be96 100644 --- a/girepository/givfuncinfo.c +++ b/girepository/givfuncinfo.c @@ -47,14 +47,14 @@ GIVFuncInfo * gi_base_info_find_vfunc (GIRealInfo *rinfo, - guint32 offset, - guint n_vfuncs, + uint32_t offset, + unsigned n_vfuncs, const char *name) { /* FIXME hash */ Header *header = (Header *)rinfo->typelib->data; - for (guint i = 0; i < n_vfuncs; i++) + for (unsigned i = 0; i < n_vfuncs; i++) { VFuncBlob *fblob = (VFuncBlob *)&rinfo->typelib->data[offset]; const char *fname = (const char *)&rinfo->typelib->data[fblob->name]; @@ -121,7 +121,7 @@ gi_vfunc_info_get_flags (GIVFuncInfo *info) * Returns: the struct offset or `0xFFFF` if it’s unknown * Since: 2.80 */ -guint +unsigned int gi_vfunc_info_get_offset (GIVFuncInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; diff --git a/girepository/givfuncinfo.h b/girepository/givfuncinfo.h index 2e0cded3b..85f23c707 100644 --- a/girepository/givfuncinfo.h +++ b/girepository/givfuncinfo.h @@ -47,7 +47,7 @@ GI_AVAILABLE_IN_ALL GIVFuncInfoFlags gi_vfunc_info_get_flags (GIVFuncInfo *info); GI_AVAILABLE_IN_ALL -guint gi_vfunc_info_get_offset (GIVFuncInfo *info); +unsigned int gi_vfunc_info_get_offset (GIVFuncInfo *info); GI_AVAILABLE_IN_ALL GISignalInfo * gi_vfunc_info_get_signal (GIVFuncInfo *info); diff --git a/girepository/gthash.c b/girepository/gthash.c index cdb0d8ce1..954cd6fce 100644 --- a/girepository/gthash.c +++ b/girepository/gthash.c @@ -48,7 +48,7 @@ * INT32 mph_size * MPH (mph_size bytes) * (padding for alignment to uint32 if necessary) - * INDEX (array of guint16) + * INDEX (array of uint16_t) * * Because BDZ is not order preserving, we need a lookaside table which * maps the hash value into the directory index. @@ -59,8 +59,8 @@ struct _GITypelibHashBuilder { gboolean buildable; cmph_t *c; GHashTable *strings; - guint32 dirmap_offset; - guint32 packed_size; + uint32_t dirmap_offset; + uint32_t packed_size; }; GITypelibHashBuilder * @@ -75,10 +75,10 @@ gi_typelib_hash_builder_new (void) void gi_typelib_hash_builder_add_string (GITypelibHashBuilder *builder, const char *str, - guint16 value) + uint16_t value) { g_return_if_fail (builder->c == NULL); - g_hash_table_insert (builder->strings, g_strdup (str), GUINT_TO_POINTER ((guint) value)); + g_hash_table_insert (builder->strings, g_strdup (str), GUINT_TO_POINTER (value)); } gboolean @@ -89,9 +89,9 @@ gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder) void *key, *value; cmph_io_adapter_t *io; cmph_config_t *config; - guint32 num_elts; - guint32 offset; - guint i; + uint32_t num_elts; + uint32_t offset; + unsigned i; if (builder->prepared) return builder->buildable; @@ -127,9 +127,9 @@ gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder) g_assert (cmph_size (builder->c) == num_elts); /* Pack a size counter at front */ - offset = sizeof(guint32) + cmph_packed_size (builder->c); + offset = sizeof (uint32_t) + cmph_packed_size (builder->c); builder->dirmap_offset = ALIGN_VALUE (offset, 4); - builder->packed_size = builder->dirmap_offset + (num_elts * sizeof(guint16)); + builder->packed_size = builder->dirmap_offset + (num_elts * sizeof (uint16_t)); out: g_strfreev (strs); cmph_config_destroy (config); @@ -137,7 +137,7 @@ gi_typelib_hash_builder_prepare (GITypelibHashBuilder *builder) return builder->buildable; } -guint32 +uint32_t gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder) { g_return_val_if_fail (builder != NULL, 0); @@ -148,15 +148,15 @@ gi_typelib_hash_builder_get_buffer_size (GITypelibHashBuilder *builder) } void -gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint32 len) +gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, uint8_t* mem, uint32_t len) { - guint16 *table; + uint16_t *table; GHashTableIter hashiter; void *key, *value; #ifndef G_DISABLE_ASSERT - guint32 num_elts; + uint32_t num_elts; #endif - guint8 *packed_mem; + uint8_t *packed_mem; g_return_if_fail (builder != NULL); g_return_if_fail (builder->prepared); @@ -167,11 +167,11 @@ gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint3 memset (mem, 0, len); - *((guint32*) mem) = builder->dirmap_offset; - packed_mem = (guint8*)(mem + sizeof(guint32)); + *((uint32_t*) mem) = builder->dirmap_offset; + packed_mem = (uint8_t*)(mem + sizeof (uint32_t)); cmph_pack (builder->c, packed_mem); - table = (guint16*) (mem + builder->dirmap_offset); + table = (uint16_t*) (mem + builder->dirmap_offset); #ifndef G_DISABLE_ASSERT num_elts = g_hash_table_size (builder->strings); @@ -180,8 +180,8 @@ gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint3 while (g_hash_table_iter_next (&hashiter, &key, &value)) { const char *str = key; - guint16 strval = (guint16)GPOINTER_TO_UINT(value); - guint32 hashv; + uint16_t strval = (uint16_t)GPOINTER_TO_UINT(value); + uint32_t hashv; hashv = cmph_search_packed (packed_mem, str, strlen (str)); g_assert (hashv < num_elts); @@ -201,16 +201,16 @@ gi_typelib_hash_builder_destroy (GITypelibHashBuilder *builder) g_slice_free (GITypelibHashBuilder, builder); } -guint16 -gi_typelib_hash_search (guint8* memory, const char *str, guint n_entries) +uint16_t +gi_typelib_hash_search (uint8_t* memory, const char *str, uint32_t n_entries) { - guint32 *mph; - guint16 *table; - guint32 dirmap_offset; - guint32 offset; + uint32_t *mph; + uint16_t *table; + uint32_t dirmap_offset; + uint32_t offset; g_assert ((((size_t)memory) & 0x3) == 0); - mph = ((guint32*)memory)+1; + mph = ((uint32_t*)memory)+1; offset = cmph_search_packed (mph, str, strlen (str)); @@ -222,8 +222,8 @@ gi_typelib_hash_search (guint8* memory, const char *str, guint n_entries) if (offset >= n_entries) offset = 0; - dirmap_offset = *((guint32*)memory); - table = (guint16*) (memory + dirmap_offset); + dirmap_offset = *((uint32_t*)memory); + table = (uint16_t*) (memory + dirmap_offset); return table[offset]; } diff --git a/girepository/tests/cmph-bdz.c b/girepository/tests/cmph-bdz.c index 56aac0979..09bbbdec6 100644 --- a/girepository/tests/cmph-bdz.c +++ b/girepository/tests/cmph-bdz.c @@ -30,7 +30,7 @@ build (void) cmph_io_adapter_t *io; char **strings; cmph_t *c; - guint32 size; + uint32_t size; strings = g_strsplit ("foo,bar,baz", ",", -1); @@ -50,14 +50,14 @@ build (void) } static void -assert_hashes_unique (guint n_hashes, - guint32* hashes) +assert_hashes_unique (unsigned n_hashes, + uint32_t* hashes) { - guint i; + unsigned i; for (i = 0; i < n_hashes; i++) { - guint j = 0; + unsigned j = 0; for (j = 0; j < n_hashes; j++) { if (j != i) @@ -70,10 +70,10 @@ static void test_search (void) { cmph_t *c = build(); - guint i; - guint32 hash; - guint32 hashes[3]; - guint32 size; + unsigned i; + uint32_t hash; + uint32_t hashes[3]; + uint32_t size; size = cmph_size (c); @@ -102,12 +102,12 @@ static void test_search_packed (void) { cmph_t *c = build(); - guint32 bufsize; - guint i; - guint32 hash; - guint32 hashes[3]; - guint32 size; - guint8 *buf; + unsigned i; + uint32_t bufsize; + uint32_t hash; + uint32_t hashes[3]; + uint32_t size; + uint8_t *buf; bufsize = cmph_packed_size (c); buf = g_malloc (bufsize); diff --git a/girepository/tests/gthash.c b/girepository/tests/gthash.c index 1b5dce115..6c674c1da 100644 --- a/girepository/tests/gthash.c +++ b/girepository/tests/gthash.c @@ -21,6 +21,7 @@ * Boston, MA 02111-1307, USA. */ +#include #include #include "gitypelib-internal.h" @@ -28,8 +29,8 @@ static void test_build_retrieve (void) { GITypelibHashBuilder *builder; - guint32 bufsize; - guint8* buf; + uint32_t bufsize; + uint8_t* buf; builder = gi_typelib_hash_builder_new ();