diff options
author | Matthias Clasen <mclasen@redhat.com> | 2010-11-22 09:03:07 -0500 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2010-12-04 15:39:29 +0100 |
commit | 953ac51fb8bd163d49a2abfb09ac77c6e63cb46e (patch) | |
tree | 1977f92faf63da581a65de60aea6dc62b90b210d /gtk/gtkcssprovider.c | |
parent | 28e549082c6026e5364a27ff4b4ab9c6ee4a2758 (diff) | |
download | gtk+-953ac51fb8bd163d49a2abfb09ac77c6e63cb46e.tar.gz |
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.
Diffstat (limited to 'gtk/gtkcssprovider.c')
-rw-r--r-- | gtk/gtkcssprovider.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c index ac4a35fc80..5739c9a3a7 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 |