NTDLL: Collapse slashes

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Thu Mar 18 15:48:34 CST 2004


Changelog:
	dlls/ntdll/path.c: get_full_path_helper
	Add a function to collapse successive slashes
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/ntdll/path.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/path.c,v
retrieving revision 1.17
diff -u -r1.17 path.c
--- wine/dlls/ntdll/path.c	17 Mar 2004 01:58:51 -0000	1.17
+++ wine/dlls/ntdll/path.c	18 Mar 2004 21:46:17 -0000
@@ -370,7 +370,27 @@
         while (*p == '\\') p++;
     }
 }
-
+/******************************************************************
+ *		collapse_path_slash
+ *
+ * Helper for RtlGetFullPathName_U.
+ * Get rid of consecutive slashes in the path.
+ */
+static inline void collapse_path_slash( WCHAR *path )
+{
+    WCHAR *p=path,*q;
+    while (*p)
+    {
+	if (*p == '\\')
+	{
+	    q = p +1;
+	    while (*q == '\\')
+		q++;
+	    memmove( p +1, q , (strlenW(q) + 1) * sizeof(WCHAR) );
+	}
+	p++;
+    }
+}
 
 /******************************************************************
  *		get_full_path_helper
@@ -528,6 +548,7 @@
     for (p = buffer; *p; p++) if (*p == '/') *p = '\\';
 
     collapse_path( buffer + mark );
+    collapse_path_slash( buffer + mark );
     reqsize = strlenW(buffer) * sizeof(WCHAR);
 
 done:



More information about the wine-patches mailing list