mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02:00
gio-tool: Fix errors format string
Compiling with clang 3.8.1-18 (debian, x86_64) I ran across this error: gio-tool.c:40:31: error: format string is not a string literal [-Werror,-Wformat-nonliteral] message = g_strdup_vprintf (format, args); ^~~~~~ gio-tool.c:55:31: error: format string is not a string literal [-Werror,-Wformat-nonliteral] message = g_strdup_vprintf (format, args); ^~~~~~ 2 errors generated. To fix the first one, related with the function print_error(), this patch adds to the function prototype a compiler's attribute. For the second one, since the usage of that function is to print one string and the format is already provided, the patch simplifies the function by no receiving variadic arguments. https://bugzilla.gnome.org/show_bug.cgi?id=781125
This commit is contained in:
@@ -105,7 +105,7 @@ save (GFile *file)
|
||||
if (written == -1)
|
||||
{
|
||||
save_res = FALSE;
|
||||
print_error (error->message);
|
||||
print_error ("%s", error->message);
|
||||
g_error_free (error);
|
||||
goto out;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ save (GFile *file)
|
||||
else if (res < 0)
|
||||
{
|
||||
save_res = FALSE;
|
||||
print_error (_("Error reading from standard input"));
|
||||
print_error ("%s", _("Error reading from standard input"));
|
||||
break;
|
||||
}
|
||||
else if (res == 0)
|
||||
@@ -129,7 +129,7 @@ save (GFile *file)
|
||||
if (!close_res)
|
||||
{
|
||||
save_res = FALSE;
|
||||
print_error (error->message);
|
||||
print_error ("%s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user