[gtk+] css: Actually break at end of the string
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] css: Actually break at end of the string
- Date: Thu, 22 May 2014 00:32:26 +0000 (UTC)
commit b90802f7e44f280b9ea233cf71692704e5b52651
Author: Benjamin Otte <otte redhat com>
Date: Wed May 21 19:17:21 2014 +0200
css: Actually break at end of the string
Introduced in 65c4c1555d0634c063c3aa354620de260e4aaf7f.
Found by gnome-continuous running the testsuite.
Includes fixing a broken test in the testsuite.
gtk/gtkcssparser.c | 5 +++--
gtk/gtkcssstringvalue.c | 5 ++++-
testsuite/css/parser/Makefile.am | 1 +
testsuite/css/parser/string-values.ref.css | 27 +++++++++++++++++++++++++++
4 files changed, 35 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcssparser.c b/gtk/gtkcssparser.c
index de78ae6..644592b 100644
--- a/gtk/gtkcssparser.c
+++ b/gtk/gtkcssparser.c
@@ -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, '"');
}
diff --git a/gtk/gtkcssstringvalue.c b/gtk/gtkcssstringvalue.c
index 5da9fef..56ccc69 100644
--- a/gtk/gtkcssstringvalue.c
+++ b/gtk/gtkcssstringvalue.c
@@ -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 = {
diff --git a/testsuite/css/parser/Makefile.am b/testsuite/css/parser/Makefile.am
index 846b938..084a340 100644
--- a/testsuite/css/parser/Makefile.am
+++ b/testsuite/css/parser/Makefile.am
@@ -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 \
diff --git a/testsuite/css/parser/string-values.ref.css b/testsuite/css/parser/string-values.ref.css
new file mode 100644
index 0000000..491a023
--- /dev/null
+++ b/testsuite/css/parser/string-values.ref.css
@@ -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: "\\";
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]