MBCS minor bug fix
Hirofumi Katayama
katayama.hirofumi.mz at gmail.com
Sat Jul 19 21:19:50 CDT 2008
diff -r -u wineold/wine-1.1.0/dlls/shlwapi/path.c
wine/wine-1.1.0/dlls/shlwapi/path.c
--- wineold/wine-1.1.0/dlls/shlwapi/path.c Fri Jun 27 23:24:42 2008
+++ wine/wine-1.1.0/dlls/shlwapi/path.c Sun Jul 20 08:00:44 2008
@@ -234,21 +234,24 @@
*/
LPSTR WINAPI PathAddBackslashA(LPSTR lpszPath)
{
- size_t iLen;
-
+ LPSTR pchLast;
+ LPSTR pch = lpszPath;
+
TRACE("(%s)\n",debugstr_a(lpszPath));
- if (!lpszPath || (iLen = strlen(lpszPath)) >= MAX_PATH)
- return NULL;
+ while(*pch != '\0')
+ {
+ pchLast = pch;
+ pch = CharNext(pch);
+ }
+
+ if(MAX_PATH <= lstrlen(lpszPath))
+ return NULL;
- if (iLen)
+ if(*lpszPath == '\0' || *pchLast != '\\')
{
- lpszPath += iLen;
- if (lpszPath[-1] != '\\')
- {
- *lpszPath++ = '\\';
- *lpszPath = '\0';
- }
+ *pch++ = '\\';
+ *pch = '\0';
}
return lpszPath;
}
@@ -260,21 +263,24 @@
*/
LPWSTR WINAPI PathAddBackslashW( LPWSTR lpszPath )
{
- size_t iLen;
-
+ LPWSTR pchLast;
+ LPWSTR pch = lpszPath;
+
TRACE("(%s)\n",debugstr_w(lpszPath));
-
- if (!lpszPath || (iLen = strlenW(lpszPath)) >= MAX_PATH)
+
+ while(*pch != '\0')
+ {
+ pchLast = pch;
+ pch = CharNext(pch);
+ }
+
+ if(MAX_PATH <= lstrlen(lpszPath))
return NULL;
-
- if (iLen)
+
+ if(*lpszPath == '\0' || *pchLast != '\\')
{
- lpszPath += iLen;
- if (lpszPath[-1] != '\\')
- {
- *lpszPath++ = '\\';
- *lpszPath = '\0';
- }
+ *pch++ = '\\';
+ *pch = '\0';
}
return lpszPath;
}
More information about the wine-patches
mailing list