jscript: Properly handle NULL bstr in str_to_number.
This commit is contained in:
parent
1528d9021f
commit
8f36daa422
|
@ -320,6 +320,11 @@ static HRESULT str_to_number(BSTR str, double *ret)
|
||||||
|
|
||||||
static const WCHAR infinityW[] = {'I','n','f','i','n','i','t','y'};
|
static const WCHAR infinityW[] = {'I','n','f','i','n','i','t','y'};
|
||||||
|
|
||||||
|
if(!ptr) {
|
||||||
|
*ret = 0;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
while(isspaceW(*ptr))
|
while(isspaceW(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
|
|
|
@ -1238,7 +1238,9 @@ for(var i=0; i<2; i++)
|
||||||
tmp[i] = /b/;
|
tmp[i] = /b/;
|
||||||
ok(tmp[0] != tmp[1], "tmp[0] == tmp [1]");
|
ok(tmp[0] != tmp[1], "tmp[0] == tmp [1]");
|
||||||
|
|
||||||
ok(createNullBSTR() === '', "createNullBSTR() !== ''");
|
ok(isNullBSTR(getNullBSTR()), "isNullBSTR(getNullBSTR()) failed\n");
|
||||||
|
ok(getNullBSTR() === '', "getNullBSTR() !== ''");
|
||||||
|
ok(+getNullBSTR() === 0 , "+getNullBTR() !=== 0");
|
||||||
|
|
||||||
ok(getVT(nullDisp) === "VT_DISPATCH", "getVT(nullDisp) = " + getVT(nullDisp));
|
ok(getVT(nullDisp) === "VT_DISPATCH", "getVT(nullDisp) = " + getVT(nullDisp));
|
||||||
ok(typeof(nullDisp) === "object", "typeof(nullDisp) = " + typeof(nullDisp));
|
ok(typeof(nullDisp) === "object", "typeof(nullDisp) = " + typeof(nullDisp));
|
||||||
|
|
|
@ -84,7 +84,7 @@ DEFINE_EXPECT(DeleteMemberByDispID);
|
||||||
#define DISPID_GLOBAL_OK 0x1004
|
#define DISPID_GLOBAL_OK 0x1004
|
||||||
#define DISPID_GLOBAL_GETVT 0x1005
|
#define DISPID_GLOBAL_GETVT 0x1005
|
||||||
#define DISPID_GLOBAL_TESTOBJ 0x1006
|
#define DISPID_GLOBAL_TESTOBJ 0x1006
|
||||||
#define DISPID_GLOBAL_NULL_BSTR 0x1007
|
#define DISPID_GLOBAL_GETNULLBSTR 0x1007
|
||||||
#define DISPID_GLOBAL_NULL_DISP 0x1008
|
#define DISPID_GLOBAL_NULL_DISP 0x1008
|
||||||
#define DISPID_GLOBAL_TESTTHIS 0x1009
|
#define DISPID_GLOBAL_TESTTHIS 0x1009
|
||||||
#define DISPID_GLOBAL_TESTTHIS2 0x100a
|
#define DISPID_GLOBAL_TESTTHIS2 0x100a
|
||||||
|
@ -95,6 +95,7 @@ DEFINE_EXPECT(DeleteMemberByDispID);
|
||||||
#define DISPID_GLOBAL_ISWIN64 0x100f
|
#define DISPID_GLOBAL_ISWIN64 0x100f
|
||||||
#define DISPID_GLOBAL_PUREDISP 0x1010
|
#define DISPID_GLOBAL_PUREDISP 0x1010
|
||||||
#define DISPID_GLOBAL_TESTPROPDELETE 0x1010
|
#define DISPID_GLOBAL_TESTPROPDELETE 0x1010
|
||||||
|
#define DISPID_GLOBAL_ISNULLBSTR 0x1011
|
||||||
|
|
||||||
#define DISPID_TESTOBJ_PROP 0x2000
|
#define DISPID_TESTOBJ_PROP 0x2000
|
||||||
#define DISPID_TESTOBJ_ONLYDISPID 0x2001
|
#define DISPID_TESTOBJ_ONLYDISPID 0x2001
|
||||||
|
@ -438,8 +439,12 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD
|
||||||
*pid = DISPID_GLOBAL_TESTOBJ;
|
*pid = DISPID_GLOBAL_TESTOBJ;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
if(!strcmp_wa(bstrName, "createNullBSTR")) {
|
if(!strcmp_wa(bstrName, "getNullBSTR")) {
|
||||||
*pid = DISPID_GLOBAL_NULL_BSTR;
|
*pid = DISPID_GLOBAL_GETNULLBSTR;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
if(!strcmp_wa(bstrName, "isNullBSTR")) {
|
||||||
|
*pid = DISPID_GLOBAL_ISNULLBSTR;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
if(!strcmp_wa(bstrName, "nullDisp")) {
|
if(!strcmp_wa(bstrName, "nullDisp")) {
|
||||||
|
@ -663,13 +668,28 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid,
|
||||||
V_DISPATCH(pvarRes) = (IDispatch*)&pureDisp;
|
V_DISPATCH(pvarRes) = (IDispatch*)&pureDisp;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
case DISPID_GLOBAL_NULL_BSTR:
|
case DISPID_GLOBAL_GETNULLBSTR:
|
||||||
if(pvarRes) {
|
if(pvarRes) {
|
||||||
V_VT(pvarRes) = VT_BSTR;
|
V_VT(pvarRes) = VT_BSTR;
|
||||||
V_BSTR(pvarRes) = NULL;
|
V_BSTR(pvarRes) = NULL;
|
||||||
}
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
|
case DISPID_GLOBAL_ISNULLBSTR:
|
||||||
|
ok(pdp != NULL, "pdp == NULL\n");
|
||||||
|
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
|
||||||
|
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
|
||||||
|
ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs);
|
||||||
|
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
|
||||||
|
ok(pvarRes != NULL, "pvarRes == NULL\n");
|
||||||
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes));
|
||||||
|
ok(pei != NULL, "pei == NULL\n");
|
||||||
|
ok(V_VT(pdp->rgvarg) == VT_BSTR, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
|
||||||
|
|
||||||
|
V_VT(pvarRes) = VT_BOOL;
|
||||||
|
V_BOOL(pvarRes) = V_BSTR(pdp->rgvarg) ? VARIANT_FALSE : VARIANT_TRUE;
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
case DISPID_GLOBAL_ISWIN64:
|
case DISPID_GLOBAL_ISWIN64:
|
||||||
if(pvarRes) {
|
if(pvarRes) {
|
||||||
V_VT(pvarRes) = VT_BOOL;
|
V_VT(pvarRes) = VT_BOOL;
|
||||||
|
|
Loading…
Reference in New Issue