Merge branch 'fix_more_warnings' into 'master'

Fix more warnings

See merge request GNOME/glib!1938
This commit is contained in:
Philip Withnall 2021-02-10 20:01:08 +00:00
commit efe49e46cf
8 changed files with 15 additions and 14 deletions

View File

@ -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)

View File

@ -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 }
};

View File

@ -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;

View File

@ -149,7 +149,7 @@ char *
attribute_flags_to_string (GFileAttributeInfoFlags flags)
{
GString *s;
int i;
gsize i;
gboolean first;
struct {
guint32 mask;

View File

@ -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;

View File

@ -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;
@ -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 },

View File

@ -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))
{

View File

@ -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));