Jacek Caban : vbscript: Return proper error on invalid argument in Chr.

Alexandre Julliard julliard at winehq.org
Wed Apr 23 14:17:33 CDT 2014


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Apr 23 17:49:23 2014 +0200

vbscript: Return proper error on invalid argument in Chr.

---

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

diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c
index 9983509..b89b888 100644
--- a/dlls/vbscript/global.c
+++ b/dlls/vbscript/global.c
@@ -1141,8 +1141,8 @@ static HRESULT Global_Chr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA
         return hres;
 
     if(c < 0 || c >= 0x100) {
-        FIXME("invalid arg\n");
-        return E_FAIL;
+        WARN("invalid arg %d\n", c);
+        return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL);
     }
 
     if(res) {
diff --git a/dlls/vbscript/tests/api.vbs b/dlls/vbscript/tests/api.vbs
index 3c496b1..ee9ebd3 100644
--- a/dlls/vbscript/tests/api.vbs
+++ b/dlls/vbscript/tests/api.vbs
@@ -137,6 +137,20 @@ Call ok(Chr(0) <> "", "Chr(0) = """"")
 Call ok(Chr(120.5) = "x", "Chr(120.5) = " & Chr(120.5))
 Call ok(Chr(119.5) = "x", "Chr(119.5) = " & Chr(119.5))
 
+sub testChrError
+    on error resume next
+
+    call Err.clear()
+    call Chr(-1)
+    call ok(Err.number = 5, "Err.number = " & Err.number)
+
+    call Err.clear()
+    call Chr(256)
+    call ok(Err.number = 5, "Err.number = " & Err.number)
+end sub
+
+call testChrError
+
 Call ok(isObject(new EmptyClass), "isObject(new EmptyClass) is not true?")
 Set x = new EmptyClass
 Call ok(isObject(x), "isObject(x) is not true?")




More information about the wine-cvs mailing list