From 7873ef00e93f4bb390f873eddc16fa1afa071b8a Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Fri, 31 Jan 2020 09:34:45 +0100 Subject: [PATCH] simtech: fix warnings with -Wsign-compare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit simtech/mm-broadband-modem-simtech.c: In function ‘simtech_act_to_mm_act’: simtech/mm-broadband-modem-simtech.c:89:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare] 89 | return (nsmod < G_N_ELEMENTS (simtech_act_to_mm_act_map) ? simtech_act_to_mm_act_map[nsmod] : MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN); | ^ --- plugins/simtech/mm-broadband-modem-simtech.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/simtech/mm-broadband-modem-simtech.c b/plugins/simtech/mm-broadband-modem-simtech.c index 246ce682..8a952dca 100644 --- a/plugins/simtech/mm-broadband-modem-simtech.c +++ b/plugins/simtech/mm-broadband-modem-simtech.c @@ -72,7 +72,7 @@ struct _MMBroadbandModemSimtechPrivate { /* Setup/Cleanup unsolicited events (3GPP interface) */ static MMModemAccessTechnology -simtech_act_to_mm_act (int nsmod) +simtech_act_to_mm_act (guint nsmod) { static const MMModemAccessTechnology simtech_act_to_mm_act_map[] = { [0] = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN, @@ -94,15 +94,15 @@ simtech_tech_changed (MMPortSerialAt *port, GMatchInfo *match_info, MMBroadbandModemSimtech *self) { - gchar *str; + guint simtech_act = 0; - str = g_match_info_fetch (match_info, 1); - if (str && str[0]) - mm_iface_modem_update_access_technologies ( - MM_IFACE_MODEM (self), - simtech_act_to_mm_act (atoi (str)), - MM_IFACE_MODEM_3GPP_ALL_ACCESS_TECHNOLOGIES_MASK); - g_free (str); + if (!mm_get_uint_from_match_info (match_info, 1, &simtech_act)) + return; + + mm_iface_modem_update_access_technologies ( + MM_IFACE_MODEM (self), + simtech_act_to_mm_act (simtech_act), + MM_IFACE_MODEM_3GPP_ALL_ACCESS_TECHNOLOGIES_MASK); } static void