vbscript: Coerce datatype in StrComp.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
906e770121
commit
73924a45d6
|
@ -1038,11 +1038,6 @@ static HRESULT Global_StrComp(vbdisp_t *This, VARIANT *args, unsigned args_cnt,
|
|||
|
||||
assert(args_cnt == 2 || args_cnt == 3);
|
||||
|
||||
if(V_VT(args) != VT_BSTR || V_VT(args+1) != VT_BSTR) {
|
||||
FIXME("args[0] = %s, args[1] = %s\n", debugstr_variant(args), debugstr_variant(args+1));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
if (args_cnt == 3) {
|
||||
hres = to_int(args+2, &mode);
|
||||
if(FAILED(hres))
|
||||
|
@ -1056,11 +1051,22 @@ static HRESULT Global_StrComp(vbdisp_t *This, VARIANT *args, unsigned args_cnt,
|
|||
else
|
||||
mode = 0;
|
||||
|
||||
left = V_BSTR(args);
|
||||
right = V_BSTR(args+1);
|
||||
hres = to_string(args, &left);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = to_string(args+1, &right);
|
||||
if(FAILED(hres))
|
||||
{
|
||||
SysFreeString(left);
|
||||
return hres;
|
||||
}
|
||||
|
||||
ret = mode ? strcmpiW(left, right) : strcmpW(left, right);
|
||||
val = ret < 0 ? -1 : (ret > 0 ? 1 : 0);
|
||||
|
||||
SysFreeString(left);
|
||||
SysFreeString(right);
|
||||
return return_short(res, val);
|
||||
}
|
||||
|
||||
|
|
|
@ -459,6 +459,15 @@ TestStrComp "ABCD", "ABC", 1, 1
|
|||
TestStrComp "ABC", "ABCD", 1, -1
|
||||
TestStrComp "ABC", "ABCD", "0", -1
|
||||
TestStrComp "ABC", "ABCD", "1", -1
|
||||
TestStrComp 1, 1, 1, 0
|
||||
TestStrComp "1", 1, 1, 0
|
||||
TestStrComp "1", 1.0, 1, 0
|
||||
TestStrComp Empty, Empty, 1, 0
|
||||
TestStrComp Empty, "", 1, 0
|
||||
TestStrComp Empty, "ABC", 1, -1
|
||||
TestStrComp "ABC", Empty, 1, 1
|
||||
TestStrComp vbNull, vbNull, 1, 0
|
||||
TestStrComp "", vbNull, 1, -1
|
||||
|
||||
Call ok(Len("abc") = 3, "Len(abc) = " & Len("abc"))
|
||||
Call ok(Len("") = 0, "Len() = " & Len(""))
|
||||
|
|
Loading…
Reference in New Issue