Jacek Caban : vbscript: Support arrays in VarType.
Alexandre Julliard
julliard at winehq.org
Thu Aug 22 15:09:54 CDT 2019
Module: wine
Branch: master
Commit: a390b7e8702d79df3d4a4aecfb2e0a8ddade3d0f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=a390b7e8702d79df3d4a4aecfb2e0a8ddade3d0f
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Aug 22 19:31:35 2019 +0200
vbscript: Support arrays in VarType.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/vbscript/global.c | 7 +++++--
dlls/vbscript/tests/api.vbs | 5 +++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c
index 0797403..9b2ce3d 100644
--- a/dlls/vbscript/global.c
+++ b/dlls/vbscript/global.c
@@ -627,16 +627,19 @@ static HRESULT Global_Oct(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIA
static HRESULT Global_VarType(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
{
+ VARTYPE vt;
+
TRACE("(%s)\n", debugstr_variant(arg));
assert(args_cnt == 1);
- if(V_VT(arg) & ~VT_TYPEMASK) {
+ vt = V_VT(arg) & ~VT_BYREF;
+ if(vt & ~(VT_TYPEMASK | VT_ARRAY)) {
FIXME("not supported %s\n", debugstr_variant(arg));
return E_NOTIMPL;
}
- return return_short(res, V_VT(arg));
+ return return_short(res, vt);
}
static HRESULT Global_IsDate(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 0548c7b..6cc4984 100644
--- a/dlls/vbscript/tests/api.vbs
+++ b/dlls/vbscript/tests/api.vbs
@@ -1096,6 +1096,9 @@ Call ok(VarType(Null) = vbNull, "VarType(Null) = " & VarType(Null))
Call ok(getVT(VarType(Null)) = "VT_I2", "getVT(VarType(Null)) = " & getVT(VarType(Null)))
Call ok(VarType(255) = vbInteger, "VarType(255) = " & VarType(255))
Call ok(getVT(VarType(255)) = "VT_I2", "getVT(VarType(255)) = " & getVT(VarType(255)))
+set x = new EmptyClass
+Call ok(VarType(x) = vbObject, "VarType(x) = " & VarType(x))
+Call ok(getVT(VarType(x)) = "VT_I2", "getVT(VarType(x)) = " & getVT(VarType(x)))
Call ok(VarType(32768) = vbLong, "VarType(32768) = " & VarType(32768))
Call ok(getVT(VarType(32768)) = "VT_I2", "getVT(VarType(32768)) = " & getVT(VarType(32768)))
Call ok(VarType(CSng(0.5)) = vbSingle, "VarType(CSng(0.5)) = " & VarType(CSng(0.5)))
@@ -1110,6 +1113,8 @@ Call ok(VarType(CBool(0.5)) = vbBoolean, "VarType(CBool(0.5)) = " & VarType(CBoo
Call ok(getVT(VarType(CBool(0.5))) = "VT_I2", "getVT(VarType(CBool(0.5))) = " & getVT(VarType(CBool(0.5))))
Call ok(VarType(CByte(255)) = vbByte, "VarType(CByte(255)) = " & VarType(CByte(255)))
Call ok(getVT(VarType(CByte(255))) = "VT_I2", "getVT(VarType(CByte(255))) = " & getVT(VarType(CByte(255))))
+Call ok(VarType(arr) = (vbArray or vbVariant), "VarType(arr) = " & VarType(arr))
+Call ok(getVT(VarType(arr)) = "VT_I2", "getVT(VarType(arr)) = " & getVT(VarType(arr)))
Call ok(Sgn(Empty) = 0, "Sgn(MyEmpty) = " & Sgn(Empty))
Call ok(getVT(Sgn(Empty)) = "VT_I2", "getVT(Sgn(MyEmpty)) = " & getVT(Sgn(Empty)))
More information about the wine-cvs
mailing list