Carlo Bramini : shlwapi: Don' t remove nonexistent extension in PathRemoveExtension.

Alexandre Julliard julliard at winehq.org
Fri Apr 13 11:03:22 CDT 2012


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

Author: Carlo Bramini <carlo.bramix at libero.it>
Date:   Mon Apr  9 23:55:53 2012 +0200

shlwapi: Don't remove nonexistent extension in PathRemoveExtension.

---

 dlls/shlwapi/path.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/shlwapi/path.c b/dlls/shlwapi/path.c
index 92a830b..6f09d22 100644
--- a/dlls/shlwapi/path.c
+++ b/dlls/shlwapi/path.c
@@ -760,6 +760,10 @@ void WINAPI PathRemoveArgsW(LPWSTR lpszPath)
  * PARAMS
  *  lpszPath [I/O] Path to remove the extension from
  *
+ * NOTES
+ *  The NUL terminator must be written only if extension exists
+ *  and if the pointed character is not already NUL.
+ *
  * RETURNS
  *  Nothing.
  */
@@ -770,7 +774,8 @@ void WINAPI PathRemoveExtensionA(LPSTR lpszPath)
   if (lpszPath)
   {
     lpszPath = PathFindExtensionA(lpszPath);
-    *lpszPath = '\0';
+    if (lpszPath && *lpszPath != '\0')
+      *lpszPath = '\0';
   }
 }
 
@@ -786,7 +791,8 @@ void WINAPI PathRemoveExtensionW(LPWSTR lpszPath)
   if (lpszPath)
   {
     lpszPath = PathFindExtensionW(lpszPath);
-    *lpszPath = '\0';
+    if (lpszPath && *lpszPath != '\0')
+      *lpszPath = '\0';
   }
 }
 




More information about the wine-cvs mailing list