From 1e40d7125025d8174a536e586f6890d11a2e97bd Mon Sep 17 00:00:00 2001 From: Shuai Meng Date: Sun, 16 Mar 2014 00:11:49 +0800 Subject: [PATCH 02/11] vbscript: Fixed CBool. --- dlls/vbscript/global.c | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index 9d8f021..3315185 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -114,16 +114,6 @@ static HRESULT return_int(VARIANT *res, int val) return S_OK; } -static HRESULT return_bool(VARIANT *res, int val) -{ - if(res) { - V_VT(res) = VT_BOOL; - V_BOOL(res) = val != 0 ? VARIANT_TRUE : VARIANT_FALSE; - } - - return S_OK; -} - static inline HRESULT return_double(VARIANT *res, double val) { if(res) { @@ -413,30 +403,11 @@ static HRESULT Global_CLng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI static HRESULT Global_CBool(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - int val; TRACE("%s\n", debugstr_variant(arg)); - assert(args_cnt == 1); - switch(V_VT(arg)) { - case VT_I2: - val = V_I2(arg); - break; - case VT_I4: - val = V_I4(arg); - break; - case VT_R4: - val = V_R4(arg) > 0.0 || V_R4(arg) < 0.0; - break; - case VT_R8: - val = V_R8(arg) > 0.0 || V_R8(arg) < 0.0; - break; - default: - ERR("Not a numeric value: %s\n", debugstr_variant(arg)); - return E_FAIL; - } - - return return_bool(res, val); + V_VT(res) = VT_EMPTY; + return VariantChangeType(res, arg, VARIANT_LOCALBOOL, VT_BOOL); } static HRESULT Global_CByte(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) -- 1.8.1.2