css: Actually break at end of the string

Introduced in 65c4c1555d.

Found by gnome-continuous running the testsuite.

Includes fixing a broken test in the testsuite.
This commit is contained in:
Benjamin Otte 2014-05-21 19:17:21 +02:00
parent 9ae12b15e9
commit b90802f7e4
4 changed files with 35 additions and 3 deletions

View File

@ -1025,13 +1025,13 @@ _gtk_css_print_string (GString *str,
g_string_append_c (str, '"');
do {
len = strcspn (string, "\"\n\r\f");
len = strcspn (string, "\\\"\n\r\f");
g_string_append_len (str, string, len);
string += len;
switch (*string)
{
case '\0':
break;
goto out;
case '\n':
g_string_append (str, "\\A ");
break;
@ -1054,6 +1054,7 @@ _gtk_css_print_string (GString *str,
string++;
} while (*string);
out:
g_string_append_c (str, '"');
}

View File

@ -88,7 +88,7 @@ gtk_css_value_ident_print (const GtkCssValue *value,
switch (*string)
{
case '\0':
break;
goto out;
case '\n':
g_string_append (str, "\\A ");
break;
@ -113,6 +113,9 @@ gtk_css_value_ident_print (const GtkCssValue *value,
}
string++;
} while (*string);
out:
;
}
static const GtkCssValueClass GTK_CSS_VALUE_STRING = {

View File

@ -334,6 +334,7 @@ test_data = \
single-slash.errors\
single-slash.ref.css \
string-values.css \
string-values.ref.css \
test.png \
transition.css \
transition.ref.css \

View File

@ -0,0 +1,27 @@
n {
font-family: "\A ";
}
r {
font-family: "\C ";
}
f {
font-family: "\D ";
}
a {
font-family: "\"";
}
b {
font-family: "'";
}
c {
font-family: "'";
}
d {
font-family: "\\";
}