+2006-10-26 Tim-Philipp Müller <tim at centricular dot net>
+
+ * gst/gststructure.c: (gst_structure_id_set_value):
+ If someone tries to set a non-UTF8 string field on a structure,
+ don't just print a warning, but also ignore the request and do
+ not change/add that field to the structure.
+
+ * tests/check/gst/gsttag.c: (GST_START_TEST), (gst_tag_suite):
+ Test for the above.
+
2006-10-25 David Schleef <ds@schleef.org>
* gst/gstinfo.c:
if (s != NULL && !g_utf8_validate (s, -1, NULL)) {
g_warning ("Trying to set string field '%s' on structure, but string is "
"not valid UTF-8. Please file a bug.", g_quark_to_string (field));
+ return;
}
}
#endif
GST_END_TEST;
+GST_START_TEST (test_set_non_utf8_string)
+{
+ GstTagList *taglist;
+ guint8 foobar[2] = { 0xff, 0x00 }; /* not UTF-8 */
+
+ taglist = gst_tag_list_new ();
+ fail_unless (taglist != NULL);
+
+ ASSERT_WARNING (gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND,
+ GST_TAG_ARTIST, (gchar *) foobar, NULL));
+
+ /* That string field with a non-UTF8 string should not have been added */
+ fail_unless (gst_tag_list_is_empty (taglist));
+
+ gst_tag_list_free (taglist);
+}
+
+GST_END_TEST;
+
static Suite *
gst_tag_suite (void)
{
tcase_add_test (tc_chain, test_merge);
tcase_add_test (tc_chain, test_date_tags);
tcase_add_test (tc_chain, test_type);
+ tcase_add_test (tc_chain, test_set_non_utf8_string);
return s;
}