Merge branch 'wip/pwithnall/wfloat-conversion-macos' into 'main'

tests: Add some explicit float → int casts

See merge request GNOME/glib!4277
This commit is contained in:
Michael Catanzaro 2024-09-18 00:09:20 +00:00
commit 3936eaaa39
3 changed files with 4 additions and 4 deletions

View File

@ -459,7 +459,7 @@ g_application_pack_option_entries (GApplication *application,
break;
case G_OPTION_ARG_DOUBLE:
if (*(gdouble *) entry->arg_data)
if (*(gdouble *) entry->arg_data != 0.0)
value = g_variant_new_double (*(gdouble *) entry->arg_data);
break;

View File

@ -837,7 +837,7 @@ cancellable_thread_cb (gpointer data)
{
GCancellable *cancellable = data;
g_usleep (0.1 * G_USEC_PER_SEC);
g_usleep ((guint64) (0.1 * G_USEC_PER_SEC));
g_cancellable_cancel (cancellable);
g_object_unref (cancellable);

View File

@ -330,7 +330,7 @@ static void
test_fork_timeout (void)
{
/* allow child to run for only a fraction of a second */
if (g_test_trap_fork (0.11 * 1000000, G_TEST_TRAP_DEFAULT))
if (g_test_trap_fork ((guint64) (0.11 * G_USEC_PER_SEC), G_TEST_TRAP_DEFAULT))
{
/* loop and sleep forever */
while (TRUE)
@ -399,7 +399,7 @@ test_subprocess_timeout (void)
return;
}
/* allow child to run for only a fraction of a second */
g_test_trap_subprocess (NULL, 0.05 * G_USEC_PER_SEC, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_subprocess (NULL, (guint64) (0.05 * G_USEC_PER_SEC), G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_assert_true (g_test_trap_reached_timeout ());
}