diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2006-11-06 08:54:18 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2006-11-06 08:54:18 +0000 |
commit | 481dcfcff3945620a05b8cdbc2f3c7aa5de7a470 (patch) | |
tree | a760b42ec662948852b775cc2953fff810784dfc | |
parent | fcd18ff8f753dd7308b619476266f1a2ddcc8859 (diff) | |
download | libxml2-481dcfcff3945620a05b8cdbc2f3c7aa5de7a470.tar.gz |
applied patch from Igor for path conversion on Windows Daniel
* uri.c: applied patch from Igor for path conversion on Windows
Daniel
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | uri.c | 18 |
2 files changed, 22 insertions, 0 deletions
@@ -1,3 +1,7 @@ +Mon Nov 6 09:56:41 CET 2006 Daniel Veillard <daniel@veillard.com> + + * uri.c: applied patch from Igor for path conversion on Windows + Thu Nov 2 11:29:17 CET 2006 Daniel Veillard <daniel@veillard.com> * xmlregexp.c: another small change on the algorithm for the @@ -2473,6 +2473,24 @@ xmlPathToURI(const xmlChar *path) cal = xmlCanonicPath(path); if (cal == NULL) return(NULL); +#if defined(_WIN32) && !defined(__CYGWIN__) + /* xmlCanonicPath can return an URI on Windows (is that the intended behaviour?) + If 'cal' is a valid URI allready then we are done here, as continuing would make + it invalid. */ + if ((uri = xmlParseURI((const char *) cal)) != NULL) { + xmlFreeURI(uri); + return cal; + } + /* 'cal' can contain a relative path with backslashes. If that is processed + by xmlSaveURI, they will be escaped and the external entity loader machinery + will fail. So convert them to slashes. Misuse 'ret' for walking. */ + ret = cal; + while (*ret != '\0') { + if (*ret == '\\') + *ret = '/'; + ret++; + } +#endif memset(&temp, 0, sizeof(temp)); temp.path = (char *) cal; ret = xmlSaveUri(&temp); |