[gcr] fix build error with -Werror=format-security



commit 1d7b9740bc9a0a11e880c342fdabf4e2c2552b63
Author: Andreas Henriksson <andreas fatal se>
Date:   Sat Mar 16 17:51:22 2013 +0100

    fix build error with -Werror=format-security
    
    partial build output:
    
    libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I.. -pthread -I/usr/includ
    e/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gio-unix-
    2.0/ -I/usr/include/p11-kit-1 -DG_LOG_DOMAIN=\"Gcr\" -DGCR_API_SUBJECT_TO_CHANGE
     -DLOCALEDIR=\"/usr/share/locale\" -D_FORTIFY_SOURCE=2 -DGCK_API_SUBJECT_TO_CHAN
    GE -DP11_KIT_API_SUBJECT_TO_CHANGE -DGCR_COMPILATION -pthread -I/usr/include/gtk-3.0 
-I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/atk-1.0 -I/usr/include/cairo 
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/glib-2.0 
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 
-DUIDIR=\"/usr/share/gcr-3/ui/\" -Wall -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes 
-Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -g -O2 -fstack-protector 
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -g -Wno-strict-aliasing -Wno-sign-compare -c 
gcr-certificate-exporter.c  -fPIC -DPIC -o .libs/libgcr_ui_3_la-gcr-certificate-exporter.o
    gcr-certificate-exporter.c: In function 'on_create_file_ready':
    gcr-certificate-exporter.c:230:8: error: format not a string literal and no format arguments 
[-Werror=format-security]
    cc1: some warnings being treated as errors
    make[5]: *** [libgcr_ui_3_la-gcr-certificate-exporter.lo] Error 1
    
    https://bugzilla.gnome.org/show_bug.cgi?id=695973

 ui/gcr-certificate-exporter.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/ui/gcr-certificate-exporter.c b/ui/gcr-certificate-exporter.c
index b448034..8b0977f 100644
--- a/ui/gcr-certificate-exporter.c
+++ b/ui/gcr-certificate-exporter.c
@@ -214,7 +214,6 @@ on_create_file_ready (GObject *source, GAsyncResult *res, gpointer user_data)
        GcrCertificateExporter *self = GCR_CERTIFICATE_EXPORTER (user_data);
        GFileOutputStream *os;
        GtkWidget *dialog;
-       gchar *msg;
 
        os = g_file_create_finish (self->pv->output_file, res, &self->pv->error);
 
@@ -222,12 +221,11 @@ on_create_file_ready (GObject *source, GAsyncResult *res, gpointer user_data)
        if (g_error_matches (self->pv->error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
                g_clear_error (&self->pv->error);
 
-               msg = g_strdup_printf ("<b>%s</b>\n\n%s",
-                                      _("A file already exists with this name."),
-                                      _("Do you want to replace it with a new file?"));
                dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (self->pv->chooser_dialog),
                     GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION,
-                    GTK_BUTTONS_NONE, msg);
+                    GTK_BUTTONS_NONE, "<b>%s</b>\n\n%s",
+                    _("A file already exists with this name."),
+                    _("Do you want to replace it with a new file?"));
                gtk_dialog_add_buttons (GTK_DIALOG (dialog),
                                        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                        _("_Replace"), GTK_RESPONSE_ACCEPT, NULL);
@@ -239,7 +237,6 @@ on_create_file_ready (GObject *source, GAsyncResult *res, gpointer user_data)
                                               G_CALLBACK (on_cancel_replace_dialog),
                                               g_object_ref (dialog), g_object_unref);
                gtk_widget_show (dialog);
-               g_free(msg);
 
                return;
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]