diff --git a/girepository/gdump.c b/girepository/gdump.c index d04f2fe76..d96e558cb 100644 --- a/girepository/gdump.c +++ b/girepository/gdump.c @@ -641,7 +641,7 @@ gi_repository_dump (const char *input_filename, if (input == NULL) { int saved_errno = errno; - g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (saved_errno), + g_set_error (error, G_FILE_ERROR, (int) g_file_error_from_errno (saved_errno), "Failed to open ‘%s’: %s", input_filename, g_strerror (saved_errno)); g_module_close (self); @@ -653,7 +653,7 @@ gi_repository_dump (const char *input_filename, if (output == NULL) { int saved_errno = errno; - g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (saved_errno), + g_set_error (error, G_FILE_ERROR, (int) g_file_error_from_errno (saved_errno), "Failed to open ‘%s’: %s", output_filename, g_strerror (saved_errno)); fclose (input); @@ -735,7 +735,7 @@ gi_repository_dump (const char *input_filename, { int saved_errno = errno; - g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (saved_errno), + g_set_error (error, G_FILE_ERROR, (int) g_file_error_from_errno (saved_errno), "Error closing input file ‘%s’: %s", input_filename, g_strerror (saved_errno)); caught_error = TRUE; @@ -745,7 +745,7 @@ gi_repository_dump (const char *input_filename, { int saved_errno = errno; - g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (saved_errno), + g_set_error (error, G_FILE_ERROR, (int) g_file_error_from_errno (saved_errno), "Error closing output file ‘%s’: %s", output_filename, g_strerror (saved_errno)); caught_error = TRUE; diff --git a/girepository/giarginfo.c b/girepository/giarginfo.c index 5d048377e..775e0d62c 100644 --- a/girepository/giarginfo.c +++ b/girepository/giarginfo.c @@ -60,8 +60,8 @@ gi_arg_info_get_direction (GIArgInfo *info) GIRealInfo *rinfo = (GIRealInfo *)info; ArgBlob *blob; - g_return_val_if_fail (info != NULL, -1); - g_return_val_if_fail (GI_IS_ARG_INFO (info), -1); + g_return_val_if_fail (info != NULL, GI_DIRECTION_OUT); + g_return_val_if_fail (GI_IS_ARG_INFO (info), GI_DIRECTION_OUT); blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset]; @@ -218,8 +218,8 @@ gi_arg_info_get_ownership_transfer (GIArgInfo *info) GIRealInfo *rinfo = (GIRealInfo *)info; ArgBlob *blob; - g_return_val_if_fail (info != NULL, -1); - g_return_val_if_fail (GI_IS_ARG_INFO (info), -1); + g_return_val_if_fail (info != NULL, GI_TRANSFER_NOTHING); + g_return_val_if_fail (GI_IS_ARG_INFO (info), GI_TRANSFER_NOTHING); blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset]; @@ -251,8 +251,8 @@ gi_arg_info_get_scope (GIArgInfo *info) GIRealInfo *rinfo = (GIRealInfo *)info; ArgBlob *blob; - g_return_val_if_fail (info != NULL, -1); - g_return_val_if_fail (GI_IS_ARG_INFO (info), -1); + g_return_val_if_fail (info != NULL, GI_SCOPE_TYPE_INVALID); + g_return_val_if_fail (GI_IS_ARG_INFO (info), GI_SCOPE_TYPE_INVALID); blob = (ArgBlob *)&rinfo->typelib->data[rinfo->offset]; diff --git a/girepository/gicallableinfo.c b/girepository/gicallableinfo.c index 48b1fc679..2564b23e1 100644 --- a/girepository/gicallableinfo.c +++ b/girepository/gicallableinfo.c @@ -297,8 +297,8 @@ gi_callable_info_get_caller_owns (GICallableInfo *info) GIRealInfo *rinfo = (GIRealInfo*) info; SignatureBlob *blob; - g_return_val_if_fail (info != NULL, -1); - g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), -1); + g_return_val_if_fail (info != NULL, GI_TRANSFER_NOTHING); + g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), GI_TRANSFER_NOTHING); blob = (SignatureBlob *)&rinfo->typelib->data[signature_offset (info)]; @@ -327,8 +327,8 @@ gi_callable_info_get_instance_ownership_transfer (GICallableInfo *info) GIRealInfo *rinfo = (GIRealInfo*) info; SignatureBlob *blob; - g_return_val_if_fail (info != NULL, -1); - g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), -1); + g_return_val_if_fail (info != NULL, GI_TRANSFER_NOTHING); + g_return_val_if_fail (GI_IS_CALLABLE_INFO (info), GI_TRANSFER_NOTHING); blob = (SignatureBlob *)&rinfo->typelib->data[signature_offset (info)]; diff --git a/girepository/gifunctioninfo.c b/girepository/gifunctioninfo.c index 79afc26fd..45baac666 100644 --- a/girepository/gifunctioninfo.c +++ b/girepository/gifunctioninfo.c @@ -116,8 +116,8 @@ gi_function_info_get_flags (GIFunctionInfo *info) GIRealInfo *rinfo; FunctionBlob *blob; - g_return_val_if_fail (info != NULL, -1); - g_return_val_if_fail (GI_IS_FUNCTION_INFO (info), -1); + g_return_val_if_fail (info != NULL, GI_FUNCTION_INFO_FLAGS_NONE); + g_return_val_if_fail (GI_IS_FUNCTION_INFO (info), GI_FUNCTION_INFO_FLAGS_NONE); rinfo = (GIRealInfo *)info; blob = (FunctionBlob *)&rinfo->typelib->data[rinfo->offset]; diff --git a/girepository/gipropertyinfo.c b/girepository/gipropertyinfo.c index 9aaed45da..ccc61e0c3 100644 --- a/girepository/gipropertyinfo.c +++ b/girepository/gipropertyinfo.c @@ -124,8 +124,8 @@ gi_property_info_get_ownership_transfer (GIPropertyInfo *info) GIRealInfo *rinfo = (GIRealInfo *)info; PropertyBlob *blob; - g_return_val_if_fail (info != NULL, -1); - g_return_val_if_fail (GI_IS_PROPERTY_INFO (info), -1); + g_return_val_if_fail (info != NULL, GI_TRANSFER_NOTHING); + g_return_val_if_fail (GI_IS_PROPERTY_INFO (info), GI_TRANSFER_NOTHING); blob = (PropertyBlob *)&rinfo->typelib->data[rinfo->offset]; diff --git a/girepository/girepository.c b/girepository/girepository.c index 8d65b6258..3f6b5806b 100644 --- a/girepository/girepository.c +++ b/girepository/girepository.c @@ -198,13 +198,13 @@ gi_repository_get_library_path_macos (void) if (cmd->cmd == LC_SEGMENT) { struct segment_command *seg = (struct segment_command *) cmd; - if (((intptr_t) ptr >= (seg->vmaddr + offset)) && ((intptr_t) ptr < (seg->vmaddr + offset + seg->vmsize))) + if (((intptr_t) ptr >= ((intptr_t) seg->vmaddr + offset)) && ((intptr_t) ptr < ((intptr_t) seg->vmaddr + offset + (intptr_t) seg->vmsize))) return _dyld_get_image_name (i); } if (cmd->cmd == LC_SEGMENT_64) { struct segment_command_64 *seg = (struct segment_command_64 *) cmd; - if (((uintptr_t ) ptr >= (seg->vmaddr + offset)) && ((uintptr_t ) ptr < (seg->vmaddr + offset + seg->vmsize))) + if (((intptr_t) ptr >= ((intptr_t) seg->vmaddr + offset)) && ((intptr_t) ptr < ((intptr_t) seg->vmaddr + offset + (intptr_t) seg->vmsize))) return _dyld_get_image_name (i); } /* Jump to the next command */ diff --git a/girepository/girnode-private.h b/girepository/girnode-private.h index 6bb814e38..171d38a50 100644 --- a/girepository/girnode-private.h +++ b/girepository/girnode-private.h @@ -147,7 +147,7 @@ struct _GIIrNodeType uint8_t is_ghashtable : 1; uint8_t is_interface : 1; uint8_t is_error : 1; - int tag; + GITypeTag tag; char *unparsed; /* (owned) */ diff --git a/girepository/girparser.c b/girepository/girparser.c index 52e6a92fa..e6f78b76f 100644 --- a/girepository/girparser.c +++ b/girepository/girparser.c @@ -499,7 +499,7 @@ static IntegerAliasInfo integer_aliases[] = { typedef struct { const char *str; - int tag; + GITypeTag tag; gboolean pointer; } BasicTypeInfo; diff --git a/girepository/girwriter.c b/girepository/girwriter.c index 82db11774..b2bd6395d 100644 --- a/girepository/girwriter.c +++ b/girepository/girwriter.c @@ -221,7 +221,7 @@ write_type_info (const char *ns, GITypeInfo *info, Xml *file) { - int tag; + GITypeTag tag; GITypeInfo *type; gboolean is_pointer; diff --git a/girepository/gitypeinfo.c b/girepository/gitypeinfo.c index e07ab8e9d..6cfdb9bae 100644 --- a/girepository/gitypeinfo.c +++ b/girepository/gitypeinfo.c @@ -373,15 +373,15 @@ gi_type_info_get_array_type (GITypeInfo *info) GIRealInfo *rinfo = (GIRealInfo *)info; SimpleTypeBlob *type; - g_return_val_if_fail (info != NULL, -1); - g_return_val_if_fail (GI_IS_TYPE_INFO (info), -1); + g_return_val_if_fail (info != NULL, GI_ARRAY_TYPE_C); + g_return_val_if_fail (GI_IS_TYPE_INFO (info), GI_ARRAY_TYPE_C); type = (SimpleTypeBlob *)&rinfo->typelib->data[rinfo->offset]; if (!(type->flags.reserved == 0 && type->flags.reserved2 == 0)) { ArrayTypeBlob *blob = (ArrayTypeBlob *)&rinfo->typelib->data[rinfo->offset]; - g_return_val_if_fail (blob->tag == GI_TYPE_TAG_ARRAY, -1); + g_return_val_if_fail (blob->tag == GI_TYPE_TAG_ARRAY, GI_ARRAY_TYPE_C); return blob->array_type; } diff --git a/girepository/gitypes.h b/girepository/gitypes.h index a76b97937..d52ffaba4 100644 --- a/girepository/gitypes.h +++ b/girepository/gitypes.h @@ -366,6 +366,7 @@ typedef enum { /** * GIFieldInfoFlags: + * @GI_FIELD_INFO_FLAGS_NONE: no flags set (since: 2.86) * @GI_FIELD_IS_READABLE: field is readable. * @GI_FIELD_IS_WRITABLE: field is writable. * @@ -376,12 +377,14 @@ typedef enum { typedef enum { + GI_FIELD_INFO_FLAGS_NONE GI_AVAILABLE_ENUMERATOR_IN_2_86 = 0, GI_FIELD_IS_READABLE = 1 << 0, GI_FIELD_IS_WRITABLE = 1 << 1 } GIFieldInfoFlags; /** * GIVFuncInfoFlags: + * @GI_VFUNC_INFO_FLAGS_NONE: no flags set (since: 2.86) * @GI_VFUNC_MUST_CHAIN_UP: chains up to the parent type * @GI_VFUNC_MUST_OVERRIDE: overrides * @GI_VFUNC_MUST_NOT_OVERRIDE: does not override @@ -392,6 +395,7 @@ typedef enum */ typedef enum { + GI_VFUNC_INFO_FLAGS_NONE GI_AVAILABLE_ENUMERATOR_IN_2_86 = 0, GI_VFUNC_MUST_CHAIN_UP = 1 << 0, GI_VFUNC_MUST_OVERRIDE = 1 << 1, GI_VFUNC_MUST_NOT_OVERRIDE = 1 << 2, @@ -399,6 +403,7 @@ typedef enum /** * GIFunctionInfoFlags: + * @GI_FUNCTION_INFO_FLAGS_NONE: no flags set (since: 2.86) * @GI_FUNCTION_IS_METHOD: is a method. * @GI_FUNCTION_IS_CONSTRUCTOR: is a constructor. * @GI_FUNCTION_IS_GETTER: is a getter of a [class@GIRepository.PropertyInfo]. @@ -411,6 +416,7 @@ typedef enum */ typedef enum { + GI_FUNCTION_INFO_FLAGS_NONE GI_AVAILABLE_ENUMERATOR_IN_2_86 = 0, GI_FUNCTION_IS_METHOD = 1 << 0, GI_FUNCTION_IS_CONSTRUCTOR = 1 << 1, GI_FUNCTION_IS_GETTER = 1 << 2, diff --git a/gobject/gclosure.c b/gobject/gclosure.c index 1a1ce5e06..3a80c17f3 100644 --- a/gobject/gclosure.c +++ b/gobject/gclosure.c @@ -920,7 +920,7 @@ g_closure_invoke (GClosure *closure, marshal_data); if (!in_marshal) closure_invoke_notifiers (closure, POST_NOTIFY); - ATOMIC_SET (closure, in_marshal, in_marshal); + ATOMIC_SET (closure, in_marshal, (guint) in_marshal); } g_closure_unref (closure); } @@ -984,7 +984,7 @@ _g_closure_invoke_va (GClosure *closure, n_params, param_types); if (!in_marshal) closure_invoke_notifiers (closure, POST_NOTIFY); - ATOMIC_SET (closure, in_marshal, in_marshal); + ATOMIC_SET (closure, in_marshal, (guint) in_marshal); } g_closure_unref (closure); } diff --git a/gobject/gsignal.c b/gobject/gsignal.c index 137bc003f..a58bbcdb3 100644 --- a/gobject/gsignal.c +++ b/gobject/gsignal.c @@ -755,7 +755,7 @@ node_update_single_va_closure (SignalNode *node) node->single_va_closure_is_valid = TRUE; node->single_va_closure = closure; - node->single_va_closure_is_after = is_after; + node->single_va_closure_is_after = (guint) is_after; } static inline void diff --git a/gobject/gsignalgroup.c b/gobject/gsignalgroup.c index 5372e8cc7..19f4427c4 100644 --- a/gobject/gsignalgroup.c +++ b/gobject/gsignalgroup.c @@ -736,7 +736,7 @@ g_signal_group_connect_closure_ (GSignalGroup *self, handler->signal_id = signal_id; handler->signal_detail = signal_detail; handler->closure = g_closure_ref (closure); - handler->connect_after = after; + handler->connect_after = (guint) after; g_closure_sink (closure); diff --git a/gobject/gtype.c b/gobject/gtype.c index 7d03d322a..a374d0ea2 100644 --- a/gobject/gtype.c +++ b/gobject/gtype.c @@ -1444,7 +1444,7 @@ type_add_interface_Wm (TypeNode *node, */ if (node->data) { - InitState class_state = g_atomic_int_get (&node->data->class.init_state); + InitState class_state = (InitState) g_atomic_int_get (&node->data->class.init_state); if (class_state >= BASE_IFACE_INIT) type_iface_vtable_base_init_Wm (iface, node); diff --git a/gobject/tests/flags.c b/gobject/tests/flags.c index 89ea06b10..7f1957386 100644 --- a/gobject/tests/flags.c +++ b/gobject/tests/flags.c @@ -116,7 +116,7 @@ my_test_get_property (GObject *object, switch (prop_id) { case PROP_FLAGS: - g_value_set_flags (value, test->flags); + g_value_set_flags (value, (guint) test->flags); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -135,7 +135,7 @@ my_test_set_property (GObject *object, switch (prop_id) { case PROP_FLAGS: - test->flags = g_value_get_flags (value); + test->flags = (MyFlagsEnum) g_value_get_flags (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -157,7 +157,7 @@ check_flags_validation (void) for (i = 0; i < G_N_ELEMENTS (test_flags); i++) { - guint flag_set = test_flags[i]; + guint flag_set = (guint) test_flags[i]; GObject *test = g_object_new (G_TYPE_TEST, "flags", flag_set, NULL); diff --git a/gobject/tests/param.c b/gobject/tests/param.c index 29a14f282..f4ccd601e 100644 --- a/gobject/tests/param.c +++ b/gobject/tests/param.c @@ -1164,7 +1164,7 @@ test_interface_default_init (TestInterfaceInterface *iface) continue; /* we think that this is impossible. make sure. */ - pspec = g_param_spec_object ("xyz", "xyz", "xyz", types[i], j); + pspec = g_param_spec_object ("xyz", "xyz", "xyz", types[i], (GParamFlags) j); g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*assertion*pspec->flags*failed*"); @@ -1176,7 +1176,7 @@ test_interface_default_init (TestInterfaceInterface *iface) /* install the property */ g_snprintf (prop_name, sizeof prop_name, "%s-%s", names[i], perms[j]); - pspec = g_param_spec_object (prop_name, prop_name, prop_name, types[i], j); + pspec = g_param_spec_object (prop_name, prop_name, prop_name, types[i], (GParamFlags) j); g_object_interface_install_property (iface, pspec); } } @@ -1320,8 +1320,8 @@ static gint valid_impl_flags[16][16] = { static guint change_this_flag; static guint change_this_type; -static guint use_this_flag; -static guint use_this_type; +static GParamFlags use_this_flag; +static size_t use_this_type_index; typedef GObjectClass TestImplementationClass; typedef GObject TestImplementation; @@ -1371,15 +1371,15 @@ static void test_implementation_class_init (TestImplementationClass *class) g_error ("Interface property does not exist"); g_snprintf (prop_name, sizeof prop_name, "%s-%s", names[change_this_type], perms[change_this_flag]); - pspec = g_param_spec_object (prop_name, prop_name, prop_name, types[use_this_type], use_this_flag); + pspec = g_param_spec_object (prop_name, prop_name, prop_name, types[use_this_type_index], use_this_flag); g_object_class_install_property (class, 1, pspec); } typedef struct { guint change_this_flag; guint change_this_type; - guint use_this_flag; - guint use_this_type; + GParamFlags use_this_flag; + size_t use_this_type_index; } TestParamImplementData; static void @@ -1401,7 +1401,7 @@ test_param_implement_child (gconstpointer user_data) change_this_flag = data->change_this_flag; change_this_type = data->change_this_type; use_this_flag = data->use_this_flag; - use_this_type = data->use_this_type; + use_this_type_index = data->use_this_type_index; g_type_class_ref (test_implementation_get_type ()); } @@ -1421,7 +1421,7 @@ test_param_implement (void) for (change_this_flag = 0; change_this_flag < 16; change_this_flag++) for (change_this_type = 0; change_this_type < 3; change_this_type++) for (use_this_flag = 0; use_this_flag < 16; use_this_flag++) - for (use_this_type = 0; use_this_type < 4; use_this_type++) + for (use_this_type_index = 0; use_this_type_index < 4; use_this_type_index++) { if (!g_test_undefined ()) { @@ -1429,13 +1429,13 @@ test_param_implement (void) if (valid_impl_flags[change_this_flag][use_this_flag] != 'v') continue; - if (valid_impl_types[change_this_type * 16 + change_this_flag][use_this_type] != 'v') + if (valid_impl_types[change_this_type * 16 + change_this_flag][use_this_type_index] != 'v') continue; } - test_path = g_strdup_printf ("/param/implement/subprocess/%u-%u-%u-%u", + test_path = g_strdup_printf ("/param/implement/subprocess/%u-%u-%u-%" G_GSIZE_FORMAT, change_this_flag, change_this_type, - use_this_flag, use_this_type); + use_this_flag, use_this_type_index); g_test_trap_subprocess (test_path, G_TIME_SPAN_SECOND, G_TEST_SUBPROCESS_DEFAULT); g_free (test_path); @@ -1445,7 +1445,7 @@ test_param_implement (void) { case 0: /* make sure the other table agrees */ - g_assert_cmpint (valid_impl_types[change_this_type * 16 + change_this_flag][use_this_type], ==, 0); + g_assert_cmpint (valid_impl_types[change_this_type * 16 + change_this_flag][use_this_type_index], ==, 0); g_test_trap_assert_failed (); g_test_trap_assert_stderr ("*Interface property does not exist*"); continue; @@ -1470,7 +1470,7 @@ test_param_implement (void) } /* Next, we check if there should have been a type error. */ - switch (valid_impl_types[change_this_type * 16 + change_this_flag][use_this_type]) + switch (valid_impl_types[change_this_type * 16 + change_this_flag][use_this_type_index]) { case 0: /* this should have been caught above */ @@ -1684,11 +1684,11 @@ main (int argc, char *argv[]) for (data.change_this_flag = 0; data.change_this_flag < 16; data.change_this_flag++) for (data.change_this_type = 0; data.change_this_type < 3; data.change_this_type++) for (data.use_this_flag = 0; data.use_this_flag < 16; data.use_this_flag++) - for (data.use_this_type = 0; data.use_this_type < 4; data.use_this_type++) + for (data.use_this_type_index = 0; data.use_this_type_index < 4; data.use_this_type_index++) { - test_path = g_strdup_printf ("/param/implement/subprocess/%u-%u-%u-%u", + test_path = g_strdup_printf ("/param/implement/subprocess/%u-%u-%u-%" G_GSIZE_FORMAT, data.change_this_flag, data.change_this_type, - data.use_this_flag, data.use_this_type); + data.use_this_flag, data.use_this_type_index); test_data = g_memdup2 (&data, sizeof (TestParamImplementData)); g_test_add_data_func_full (test_path, g_steal_pointer (&test_data), test_param_implement_child, g_free); g_free (test_path);