if (G_UNLIKELY (strcmp (s, "NULL") == 0)) {
g_value_set_string (dest, NULL);
return TRUE;
- } else if (G_LIKELY (*s != '"')) {
+ } else if (G_LIKELY (*s != '"' || s[strlen (s) - 1] != '"')) {
if (!g_utf8_validate (s, -1, NULL))
return FALSE;
g_value_set_string (dest, s);
return TRUE;
} else {
+ /* strings delimited with double quotes should be unwrapped */
gchar *str = gst_string_unwrap (s);
if (G_UNLIKELY (!str))
return FALSE;
"\"foo\\%\"", "foo%"}, {
"\"0123456789_-+/:.\"", "0123456789_-+/:."}, {
"\"Hello\\ World\"", "Hello World"}, {
+ "\"Hello\\ World", "\"Hello\\ World"}, {
+ "\"\\", "\"\\"}, {
+ "\"\\0", "\"\\0"}, {
"", ""}, /* empty strings */
{
"\"\"", ""}, /* quoted empty string -> empty string */
/* Expected FAILURES: */
{
- "\"", NULL}, /* missing second quote */
- {
- "\"Hello\\ World", NULL}, /* missing second quote */
- {
- "\"\\", NULL}, /* quote at end, missing second quote */
- {
- "\"\\0", NULL}, /* missing second quote */
- {
"\"\\0\"", NULL}, /* unfinished escaped character */
{
+ "\"", NULL}, /* solitary quote */
+ {
"\" \"", NULL}, /* spaces must be escaped */
#if 0
/* FIXME 0.9: this test should fail, but it doesn't */