[glib: 3/4] Fix several signedness warnings in glib/tests/uri.c
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 3/4] Fix several signedness warnings in glib/tests/uri.c
- Date: Wed, 18 Nov 2020 11:54:00 +0000 (UTC)
commit 40e70f5d947c90cada88957daa0370c420cf94b1
Author: Emmanuel Fleury <emmanuel fleury gmail com>
Date: Sat Nov 14 14:43:39 2020 +0100
Fix several signedness warnings in glib/tests/uri.c
In file included from glib/glib.h:86,
from glib/tests/uri.c:25:
glib/gtestutils.h:134:96: error: comparison of integer expressions of different signedness: ‘gint’ {aka
‘int’} and ‘GConvertError’
134 | if (!err || (err)->domain != dom || (err)->code !=
c) \
| ^~
glib/tests/uri.c:182:9: note: in expansion of macro ‘g_assert_error’
182 | g_assert_error (error, G_CONVERT_ERROR, file_to_uri_tests[i].expected_error);
| ^~~~~~~~~~~~~~
glib/gtestutils.h:134:96: error: comparison of integer expressions of different signedness: ‘gint’ {aka
‘int’} and ‘GConvertError’
134 | if (!err || (err)->domain != dom || (err)->code !=
c) \
| ^~
glib/tests/uri.c:220:9: note: in expansion of macro ‘g_assert_error’
220 | g_assert_error (error, G_CONVERT_ERROR, file_from_uri_tests[i].expected_error);
| ^~~~~~~~~~~~~~
glib/tests/uri.c: In function ‘test_uri_parsing_absolute’:
glib/gtestutils.h:134:96: error: comparison of integer expressions of different signedness: ‘gint’ {aka
‘int’} and ‘GUriError’
134 | if (!err || (err)->domain != dom || (err)->code !=
c) \
| ^~
glib/tests/uri.c:790:11: note: in expansion of macro ‘g_assert_error’
790 | g_assert_error (error, G_URI_ERROR, test->expected_error_code);
| ^~~~~~~~~~~~~~
In file included from glib/glibconfig.h:9,
from glib/gtypes.h:32,
from glib/galloca.h:32,
from glib/glib.h:30,
from glib/tests/uri.c:25:
glib/tests/uri.c: In function ‘test_uri_iter_params’:
glib/tests/uri.c:1495:51: error: comparison of integer expressions of different signedness: ‘gssize’ {aka
‘const long int’} and ‘long unsigned int’
1495 | params_tests[i].expected_n_params <= G_N_ELEMENTS
(params_tests[i].expected_param_key_values) / 2);
| ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
941 | #define G_LIKELY(expr) (expr)
| ^~~~
glib/tests/uri.c:1494:7: note: in expansion of macro ‘g_assert’
1494 | g_assert (params_tests[i].expected_n_params < 0 ||
| ^~~~~~~~
glib/tests/uri.c: In function ‘test_uri_parse_params’:
glib/tests/uri.c:1562:51: error: comparison of integer expressions of different signedness: ‘gssize’ {aka
‘const long int’} and ‘long unsigned int’
1562 | params_tests[i].expected_n_params <= G_N_ELEMENTS
(params_tests[i].expected_param_key_values) / 2);
| ^~
glib/gmacros.h:941:25: note: in definition of macro ‘G_LIKELY’
941 | #define G_LIKELY(expr) (expr)
| ^~~~
glib/tests/uri.c:1561:7: note: in expansion of macro ‘g_assert’
1561 | g_assert (params_tests[i].expected_n_params < 0 ||
| ^~~~~~~~
glib/tests/uri.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/glib/tests/uri.c b/glib/tests/uri.c
index d2ac498c3..c666fc5af 100644
--- a/glib/tests/uri.c
+++ b/glib/tests/uri.c
@@ -32,7 +32,7 @@ typedef struct
char *filename;
char *hostname;
char *expected_result;
- GConvertError expected_error; /* If failed */
+ gint expected_error; /* If failed */
} FileToUriTest;
FileToUriTest
@@ -100,7 +100,7 @@ typedef struct
char *uri;
char *expected_filename;
char *expected_hostname;
- GConvertError expected_error; /* If failed */
+ gint expected_error; /* If failed */
} FileFromUriTest;
FileFromUriTest
@@ -549,7 +549,7 @@ typedef struct {
GUriFlags flags;
/* Outputs */
gboolean expected_success;
- GUriError expected_error_code; /* unused if @expected_success is true */
+ gint expected_error_code; /* unused if @expected_success is true */
const UriParts expected_parts; /* unused if @expected_success is false */
} UriAbsoluteTest;
@@ -1492,7 +1492,7 @@ test_uri_iter_params (gconstpointer test_data)
g_test_message ("URI %" G_GSIZE_FORMAT ": %s", i, params_tests[i].uri);
g_assert (params_tests[i].expected_n_params < 0 ||
- params_tests[i].expected_n_params <= G_N_ELEMENTS
(params_tests[i].expected_param_key_values) / 2);
+ params_tests[i].expected_n_params <= (gssize) G_N_ELEMENTS
(params_tests[i].expected_param_key_values) / 2);
/* The tests get run twice: once with the length unspecified, using a
* nul-terminated string; and once with the length specified and a copy of
@@ -1559,7 +1559,7 @@ test_uri_parse_params (gconstpointer test_data)
g_test_message ("URI %" G_GSIZE_FORMAT ": %s", i, params_tests[i].uri);
g_assert (params_tests[i].expected_n_params < 0 ||
- params_tests[i].expected_n_params <= G_N_ELEMENTS
(params_tests[i].expected_param_key_values) / 2);
+ params_tests[i].expected_n_params <= (gssize) G_N_ELEMENTS
(params_tests[i].expected_param_key_values) / 2);
/* The tests get run twice: once with the length unspecified, using a
* nul-terminated string; and once with the length specified and a copy of
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]