gst/gsttaglist.*: Minor fixes to GST_IS_TAG_LIST and gst_is_tag_list().
authorTim-Philipp Müller <tim@centricular.net>
Sat, 7 Oct 2006 18:41:19 +0000 (18:41 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Sat, 7 Oct 2006 18:41:19 +0000 (18:41 +0000)
Original commit message from CVS:
* gst/gsttaglist.c: (gst_is_tag_list):
* gst/gsttaglist.h:
Minor fixes to GST_IS_TAG_LIST and gst_is_tag_list().
* tests/check/gst/gsttag.c: (GST_START_TEST), (gst_tag_suite):
Small test for the above.

ChangeLog
gst/gsttaglist.c
gst/gsttaglist.h
tests/check/gst/gsttag.c

index a461736..150e0ad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2006-10-07  Tim-Philipp Müller  <tim at centricular dot net>
 
+       * gst/gsttaglist.c: (gst_is_tag_list):
+       * gst/gsttaglist.h:
+         Minor fixes to GST_IS_TAG_LIST and gst_is_tag_list().
+
+       * tests/check/gst/gsttag.c: (GST_START_TEST), (gst_tag_suite):
+         Small test for the above.
+
+2006-10-07  Tim-Philipp Müller  <tim at centricular dot net>
+
        * gst/gsttaglist.h:
          Less tabs, more spaces.
 
index 47b20f4..29a54bd 100644 (file)
@@ -479,9 +479,11 @@ gst_tag_list_new (void)
 gboolean
 gst_is_tag_list (gconstpointer p)
 {
+  GstStructure *s = (GstStructure *) p;
+
   g_return_val_if_fail (p != NULL, FALSE);
 
-  return ((GstStructure *) p)->name == gst_tag_list_quark;
+  return (GST_IS_STRUCTURE (s) && s->name == gst_tag_list_quark);
 }
 typedef struct
 {
index cd25451..62508b7 100644 (file)
@@ -82,7 +82,7 @@ typedef enum {
  */
 typedef GstStructure GstTagList;
 #define GST_TAG_LIST(x)       ((GstTagList *) (x))
-#define GST_IS_TAG_LIST(x)    (gst_is_tag_list (GST_TAG_LIST (x)))
+#define GST_IS_TAG_LIST(x)    ((x) != NULL && gst_is_tag_list (GST_TAG_LIST (x)))
 #define GST_TYPE_TAG_LIST     (gst_tag_list_get_type ())
 
 /**
index efc4e23..e0b1be3 100644 (file)
@@ -215,7 +215,25 @@ GST_START_TEST (test_date_tags)
 
 GST_END_TEST;
 
-Suite *
+GST_START_TEST (test_type)
+{
+  GstTagList *taglist;
+
+  taglist = gst_tag_list_new ();
+  fail_unless (GST_IS_TAG_LIST (taglist));
+  fail_unless (gst_is_tag_list (taglist));
+  gst_tag_list_free (taglist);
+
+  /* this isn't okay */
+  ASSERT_CRITICAL (fail_if (gst_is_tag_list (NULL)));
+
+  /* this however should be fine */
+  fail_if (GST_IS_TAG_LIST (NULL));
+}
+
+GST_END_TEST;
+
+static Suite *
 gst_tag_suite (void)
 {
   Suite *s = suite_create ("GstTag");
@@ -224,6 +242,7 @@ gst_tag_suite (void)
   suite_add_tcase (s, tc_chain);
   tcase_add_test (tc_chain, test_merge);
   tcase_add_test (tc_chain, test_date_tags);
+  tcase_add_test (tc_chain, test_type);
 
   return s;
 }