[PATCH v2] cli,nas: use '%u' for printing cell IDs

Ben Chan benchan at chromium.org
Fri May 10 00:33:41 PDT 2013


This patch fixes the following type mismatches in the format string for
printing cell IDs:

qmicli-nas.c:1271:71: error: format specifies type 'unsigned short' but the argument has type 'guint32' (aka 'unsigned int') [-Werror,-Wformat]
                    g_print ("\t\tCell ID: '%" G_GUINT16_FORMAT"'\n", cid);
                                            ~~~                       ^~~
qmicli-nas.c:1391:71: error: format specifies type 'unsigned short' but the argument has type 'guint32' (aka 'unsigned int') [-Werror,-Wformat]
                    g_print ("\t\tCell ID: '%" G_GUINT16_FORMAT"'\n", cid);
                                            ~~~                       ^~~
qmicli-nas.c:1505:71: error: format specifies type 'unsigned short' but the argument has type 'guint32' (aka 'unsigned int') [-Werror,-Wformat]
                    g_print ("\t\tCell ID: '%" G_GUINT16_FORMAT"'\n", cid);
                                            ~~~                       ^~~
qmicli-nas.c:1626:71: error: format specifies type 'unsigned short' but the argument has type 'guint32' (aka 'unsigned int') [-Werror,-Wformat]
                    g_print ("\t\tCell ID: '%" G_GUINT16_FORMAT"'\n", cid);
                                            ~~~                       ^~~

Bug reported on https://code.google.com/p/chromium/issues/detail?id=239736
---
 cli/qmicli-nas.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cli/qmicli-nas.c b/cli/qmicli-nas.c
index 7e2fcb5..1fa7abd 100644
--- a/cli/qmicli-nas.c
+++ b/cli/qmicli-nas.c
@@ -1268,7 +1268,7 @@ get_system_info_ready (QmiClientNas *client,
                 if (lac_valid)
                     g_print ("\t\tLocation Area Code: '%" G_GUINT16_FORMAT"'\n", lac);
                 if (cid_valid)
-                    g_print ("\t\tCell ID: '%" G_GUINT16_FORMAT"'\n", cid);
+                    g_print ("\t\tCell ID: '%u'\n", cid);
                 if (registration_reject_info_valid)
                     g_print ("\t\tRegistration reject: '%s' (%u)\n",
                              qmi_nas_network_service_domain_get_string (registration_reject_domain),
@@ -1388,7 +1388,7 @@ get_system_info_ready (QmiClientNas *client,
                 if (lac_valid)
                     g_print ("\t\tLocation Area Code: '%" G_GUINT16_FORMAT"'\n", lac);
                 if (cid_valid)
-                    g_print ("\t\tCell ID: '%" G_GUINT16_FORMAT"'\n", cid);
+                    g_print ("\t\tCell ID: '%u'\n", cid);
                 if (registration_reject_info_valid)
                     g_print ("\t\tRegistration reject: '%s' (%u)\n",
                              qmi_nas_network_service_domain_get_string (registration_reject_domain),
@@ -1502,7 +1502,7 @@ get_system_info_ready (QmiClientNas *client,
                 if (lac_valid)
                     g_print ("\t\tLocation Area Code: '%" G_GUINT16_FORMAT"'\n", lac);
                 if (cid_valid)
-                    g_print ("\t\tCell ID: '%" G_GUINT16_FORMAT"'\n", cid);
+                    g_print ("\t\tCell ID: '%u'\n", cid);
                 if (registration_reject_info_valid)
                     g_print ("\t\tRegistration reject: '%s' (%u)\n",
                              qmi_nas_network_service_domain_get_string (registration_reject_domain),
@@ -1623,7 +1623,7 @@ get_system_info_ready (QmiClientNas *client,
                 if (lac_valid)
                     g_print ("\t\tLocation Area Code: '%" G_GUINT16_FORMAT"'\n", lac);
                 if (cid_valid)
-                    g_print ("\t\tCell ID: '%" G_GUINT16_FORMAT"'\n", cid);
+                    g_print ("\t\tCell ID: '%u'\n", cid);
                 if (registration_reject_info_valid)
                     g_print ("\t\tRegistration reject: '%s' (%u)\n",
                              qmi_nas_network_service_domain_get_string (registration_reject_domain),
-- 
1.8.2.1



More information about the libqmi-devel mailing list