From 6a6c323306681ef2a422f9711bde6271be9c0d96 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 27 Feb 2013 12:55:19 +0100 Subject: [PATCH] vbscript: Make constant type explicit. --- dlls/vbscript/global.c | 136 ++++++++++++++++++++--------------------- dlls/vbscript/vbdisp.c | 11 +++- 2 files changed, 76 insertions(+), 71 deletions(-) diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c index a576f08299..ab3965ed67 100644 --- a/dlls/vbscript/global.c +++ b/dlls/vbscript/global.c @@ -1712,70 +1712,70 @@ static HRESULT Global_vbVerticalTab(vbdisp_t *This, VARIANT *arg, unsigned args_ } static const builtin_prop_t global_props[] = { - {DISPID_GLOBAL_VBUSESYSTEM, NULL, BP_GET, 0}, - {DISPID_GLOBAL_USESYSTEMDAYOFWEEK, NULL, BP_GET, 0}, - {DISPID_GLOBAL_VBSUNDAY, NULL, BP_GET, 1}, - {DISPID_GLOBAL_VBMONDAY, NULL, BP_GET, 2}, - {DISPID_GLOBAL_VBTUESDAY, NULL, BP_GET, 3}, - {DISPID_GLOBAL_VBWEDNESDAY, NULL, BP_GET, 4}, - {DISPID_GLOBAL_VBTHURSDAY, NULL, BP_GET, 5}, - {DISPID_GLOBAL_VBFRIDAY, NULL, BP_GET, 6}, - {DISPID_GLOBAL_VBSATURDAY, NULL, BP_GET, 7}, - {DISPID_GLOBAL_VBFIRSTJAN1, NULL, BP_GET, 1}, - {DISPID_GLOBAL_VBFIRSTFOURDAYS, NULL, BP_GET, 2}, - {DISPID_GLOBAL_VBFIRSTFULLWEEK, NULL, BP_GET, 3}, - {DISPID_GLOBAL_VBOKONLY, NULL, BP_GET, MB_OK}, - {DISPID_GLOBAL_VBOKCANCEL, NULL, BP_GET, MB_OKCANCEL}, - {DISPID_GLOBAL_VBABORTRETRYIGNORE, NULL, BP_GET, MB_ABORTRETRYIGNORE}, - {DISPID_GLOBAL_VBYESNOCANCEL, NULL, BP_GET, MB_YESNOCANCEL}, - {DISPID_GLOBAL_VBYESNO, NULL, BP_GET, MB_YESNO}, - {DISPID_GLOBAL_VBRETRYCANCEL, NULL, BP_GET, MB_RETRYCANCEL}, - {DISPID_GLOBAL_VBCRITICAL, NULL, BP_GET, MB_ICONHAND}, - {DISPID_GLOBAL_VBQUESTION, NULL, BP_GET, MB_ICONQUESTION}, - {DISPID_GLOBAL_VBEXCLAMATION, NULL, BP_GET, MB_ICONEXCLAMATION}, - {DISPID_GLOBAL_VBINFORMATION, NULL, BP_GET, MB_ICONASTERISK}, - {DISPID_GLOBAL_VBDEFAULTBUTTON1, NULL, BP_GET, MB_DEFBUTTON1}, - {DISPID_GLOBAL_VBDEFAULTBUTTON2, NULL, BP_GET, MB_DEFBUTTON2}, - {DISPID_GLOBAL_VBDEFAULTBUTTON3, NULL, BP_GET, MB_DEFBUTTON3}, - {DISPID_GLOBAL_VBDEFAULTBUTTON4, NULL, BP_GET, MB_DEFBUTTON4}, - {DISPID_GLOBAL_VBAPPLICATIONMODAL, NULL, BP_GET, MB_APPLMODAL}, - {DISPID_GLOBAL_VBSYSTEMMODAL, NULL, BP_GET, MB_SYSTEMMODAL}, - {DISPID_GLOBAL_VBOK, NULL, BP_GET, IDOK}, - {DISPID_GLOBAL_VBCANCEL, NULL, BP_GET, IDCANCEL}, - {DISPID_GLOBAL_VBABORT, NULL, BP_GET, IDABORT}, - {DISPID_GLOBAL_VBRETRY, NULL, BP_GET, IDRETRY}, - {DISPID_GLOBAL_VBIGNORE, NULL, BP_GET, IDIGNORE}, - {DISPID_GLOBAL_VBYES, NULL, BP_GET, IDYES}, - {DISPID_GLOBAL_VBNO, NULL, BP_GET, IDNO}, - {DISPID_GLOBAL_VBEMPTY, NULL, BP_GET, VT_EMPTY}, - {DISPID_GLOBAL_VBNULL, NULL, BP_GET, VT_NULL}, - {DISPID_GLOBAL_VBINTEGER, NULL, BP_GET, VT_I2}, - {DISPID_GLOBAL_VBLONG, NULL, BP_GET, VT_I4}, - {DISPID_GLOBAL_VBSINGLE, NULL, BP_GET, VT_R4}, - {DISPID_GLOBAL_VBDOUBLE, NULL, BP_GET, VT_R8}, - {DISPID_GLOBAL_VBCURRENCY, NULL, BP_GET, VT_CY}, - {DISPID_GLOBAL_VBDATE, NULL, BP_GET, VT_DATE}, - {DISPID_GLOBAL_VBSTRING, NULL, BP_GET, VT_BSTR}, - {DISPID_GLOBAL_VBOBJECT, NULL, BP_GET, VT_DISPATCH}, - {DISPID_GLOBAL_VBERROR, NULL, BP_GET, VT_ERROR}, - {DISPID_GLOBAL_VBBOOLEAN, NULL, BP_GET, VT_BOOL}, - {DISPID_GLOBAL_VBVARIANT, NULL, BP_GET, VT_VARIANT}, - {DISPID_GLOBAL_VBDATAOBJECT, NULL, BP_GET, VT_UNKNOWN}, - {DISPID_GLOBAL_VBDECIMAL, NULL, BP_GET, VT_DECIMAL}, - {DISPID_GLOBAL_VBBYTE, NULL, BP_GET, VT_UI1}, - {DISPID_GLOBAL_VBARRAY, NULL, BP_GET, VT_ARRAY}, - {DISPID_GLOBAL_VBTRUE, NULL, BP_GET, VARIANT_TRUE}, - {DISPID_GLOBAL_VBFALSE, NULL, BP_GET, VARIANT_FALSE}, - {DISPID_GLOBAL_VBUSEDEFAULT, NULL, BP_GET, -2}, - {DISPID_GLOBAL_VBBINARYCOMPARE, NULL, BP_GET, 0}, - {DISPID_GLOBAL_VBTEXTCOMPARE, NULL, BP_GET, 1}, - {DISPID_GLOBAL_VBDATABASECOMPARE, NULL, BP_GET, 2}, - {DISPID_GLOBAL_VBGENERALDATE, NULL, BP_GET, 0}, - {DISPID_GLOBAL_VBLONGDATE, NULL, BP_GET, 1}, - {DISPID_GLOBAL_VBSHORTDATE, NULL, BP_GET, 2}, - {DISPID_GLOBAL_VBLONGTIME, NULL, BP_GET, 3}, - {DISPID_GLOBAL_VBSHORTTIME, NULL, BP_GET, 4}, - {DISPID_GLOBAL_VBOBJECTERROR, NULL, BP_GET, 0x80040000}, + {DISPID_GLOBAL_VBUSESYSTEM, NULL, BP_GET, VT_I2, 0}, + {DISPID_GLOBAL_USESYSTEMDAYOFWEEK, NULL, BP_GET, VT_I2, 0}, + {DISPID_GLOBAL_VBSUNDAY, NULL, BP_GET, VT_I2, 1}, + {DISPID_GLOBAL_VBMONDAY, NULL, BP_GET, VT_I2, 2}, + {DISPID_GLOBAL_VBTUESDAY, NULL, BP_GET, VT_I2, 3}, + {DISPID_GLOBAL_VBWEDNESDAY, NULL, BP_GET, VT_I2, 4}, + {DISPID_GLOBAL_VBTHURSDAY, NULL, BP_GET, VT_I2, 5}, + {DISPID_GLOBAL_VBFRIDAY, NULL, BP_GET, VT_I2, 6}, + {DISPID_GLOBAL_VBSATURDAY, NULL, BP_GET, VT_I2, 7}, + {DISPID_GLOBAL_VBFIRSTJAN1, NULL, BP_GET, VT_I2, 1}, + {DISPID_GLOBAL_VBFIRSTFOURDAYS, NULL, BP_GET, VT_I2, 2}, + {DISPID_GLOBAL_VBFIRSTFULLWEEK, NULL, BP_GET, VT_I2, 3}, + {DISPID_GLOBAL_VBOKONLY, NULL, BP_GET, VT_I2, MB_OK}, + {DISPID_GLOBAL_VBOKCANCEL, NULL, BP_GET, VT_I2, MB_OKCANCEL}, + {DISPID_GLOBAL_VBABORTRETRYIGNORE, NULL, BP_GET, VT_I2, MB_ABORTRETRYIGNORE}, + {DISPID_GLOBAL_VBYESNOCANCEL, NULL, BP_GET, VT_I2, MB_YESNOCANCEL}, + {DISPID_GLOBAL_VBYESNO, NULL, BP_GET, VT_I2, MB_YESNO}, + {DISPID_GLOBAL_VBRETRYCANCEL, NULL, BP_GET, VT_I2, MB_RETRYCANCEL}, + {DISPID_GLOBAL_VBCRITICAL, NULL, BP_GET, VT_I2, MB_ICONHAND}, + {DISPID_GLOBAL_VBQUESTION, NULL, BP_GET, VT_I2, MB_ICONQUESTION}, + {DISPID_GLOBAL_VBEXCLAMATION, NULL, BP_GET, VT_I2, MB_ICONEXCLAMATION}, + {DISPID_GLOBAL_VBINFORMATION, NULL, BP_GET, VT_I2, MB_ICONASTERISK}, + {DISPID_GLOBAL_VBDEFAULTBUTTON1, NULL, BP_GET, VT_I2, MB_DEFBUTTON1}, + {DISPID_GLOBAL_VBDEFAULTBUTTON2, NULL, BP_GET, VT_I2, MB_DEFBUTTON2}, + {DISPID_GLOBAL_VBDEFAULTBUTTON3, NULL, BP_GET, VT_I2, MB_DEFBUTTON3}, + {DISPID_GLOBAL_VBDEFAULTBUTTON4, NULL, BP_GET, VT_I2, MB_DEFBUTTON4}, + {DISPID_GLOBAL_VBAPPLICATIONMODAL, NULL, BP_GET, VT_I2, MB_APPLMODAL}, + {DISPID_GLOBAL_VBSYSTEMMODAL, NULL, BP_GET, VT_I2, MB_SYSTEMMODAL}, + {DISPID_GLOBAL_VBOK, NULL, BP_GET, VT_I2, IDOK}, + {DISPID_GLOBAL_VBCANCEL, NULL, BP_GET, VT_I2, IDCANCEL}, + {DISPID_GLOBAL_VBABORT, NULL, BP_GET, VT_I2, IDABORT}, + {DISPID_GLOBAL_VBRETRY, NULL, BP_GET, VT_I2, IDRETRY}, + {DISPID_GLOBAL_VBIGNORE, NULL, BP_GET, VT_I2, IDIGNORE}, + {DISPID_GLOBAL_VBYES, NULL, BP_GET, VT_I2, IDYES}, + {DISPID_GLOBAL_VBNO, NULL, BP_GET, VT_I2, IDNO}, + {DISPID_GLOBAL_VBEMPTY, NULL, BP_GET, VT_I2, VT_EMPTY}, + {DISPID_GLOBAL_VBNULL, NULL, BP_GET, VT_I2, VT_NULL}, + {DISPID_GLOBAL_VBINTEGER, NULL, BP_GET, VT_I2, VT_I2}, + {DISPID_GLOBAL_VBLONG, NULL, BP_GET, VT_I2, VT_I4}, + {DISPID_GLOBAL_VBSINGLE, NULL, BP_GET, VT_I2, VT_R4}, + {DISPID_GLOBAL_VBDOUBLE, NULL, BP_GET, VT_I2, VT_R8}, + {DISPID_GLOBAL_VBCURRENCY, NULL, BP_GET, VT_I2, VT_CY}, + {DISPID_GLOBAL_VBDATE, NULL, BP_GET, VT_I2, VT_DATE}, + {DISPID_GLOBAL_VBSTRING, NULL, BP_GET, VT_I2, VT_BSTR}, + {DISPID_GLOBAL_VBOBJECT, NULL, BP_GET, VT_I2, VT_DISPATCH}, + {DISPID_GLOBAL_VBERROR, NULL, BP_GET, VT_I2, VT_ERROR}, + {DISPID_GLOBAL_VBBOOLEAN, NULL, BP_GET, VT_I2, VT_BOOL}, + {DISPID_GLOBAL_VBVARIANT, NULL, BP_GET, VT_I2, VT_VARIANT}, + {DISPID_GLOBAL_VBDATAOBJECT, NULL, BP_GET, VT_I2, VT_UNKNOWN}, + {DISPID_GLOBAL_VBDECIMAL, NULL, BP_GET, VT_I2, VT_DECIMAL}, + {DISPID_GLOBAL_VBBYTE, NULL, BP_GET, VT_I2, VT_UI1}, + {DISPID_GLOBAL_VBARRAY, NULL, BP_GET, VT_I2, VT_ARRAY}, + {DISPID_GLOBAL_VBTRUE, NULL, BP_GET, VT_I2, VARIANT_TRUE}, + {DISPID_GLOBAL_VBFALSE, NULL, BP_GET, VT_I2, VARIANT_FALSE}, + {DISPID_GLOBAL_VBUSEDEFAULT, NULL, BP_GET, VT_I2, -2}, + {DISPID_GLOBAL_VBBINARYCOMPARE, NULL, BP_GET, VT_I2, 0}, + {DISPID_GLOBAL_VBTEXTCOMPARE, NULL, BP_GET, VT_I2, 1}, + {DISPID_GLOBAL_VBDATABASECOMPARE, NULL, BP_GET, VT_I2, 2}, + {DISPID_GLOBAL_VBGENERALDATE, NULL, BP_GET, VT_I2, 0}, + {DISPID_GLOBAL_VBLONGDATE, NULL, BP_GET, VT_I2, 1}, + {DISPID_GLOBAL_VBSHORTDATE, NULL, BP_GET, VT_I2, 2}, + {DISPID_GLOBAL_VBLONGTIME, NULL, BP_GET, VT_I2, 3}, + {DISPID_GLOBAL_VBSHORTTIME, NULL, BP_GET, VT_I2, 4}, + {DISPID_GLOBAL_VBOBJECTERROR, NULL, BP_GET, VT_I4, 0x80040000}, {DISPID_GLOBAL_VBBLACK, Global_vbBlack, BP_GET}, {DISPID_GLOBAL_VBBLUE, Global_vbBlue, BP_GET}, {DISPID_GLOBAL_VBCYAN, Global_vbCyan, BP_GET}, @@ -1900,10 +1900,10 @@ static const builtin_prop_t global_props[] = { {DISPID_GLOBAL_EXECUTE, Global_Execute, 0, 1}, {DISPID_GLOBAL_EXECUTEGLOBAL, Global_ExecuteGlobal, 0, 1}, {DISPID_GLOBAL_GETREF, Global_GetRef, 0, 1}, - {DISPID_GLOBAL_VBMSGBOXHELPBUTTON, NULL, BP_GET, MB_HELP}, - {DISPID_GLOBAL_VBMSGBOXSETFOREGROUND, NULL, BP_GET, MB_SETFOREGROUND}, - {DISPID_GLOBAL_VBMSGBOXRIGHT, NULL, BP_GET, MB_RIGHT}, - {DISPID_GLOBAL_VBMSGBOXRTLREADING, NULL, BP_GET, MB_RTLREADING} + {DISPID_GLOBAL_VBMSGBOXHELPBUTTON, NULL, BP_GET, VT_I4, MB_HELP}, + {DISPID_GLOBAL_VBMSGBOXSETFOREGROUND, NULL, BP_GET, VT_I4, MB_SETFOREGROUND}, + {DISPID_GLOBAL_VBMSGBOXRIGHT, NULL, BP_GET, VT_I4, MB_RIGHT}, + {DISPID_GLOBAL_VBMSGBOXRTLREADING, NULL, BP_GET, VT_I4, MB_RTLREADING} }; HRESULT init_global(script_ctx_t *ctx) diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c index 5a23c7167a..0c3995621c 100644 --- a/dlls/vbscript/vbdisp.c +++ b/dlls/vbscript/vbdisp.c @@ -150,13 +150,18 @@ static HRESULT invoke_builtin(vbdisp_t *This, const builtin_prop_t *prop, WORD f break; case DISPATCH_PROPERTYGET|DISPATCH_METHOD: if(!prop->proc && prop->flags == BP_GET) { - int val = prop->min_args; - if(val < 0x4000 && (INT16)val == val) { + const int vt = prop->min_args, val = prop->max_args; + switch(vt) { + case VT_I2: V_VT(res) = VT_I2; V_I2(res) = val; - }else { + break; + case VT_I4: V_VT(res) = VT_I4; V_I4(res) = val; + break; + default: + assert(0); } return S_OK; }