gstreamer: tools: fix compiler warning

Tim Müller tpm at kemper.freedesktop.org
Mon Apr 2 15:18:06 PDT 2012


Module: gstreamer
Branch: master
Commit: f1bf53823a0244a1dbde8de69500556a629e0b68
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=f1bf53823a0244a1dbde8de69500556a629e0b68

Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date:   Mon Apr  2 23:17:21 2012 +0100

tools: fix compiler warning

gst-launch.c: In function ‘print_toc_entry’:
gst-launch.c:446:3: error: the size of array ‘spc’ can’t be evaluated [-Werror=vla]
gst-launch.c:446:3: error: variable-sized object may not be initialized

---

 tools/gst-launch.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/gst-launch.c b/tools/gst-launch.c
index 9a34139..2113bf4 100644
--- a/tools/gst-launch.c
+++ b/tools/gst-launch.c
@@ -438,19 +438,20 @@ print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
   }
 }
 
+#define MAX_INDENT 40
+
 static void
 print_toc_entry (gpointer data, gpointer user_data)
 {
   GstTocEntry *entry = (GstTocEntry *) data;
-  const guint max_indent = 40;
-  const gchar spc[max_indent + 1] = "                                        ";
+  const gchar spc[MAX_INDENT + 1] = "                                        ";
   const gchar *entry_types[] = { "chapter", "edition" };
-  guint indent = MIN (GPOINTER_TO_UINT (user_data), max_indent);
+  guint indent = MIN (GPOINTER_TO_UINT (user_data), MAX_INDENT);
   gint64 start, stop;
 
   gst_toc_entry_get_start_stop (entry, &start, &stop);
 
-  PRINT ("%s%s:", &spc[max_indent - indent], entry_types[entry->type]);
+  PRINT ("%s%s:", &spc[MAX_INDENT - indent], entry_types[entry->type]);
   if (GST_CLOCK_TIME_IS_VALID (start)) {
     PRINT (" start: %" GST_TIME_FORMAT, GST_TIME_ARGS (start));
   }



More information about the gstreamer-commits mailing list