[gtk+/parser: 77/79] xxx: rewrite



commit 48bb1f3d9bd6f43a1f622a3c418bce1c6050e651
Author: Benjamin Otte <otte redhat com>
Date:   Thu Apr 14 21:12:24 2011 +0200

    xxx: rewrite

 gtk/gtkcssparser.c      |   23 ++++++++++++++++-------
 gtk/gtkcssstringfuncs.c |    3 ---
 2 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkcssparser.c b/gtk/gtkcssparser.c
index e71ab4f..cb6e488 100644
--- a/gtk/gtkcssparser.c
+++ b/gtk/gtkcssparser.c
@@ -499,6 +499,9 @@ _gtk_css_parser_try_int (GtkCssParser *parser,
 
   parser->data = end;
   *value = result;
+
+  _gtk_css_parser_skip_whitespace (parser);
+
   return TRUE;
 }
 
@@ -522,6 +525,9 @@ _gtk_css_parser_try_uint (GtkCssParser *parser,
 
   parser->data = end;
   *value = result;
+
+  _gtk_css_parser_skip_whitespace (parser);
+
   return TRUE;
 }
 
@@ -543,6 +549,9 @@ _gtk_css_parser_try_double (GtkCssParser *parser,
 
   parser->data = end;
   *value = result;
+
+  _gtk_css_parser_skip_whitespace (parser);
+
   return TRUE;
 }
 
@@ -573,7 +582,7 @@ gtk_css_parser_read_symbolic_color_function (GtkCssParser *parser,
   if (color == COLOR_RGB || color == COLOR_RGBA)
     {
       GdkRGBA rgba;
-      double color;
+      double tmp;
       guint i;
 
       for (i = 0; i < 3; i++)
@@ -584,21 +593,21 @@ gtk_css_parser_read_symbolic_color_function (GtkCssParser *parser,
               return NULL;
             }
 
-          if (!_gtk_css_parser_try_double (parser, &color))
+          if (!_gtk_css_parser_try_double (parser, &tmp))
             {
               _gtk_css_parser_error (parser, "Invalid number for color value");
               return NULL;
             }
           if (_gtk_css_parser_try (parser, "%", TRUE))
-            color /= 100.0;
+            tmp /= 100.0;
           else
-            color /= 255.0;
+            tmp /= 255.0;
           if (i == 0)
-            rgba.red = color;
+            rgba.red = tmp;
           else if (i == 1)
-            rgba.green = color;
+            rgba.green = tmp;
           else if (i == 2)
-            rgba.blue = color;
+            rgba.blue = tmp;
           else
             g_assert_not_reached ();
         }
diff --git a/gtk/gtkcssstringfuncs.c b/gtk/gtkcssstringfuncs.c
index efa834a..53a5ccc 100644
--- a/gtk/gtkcssstringfuncs.c
+++ b/gtk/gtkcssstringfuncs.c
@@ -102,9 +102,6 @@ _gtk_css_parse_symbolic_color (const char  *str,
   symbolic = _gtk_css_parser_read_symbolic_color (parser);
   _gtk_css_parser_free (parser);
 
-  if (symbolic == NULL)
-    set_default_error (error, GTK_TYPE_SYMBOLIC_COLOR);
-
   return symbolic;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]