Qian Hong : wscript: Get extension name by strrchrW instead of strchrW.

Alexandre Julliard julliard at winehq.org
Fri Jan 10 14:44:55 CST 2014


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

Author: Qian Hong <qhong at codeweavers.com>
Date:   Tue Nov 12 16:19:59 2013 +0800

wscript: Get extension name by strrchrW instead of strchrW.

(cherry picked from commit fa9fec618d647e22da3e33b7ad8c7b7053d73fe7)

---

 programs/wscript/main.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/programs/wscript/main.c b/programs/wscript/main.c
index 3d97bde..cebabed 100644
--- a/programs/wscript/main.c
+++ b/programs/wscript/main.c
@@ -361,7 +361,7 @@ static BOOL set_host_properties(const WCHAR *prop)
 
 int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow)
 {
-    const WCHAR *ext, *filename = NULL;
+    WCHAR *ext, *filepart, *filename = NULL;
     IActiveScriptParse *parser;
     IActiveScript *script;
     WCHAR **argv;
@@ -391,14 +391,12 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm
         WINE_FIXME("No file name specified\n");
         return 1;
     }
-    res = GetFullPathNameW(filename, sizeof(scriptFullName)/sizeof(WCHAR), scriptFullName, NULL);
+    res = GetFullPathNameW(filename, sizeof(scriptFullName)/sizeof(WCHAR), scriptFullName, &filepart);
     if(!res || res > sizeof(scriptFullName)/sizeof(WCHAR))
         return 1;
 
-    ext = strchrW(filename, '.');
-    if(!ext)
-        ext = filename;
-    if(!get_engine_clsid(ext, &clsid)) {
+    ext = strrchrW(filepart, '.');
+    if(!ext || !get_engine_clsid(ext, &clsid)) {
         WINE_FIXME("Could not find engine for %s\n", wine_dbgstr_w(ext));
         return 1;
     }




More information about the wine-cvs mailing list