From 20c23edb83b0bacbb28a0c7f5d3e41309ce4053e Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Thu, 30 Jan 2020 18:03:49 +0100 Subject: [PATCH] altair,helpers: fix warnings with -Wsign-compare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CC altair/tests/test_modem_helpers_altair_lte-test-modem-helpers-altair-lte.o In file included from /usr/lib/glib-2.0/include/glibconfig.h:9, from /usr/include/glib-2.0/glib/gtypes.h:32, from /usr/include/glib-2.0/glib/galloca.h:32, from /usr/include/glib-2.0/glib.h:30, from altair/tests/test-modem-helpers-altair-lte.c:20: altair/tests/test-modem-helpers-altair-lte.c: In function ‘test_parse_cid’: altair/tests/test-modem-helpers-altair-lte.c:98:58: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare] 98 | g_assert (mm_altair_parse_cid ("%CGINFO:blah", NULL) == -1); | ^~ /usr/include/glib-2.0/glib/gmacros.h:937:25: note: in definition of macro ‘G_LIKELY’ 937 | #define G_LIKELY(expr) (expr) | ^~~~ altair/tests/test-modem-helpers-altair-lte.c:98:5: note: in expansion of macro ‘g_assert’ 98 | g_assert (mm_altair_parse_cid ("%CGINFO:blah", NULL) == -1); | ^~~~~~~~ --- plugins/altair/mm-modem-helpers-altair-lte.c | 5 ++--- plugins/altair/mm-modem-helpers-altair-lte.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/altair/mm-modem-helpers-altair-lte.c b/plugins/altair/mm-modem-helpers-altair-lte.c index 7df77ce2..d1b2aa5c 100644 --- a/plugins/altair/mm-modem-helpers-altair-lte.c +++ b/plugins/altair/mm-modem-helpers-altair-lte.c @@ -108,7 +108,7 @@ mm_altair_parse_ceer_response (const gchar *response, /*****************************************************************************/ /* %CGINFO="cid",1 response parser */ -guint +gint mm_altair_parse_cid (const gchar *response, GError **error) { g_autoptr(GRegex) regex = NULL; @@ -117,9 +117,8 @@ mm_altair_parse_cid (const gchar *response, GError **error) regex = g_regex_new ("\\%CGINFO:\\s*(\\d+)", G_REGEX_RAW, 0, NULL); g_assert (regex); - if (!g_regex_match_full (regex, response, strlen (response), 0, 0, &match_info, error)) { + if (!g_regex_match_full (regex, response, strlen (response), 0, 0, &match_info, error)) return -1; - } if (!mm_get_uint_from_match_info (match_info, 1, &cid)) g_set_error (error, diff --git a/plugins/altair/mm-modem-helpers-altair-lte.h b/plugins/altair/mm-modem-helpers-altair-lte.h index 226e7884..ff7f64b0 100644 --- a/plugins/altair/mm-modem-helpers-altair-lte.h +++ b/plugins/altair/mm-modem-helpers-altair-lte.h @@ -30,7 +30,7 @@ gchar *mm_altair_parse_ceer_response (const gchar *response, GError **error); /* %CGINFO="cid",1 response parser */ -guint mm_altair_parse_cid (const gchar *response, GError **error); +gint mm_altair_parse_cid (const gchar *response, GError **error); /* %PCOINFO response parser */ MMPco *mm_altair_parse_vendor_pco_info (const gchar *pco_info, GError **error);