[gtk+/gtk-style-context: 438/533] Make url parsing work for slices
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context: 438/533] Make url parsing work for slices
- Date: Wed, 1 Dec 2010 02:42:38 +0000 (UTC)
commit 11f278a6c5d00005dd42c03145a6660ea6c1ada4
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Nov 22 09:03:07 2010 -0500
Make url parsing work for slices
The border-image parsing code relies on parse_path_str to return
a meaningful end_ptr in case of success, too.
gtk/gtkcssprovider.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index ac4a35f..5739c9a 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -2318,7 +2318,9 @@ path_parse_str (GtkCssProvider *css_provider,
const gchar *str,
gchar **end_ptr)
{
- gchar *path, *chr;
+ gchar *path, *chr, *start, *end;
+
+ start = str;
if (g_str_has_prefix (str, "url"))
{
@@ -2331,14 +2333,15 @@ path_parse_str (GtkCssProvider *css_provider,
return NULL;
}
- chr = strrchr (str, ')');
-
+ chr = strchr (str, ')');
if (!chr)
{
*end_ptr = (gchar *) str;
return NULL;
}
+ end = chr + 1;
+
str++;
SKIP_SPACES (str);
@@ -2366,7 +2369,7 @@ path_parse_str (GtkCssProvider *css_provider,
path = g_strndup (str, chr - str);
g_strstrip (path);
- *end_ptr = str + strlen (str);
+ *end_ptr = end;
}
else
{
@@ -2400,6 +2403,7 @@ path_parse_str (GtkCssProvider *css_provider,
g_warning ("File doesn't exist: %s\n", path);
g_free (path);
path = NULL;
+ *end_ptr = start;
}
return path;
@@ -2454,22 +2458,22 @@ slice_parse_str (GtkCssProvider *css_provider,
SKIP_SPACES (str);
/* Parse top/left/bottom/right distances */
- distance_top = g_strtod (str, end_ptr);
+ distance_top = g_ascii_strtod (str, end_ptr);
str = *end_ptr;
SKIP_SPACES (str);
- distance_right = g_strtod (str, end_ptr);
+ distance_right = g_ascii_strtod (str, end_ptr);
str = *end_ptr;
SKIP_SPACES (str);
- distance_bottom = g_strtod (str, end_ptr);
+ distance_bottom = g_ascii_strtod (str, end_ptr);
str = *end_ptr;
SKIP_SPACES (str);
- distance_left = g_strtod (str, end_ptr);
+ distance_left = g_ascii_strtod (str, end_ptr);
str = *end_ptr;
SKIP_SPACES (str);
@@ -2562,7 +2566,7 @@ unit_parse_str (const gchar *str,
gdouble unit;
SKIP_SPACES (str);
- unit = g_strtod (str, end_str);
+ unit = g_ascii_strtod (str, end_str);
str = *end_str;
/* Now parse the unit type, if any. We
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]