Merge branch 'fix_more_warnings' into 'master'

Fix more warnings

See merge request GNOME/glib!1918
This commit is contained in:
Philip Withnall 2021-02-09 10:45:51 +00:00
commit 652026b9d1
4 changed files with 9 additions and 8 deletions

View File

@ -170,14 +170,14 @@ read_link (const gchar *full_name)
{ {
#if defined (HAVE_READLINK) #if defined (HAVE_READLINK)
gchar *buffer; gchar *buffer;
guint size; gsize size;
size = 256; size = 256;
buffer = g_malloc (size); buffer = g_malloc (size);
while (1) while (1)
{ {
int read_size; gssize read_size;
read_size = readlink (full_name, buffer, size); read_size = readlink (full_name, buffer, size);
if (read_size < 0) if (read_size < 0)
@ -185,7 +185,7 @@ read_link (const gchar *full_name)
g_free (buffer); g_free (buffer);
return NULL; return NULL;
} }
if (read_size < size) if ((gsize) read_size < size)
{ {
buffer[read_size] = 0; buffer[read_size] = 0;
return buffer; return buffer;
@ -929,7 +929,7 @@ get_access_rights (GFileAttributeMatcher *attribute_matcher,
uid_t uid = geteuid (); uid_t uid = geteuid ();
if (uid == _g_stat_uid (statbuf) || if (uid == _g_stat_uid (statbuf) ||
uid == parent_info->owner || uid == (uid_t) parent_info->owner ||
uid == 0) uid == 0)
writable = TRUE; writable = TRUE;
} }

View File

@ -46,6 +46,7 @@ typedef struct
gboolean writable; gboolean writable;
gboolean is_sticky; gboolean is_sticky;
gboolean has_trash_dir; gboolean has_trash_dir;
/* owner should be uid_t but it breaks compliance with MS-Windows */
int owner; int owner;
dev_t device; dev_t device;
ino_t inode; ino_t inode;

View File

@ -162,7 +162,7 @@ g_menu_insert_item (GMenu *menu,
g_return_if_fail (G_IS_MENU (menu)); g_return_if_fail (G_IS_MENU (menu));
g_return_if_fail (G_IS_MENU_ITEM (item)); g_return_if_fail (G_IS_MENU_ITEM (item));
if (position < 0 || position > menu->items->len) if (position < 0 || (guint) position > menu->items->len)
position = menu->items->len; position = menu->items->len;
new_item.attributes = g_hash_table_ref (item->attributes); new_item.attributes = g_hash_table_ref (item->attributes);
@ -480,7 +480,7 @@ g_menu_remove (GMenu *menu,
gint position) gint position)
{ {
g_return_if_fail (G_IS_MENU (menu)); g_return_if_fail (G_IS_MENU (menu));
g_return_if_fail (0 <= position && position < menu->items->len); g_return_if_fail (0 <= position && (guint) position < menu->items->len);
g_menu_clear_item (&g_array_index (menu->items, struct item, position)); g_menu_clear_item (&g_array_index (menu->items, struct item, position));
g_array_remove_index (menu->items, position); g_array_remove_index (menu->items, position);

View File

@ -683,8 +683,8 @@ parse_into_text_tables (const gchar *directory,
GHashTable *summaries, GHashTable *summaries,
GHashTable *descriptions) GHashTable *descriptions)
{ {
GMarkupParser parser = { start_element, end_element, text }; GMarkupParser parser = { start_element, end_element, text, NULL, NULL };
TextTableParseInfo info = { summaries, descriptions }; TextTableParseInfo info = { summaries, descriptions, NULL, NULL, NULL, NULL };
const gchar *basename; const gchar *basename;
GDir *dir; GDir *dir;