altair,helpers: fix warnings with -Wsign-compare
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); | ^~~~~~~~
This commit is contained in:
@@ -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,
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user