summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam M. Brack <wbrack@src.gnome.org>2004-07-27 00:06:37 +0000
committerWilliam M. Brack <wbrack@src.gnome.org>2004-07-27 00:06:37 +0000
commit391aed81b51dbad8608773e4c1f65fd917beb917 (patch)
tree391c01b660df7c8d76e9cff9d41927cd287f9cbd
parent6432c3ca51f06cbe7f08fa33102b631b8490cd74 (diff)
downloadlibxslt-391aed81b51dbad8608773e4c1f65fd917beb917.tar.gz
libxslt-391aed81b51dbad8608773e4c1f65fd917beb917.tar.bz2
libxslt-391aed81b51dbad8608773e4c1f65fd917beb917.zip
fixed str:tokenize for case when 2nd argument is an empty string (should
* libexslt/strings.c: fixed str:tokenize for case when 2nd argument is an empty string (should produce a token for each char in the string). Reported on the mailing list by Peter Pawlowski.
-rw-r--r--ChangeLog7
-rw-r--r--libexslt/strings.c12
2 files changed, 18 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 458e6429..2b435757 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Jul 26 17:03:22 PDT 2004 William Brack <wbrack@mmm.com.hk>
+
+ * libexslt/strings.c: fixed str:tokenize for case when 2nd
+ argument is an empty string (should produce a token for
+ each char in the string). Reported on the mailing list by
+ Peter Pawlowski.
+
Fri Jul 23 21:55:14 PDT 2004 William Brack <wbrack@mmm.com.hk>
* libxslt/imports.c: further enhancement for template priorities
on imported stylesheets (better fix for bug 141279, fixes
diff --git a/libexslt/strings.c b/libexslt/strings.c
index 39c1a3e4..6ad6d6ce 100644
--- a/libexslt/strings.c
+++ b/libexslt/strings.c
@@ -77,7 +77,17 @@ exsltStrTokenizeFunction(xmlXPathParserContextPtr ctxt, int nargs)
ret->boolval = 0; /* Freeing is not handled there anymore */
for (cur = str, token = str; *cur != 0; cur += clen) {
clen = xmlUTF8Size(cur);
- for (delimiter = delimiters; *delimiter != 0;
+ if (*delimiters == 0) { /* empty string case */
+ xmlChar ctmp;
+ ctmp = *(cur+clen);
+ *(cur+clen) = 0;
+ node = xmlNewDocRawNode(container, NULL,
+ (const xmlChar *) "token", cur);
+ xmlAddChild((xmlNodePtr) container, node);
+ xmlXPathNodeSetAddUnique(ret->nodesetval, node);
+ *(cur+clen) = ctmp; /* restore the changed byte */
+ token = cur + clen;
+ } else for (delimiter = delimiters; *delimiter != 0;
delimiter += xmlUTF8Size(delimiter)) {
if (!xmlUTF8Charcmp(cur, delimiter)) {
if (cur == token) {