Juan Lang : shlwapi: Use CharNextA to iterate through characters in PathAddBackslashA. Fixes problems with MBCS paths.

Alexandre Julliard julliard at winehq.org
Mon Jul 28 08:06:55 CDT 2008


Module: wine
Branch: master
Commit: 87c3df1578803f63ce68096c07c42c3af279077c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=87c3df1578803f63ce68096c07c42c3af279077c

Author: Juan Lang <juan.lang at gmail.com>
Date:   Fri Jul 25 11:16:54 2008 -0700

shlwapi: Use CharNextA to iterate through characters in PathAddBackslashA. Fixes problems with MBCS paths.

---

 dlls/shlwapi/path.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/dlls/shlwapi/path.c b/dlls/shlwapi/path.c
index d0d4e93..e06e027 100644
--- a/dlls/shlwapi/path.c
+++ b/dlls/shlwapi/path.c
@@ -235,6 +235,7 @@ LPWSTR WINAPI PathCombineW(LPWSTR lpszDest, LPCWSTR lpszDir, LPCWSTR lpszFile)
 LPSTR WINAPI PathAddBackslashA(LPSTR lpszPath)
 {
   size_t iLen;
+  LPSTR prev = lpszPath;
 
   TRACE("(%s)\n",debugstr_a(lpszPath));
 
@@ -243,11 +244,15 @@ LPSTR WINAPI PathAddBackslashA(LPSTR lpszPath)
 
   if (iLen)
   {
-    lpszPath += iLen;
-    if (lpszPath[-1] != '\\')
+    do {
+      lpszPath = CharNextA(prev);
+      if (*lpszPath)
+        prev = lpszPath;
+    } while (*lpszPath);
+    if (*prev != '\\')
     {
-     *lpszPath++ = '\\';
-     *lpszPath = '\0';
+      *lpszPath++ = '\\';
+      *lpszPath = '\0';
     }
   }
   return lpszPath;




More information about the wine-cvs mailing list