diff options
author | Sebastian Dröge <slomo@coaxion.net> | 2021-04-23 09:37:28 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@coaxion.net> | 2021-04-23 09:37:28 +0000 |
commit | 3e2f31c8584565eac09b50e4269801cfb720f52c (patch) | |
tree | fb109d15bea5ab0ae519b2c8db3c2f73528b6528 | |
parent | 0b863a4ea9ba085f8ec75a220e9c7decaec36280 (diff) | |
parent | e642562fff90928650fe4fe37bcb456f572731a2 (diff) | |
download | glib-3e2f31c8584565eac09b50e4269801cfb720f52c.tar.gz |
Merge branch 'fix_more_warnings' into 'master'
Fix more warnings
See merge request GNOME/glib!2048
-rw-r--r-- | gio/ginputstream.c | 4 | ||||
-rw-r--r-- | gio/gkeyfilesettingsbackend.c | 8 | ||||
-rw-r--r-- | gio/gseekable.c | 3 | ||||
-rw-r--r-- | gio/tests/gdbus-example-server.c | 3 | ||||
-rw-r--r-- | gio/tests/gdbus-example-subtree.c | 12 | ||||
-rw-r--r-- | gio/tests/gdbus-non-socket.c | 3 | ||||
-rw-r--r-- | gio/tests/gdbus-proxy.c | 2 | ||||
-rw-r--r-- | gio/tests/gnotification-server.c | 2 | ||||
-rw-r--r-- | gio/tests/socket-common.c | 2 |
9 files changed, 25 insertions, 14 deletions
diff --git a/gio/ginputstream.c b/gio/ginputstream.c index 9330169dc..a40c7d9c4 100644 --- a/gio/ginputstream.c +++ b/gio/ginputstream.c @@ -427,8 +427,10 @@ g_input_stream_real_skip (GInputStream *stream, NULL)) { end = g_seekable_tell (seekable); + g_assert (start >= 0); g_assert (end >= start); - if (start > G_MAXSIZE - count || start + count > end) + if ((guint64) start > (G_MAXSIZE - count) || + (start + count) > (guint64) end) { stream->priv->pending = TRUE; return end - start; diff --git a/gio/gkeyfilesettingsbackend.c b/gio/gkeyfilesettingsbackend.c index 094be3f91..9319491d5 100644 --- a/gio/gkeyfilesettingsbackend.c +++ b/gio/gkeyfilesettingsbackend.c @@ -66,9 +66,9 @@ typedef struct GHashTable *system_locks; /* Used as a set, owning the strings it contains */ gchar *prefix; - gint prefix_len; + gsize prefix_len; gchar *root_group; - gint root_group_len; + gsize root_group_len; GFile *file; GFileMonitor *file_monitor; @@ -173,7 +173,9 @@ convert_path (GKeyfileSettingsBackend *kfsb, /* if a root_group was specified, make sure the user hasn't given * a path that ghosts that group name */ - if (last_slash != NULL && (last_slash - key) == kfsb->root_group_len && memcmp (key, kfsb->root_group, last_slash - key) == 0) + if (last_slash != NULL && last_slash - key >= 0 && + (gsize) (last_slash - key) == kfsb->root_group_len && + memcmp (key, kfsb->root_group, last_slash - key) == 0) return FALSE; } else diff --git a/gio/gseekable.c b/gio/gseekable.c index 28e815703..9689a77b6 100644 --- a/gio/gseekable.c +++ b/gio/gseekable.c @@ -59,7 +59,8 @@ g_seekable_default_init (GSeekableInterface *iface) * * Tells the current position within the stream. * - * Returns: the offset from the beginning of the buffer. + * Returns: the (positive or zero) offset from the beginning of the + * buffer, zero if the target is not seekable. **/ goffset g_seekable_tell (GSeekable *seekable) diff --git a/gio/tests/gdbus-example-server.c b/gio/tests/gdbus-example-server.c index 00e482724..b19f6505d 100644 --- a/gio/tests/gdbus-example-server.c +++ b/gio/tests/gdbus-example-server.c @@ -276,7 +276,8 @@ static const GDBusInterfaceVTable interface_vtable = { handle_method_call, handle_get_property, - handle_set_property + handle_set_property, + { 0 } }; /* ---------------------------------------------------------------------------------------------------- */ diff --git a/gio/tests/gdbus-example-subtree.c b/gio/tests/gdbus-example-subtree.c index 714bbe612..3254a27cd 100644 --- a/gio/tests/gdbus-example-subtree.c +++ b/gio/tests/gdbus-example-subtree.c @@ -72,7 +72,8 @@ const GDBusInterfaceVTable manager_vtable = { manager_method_call, NULL, /* get_property */ - NULL /* set_property */ + NULL, /* set_property */ + { 0 } }; /* ---------------------------------------------------------------------------------------------------- */ @@ -187,6 +188,7 @@ const GDBusInterfaceVTable block_vtable = block_method_call, block_get_property, block_set_property, + { 0 } }; /* ---------------------------------------------------------------------------------------------------- */ @@ -223,8 +225,9 @@ partition_method_call (GDBusConnection *connection, const GDBusInterfaceVTable partition_vtable = { partition_method_call, - //partition_get_property, - //partition_set_property + NULL, + NULL, + { 0 } }; /* ---------------------------------------------------------------------------------------------------- */ @@ -321,7 +324,8 @@ const GDBusSubtreeVTable subtree_vtable = { subtree_enumerate, subtree_introspect, - subtree_dispatch + subtree_dispatch, + { 0 } }; /* ---------------------------------------------------------------------------------------------------- */ diff --git a/gio/tests/gdbus-non-socket.c b/gio/tests/gdbus-non-socket.c index 64d985a15..911aff262 100644 --- a/gio/tests/gdbus-non-socket.c +++ b/gio/tests/gdbus-non-socket.c @@ -112,7 +112,8 @@ pokee_method_call (GDBusConnection *connection, static const GDBusInterfaceVTable pokee_vtable = { pokee_method_call, NULL, /* get_property */ - NULL /* set_property */ + NULL, /* set_property */ + { 0 } }; /* Processes: diff --git a/gio/tests/gdbus-proxy.c b/gio/tests/gdbus-proxy.c index a2160dcca..7e619c2ac 100644 --- a/gio/tests/gdbus-proxy.c +++ b/gio/tests/gdbus-proxy.c @@ -132,7 +132,7 @@ test_methods (GDBusProxy *proxy) static gboolean strv_equal (gchar **strv, ...) { - gint count; + gsize count; va_list list; const gchar *str; gboolean res; diff --git a/gio/tests/gnotification-server.c b/gio/tests/gnotification-server.c index 9585b0949..c98cbf018 100644 --- a/gio/tests/gnotification-server.c +++ b/gio/tests/gnotification-server.c @@ -220,7 +220,7 @@ g_notification_server_bus_acquired (GDBusConnection *connection, gpointer user_data) { const GDBusInterfaceVTable vtable = { - org_gtk_Notifications_method_call, NULL, NULL + org_gtk_Notifications_method_call, NULL, NULL, { 0 } }; GNotificationServer *server = user_data; diff --git a/gio/tests/socket-common.c b/gio/tests/socket-common.c index e59fa9cd4..18d083a30 100644 --- a/gio/tests/socket-common.c +++ b/gio/tests/socket-common.c @@ -45,7 +45,7 @@ static GSocketAddress * socket_address_from_string (const char *name) { #ifdef G_OS_UNIX - int i, len; + gsize i, len; for (i = 0; i < G_N_ELEMENTS (unix_socket_address_types); i++) { |