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))
      |                  ^~
This commit is contained in:
Emmanuel Fleury 2020-11-20 23:13:17 +01:00
parent 951105fae5
commit 53157f32b9

View File

@ -137,7 +137,7 @@ process (gint line,
ucs4_result = g_utf8_to_ucs4 (utf8, -1, &items_read, NULL, &error); 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); fail ("line %d: incomplete input not properly detected\n", line);
return; return;
@ -158,7 +158,7 @@ process (gint line,
} }
if (!ucs4_equal (ucs4_result, ucs4) || if (!ucs4_equal (ucs4_result, ucs4) ||
items_read != strlen (utf8) || items_read != (glong) strlen (utf8) ||
items_written != ucs4_len) items_written != ucs4_len)
{ {
fail ("line %d: results of conversion with status %d to ucs4 do not match expected.\n", line, status); 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 || if (strcmp (utf8_result, utf8) != 0 ||
items_read != ucs4_len || 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); fail ("line %d: conversion back to utf8 did not match original\n", line);
return; return;
@ -257,7 +257,7 @@ process (gint line,
return; return;
} }
if (items_read != strlen (utf8) || if (items_read != (glong) strlen (utf8) ||
utf16_count (utf16_from_utf8) != items_written) utf16_count (utf16_from_utf8) != items_written)
{ {
fail ("line %d: length error in conversion to ucs16\n", line); 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) || 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); fail ("line %d: length error in conversion from ucs16 to utf8\n", line);
return; return;