Merge branch 'android-warning-fixes' into 'master'

Fix various compiler warnings on Android

See merge request GNOME/glib!1157
This commit is contained in:
Simon McVittie 2019-10-09 12:33:00 +00:00
commit 35e26151a8
4 changed files with 22 additions and 13 deletions

View File

@ -244,8 +244,8 @@ is_valid_nonce_tcp (const gchar *address_entry,
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
_("Error in address “%s” — the port attribute is malformed"),
address_entry);
_("Error in address “%s” — the “%s” attribute is malformed"),
address_entry, "port");
goto out;
}
}
@ -255,8 +255,8 @@ is_valid_nonce_tcp (const gchar *address_entry,
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
_("Error in address “%s” — the family attribute is malformed"),
address_entry);
_("Error in address “%s” — the “%s” attribute is malformed"),
address_entry, "family");
goto out;
}
@ -265,9 +265,17 @@ is_valid_nonce_tcp (const gchar *address_entry,
/* TODO: validate host */
}
nonce_file = nonce_file; /* To avoid -Wunused-but-set-variable */
if (nonce_file != NULL && *nonce_file == '\0')
{
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
_("Error in address “%s” — the “%s” attribute is malformed"),
address_entry, "noncefile");
goto out;
}
ret= TRUE;
ret = TRUE;
out:
g_list_free (keys);
@ -325,8 +333,8 @@ is_valid_tcp (const gchar *address_entry,
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
_("Error in address “%s” — the port attribute is malformed"),
address_entry);
_("Error in address “%s” — the “%s” attribute is malformed"),
address_entry, "port");
goto out;
}
}
@ -336,8 +344,8 @@ is_valid_tcp (const gchar *address_entry,
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
_("Error in address “%s” — the family attribute is malformed"),
address_entry);
_("Error in address “%s” — the “%s” attribute is malformed"),
address_entry, "family");
goto out;
}

View File

@ -193,7 +193,7 @@ ih_event_callback (ik_event_t *event,
* properly. If not, the assumption we have made about event->mask
* only ever having a single bit set (apart from IN_ISDIR) is false.
* The kernel documentation is lacking here. */
g_assert (event_flags != -1);
g_assert ((int) event_flags != -1);
interesting = g_file_monitor_source_handle_event (sub->user_data, event_flags,
event->name, NULL, other, event->timestamp);
@ -201,7 +201,7 @@ ih_event_callback (ik_event_t *event,
g_object_unref (other);
}
}
else if (event_flags != -1)
else if ((int) event_flags != -1)
/* unpaired event -- no 'other' field */
interesting = g_file_monitor_source_handle_event (sub->user_data, event_flags,
event->name, NULL, NULL, event->timestamp);

View File

@ -146,6 +146,7 @@ test_nonce_tcp_address (void)
assert_not_supported_address ("nonce-tcp:host=localhost,port=420000");
assert_not_supported_address ("nonce-tcp:host=localhost,port=42x");
assert_not_supported_address ("nonce-tcp:host=localhost,port=");
assert_not_supported_address ("nonce-tcp:host=localhost,port=42,noncefile=");
}
static void

View File

@ -428,7 +428,7 @@ g_utf8_collate_key (const gchar *str,
if (g_get_charset (&charset))
{
xfrm_len = strxfrm (NULL, str_norm, 0);
if (xfrm_len >= 0 && xfrm_len < G_MAXINT - 2)
if (xfrm_len < G_MAXINT - 2)
{
result = g_malloc (xfrm_len + 1);
strxfrm (result, str_norm, xfrm_len + 1);