libxml2 r3714 - trunk



Author: veillard
Date: Tue Mar 25 13:22:41 2008
New Revision: 3714
URL: http://svn.gnome.org/viewvc/libxml2?rev=3714&view=rev

Log:
* uri.c: fix saving for file:///X:/ URI embedding Windows file paths
  should fix #524253 
Daniel


Modified:
   trunk/ChangeLog
   trunk/uri.c

Modified: trunk/uri.c
==============================================================================
--- trunk/uri.c	(original)
+++ trunk/uri.c	Tue Mar 25 13:22:41 2008
@@ -421,6 +421,30 @@
 	}
 	if (uri->path != NULL) {
 	    p = uri->path;
+	    /*
+	     * the colon in file:///d: should not be escaped or
+	     * Windows accesses fail later.
+	     */
+	    if ((uri->scheme != NULL) &&
+		(p[0] == '/') &&
+		(((p[1] >= 'a') && (p[1] <= 'z')) ||
+		 ((p[1] >= 'A') && (p[1] <= 'Z'))) &&
+		(p[2] == ':') &&
+	        (xmlStrEqual(uri->scheme, BAD_CAST "file"))) {
+		if (len + 3 >= max) {
+		    max *= 2;
+		    ret = (xmlChar *) xmlRealloc(ret,
+			    (max + 1) * sizeof(xmlChar));
+		    if (ret == NULL) {
+			xmlGenericError(xmlGenericErrorContext,
+				"xmlSaveUri: out of memory\n");
+			return(NULL);
+		    }
+		}
+		ret[len++] = *p++;
+		ret[len++] = *p++;
+		ret[len++] = *p++;
+	    }
 	    while (*p != 0) {
 		if (len + 3 >= max) {
 		    max *= 2;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]