summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Knight <james.d.knight@live.com>2023-04-25 23:25:38 -0400
committerJames Knight <james.d.knight@live.com>2023-04-25 23:25:38 -0400
commit55e93a8278d12d41cfffc9e9c811a55fde844b7c (patch)
tree6c926eb1d336af976e15c333c10d86a50c8a4d67
parent0ca660315a9044696f778da087a6e3dd8910a765 (diff)
downloadglib-55e93a8278d12d41cfffc9e9c811a55fde844b7c.tar.gz
gio: switch gunixconnection ngettext with g_dngettext calls
This commit changes the use of `ngettext` with `g_dngettext`. The project defined `g_dngettext` (with domain support) provides the same functionality as `ngettext` with a NULL domain provided. The purpose of this change is to help address a build error for certain compilers that trigger a `format-nonliteral` error-promoted-warning when using `ngettext` (see also [1][2]). The benefit of switching to use `g_dngettext` is that the function is defined with `G_GNUC_FORMAT`. This provides a hint to GNU GCC compilers to still sanity check these arguments, but not generate a `format-nonliteral`. [1]: 4ae8606b6f80f9764e1f0a82cea7e23c8af487ae [2]: 0ca660315a9044696f778da087a6e3dd8910a765 Signed-off-by: James Knight <james.d.knight@live.com>
-rw-r--r--gio/gunixconnection.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/gio/gunixconnection.c b/gio/gunixconnection.c
index b3f2b1c04..7b466cdf9 100644
--- a/gio/gunixconnection.c
+++ b/gio/gunixconnection.c
@@ -177,10 +177,11 @@ g_unix_connection_receive_fd (GUnixConnection *connection,
gint i;
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- ngettext("Expecting 1 control message, got %d",
- "Expecting 1 control message, got %d",
- nscm),
- nscm);
+ g_dngettext (NULL,
+ "Expecting 1 control message, got %d",
+ "Expecting 1 control message, got %d",
+ nscm),
+ nscm);
for (i = 0; i < nscm; i++)
g_object_unref (scms[i]);
@@ -211,9 +212,10 @@ g_unix_connection_receive_fd (GUnixConnection *connection,
gint i;
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- ngettext("Expecting one fd, but got %d\n",
- "Expecting one fd, but got %d\n",
- nfd),
+ g_dngettext (NULL,
+ "Expecting one fd, but got %d\n",
+ "Expecting one fd, but got %d\n",
+ nfd),
nfd);
for (i = 0; i < nfd; i++)
@@ -595,9 +597,10 @@ g_unix_connection_receive_credentials (GUnixConnection *connection,
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_FAILED,
- ngettext("Expecting 1 control message, got %d",
- "Expecting 1 control message, got %d",
- nscm),
+ g_dngettext (NULL,
+ "Expecting 1 control message, got %d",
+ "Expecting 1 control message, got %d",
+ nscm),
nscm);
goto out;
}