[nautilus] Fix "format not a string literal" warnings



commit adac0747b773d6b81aa1893de8b4239f94df5ee6
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Jun 13 19:15:50 2016 +0200

    Fix "format not a string literal" warnings
    
    With new GCC6.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767616

 src/nautilus-canvas-container.c |    3 +++
 src/nautilus-file-operations.c  |    7 ++++++-
 src/nautilus-ui-utilities.c     |    3 +++
 3 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-canvas-container.c b/src/nautilus-canvas-container.c
index 3427a75..3da17a0 100644
--- a/src/nautilus-canvas-container.c
+++ b/src/nautilus-canvas-container.c
@@ -5152,11 +5152,14 @@ get_text_ellipsis_limit_for_zoom (char **strs,
        }
 
        if (strs != NULL) {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
                for (p = strs; *p != NULL; p++) {
                        if (sscanf (*p, str, limit)) {
                                success = TRUE;
                        }
                }
+#pragma GCC diagnostic pop
        }
 
        g_free (str);
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c
index 4076c99..1ec5591 100644
--- a/src/nautilus-file-operations.c
+++ b/src/nautilus-file-operations.c
@@ -414,6 +414,8 @@ get_link_name (const char *name, int count, int max_length)
                use_count = TRUE;
        }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
        if (use_count)
                result = g_strdup_printf (format, count, name);
        else
@@ -435,7 +437,7 @@ get_link_name (const char *name, int count, int max_length)
                        g_free (new_name);
                }
        }
-
+#pragma GCC diagnostic pop
        return result;
 }
 
@@ -708,6 +710,8 @@ make_next_duplicate_name (const char *base, const char *suffix, int count, int m
 
        }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
        if (use_count)
                result = g_strdup_printf (format, base, count, suffix);
        else
@@ -729,6 +733,7 @@ make_next_duplicate_name (const char *base, const char *suffix, int count, int m
                        g_free (new_base);
                }
        }
+#pragma GCC diagnostic pop
 
        return result;
 }
diff --git a/src/nautilus-ui-utilities.c b/src/nautilus-ui-utilities.c
index c0eaab4..67acdf5 100644
--- a/src/nautilus-ui-utilities.c
+++ b/src/nautilus-ui-utilities.c
@@ -425,7 +425,10 @@ get_text_for_date_range (GPtrArray *date_range)
           normalized = days / 365;
         }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
       label = g_strdup_printf (get_text_for_days_ago (days), normalized);
+#pragma GCC diagnostic pop
     }
 
     g_free (formatted_date);


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