[PATCH] cli,nas: use G_GUINT32_FORMAT for printing cell IDs

Aleksander Morgado aleksander at lanedo.com
Fri May 10 00:11:25 PDT 2013


On 10/05/13 08:57, Ben Chan wrote:
> 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


Bah, just use %u for printing the guint32. Should probably also just use
%hu instead of G_GUINT16_FORMAT, but anyway...


> ---
>  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..0bdaf4b 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: '%" G_GUINT32_FORMAT"'\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: '%" G_GUINT32_FORMAT"'\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: '%" G_GUINT32_FORMAT"'\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: '%" G_GUINT32_FORMAT"'\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),
> 


-- 
Aleksander


More information about the libqmi-devel mailing list