huawei: fix warnings with -Wsign-compare

huawei/mm-plugin-huawei.c: In function ‘try_next_usbif’:
  huawei/mm-plugin-huawei.c:234:30: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’} [-Werror=sign-compare]
    234 |                        usbif < closest) {
        |                              ^
  huawei/mm-plugin-huawei.c: In function ‘propagate_port_mode_results’:
  huawei/mm-plugin-huawei.c:439:27: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
    439 |             if (usbif + 1 == GPOINTER_TO_INT (g_object_get_data (G_OBJECT (device), TAG_HUAWEI_PCUI_PORT))) {
        |                           ^~
  huawei/mm-plugin-huawei.c:442:34: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
    442 |             } else if (usbif + 1 == GPOINTER_TO_INT (g_object_get_data (G_OBJECT (device), TAG_HUAWEI_MODEM_PORT)))
        |                                  ^~
  huawei/mm-plugin-huawei.c:445:32: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
    445 |                      usbif + 1 == GPOINTER_TO_INT (g_object_get_data (G_OBJECT (device), TAG_HUAWEI_NDIS_PORT)))
        |                                ^~
This commit is contained in:
Aleksander Morgado
2020-01-31 07:47:17 +01:00
parent 497398158f
commit 2753afb73c

View File

@@ -106,7 +106,7 @@ cache_port_mode (MMDevice *device,
const gchar *tag) const gchar *tag)
{ {
gchar *p; gchar *p;
glong i; gulong i;
/* Get the USB interface number of the PCUI port */ /* Get the USB interface number of the PCUI port */
p = strstr (reply, type); p = strstr (reply, type);
@@ -115,7 +115,7 @@ cache_port_mode (MMDevice *device,
/* shift by 1 so NULL return from g_object_get_data() means no tag */ /* shift by 1 so NULL return from g_object_get_data() means no tag */
i = 1 + strtol (p + strlen (type), NULL, 10); i = 1 + strtol (p + strlen (type), NULL, 10);
if (i > 0 && i < 256 && errno == 0) if (i > 0 && i < 256 && errno == 0)
g_object_set_data (G_OBJECT (device), tag, GINT_TO_POINTER ((gint) i)); g_object_set_data (G_OBJECT (device), tag, GUINT_TO_POINTER ((guint) i));
} }
} }
@@ -212,14 +212,14 @@ try_next_usbif (MMDevice *device)
{ {
FirstInterfaceContext *fi_ctx; FirstInterfaceContext *fi_ctx;
GList *l; GList *l;
gint closest; guint closest;
fi_ctx = g_object_get_data (G_OBJECT (device), TAG_FIRST_INTERFACE_CONTEXT); fi_ctx = g_object_get_data (G_OBJECT (device), TAG_FIRST_INTERFACE_CONTEXT);
g_assert (fi_ctx != NULL); g_assert (fi_ctx != NULL);
/* Look for the next closest one among the list of interfaces in the device, /* Look for the next closest one among the list of interfaces in the device,
* and enable that one as being first */ * and enable that one as being first */
closest = G_MAXINT; closest = G_MAXUINT;
for (l = mm_device_peek_port_probe_list (device); l; l = g_list_next (l)) { for (l = mm_device_peek_port_probe_list (device); l; l = g_list_next (l)) {
MMPortProbe *probe = MM_PORT_PROBE (l->data); MMPortProbe *probe = MM_PORT_PROBE (l->data);
@@ -237,7 +237,7 @@ try_next_usbif (MMDevice *device)
} }
} }
if (closest == G_MAXINT) { if (closest == G_MAXUINT) {
/* No more ttys to try! Just return something */ /* No more ttys to try! Just return something */
closest = 0; closest = 0;
mm_dbg ("(Huawei) No more ports to run initial probing"); mm_dbg ("(Huawei) No more ports to run initial probing");
@@ -436,13 +436,13 @@ propagate_port_mode_results (GList *probes)
usbif = mm_kernel_device_get_property_as_int_hex (mm_port_probe_peek_port (MM_PORT_PROBE (l->data)), "ID_USB_INTERFACE_NUM"); usbif = mm_kernel_device_get_property_as_int_hex (mm_port_probe_peek_port (MM_PORT_PROBE (l->data)), "ID_USB_INTERFACE_NUM");
if (GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (device), TAG_GETPORTMODE_SUPPORTED))) { if (GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (device), TAG_GETPORTMODE_SUPPORTED))) {
if (usbif + 1 == GPOINTER_TO_INT (g_object_get_data (G_OBJECT (device), TAG_HUAWEI_PCUI_PORT))) { if (usbif + 1 == GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (device), TAG_HUAWEI_PCUI_PORT))) {
at_port_flags = MM_PORT_SERIAL_AT_FLAG_PRIMARY; at_port_flags = MM_PORT_SERIAL_AT_FLAG_PRIMARY;
primary_flagged = TRUE; primary_flagged = TRUE;
} else if (usbif + 1 == GPOINTER_TO_INT (g_object_get_data (G_OBJECT (device), TAG_HUAWEI_MODEM_PORT))) } else if (usbif + 1 == GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (device), TAG_HUAWEI_MODEM_PORT)))
at_port_flags = MM_PORT_SERIAL_AT_FLAG_PPP; at_port_flags = MM_PORT_SERIAL_AT_FLAG_PPP;
else if (!g_object_get_data (G_OBJECT (device), TAG_HUAWEI_MODEM_PORT) && else if (!g_object_get_data (G_OBJECT (device), TAG_HUAWEI_MODEM_PORT) &&
usbif + 1 == GPOINTER_TO_INT (g_object_get_data (G_OBJECT (device), TAG_HUAWEI_NDIS_PORT))) usbif + 1 == GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (device), TAG_HUAWEI_NDIS_PORT)))
/* If NDIS reported only instead of MDM, use it */ /* If NDIS reported only instead of MDM, use it */
at_port_flags = MM_PORT_SERIAL_AT_FLAG_PPP; at_port_flags = MM_PORT_SERIAL_AT_FLAG_PPP;
} else if (usbif == 0 && } else if (usbif == 0 &&