Silence compiler warnings

Fix several warnings for format strings (-Werror=format-security) and
set but unused variables (-Wunused-but-set-variable)

https://bugzilla.gnome.org/show_bug.cgi?id=664144
This commit is contained in:
Sjoerd Simons 2011-11-14 22:06:07 +01:00 committed by Matthias Clasen
parent fcffe6abbb
commit 216fd8a82c

View File

@ -64,7 +64,6 @@ gint main (gint argc, gchar * argv[])
gsize length_out; gsize length_out;
const gchar encoding[] = "EUC-JP"; const gchar encoding[] = "EUC-JP";
GIOStatus status; GIOStatus status;
GIOFlags flags;
if (!srcdir) if (!srcdir)
srcdir = "."; srcdir = ".";
@ -90,7 +89,7 @@ gint main (gint argc, gchar * argv[])
g_io_channel_set_encoding (gio_r, encoding, &gerr); g_io_channel_set_encoding (gio_r, encoding, &gerr);
if (gerr) if (gerr)
{ {
g_warning (gerr->message); g_warning ("%s", gerr->message);
/* Keep going if this is just a case of iconv not supporting EUC-JP, see bug 428048 */ /* Keep going if this is just a case of iconv not supporting EUC-JP, see bug 428048 */
if (gerr->code != G_CONVERT_ERROR_NO_CONVERSION) if (gerr->code != G_CONVERT_ERROR_NO_CONVERSION)
return 1; return 1;
@ -103,11 +102,10 @@ gint main (gint argc, gchar * argv[])
status = g_io_channel_set_flags (gio_r, G_IO_FLAG_NONBLOCK, &gerr); status = g_io_channel_set_flags (gio_r, G_IO_FLAG_NONBLOCK, &gerr);
if (status == G_IO_STATUS_ERROR) if (status == G_IO_STATUS_ERROR)
{ {
g_warning (gerr->message); g_warning ("%s", gerr->message);
g_error_free (gerr); g_error_free (gerr);
gerr = NULL; gerr = NULL;
} }
flags = g_io_channel_get_flags (gio_r);
buffer = g_string_sized_new (BUFFER_SIZE); buffer = g_string_sized_new (BUFFER_SIZE);
while (TRUE) while (TRUE)
@ -143,7 +141,7 @@ gint main (gint argc, gchar * argv[])
case G_IO_STATUS_EOF: case G_IO_STATUS_EOF:
break; break;
case G_IO_STATUS_ERROR: case G_IO_STATUS_ERROR:
g_warning (gerr->message); g_warning ("%s", gerr->message);
g_error_free (gerr); g_error_free (gerr);
gerr = NULL; gerr = NULL;
break; break;
@ -158,7 +156,7 @@ gint main (gint argc, gchar * argv[])
if (status == G_IO_STATUS_ERROR) if (status == G_IO_STATUS_ERROR)
{ {
g_warning (gerr->message); g_warning ("%s", gerr->message);
g_error_free (gerr); g_error_free (gerr);
gerr = NULL; gerr = NULL;
} }