From 043620e1cbee6d76781811803e6468640c273ce4 Mon Sep 17 00:00:00 2001 From: Igor Zlatkovic Date: Fri, 4 Oct 2002 13:32:07 +0000 Subject: extended slashification to fix the base problem in xslt --- xmlIO.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'xmlIO.c') diff --git a/xmlIO.c b/xmlIO.c index 9e84a3c9..796c8ac0 100644 --- a/xmlIO.c +++ b/xmlIO.c @@ -151,35 +151,44 @@ static int xmlOutputCallbackInitialized = 0; xmlChar * xmlNormalizeWindowsPath(const xmlChar *path) { - int len, i, j; + int len, i = 0, j; xmlChar *ret; if (path == NULL) return(NULL); - if (!IS_WINDOWS_PATH(path)) - return(xmlStrdup(path)); len = xmlStrlen(path); - ret = xmlMalloc(len + 10); - if (ret == NULL) - return(NULL); - - ret[0] = 'f'; - ret[1] = 'i'; - ret[2] = 'l'; - ret[3] = 'e'; - ret[4] = ':'; - ret[5] = '/'; - ret[6] = '/'; - ret[7] = '/'; - for (i = 0,j = 8;i < len;i++,j++) { + if (!IS_WINDOWS_PATH(path)) { + ret = xmlStrdup(path); + if (ret == NULL) + return(NULL); + j = 0; + } else { + ret = xmlMalloc(len + 10); + if (ret == NULL) + return(NULL); + ret[0] = 'f'; + ret[1] = 'i'; + ret[2] = 'l'; + ret[3] = 'e'; + ret[4] = ':'; + ret[5] = '/'; + ret[6] = '/'; + ret[7] = '/'; + j = 8; + } + + while (i < len) { /* TODO: UTF8 conversion + URI escaping ??? */ if (path[i] == '\\') ret[j] = '/'; else ret[j] = path[i]; + i++; + j++; } ret[j] = 0; + return(ret); } -- cgit v1.2.3