From 18a0d95aa21f5007a330c00d7d25412695525bf1 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Sat, 22 Jun 2019 13:34:21 -0500 Subject: [PATCH] Fix -Wsign-compare warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [23/236] Compiling C object 'lib/76b5a...isc@sha/contrib_gvdb_gvdb-reader.c.o'. ../../../../Projects/epiphany/lib/contrib/gvdb/gvdb-reader.c: In function ‘gvdb_table_get_names’: ../../../../Projects/epiphany/lib/contrib/gvdb/gvdb-reader.c:428:27: warning: comparison of integer expressions of different signedness: ‘guint32’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’} [-Wsign-compare] 428 | else if (parent < n_names && names[parent] != NULL) | ^ To fix this, we have to change n_names to guint, and then also change the types of everything it's compared against. This seems to be safe since none of these should ever be negative. --- gvdb-reader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gvdb-reader.c b/gvdb-reader.c index ccae40e64..2dbb5b414 100644 --- a/gvdb-reader.c +++ b/gvdb-reader.c @@ -351,10 +351,10 @@ gvdb_table_get_names (GvdbTable *table, gsize *length) { gchar **names; - gint n_names; - gint filled; - gint total; - gint i; + guint n_names; + guint filled; + guint total; + guint i; /* We generally proceed by iterating over the list of items in the * hash table (in order of appearance) recording them into an array.