summaryrefslogtreecommitdiffstats
path: root/src/extract-uri.cpp
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2007-09-06 06:46:42 +0000
committerjoncruz <joncruz@users.sourceforge.net>2007-09-06 06:46:42 +0000
commitaf6f36d317c9b63eaeea11a995fa82f26a6ce831 (patch)
tree8f1492009f3f4ddf605ce03f5bc05a14fffa3219 /src/extract-uri.cpp
parentmake it even darker :) (diff)
downloadinkscape-af6f36d317c9b63eaeea11a995fa82f26a6ce831.tar.gz
inkscape-af6f36d317c9b63eaeea11a995fa82f26a6ce831.zip
Preserve paint styles with multiple components
(bzr r3696)
Diffstat (limited to 'src/extract-uri.cpp')
-rw-r--r--src/extract-uri.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/extract-uri.cpp b/src/extract-uri.cpp
index b3923ed1e..858027010 100644
--- a/src/extract-uri.cpp
+++ b/src/extract-uri.cpp
@@ -5,7 +5,7 @@
// Functions as per 4.3.4 of CSS 2.1
// http://www.w3.org/TR/CSS21/syndata.html#uri
-gchar *extract_uri(gchar const *s)
+gchar *extract_uri( gchar const *s, gchar const** endptr )
{
if (!s)
return NULL;
@@ -18,6 +18,10 @@ gchar *extract_uri(gchar const *s)
sb += 3;
+ if ( endptr ) {
+ *endptr = 0;
+ }
+
// This first whitespace technically is not allowed.
// Just left in for now for legacy behavior.
while ( ( *sb == ' ' ) ||
@@ -47,6 +51,10 @@ gchar *extract_uri(gchar const *s)
// we found the delimiter
if ( *se ) {
if ( delim == ')' ) {
+ if ( endptr ) {
+ *endptr = se + 1;
+ }
+
// back up for any trailing whitespace
se--;
while ( ( se[-1] == ' ' ) ||
@@ -54,6 +62,7 @@ gchar *extract_uri(gchar const *s)
{
se--;
}
+
result = g_strndup(sb, se - sb + 1);
} else {
gchar const* tail = se + 1;
@@ -63,6 +72,9 @@ gchar *extract_uri(gchar const *s)
tail++;
}
if ( *tail == ')' ) {
+ if ( endptr ) {
+ *endptr = tail + 1;
+ }
result = g_strndup(sb, se - sb);
}
}