Merge branch 'fix_more_warnings' into 'master'

Fix more warnings

See merge request GNOME/glib!2048
This commit is contained in:
Sebastian Dröge 2021-04-23 09:37:28 +00:00
commit 3e2f31c858
9 changed files with 25 additions and 14 deletions

View File

@ -427,8 +427,10 @@ g_input_stream_real_skip (GInputStream *stream,
NULL)) NULL))
{ {
end = g_seekable_tell (seekable); end = g_seekable_tell (seekable);
g_assert (start >= 0);
g_assert (end >= start); 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; stream->priv->pending = TRUE;
return end - start; return end - start;

View File

@ -66,9 +66,9 @@ typedef struct
GHashTable *system_locks; /* Used as a set, owning the strings it contains */ GHashTable *system_locks; /* Used as a set, owning the strings it contains */
gchar *prefix; gchar *prefix;
gint prefix_len; gsize prefix_len;
gchar *root_group; gchar *root_group;
gint root_group_len; gsize root_group_len;
GFile *file; GFile *file;
GFileMonitor *file_monitor; GFileMonitor *file_monitor;
@ -173,7 +173,9 @@ convert_path (GKeyfileSettingsBackend *kfsb,
/* if a root_group was specified, make sure the user hasn't given /* if a root_group was specified, make sure the user hasn't given
* a path that ghosts that group name * 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; return FALSE;
} }
else else

View File

@ -59,7 +59,8 @@ g_seekable_default_init (GSeekableInterface *iface)
* *
* Tells the current position within the stream. * 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 goffset
g_seekable_tell (GSeekable *seekable) g_seekable_tell (GSeekable *seekable)

View File

@ -276,7 +276,8 @@ static const GDBusInterfaceVTable interface_vtable =
{ {
handle_method_call, handle_method_call,
handle_get_property, handle_get_property,
handle_set_property handle_set_property,
{ 0 }
}; };
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */

View File

@ -72,7 +72,8 @@ const GDBusInterfaceVTable manager_vtable =
{ {
manager_method_call, manager_method_call,
NULL, /* get_property */ NULL, /* get_property */
NULL /* set_property */ NULL, /* set_property */
{ 0 }
}; };
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
@ -187,6 +188,7 @@ const GDBusInterfaceVTable block_vtable =
block_method_call, block_method_call,
block_get_property, block_get_property,
block_set_property, block_set_property,
{ 0 }
}; };
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
@ -223,8 +225,9 @@ partition_method_call (GDBusConnection *connection,
const GDBusInterfaceVTable partition_vtable = const GDBusInterfaceVTable partition_vtable =
{ {
partition_method_call, partition_method_call,
//partition_get_property, NULL,
//partition_set_property NULL,
{ 0 }
}; };
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
@ -321,7 +324,8 @@ const GDBusSubtreeVTable subtree_vtable =
{ {
subtree_enumerate, subtree_enumerate,
subtree_introspect, subtree_introspect,
subtree_dispatch subtree_dispatch,
{ 0 }
}; };
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */

View File

@ -112,7 +112,8 @@ pokee_method_call (GDBusConnection *connection,
static const GDBusInterfaceVTable pokee_vtable = { static const GDBusInterfaceVTable pokee_vtable = {
pokee_method_call, pokee_method_call,
NULL, /* get_property */ NULL, /* get_property */
NULL /* set_property */ NULL, /* set_property */
{ 0 }
}; };
/* Processes: /* Processes:

View File

@ -132,7 +132,7 @@ test_methods (GDBusProxy *proxy)
static gboolean static gboolean
strv_equal (gchar **strv, ...) strv_equal (gchar **strv, ...)
{ {
gint count; gsize count;
va_list list; va_list list;
const gchar *str; const gchar *str;
gboolean res; gboolean res;

View File

@ -220,7 +220,7 @@ g_notification_server_bus_acquired (GDBusConnection *connection,
gpointer user_data) gpointer user_data)
{ {
const GDBusInterfaceVTable vtable = { const GDBusInterfaceVTable vtable = {
org_gtk_Notifications_method_call, NULL, NULL org_gtk_Notifications_method_call, NULL, NULL, { 0 }
}; };
GNotificationServer *server = user_data; GNotificationServer *server = user_data;

View File

@ -45,7 +45,7 @@ static GSocketAddress *
socket_address_from_string (const char *name) socket_address_from_string (const char *name)
{ {
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
int i, len; gsize i, len;
for (i = 0; i < G_N_ELEMENTS (unix_socket_address_types); i++) for (i = 0; i < G_N_ELEMENTS (unix_socket_address_types); i++)
{ {