From 1f8d8b397e923d3979b7730ce74ecb8ff252388d Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 17 Nov 2020 21:57:38 +0100 Subject: [PATCH 1/8] Fix wrong position for static qualifier warning in fuzzing/fuzz_dbus_message.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fuzzing/fuzz_dbus_message.c:3:1: error: ‘static’ is not at beginning of declaration 3 | const static GDBusCapabilityFlags flags = G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING; | ^~~~~ --- fuzzing/fuzz_dbus_message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fuzzing/fuzz_dbus_message.c b/fuzzing/fuzz_dbus_message.c index bccb2ba3e..1030d8df0 100644 --- a/fuzzing/fuzz_dbus_message.c +++ b/fuzzing/fuzz_dbus_message.c @@ -1,6 +1,6 @@ #include "fuzz.h" -const static GDBusCapabilityFlags flags = G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING; +static const GDBusCapabilityFlags flags = G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING; int LLVMFuzzerTestOneInput (const unsigned char *data, size_t size) From 8b1959dafe00e8bd2b9875ecf4fe9068f2119af6 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 17 Nov 2020 22:07:53 +0100 Subject: [PATCH 2/8] Fix several signedness warnings in gio/gsettings-mapping.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gio/gsettings-mapping.c: In function ‘g_settings_set_mapping_int’: gio/gsettings-mapping.c:65:23: error: comparison of integer expressions of different signedness: ‘gint64’ {aka ‘long int’} and ‘long unsigned int’ 65 | if (0 <= l && l <= G_MAXUINT64) | ^~ gio/gsettings-mapping.c: In function ‘g_settings_set_mapping_float’: gio/gsettings-mapping.c:120:23: error: comparison of integer expressions of different signedness: ‘gint64’ {aka ‘long int’} and ‘long unsigned int’ 120 | if (0 <= l && l <= G_MAXUINT64) | ^~ gio/gsettings-mapping.c: In function ‘g_settings_get_mapping_int’: gio/gsettings-mapping.c:224:27: error: comparison of integer expressions of different signedness: ‘gint64’ {aka ‘long int’} and ‘long unsigned int’ 224 | return (0 <= l && l <= G_MAXUINT64); | ^~ gio/gsettings-mapping.c: In function ‘g_settings_get_mapping_float’: gio/gsettings-mapping.c:269:27: error: comparison of integer expressions of different signedness: ‘gint64’ {aka ‘long int’} and ‘long unsigned int’ 269 | return (0 <= l && l <= G_MAXUINT64); | ^~ --- gio/gsettings-mapping.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gio/gsettings-mapping.c b/gio/gsettings-mapping.c index 8c64b02a5..4db9724fe 100644 --- a/gio/gsettings-mapping.c +++ b/gio/gsettings-mapping.c @@ -62,7 +62,7 @@ g_settings_set_mapping_int (const GValue *value, } else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_UINT64)) { - if (0 <= l && l <= G_MAXUINT64) + if (0 <= l && (guint64) l <= G_MAXUINT64) variant = g_variant_new_uint64 ((guint64) l); } else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_HANDLE)) @@ -117,7 +117,7 @@ g_settings_set_mapping_float (const GValue *value, } else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_UINT64)) { - if (0 <= l && l <= G_MAXUINT64) + if (0 <= l && (guint64) l <= G_MAXUINT64) variant = g_variant_new_uint64 ((guint64) l); } else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_HANDLE)) @@ -221,7 +221,7 @@ g_settings_get_mapping_int (GValue *value, else if (G_VALUE_HOLDS_UINT64 (value)) { g_value_set_uint64 (value, l); - return (0 <= l && l <= G_MAXUINT64); + return (0 <= l && (guint64) l <= G_MAXUINT64); } else if (G_VALUE_HOLDS_DOUBLE (value)) { @@ -266,7 +266,7 @@ g_settings_get_mapping_float (GValue *value, else if (G_VALUE_HOLDS_UINT64 (value)) { g_value_set_uint64 (value, l); - return (0 <= l && l <= G_MAXUINT64); + return (0 <= l && (guint64) l <= G_MAXUINT64); } else if (G_VALUE_HOLDS_DOUBLE (value)) { From 93f3831ed30068a9da9b5f4a1e11b26abfe6f6f1 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 17 Nov 2020 22:14:26 +0100 Subject: [PATCH 3/8] Fix several signedness warnings in gio/glib-compile-schemas.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gio/glib-compile-schemas.c: In function ‘key_state_set_range’: gio/glib-compile-schemas.c:376:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 376 | for (i = 0; i < G_N_ELEMENTS (table); i++) | ^ gio/glib-compile-schemas.c: In function ‘key_state_serialise’: gio/glib-compile-schemas.c:714:29: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 714 | for (i = 0; i < size / sizeof (guint32); i++) | ^ --- gio/glib-compile-schemas.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c index 788812048..84b82baa9 100644 --- a/gio/glib-compile-schemas.c +++ b/gio/glib-compile-schemas.c @@ -363,7 +363,7 @@ key_state_set_range (KeyState *state, { 'd', "-inf", "inf" }, }; gboolean type_ok = FALSE; - gint i; + gsize i; if (state->minimum) { @@ -705,7 +705,7 @@ key_state_serialise (KeyState *state) guint32 *words; gpointer data; gsize size; - gint i; + gsize i; data = state->strinfo->str; size = state->strinfo->len; From 6b3e39fafdf36dc530498af40d65971e4c596446 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 17 Nov 2020 22:18:16 +0100 Subject: [PATCH 4/8] Fix several missing initializer warnings in gio/glib-compile-schemas.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gio/glib-compile-schemas.c: In function ‘parse_gschema_files’: gio/glib-compile-schemas.c:1773:3: error: missing initializer for field ‘passthrough’ of ‘GMarkupParser’ {aka ‘struct _GMarkupParser’} 1773 | GMarkupParser parser = { start_element, end_element, text }; | ^~~~~~~~~~~~~ gio/glib-compile-schemas.c: In function ‘main’: gio/glib-compile-schemas.c:2176:5: error: missing initializer for field ‘arg_description’ of ‘GOptionEntry’ {aka ‘struct _GOptionEntry’} 2176 | { "allow-any-name", 0, 0, G_OPTION_ARG_NONE, &allow_any_name, N_("Do not enforce key name restrictions") }, | ^ --- gio/glib-compile-schemas.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c index 84b82baa9..cfea042f8 100644 --- a/gio/glib-compile-schemas.c +++ b/gio/glib-compile-schemas.c @@ -1770,7 +1770,7 @@ static GHashTable * parse_gschema_files (gchar **files, gboolean strict) { - GMarkupParser parser = { start_element, end_element, text }; + GMarkupParser parser = { start_element, end_element, text, NULL, NULL }; ParseState state = { 0, }; const gchar *filename; GError *error = NULL; @@ -2173,7 +2173,7 @@ main (int argc, char **argv) { "targetdir", 0, 0, G_OPTION_ARG_FILENAME, &targetdir, N_("Where to store the gschemas.compiled file"), N_("DIRECTORY") }, { "strict", 0, 0, G_OPTION_ARG_NONE, &strict, N_("Abort on any errors in schemas"), NULL }, { "dry-run", 0, 0, G_OPTION_ARG_NONE, &dry_run, N_("Do not write the gschema.compiled file"), NULL }, - { "allow-any-name", 0, 0, G_OPTION_ARG_NONE, &allow_any_name, N_("Do not enforce key name restrictions") }, + { "allow-any-name", 0, 0, G_OPTION_ARG_NONE, &allow_any_name, N_("Do not enforce key name restrictions"), NULL }, /* These options are only for use in the gschema-compile tests */ { "schema-file", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_FILENAME_ARRAY, &schema_files, NULL, NULL }, From 85f24921114942cc3f1efcc7270e2929a3a18378 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 17 Nov 2020 22:24:39 +0100 Subject: [PATCH 5/8] Fix signedness warning in gio/gio-tool.c:attribute_flags_to_string() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gio/gio-tool.c: In function ‘attribute_flags_to_string’: gio/gio-tool.c:171:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 171 | for (i = 0; i < G_N_ELEMENTS (flag_descr); i++) | ^ --- gio/gio-tool.c | 2 +- gio/gvdb/gvdb-builder.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gio/gio-tool.c b/gio/gio-tool.c index ff82c638e..e60d56751 100644 --- a/gio/gio-tool.c +++ b/gio/gio-tool.c @@ -149,7 +149,7 @@ char * attribute_flags_to_string (GFileAttributeInfoFlags flags) { GString *s; - int i; + gsize i; gboolean first; struct { guint32 mask; diff --git a/gio/gvdb/gvdb-builder.c b/gio/gvdb/gvdb-builder.c index 918ee43fd..64d8201dc 100644 --- a/gio/gvdb/gvdb-builder.c +++ b/gio/gvdb/gvdb-builder.c @@ -463,7 +463,7 @@ static GString * file_builder_serialise (FileBuilder *fb, struct gvdb_pointer root) { - struct gvdb_header header; + struct gvdb_header header = { { 0, 0 }, { 0 }, { 0 }, { { 0 }, { 0 } } }; GString *result; memset (&header, 0, sizeof (header)); From a54ebd68603ff515fd68adc6504f7787699b4997 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 17 Nov 2020 22:52:19 +0100 Subject: [PATCH 6/8] Fix missing initializer warning in gio/gio-tool-monitor.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gio/gio-tool-monitor.c:48:3: error: missing initializer for field ‘description’ of ‘GOptionEntry’ {aka ‘const struct _GOptionEntry’} 48 | { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &watch_default }, | ^ --- gio/gio-tool-monitor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gio/gio-tool-monitor.c b/gio/gio-tool-monitor.c index f2ffb3387..73ee1b12e 100644 --- a/gio/gio-tool-monitor.c +++ b/gio/gio-tool-monitor.c @@ -45,7 +45,8 @@ static const GOptionEntry entries[] = { N_("Report moves and renames as simple deleted/created events"), NULL }, { "mounts", 'm', 0, G_OPTION_ARG_NONE, &mounts, N_("Watch for mount events"), NULL }, - { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &watch_default }, + { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &watch_default, + NULL, NULL }, { NULL } }; From 7c7aec9b310f5fa16ef486dc6eed4679a99d7e4b Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 17 Nov 2020 22:59:00 +0100 Subject: [PATCH 7/8] Fix several signedness warnings in gio/gio-tool-tree.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gio/gio-tool-tree.c: In function ‘do_tree’: gio/gio-tool-tree.c:124:22: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ 124 | for (n = 0; n < level; n++) | ^ gio/gio-tool-tree.c:197:21: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ 197 | for (n = 0; n < level; n++) | ^ --- gio/gio-tool-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/gio-tool-tree.c b/gio/gio-tool-tree.c index e63752edb..2327c4549 100644 --- a/gio/gio-tool-tree.c +++ b/gio/gio-tool-tree.c @@ -52,7 +52,7 @@ sort_info_by_name (GFileInfo *a, GFileInfo *b) } static void -do_tree (GFile *f, int level, guint64 pattern) +do_tree (GFile *f, unsigned int level, guint64 pattern) { GFileEnumerator *enumerator; GError *error = NULL; From bdcd7eca3b0db3fddcb2d17be85c3e06ec4447dd Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Tue, 17 Nov 2020 23:04:06 +0100 Subject: [PATCH 8/8] Fix missing initializer warning in gio/glib-compile-resources.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gio/glib-compile-resources.c: In function ‘parse_resource_file’: gio/glib-compile-resources.c:553:3: error: missing initializer for field ‘passthrough’ of ‘GMarkupParser’ {aka ‘struct _GMarkupParser’} 553 | GMarkupParser parser = { start_element, end_element, text }; | ^~~~~~~~~~~~~ --- gio/glib-compile-resources.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/glib-compile-resources.c b/gio/glib-compile-resources.c index f3675c152..74373e5b0 100644 --- a/gio/glib-compile-resources.c +++ b/gio/glib-compile-resources.c @@ -550,7 +550,7 @@ parse_resource_file (const gchar *filename, gboolean collect_data, GHashTable *files) { - GMarkupParser parser = { start_element, end_element, text }; + GMarkupParser parser = { start_element, end_element, text, NULL, NULL }; ParseState state = { 0, }; GMarkupParseContext *context; GError *error = NULL;