diff --git a/configure.ac b/configure.ac
index cdac02c6b6..11610d54fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -308,10 +308,11 @@ dnl set location of plugin directory
AG_GST_SET_PLUGINDIR
dnl define an ERROR_CFLAGS Makefile variable
-AG_GST_SET_ERROR_CFLAGS($GST_GIT, [-Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings])
+dnl -Wformat-nonliteral - see ext/pango/gstclockoverlay.c and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39438
+AG_GST_SET_ERROR_CFLAGS($GST_GIT, [-Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wformat-nonliteral -Wformat-security])
dnl define an ERROR_CXXFLAGS Makefile variable
-AG_GST_SET_ERROR_CXXFLAGS($GST_GIT, [-Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings])
+AG_GST_SET_ERROR_CXXFLAGS($GST_GIT, [-Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wformat-nonliteral -Wformat-security])
dnl define correct level for debugging messages
AG_GST_SET_LEVEL_DEFAULT($GST_GIT)
diff --git a/ext/pango/gstclockoverlay.h b/ext/pango/gstclockoverlay.h
index 74e32e362b..8dcf69a7d9 100644
--- a/ext/pango/gstclockoverlay.h
+++ b/ext/pango/gstclockoverlay.h
@@ -56,6 +56,24 @@ struct _GstClockOverlayClass {
GType gst_clock_overlay_get_type (void);
+
+/* This is a hack hat allows us to use nonliterals for strftime without
+ * triggering a warning from -Wformat-nonliteral. We need to allow this
+ * because we export the format string as a property of the element.
+ * For the inspiration of this and a discussion of why this is necessary,
+ * see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39438
+ */
+#ifdef __GNUC__
+#pragma GCC system_header
+static size_t my_strftime(char *s, size_t max, const char *format,
+ const struct tm *tm)
+{
+ return strftime (s, max, format, tm);
+}
+#define strftime my_strftime
+#endif
+
+
G_END_DECLS
#endif /* __GST_CLOCK_OVERLAY_H__ */
diff --git a/gst/subparse/mpl2parse.c b/gst/subparse/mpl2parse.c
index cd400bc06f..b043064ed1 100644
--- a/gst/subparse/mpl2parse.c
+++ b/gst/subparse/mpl2parse.c
@@ -56,9 +56,9 @@ mpl2_parse_line (ParserState * state, const gchar * line, guint line_num)
markup = g_string_new (NULL);
while (1) {
- const gchar *format_string;
const gchar *sep;
gchar *line_chunk_escaped;
+ gboolean italics;
/* skip leading white spaces */
while (*line == ' ' || *line == '\t')
@@ -66,10 +66,11 @@ mpl2_parse_line (ParserState * state, const gchar * line, guint line_num)
/* a '/' at the beginning indicates italics */
if (*line == '/') {
- format_string = "%s";
+ italics = TRUE;
+ g_string_append (markup, "");
++line;
} else {
- format_string = "%s";
+ italics = FALSE;
}
if ((sep = strchr (line, '|')))
@@ -78,10 +79,12 @@ mpl2_parse_line (ParserState * state, const gchar * line, guint line_num)
line_chunk_escaped = g_markup_escape_text (line, -1);
GST_LOG ("escaped line: %s", line_chunk_escaped);
- g_string_append_printf (markup, format_string, line_chunk_escaped);
+ g_string_append (markup, line_chunk_escaped);
g_free (line_chunk_escaped);
+ if (italics)
+ g_string_append (markup, "");
if (sep == NULL)
break;