I am getting an error like this:
warning: format not a string literal and no format arguments [-Wformat-security]
GTK_BUTTONS_OK,
(const gchar*)message);
^
because of this function:
static void show_message (gchar *message, GtkMessageType type) {
GtkWidget *dialog = gtk_message_dialog_new(NULL, 0, type,
GTK_BUTTONS_OK,
message);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
}
How can I fix it?
The answer is quite simple.
You have to add
"%s"
to the arguments of thegtk_message_dialog_new()
function like this:Basically, the lack of
"%s"
is considered non-secure bygcc
.You can read more about it here:
warning: format not a string literal and no format arguments
http://cboard.cprogramming.com/linux-programming/148565-gtk_message_dialog_new-showing-literal-warning.html