mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-12 10:45:13 +01:00
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>
This commit is contained in:
parent
a47bd14e83
commit
aae4df5c6b
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user