mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-02 16:52:42 +00:00
structure: fix some more 0.11 fixmes
don't allow spaces in structure names and fix unit tests.
This commit is contained in:
parent
f7acae0af5
commit
7b43f02ed3
2 changed files with 5 additions and 20 deletions
|
@ -171,10 +171,9 @@ gst_structure_validate_name (const gchar * name)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME 0.11: don't allow spaces */
|
|
||||||
/* FIXME: test name string more */
|
/* FIXME: test name string more */
|
||||||
s = &name[1];
|
s = &name[1];
|
||||||
while (*s && (g_ascii_isalnum (*s) || strchr ("/-_.:+ ", *s) != NULL))
|
while (*s && (g_ascii_isalnum (*s) || strchr ("/-_.:+", *s) != NULL))
|
||||||
s++;
|
s++;
|
||||||
if (G_UNLIKELY (*s != '\0')) {
|
if (G_UNLIKELY (*s != '\0')) {
|
||||||
GST_WARNING ("Invalid character '%c' at offset %lu in structure name: %s",
|
GST_WARNING ("Invalid character '%c' at offset %lu in structure name: %s",
|
||||||
|
|
|
@ -159,11 +159,9 @@ GST_START_TEST (test_from_string)
|
||||||
fail_unless_equals_int (g_value_get_boolean (val), TRUE);
|
fail_unless_equals_int (g_value_get_boolean (val), TRUE);
|
||||||
gst_structure_free (structure);
|
gst_structure_free (structure);
|
||||||
|
|
||||||
/* This should still work for now (FIXME: 0.11) */
|
|
||||||
s = "0.10:decoder-video/mpeg, abc=(boolean)false";
|
s = "0.10:decoder-video/mpeg, abc=(boolean)false";
|
||||||
structure = gst_structure_from_string (s, NULL);
|
ASSERT_CRITICAL (structure = gst_structure_from_string (s, NULL));
|
||||||
fail_if (structure == NULL, "Could not get structure from string %s", s);
|
fail_unless (structure == NULL, "Could not get structure from string %s", s);
|
||||||
gst_structure_free (structure);
|
|
||||||
|
|
||||||
/* make sure we bail out correctly in case of an error or if parsing fails */
|
/* make sure we bail out correctly in case of an error or if parsing fails */
|
||||||
s = "***foo***, abc=(boolean)false";
|
s = "***foo***, abc=(boolean)false";
|
||||||
|
@ -188,22 +186,10 @@ GST_START_TEST (test_to_string)
|
||||||
ASSERT_CRITICAL (st1 = gst_structure_new ("Foo\nwith-newline", NULL));
|
ASSERT_CRITICAL (st1 = gst_structure_new ("Foo\nwith-newline", NULL));
|
||||||
fail_unless (st1 == NULL);
|
fail_unless (st1 == NULL);
|
||||||
|
|
||||||
/* FIXME 0.11: re-enable this */
|
|
||||||
#if 0
|
|
||||||
ASSERT_CRITICAL (st1 = gst_structure_new ("Foo with whitespace", NULL));
|
ASSERT_CRITICAL (st1 = gst_structure_new ("Foo with whitespace", NULL));
|
||||||
fail_unless (st1 == NULL);
|
fail_unless (st1 == NULL);
|
||||||
ASSERT_CRITICAL (st1 = gst_structure_new ("1st", NULL));
|
ASSERT_CRITICAL (st1 = gst_structure_new ("1st", NULL));
|
||||||
fail_unless (st1 == NULL);
|
fail_unless (st1 == NULL);
|
||||||
#else
|
|
||||||
st1 = gst_structure_new ("Foo with whitespace is still allowed", NULL);
|
|
||||||
fail_unless (st1 != NULL);
|
|
||||||
gst_structure_free (st1);
|
|
||||||
|
|
||||||
/* structure names starting with a number are also still allowed */
|
|
||||||
st1 = gst_structure_new ("1st", NULL);
|
|
||||||
fail_unless (st1 != NULL);
|
|
||||||
gst_structure_free (st1);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
@ -339,8 +325,8 @@ GST_START_TEST (test_structure_new)
|
||||||
g_error_free (e);
|
g_error_free (e);
|
||||||
gst_structure_free (s);
|
gst_structure_free (s);
|
||||||
|
|
||||||
/* This should still work for now (FIXME 0.11) */
|
ASSERT_CRITICAL (gst_structure_free (gst_structure_new
|
||||||
gst_structure_free (gst_structure_new ("0.10:decoder-video/mpeg", NULL));
|
("0.10:decoder-video/mpeg", NULL)));
|
||||||
|
|
||||||
/* make sure we bail out correctly in case of an error or if parsing fails */
|
/* make sure we bail out correctly in case of an error or if parsing fails */
|
||||||
ASSERT_CRITICAL (s = gst_structure_new ("^joo\nba\ndoo^",
|
ASSERT_CRITICAL (s = gst_structure_new ("^joo\nba\ndoo^",
|
||||||
|
|
Loading…
Reference in a new issue