Dnia 2005-09-29 13:56, Christian Neumair napisał:
Am Donnerstag, den 29.09.2005, 13:39 +0200 schrieb Przemysław Sitek:
Dnia 2005-09-29 21:41, Colossus napisał:
Ok,
the correct way is to cast g_strerror to (char *):
response = ShowGtkMessageDialog (GTK_WINDOW
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,(char *)
g_strerror(errno));
This way i don't get any warning.
But it's still incorrect. It should be
response = ShowGtkMessageDialog (GTK_WINDOW
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,
"%s", g_strerror(errno));
printf-like functions shouldn't take random strings as their format
string, as they may contain format instructions (such as %s, %d etc)
which will cause the function to look for non-existent arguments which
will produce segfauls.
I wasn't aware that the called method has printf flavor. I wonder which
API provides ShowGtkMessageDialog.
AAARGH, I was thinking about gtk_message_dialog_new:-) My fault:-)
--
Przemys³aw Sitek
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list