[gnome-desktop-testing/wip/no-autotools: 4/8] Fix signedness warnings




commit fc924dd120f6a6c6f48e3caf2cffa907b9c00c15
Author: Simon McVittie <smcv collabora com>
Date:   Tue Jun 29 17:05:12 2021 +0100

    Fix signedness warnings
    
    Signed-off-by: Simon McVittie <smcv collabora com>

 configure.ac                       |  2 +-
 src/gnome-desktop-testing-runner.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f929f60..3ee64aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@ if test "x$GCC" = "xyes"; then
                -Werror=pointer-arith -Werror=init-self -Werror=format=2 \
                -Werror=format-security \
                -Werror=missing-include-dirs -Werror=aggregate-return \
-               -Werror=switch-default -Wswitch-enum
+               -Werror=switch-default -Wswitch-enum -Wsign-compare \
                -Werror=declaration-after-statement"
 fi
 changequote([,])dnl
diff --git a/src/gnome-desktop-testing-runner.c b/src/gnome-desktop-testing-runner.c
index c9d6ad0..d75b71c 100644
--- a/src/gnome-desktop-testing-runner.c
+++ b/src/gnome-desktop-testing-runner.c
@@ -235,8 +235,8 @@ typedef struct {
   GPtrArray *tests;
   GPtrArray *failed_test_msgs;
 
-  int parallel;
-  int test_index;
+  unsigned int parallel;
+  unsigned int test_index;
 
   gboolean running_exclusive_test;
 } TestRunnerApp;
@@ -830,7 +830,7 @@ timeval_to_ms (const struct timeval *tv)
       tv->tv_usec == -1L)
     return -1;
 
-  if (tv->tv_sec > (G_MAXUINT64 - tv->tv_usec) / G_USEC_PER_SEC)
+  if (tv->tv_sec > (G_MAXINT64 - tv->tv_usec) / G_USEC_PER_SEC)
     return -1;
 
   return ((gint64) tv->tv_sec) * G_USEC_PER_SEC + tv->tv_usec;
@@ -850,7 +850,7 @@ main (int argc, char **argv)
   GError *local_error = NULL;
   GError **error = &local_error;
   guint total_tests = 0;
-  int i, j;
+  unsigned int i, j;
   GOptionContext *context;
   TestRunnerApp appstruct;
   const char *const *datadirs_iter;
@@ -926,7 +926,7 @@ main (int argc, char **argv)
         {
           gboolean matches = FALSE;
           GdtrTest *test = app->tests->pdata[j];
-          for (i = 1; i < argc; i++)
+          for (i = 1; i < (unsigned int) argc; i++)
             {
               const char *prefix = argv[i];
               if (g_str_has_prefix (test->name, prefix))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]