mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
Add -Wformat-nonliteral -Wformat-security
And fix the resulting compile failures. I'm sorry about the patch necessary to gstclockoverlay.h but after talking to Tim we decided we can live with it.
This commit is contained in:
parent
20c9b8eae3
commit
1471df894a
3 changed files with 28 additions and 6 deletions
|
@ -308,10 +308,11 @@ dnl set location of plugin directory
|
||||||
AG_GST_SET_PLUGINDIR
|
AG_GST_SET_PLUGINDIR
|
||||||
|
|
||||||
dnl define an ERROR_CFLAGS Makefile variable
|
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
|
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
|
dnl define correct level for debugging messages
|
||||||
AG_GST_SET_LEVEL_DEFAULT($GST_GIT)
|
AG_GST_SET_LEVEL_DEFAULT($GST_GIT)
|
||||||
|
|
|
@ -56,6 +56,24 @@ struct _GstClockOverlayClass {
|
||||||
|
|
||||||
GType gst_clock_overlay_get_type (void);
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_CLOCK_OVERLAY_H__ */
|
#endif /* __GST_CLOCK_OVERLAY_H__ */
|
||||||
|
|
|
@ -56,9 +56,9 @@ mpl2_parse_line (ParserState * state, const gchar * line, guint line_num)
|
||||||
markup = g_string_new (NULL);
|
markup = g_string_new (NULL);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
const gchar *format_string;
|
|
||||||
const gchar *sep;
|
const gchar *sep;
|
||||||
gchar *line_chunk_escaped;
|
gchar *line_chunk_escaped;
|
||||||
|
gboolean italics;
|
||||||
|
|
||||||
/* skip leading white spaces */
|
/* skip leading white spaces */
|
||||||
while (*line == ' ' || *line == '\t')
|
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 */
|
/* a '/' at the beginning indicates italics */
|
||||||
if (*line == '/') {
|
if (*line == '/') {
|
||||||
format_string = "<i>%s</i>";
|
italics = TRUE;
|
||||||
|
g_string_append (markup, "<i>");
|
||||||
++line;
|
++line;
|
||||||
} else {
|
} else {
|
||||||
format_string = "%s";
|
italics = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((sep = strchr (line, '|')))
|
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);
|
line_chunk_escaped = g_markup_escape_text (line, -1);
|
||||||
|
|
||||||
GST_LOG ("escaped line: %s", line_chunk_escaped);
|
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);
|
g_free (line_chunk_escaped);
|
||||||
|
|
||||||
|
if (italics)
|
||||||
|
g_string_append (markup, "</i>");
|
||||||
if (sep == NULL)
|
if (sep == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue