Add -Wformat-nonliteral -Wformat-security flags
authorBenjamin Otte <otte@redhat.com>
Mon, 22 Mar 2010 15:21:31 +0000 (16:21 +0100)
committerBenjamin Otte <otte@redhat.com>
Mon, 22 Mar 2010 15:22:22 +0000 (16:22 +0100)
and fix the warnings

configure.ac
gst/mxf/mxfmux.c

index 6a9fb04..bc25d6d 100644 (file)
@@ -241,12 +241,12 @@ 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 ])
+    -Wwrite-strings -Wformat-nonliteral -Wformat-security ])
 
 dnl define an ERROR_CXXFLAGS Makefile variable
 AG_GST_SET_ERROR_CXXFLAGS($GST_GIT, [
     -Wmissing-declarations -Wredundant-decls -Wundef
-    -Wwrite-strings ])
+    -Wwrite-strings -Wformat-nonliteral -Wformat-security ])
 
 dnl define correct level for debugging messages
 AG_GST_SET_LEVEL_DEFAULT($GST_GIT)
index 757d269..d463a03 100644 (file)
@@ -376,6 +376,18 @@ gst_mxf_mux_setcaps (GstPad * pad, GstCaps * caps)
   return ret;
 }
 
+static char *
+gst_mxf_mux_create_pad_name (GstPadTemplate * templ, guint id)
+{
+  GString *string;
+
+  string = g_string_new (GST_PAD_TEMPLATE_NAME_TEMPLATE (templ));
+  g_string_truncate (string, string->len - 2);
+  g_string_append_printf (string, "%u", id);
+
+  return g_string_free (string, FALSE);
+}
+
 static GstPad *
 gst_mxf_mux_request_new_pad (GstElement * element,
     GstPadTemplate * templ, const gchar * pad_name)
@@ -399,7 +411,7 @@ gst_mxf_mux_request_new_pad (GstElement * element,
   }
 
   pad_number = g_atomic_int_exchange_and_add ((gint *) & mux->n_pads, 1);
-  name = g_strdup_printf (GST_PAD_TEMPLATE_NAME_TEMPLATE (templ), pad_number);
+  name = gst_mxf_mux_create_pad_name (templ, pad_number);
 
   GST_DEBUG_OBJECT (mux, "Creating pad '%s'", name);
   pad = gst_pad_new_from_template (templ, name);