Commit 4462906b authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

gst-libs/gst/tag/gstvorbistag.c: Also accept partial dates with only year and...

gst-libs/gst/tag/gstvorbistag.c: Also accept partial dates with only year and month, like 1999-12-00 (fixes #410396 e...

Original commit message from CVS:
* gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_add):
Also accept partial dates with only year and month,
like 1999-12-00 (fixes #410396 even more).
* tests/check/libs/tag.c: (GST_START_TEST):
Add unit test for the above.
parent 5de913c2
2007-03-10 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_add):
Also accept partial dates with only year and month,
like 1999-12-00 (fixes #410396 even more).
* tests/check/libs/tag.c: (GST_START_TEST):
Add unit test for the above.
2007-03-10 Tim-Philipp Müller <tim at centricular dot net>
* tests/check/elements/subparse.c: (GST_START_TEST),
......@@ -254,10 +254,12 @@ gst_vorbis_tag_add (GstTagList * list, const gchar * tag, const gchar * value)
}
}
if (y != 0 && m == 0 && d == 0) {
/* accept dates of the form 2007-00-00 as 2007-01-01 */
m = 1;
d = 1;
/* accept dates like 2007-00-00 and 2007-05-00 */
if (y != 0) {
if (m == 0 && d == 0)
m = d = 1;
else if (m != 0 && d == 0)
d = 1;
}
/* date might be followed by a time */
......
......@@ -530,6 +530,22 @@ GST_START_TEST (test_vorbis_tags)
g_date_free (date);
gst_tag_list_free (list);
}
/* check date with valid month, but day of 00 */
{
GDate *date = NULL;
list = gst_tag_list_new ();
gst_vorbis_tag_add (list, "DATE", "1992-05-00");
fail_unless (gst_tag_list_get_date_index (list, GST_TAG_DATE, 0, &date));
fail_unless (date != NULL);
fail_unless (g_date_get_year (date) == 1992);
fail_unless (g_date_get_month (date) == G_DATE_MAY);
g_date_free (date);
gst_tag_list_free (list);
}
}
GST_END_TEST;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment