[glib/glib-2-38] More -Werror=format-nonliteral fixes



commit 7c8dcd32b91710a3c5fc089c35f228b260e86359
Author: John Ralls <jralls ceridwen us>
Date:   Sat Sep 28 16:44:32 2013 -0700

    More -Werror=format-nonliteral fixes
    
    This fixes the build with CLang.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702516

 gio/gcontenttype.c      |    5 ++++-
 gio/gthreadedresolver.c |    3 +++
 glib/gmarkup.c          |    5 ++++-
 glib/gstrfuncs.c        |    5 ++++-
 glib/gutils.c           |    3 +++
 5 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/gio/gcontenttype.c b/gio/gcontenttype.c
index 575d6fe..da9aa21 100644
--- a/gio/gcontenttype.c
+++ b/gio/gcontenttype.c
@@ -423,7 +423,9 @@ g_content_type_get_icon_internal (const gchar *type,
   G_LOCK (gio_xdgmime);
   xdg_icon = xdg_mime_get_icon (type);
   G_UNLOCK (gio_xdgmime);
-  if (xdg_icon != NULL)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+   if (xdg_icon != NULL)
     xdg_mimetype_icon = g_strdup_printf (file_template, xdg_icon);
 
   if (xdg_mimetype_icon)
@@ -438,6 +440,7 @@ g_content_type_get_icon_internal (const gchar *type,
   xdg_mimetype_generic_icon = g_content_type_get_generic_icon_name (type);
   if (xdg_mimetype_generic_icon)
     generic_mimetype_icon = g_strdup_printf (file_template, xdg_mimetype_generic_icon);
+#pragma GCC diagnostic pop
   if (generic_mimetype_icon)
     icon_names[n++] = generic_mimetype_icon;
 
diff --git a/gio/gthreadedresolver.c b/gio/gthreadedresolver.c
index 37f930c..23caddd 100644
--- a/gio/gthreadedresolver.c
+++ b/gio/gthreadedresolver.c
@@ -543,7 +543,10 @@ g_resolver_records_from_res_query (const gchar      *rrname,
           format = _("Error resolving '%s'");
         }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
       g_set_error (error, G_RESOLVER_ERROR, errnum, format, rrname);
+#pragma GCC diagnostic pop
       return NULL;
     }
 
diff --git a/glib/gmarkup.c b/glib/gmarkup.c
index 552773f..a948f40 100644
--- a/glib/gmarkup.c
+++ b/glib/gmarkup.c
@@ -2428,8 +2428,11 @@ g_markup_vprintf_escaped (const gchar *format,
   /* Use them to format the arguments
    */
   G_VA_COPY (args2, args);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
 
   output1 = g_strdup_vprintf (format1->str, args);
+
   if (!output1)
     {
       va_end (args2);
@@ -2440,7 +2443,7 @@ g_markup_vprintf_escaped (const gchar *format,
   va_end (args2);
   if (!output2)
     goto cleanup;
-
+#pragma GCC diagnostic pop
   result = g_string_new (NULL);
 
   /* Iterate through the original format string again,
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
index 9509233..ae926a9 100644
--- a/glib/gstrfuncs.c
+++ b/glib/gstrfuncs.c
@@ -909,7 +909,10 @@ g_ascii_formatd (gchar       *buffer,
   locale_t old_locale;
 
   old_locale = uselocale (get_C_locale ());
-  _g_snprintf (buffer, buf_len, format, d);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+   _g_snprintf (buffer, buf_len, format, d);
+#pragma GCC diagnostic pop
   uselocale (old_locale);
 
   return buffer;
diff --git a/glib/gutils.c b/glib/gutils.c
index 0a9944f..a59072d 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -2273,7 +2273,10 @@ g_format_size_full (guint64          size,
 #endif
 
       g_string_append (string, " (");
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
       g_string_append_printf (string, translated_format, formatted_number);
+#pragma GCC diagnostic pop
       g_free (formatted_number);
       g_string_append (string, ")");
     }


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