tags: only emit a g_warning() for empty tag strings for git versions
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 16 Jul 2009 12:59:07 +0000 (13:59 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 16 Jul 2009 12:59:07 +0000 (13:59 +0100)
For now, don't show a g_warning() for empty tag strings and NULL
tags with non-git versions; we should wait for the fixes in our
plugin modules to make it into a release before we enable this
unconditionally.

gst/gststructure.c
tests/check/gst/gsttag.c

index 77ebc49..b3ceb4e 100644 (file)
@@ -641,6 +641,12 @@ gst_structure_id_new (GQuark name_quark, GQuark field_quark, ...)
   return s;
 }
 
+#if GST_VERSION_NANO == 1
+#define GIT_G_WARNING g_warning
+#else
+#define GIT_G_WARNING GST_WARNING
+#endif
+
 /* If the structure currently contains a field with the same name, it is
  * replaced with the provided field. Otherwise, the field is added to the
  * structure. The field's value is not deeply copied.
@@ -659,13 +665,13 @@ gst_structure_set_field (GstStructure * structure, GstStructureField * field)
      * structs, e.g. error message debug strings */
     if (G_UNLIKELY (IS_TAGLIST (structure) && (s == NULL || *s == '\0'))) {
       if (s == NULL) {
-        g_warning ("Trying to set NULL string on field '%s' on taglist. "
+        GIT_G_WARNING ("Trying to set NULL string on field '%s' on taglist. "
             "Please file a bug.", g_quark_to_string (field->name));
         g_value_unset (&field->value);
         return;
       } else {
         /* empty strings never make sense */
-        g_warning ("Trying to set empty string on taglist field '%s'. "
+        GIT_G_WARNING ("Trying to set empty string on taglist field '%s'. "
             "Please file a bug.", g_quark_to_string (field->name));
         g_value_unset (&field->value);
         return;
index 4ad2708..557d2c4 100644 (file)
@@ -387,6 +387,10 @@ GST_START_TEST (test_empty_tags)
 {
   GstTagList *tags;
 
+  /* only get g_warnings() with git */
+  if (GST_VERSION_NANO != 1)
+    return;
+
   tags = gst_tag_list_new ();
   ASSERT_WARNING (gst_tag_list_add (tags, GST_TAG_MERGE_APPEND,
           GST_TAG_ARTIST, NULL, NULL));