summaryrefslogtreecommitdiff
path: root/gtk/gtkcssfontfeaturesvalue.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2019-04-05 13:41:08 +0200
committerBenjamin Otte <otte@redhat.com>2019-04-12 19:34:28 +0200
commit7f99c1e58842613573da51737a126bdeec835f1a (patch)
tree8d2d8bf88d0e9861da8893fe95720636f5539f38 /gtk/gtkcssfontfeaturesvalue.c
parent5f3e5a04066ffa96c3dc2ce423c6cb9cd50df1b2 (diff)
downloadgtk+-7f99c1e58842613573da51737a126bdeec835f1a.tar.gz
cssparser: Split integer gettig into has/consume functions
We can't try to get an integer because ultimately integer getters support the same shenanigans that numbers and percentages do with calc() and whatnot.
Diffstat (limited to 'gtk/gtkcssfontfeaturesvalue.c')
-rw-r--r--gtk/gtkcssfontfeaturesvalue.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gtk/gtkcssfontfeaturesvalue.c b/gtk/gtkcssfontfeaturesvalue.c
index a64ee3fce5..6f7c2894f0 100644
--- a/gtk/gtkcssfontfeaturesvalue.c
+++ b/gtk/gtkcssfontfeaturesvalue.c
@@ -256,8 +256,19 @@ gtk_css_font_features_value_parse (GtkCssParser *parser)
val = _gtk_css_number_value_new (1.0, GTK_CSS_NUMBER);
else if (gtk_css_parser_try_ident (parser, "off"))
val = _gtk_css_number_value_new (0.0, GTK_CSS_NUMBER);
- else if (_gtk_css_parser_try_int (parser, &num))
- val = _gtk_css_number_value_new ((double)num, GTK_CSS_NUMBER);
+ else if (gtk_css_parser_has_integer (parser))
+ {
+ if (gtk_css_parser_consume_integer (parser, &num))
+ {
+ val = _gtk_css_number_value_new ((double)num, GTK_CSS_NUMBER);
+ }
+ else
+ {
+ g_free (name);
+ _gtk_css_value_unref (result);
+ return NULL;
+ }
+ }
else
val = _gtk_css_number_value_new (1.0, GTK_CSS_NUMBER);