Jacek Caban : vbscript: Added LCase implementation.

Alexandre Julliard julliard at winehq.org
Wed Jul 11 17:39:20 CDT 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Jul 11 10:23:37 2012 +0200

vbscript: Added LCase implementation.

---

 dlls/vbscript/global.c      |   29 +++++++++++++++++++++++++++--
 dlls/vbscript/tests/api.vbs |   14 ++++++++++++++
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c
index a812d91..c3b650f 100644
--- a/dlls/vbscript/global.c
+++ b/dlls/vbscript/global.c
@@ -582,8 +582,33 @@ static HRESULT Global_StrComp(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, V
 
 static HRESULT Global_LCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
 {
-    FIXME("\n");
-    return E_NOTIMPL;
+    BSTR str;
+    HRESULT hres;
+
+    TRACE("%s\n", debugstr_variant(arg));
+
+    if(V_VT(arg) == VT_NULL) {
+        if(res)
+            V_VT(res) = VT_NULL;
+        return S_OK;
+    }
+
+    hres = to_string(arg, &str);
+    if(FAILED(hres))
+        return hres;
+
+    if(res) {
+        WCHAR *ptr;
+
+        for(ptr = str; *ptr; ptr++)
+            *ptr = tolowerW(*ptr);
+
+        V_VT(res) = VT_BSTR;
+        V_BSTR(res) = str;
+    }else {
+        SysFreeString(str);
+    }
+    return S_OK;
 }
 
 static HRESULT Global_UCase(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs
index fe6f9b0..4914e7a 100644
--- a/dlls/vbscript/tests/api.vbs
+++ b/dlls/vbscript/tests/api.vbs
@@ -159,4 +159,18 @@ TestUCase 0.123, "0.123"
 TestUCase Empty, ""
 Call ok(getVT(UCase(Null)) = "VT_NULL", "getVT(UCase(Null)) = " & getVT(UCase(Null)))
 
+Sub TestLCase(str, ex)
+    x = LCase(str)
+    Call ok(x = ex, "LCase(" & str & ") = " & x & " expected " & ex)
+End Sub
+
+TestLCase "test", "test"
+TestLCase "123aBC?", "123abc?"
+TestLCase "", ""
+TestLCase 1, "1"
+TestLCase true, "true"
+TestLCase 0.123, "0.123"
+TestLCase Empty, ""
+Call ok(getVT(LCase(Null)) = "VT_NULL", "getVT(LCase(Null)) = " & getVT(LCase(Null)))
+
 Call reportSuccess()




More information about the wine-cvs mailing list