Fix signedness warning in gio/gkeyfilesettingsbackend.c

gio/gkeyfilesettingsbackend.c: In function ‘convert_path’:
gio/gkeyfilesettingsbackend.c:155:15: warning: comparison of integer
expressions of different signedness: ‘gsize’ {aka ‘long unsigned int’}
and ‘gint’ {aka ‘int’}
  155 |   if (key_len < kfsb->prefix_len ||
      |               ^
This commit is contained in:
Emmanuel Fleury 2021-04-15 11:00:18 +02:00
parent f2be8c74e5
commit 401ff06614

View File

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