[glib: 4/7] Fix several signedness warnings in tests/gobject/performance-threaded.c




commit 0ddadf14ccb83fa1d038aeb34466c98fc43c9f93
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date:   Fri Nov 20 21:45:27 2020 +0100

    Fix several signedness warnings in tests/gobject/performance-threaded.c
    
    tests/gobject/performance-threaded.c: In function ‘run_test’:
    tests/gobject/performance-threaded.c:302:19: error: comparison of integer expressions of different 
signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’
      302 |     for (i = 0; i < n_threads; i++) {
          |                   ^
    tests/gobject/performance-threaded.c:308:19: error: comparison of integer expressions of different 
signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’
      308 |     for (i = 0; i < n_threads; i++) {
          |                   ^
    tests/gobject/performance-threaded.c: In function ‘find_test’:
    tests/gobject/performance-threaded.c:324:17: error: comparison of integer expressions of different 
signedness: ‘int’ and ‘long unsigned int’
      324 |   for (i = 0; i < G_N_ELEMENTS (tests); i++)
          |                 ^
    tests/gobject/performance-threaded.c: In function ‘main’:
    tests/gobject/performance-threaded.c:351:21: error: comparison of integer expressions of different 
signedness: ‘int’ and ‘long unsigned int’
      351 |       for (i = 0; i < G_N_ELEMENTS (tests); i++)
          |                     ^
    tests/gobject/performance-threaded.c:369:21: error: comparison of integer expressions of different 
signedness: ‘int’ and ‘long unsigned int’
      369 |       for (i = 0; i < G_N_ELEMENTS (tests); i++)
          |                     ^

 tests/gobject/performance-threaded.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/tests/gobject/performance-threaded.c b/tests/gobject/performance-threaded.c
index c98541d66..897372e9b 100644
--- a/tests/gobject/performance-threaded.c
+++ b/tests/gobject/performance-threaded.c
@@ -197,7 +197,7 @@ static const PerformanceTest tests[] = {
 };
 
 static gboolean verbose = FALSE;
-static int n_threads = 0;
+static guint n_threads = 0;
 static gboolean list = FALSE;
 static int test_length = DEFAULT_TEST_TIME;
 
@@ -320,7 +320,7 @@ run_test (const PerformanceTest *test)
 static const PerformanceTest *
 find_test (const char *name)
 {
-  int i;
+  gsize i;
   for (i = 0; i < G_N_ELEMENTS (tests); i++)
     {
       if (strcmp (tests[i].name, name) == 0)
@@ -336,7 +336,7 @@ main (int   argc,
   const PerformanceTest *test;
   GOptionContext *context;
   GError *error = NULL;
-  int i;
+  gsize i;
 
   context = g_option_context_new ("GObject performance tests");
   g_option_context_add_main_entries (context, cmd_entries, NULL);
@@ -357,9 +357,10 @@ main (int   argc,
 
   if (argc > 1)
     {
-      for (i = 1; i < argc; i++)
+      gsize k;
+      for (k = 1; k < argc; k++)
        {
-         test = find_test (argv[i]);
+         test = find_test (argv[k]);
          if (test)
            run_test (test);
        }


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