vbscript: Don't try to convert int to short in return_int.

This commit is contained in:
Jacek Caban 2014-09-22 15:52:13 +02:00 committed by Alexandre Julliard
parent d684d776c2
commit 85b989927f
3 changed files with 7 additions and 24 deletions

View File

@ -112,9 +112,6 @@ static HRESULT return_short(VARIANT *res, short val)
static HRESULT return_int(VARIANT *res, int val)
{
if((short)val == val)
return return_short(res, val);
if(res) {
V_VT(res) = VT_I4;
V_I4(res) = val;
@ -417,9 +414,7 @@ static HRESULT Global_CLng(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI
if(!res)
return DISP_E_BADVARTYPE;
V_VT(res) = VT_I4;
V_I4(res) = i;
return S_OK;
return return_int(res, i);
}
static HRESULT Global_CBool(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
@ -1778,12 +1773,7 @@ static HRESULT Global_ScriptEngineMajorVersion(vbdisp_t *This, VARIANT *arg, uns
assert(args_cnt == 0);
if(res) {
V_VT(res) = VT_I4;
V_I4(res) = VBSCRIPT_MAJOR_VERSION;
}
return S_OK;
return return_int(res, VBSCRIPT_MAJOR_VERSION);
}
static HRESULT Global_ScriptEngineMinorVersion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
@ -1792,12 +1782,7 @@ static HRESULT Global_ScriptEngineMinorVersion(vbdisp_t *This, VARIANT *arg, uns
assert(args_cnt == 0);
if(res) {
V_VT(res) = VT_I4;
V_I4(res) = VBSCRIPT_MINOR_VERSION;
}
return S_OK;
return return_int(res, VBSCRIPT_MINOR_VERSION);
}
static HRESULT Global_ScriptEngineBuildVersion(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
@ -1806,12 +1791,7 @@ static HRESULT Global_ScriptEngineBuildVersion(vbdisp_t *This, VARIANT *arg, uns
assert(args_cnt == 0);
if(res) {
V_VT(res) = VT_I4;
V_I4(res) = VBSCRIPT_BUILD_VERSION;
}
return S_OK;
return return_int(res, VBSCRIPT_BUILD_VERSION);
}
static HRESULT Global_FormatNumber(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)

View File

@ -242,6 +242,7 @@ Call ok(x = 2, "InStr returned " & x)
x = InStr("abcd", "bc")
Call ok(x = 2, "InStr returned " & x)
Call ok(getVT(x) = "VT_I4*", "getVT(InStr) returned " & getVT(x))
x = InStr("abc", "bc")
Call ok(x = 2, "InStr returned " & x)
@ -335,6 +336,7 @@ Call ok(Len("") = 0, "Len() = " & Len(""))
Call ok(Len(1) = 1, "Len(1) = " & Len(1))
Call ok(isNull(Len(null)), "Len(null) = " & Len(null))
Call ok(Len(empty) = 0, "Len(empty) = " & Len(empty))
Call ok(getVT(Len("abc")) = "VT_I4", "getVT(Len(abc)) = " & getVT(Len("abc")))
Call ok(Space(1) = " ", "Space(1) = " & Space(1) & """")
Call ok(Space(0) = "", "Space(0) = " & Space(0) & """")

View File

@ -75,6 +75,7 @@ const RPC_S_SERVER_UNAVAILABLE = &h800706BA&
const CO_E_SERVER_EXEC_FAILURE = &h80080005&
call ok(Err.Number = 0, "Err.Number = " & Err.Number)
call ok(getVT(Err.Number) = "VT_I4", "getVT(Err.Number) = " & getVT(Err.Number))
dim calledFunc