[glib: 3/8] Fix several signedness warnings in tests/unicode-encoding.c




commit 53157f32b90905c49a4f9894bcb81034e37628f0
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date:   Fri Nov 20 23:13:17 2020 +0100

    Fix several signedness warnings in tests/unicode-encoding.c
    
    tests/unicode-encoding.c: In function ‘process’:
    tests/unicode-encoding.c:140:38: error: comparison of integer expressions of different signedness: 
‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
      140 |       if (!ucs4_result || items_read == strlen (utf8))
          |                                      ^~
    tests/unicode-encoding.c:161:15: error: comparison of integer expressions of different signedness: 
‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
      161 |    items_read != strlen (utf8) ||
          |               ^~
    tests/unicode-encoding.c:198:18: error: comparison of integer expressions of different signedness: 
‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
      198 |    items_written != strlen (utf8))
          |                  ^~
    tests/unicode-encoding.c:260:22: error: comparison of integer expressions of different signedness: 
‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
      260 |       if (items_read != strlen (utf8) ||
          |                      ^~
    tests/unicode-encoding.c:294:18: error: comparison of integer expressions of different signedness: 
‘glong’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’}
      294 |    items_written != strlen (utf8))
          |                  ^~

 tests/unicode-encoding.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/tests/unicode-encoding.c b/tests/unicode-encoding.c
index c729b284d..b0603d105 100644
--- a/tests/unicode-encoding.c
+++ b/tests/unicode-encoding.c
@@ -137,7 +137,7 @@ process (gint      line,
 
       ucs4_result = g_utf8_to_ucs4 (utf8, -1, &items_read, NULL, &error);
 
-      if (!ucs4_result || items_read == strlen (utf8))
+      if (!ucs4_result || items_read == (glong) strlen (utf8))
        {
          fail ("line %d: incomplete input not properly detected\n", line);
          return;
@@ -158,7 +158,7 @@ process (gint      line,
        }
 
       if (!ucs4_equal (ucs4_result, ucs4) ||
-         items_read != strlen (utf8) ||
+          items_read != (glong) strlen (utf8) ||
          items_written != ucs4_len)
        {
          fail ("line %d: results of conversion with status %d to ucs4 do not match expected.\n", line, 
status);
@@ -195,7 +195,7 @@ process (gint      line,
 
       if (strcmp (utf8_result, utf8) != 0 ||
          items_read != ucs4_len ||
-         items_written != strlen (utf8))
+          items_written != (glong) strlen (utf8))
        {
          fail ("line %d: conversion back to utf8 did not match original\n", line);
          return;
@@ -257,7 +257,7 @@ process (gint      line,
          return;
        }
 
-      if (items_read != strlen (utf8) ||
+      if (items_read != (glong) strlen (utf8) ||
          utf16_count (utf16_from_utf8) != items_written)
        {
          fail ("line %d: length error in conversion to ucs16\n", line);
@@ -291,7 +291,7 @@ process (gint      line,
        }
 
       if (items_read != utf16_count (utf16_from_utf8) ||
-         items_written != strlen (utf8))
+          items_written != (glong) strlen (utf8))
        {
          fail ("line %d: length error in conversion from ucs16 to utf8\n", line);
          return;


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