Commit 9d23f8a7 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

jscript: Make compare2_values working with NULL BSTR's.

parent ec25138a
......@@ -304,7 +304,12 @@ static HRESULT equal2_values(VARIANT *lval, VARIANT *rval, BOOL *ret)
*ret = V_R8(lval) == V_R8(rval);
break;
case VT_BSTR:
*ret = !strcmpW(V_BSTR(lval), V_BSTR(rval));
if(!V_BSTR(lval))
*ret = SysStringLen(V_BSTR(rval))?FALSE:TRUE;
else if(!V_BSTR(rval))
*ret = SysStringLen(V_BSTR(lval))?FALSE:TRUE;
else
*ret = !strcmpW(V_BSTR(lval), V_BSTR(rval));
break;
case VT_DISPATCH:
return disp_cmp(V_DISPATCH(lval), V_DISPATCH(rval), ret);
......
......@@ -896,4 +896,6 @@ ok(""+str === "test", "''+str = " + str);
ok((function (){return 1;})() === 1, "(function (){return 1;})() = " + (function (){return 1;})());
ok(createNullBSTR() === '', "createNullBSTR() !== ''");
reportSuccess();
......@@ -73,6 +73,7 @@ DEFINE_EXPECT(GetItemInfo_testVal);
#define DISPID_GLOBAL_OK 0x1004
#define DISPID_GLOBAL_GETVT 0x1005
#define DISPID_GLOBAL_TESTOBJ 0x1006
#define DISPID_GLOBAL_NULL_BSTR 0x1007
static const WCHAR testW[] = {'t','e','s','t',0};
static const CHAR testA[] = "test";
......@@ -283,6 +284,10 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
*pid = DISPID_GLOBAL_TESTOBJ;
return S_OK;
}
if(!strcmp_wa(bstrName, "createNullBSTR")) {
*pid = DISPID_GLOBAL_NULL_BSTR;
return S_OK;
}
if(strict_dispid_check)
ok(0, "unexpected call %s\n", debugstr_w(bstrName));
......@@ -429,6 +434,13 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
V_VT(pvarRes) = VT_DISPATCH;
V_DISPATCH(pvarRes) = (IDispatch*)&testObj;
return S_OK;
case DISPID_GLOBAL_NULL_BSTR:
if(pvarRes) {
V_VT(pvarRes) = VT_BSTR;
V_BSTR(pvarRes) = NULL;
}
return S_OK;
}
ok(0, "unexpected call %x\n", id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment