From b6004c70ccb2feee298cd900b981644f9ed59200 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 14 Oct 2024 17:54:15 -0700 Subject: [PATCH] tests: add casts to avoid -Wformat errors on 32-bit Solaris builds For historical reasons, pid_t & mode_t are defined as long instead of int for 32-bit processes in the Solaris headers, and even though they are the same size, gcc issues -Wformat headers if you try to print them with "%d" and "%u" instead of "%ld" & "%lu". Signed-off-by: Alan Coopersmith --- gio/tests/file.c | 2 +- glib/tests/mapping.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gio/tests/file.c b/gio/tests/file.c index 2967406fb..0ef75dfca 100644 --- a/gio/tests/file.c +++ b/gio/tests/file.c @@ -2469,7 +2469,7 @@ test_copy_preserve_mode (void) /* Reset the umask after querying it above. There’s no way to query it without * changing it. */ umask (current_umask); - g_test_message ("Current umask: %u", current_umask); + g_test_message ("Current umask: %u", (unsigned int) current_umask); for (i = 0; i < G_N_ELEMENTS (vectors); i++) { diff --git a/glib/tests/mapping.c b/glib/tests/mapping.c index bbd4de8b0..af5dd60c3 100644 --- a/glib/tests/mapping.c +++ b/glib/tests/mapping.c @@ -228,7 +228,7 @@ test_child_private (void) spawn_flags |= G_SPAWN_DO_NOT_REAP_CHILD; #endif - g_snprintf (pid, sizeof(pid), "%d", getpid ()); + g_snprintf (pid, sizeof (pid), "%d", (int) getpid ()); child_argv[0] = local_argv[0]; child_argv[1] = "mapchild"; child_argv[2] = pid;