oleaut32: Add support for boolean strings in VarNot.

This commit is contained in:
Huw Davies 2012-06-26 13:34:02 +01:00 committed by Alexandre Julliard
parent 9173de875a
commit dc1d7868d3
2 changed files with 17 additions and 6 deletions

View File

@ -2007,6 +2007,8 @@ static void test_VarNot(void)
{
static const WCHAR szNum0[] = {'0','\0' };
static const WCHAR szNum1[] = {'1','\0' };
static const WCHAR szFalse[] = { '#','F','A','L','S','E','#','\0' };
static const WCHAR szTrue[] = { '#','T','R','U','E','#','\0' };
HRESULT hres;
VARIANT v, exp, vDst;
DECIMAL *pdec = &V_DECIMAL(&v);
@ -2102,6 +2104,8 @@ static void test_VarNot(void)
ok(V_VT(&v) == VT_BSTR && V_BSTR(&v) == szNum0, "VarNot(0): changed input\n");
VARNOT(BSTR,(BSTR)szNum1,I4,-2);
ok(V_VT(&v) == VT_BSTR && V_BSTR(&v) == szNum1, "VarNot(1): changed input\n");
VARNOT(BSTR, (BSTR)szTrue, BOOL, VARIANT_FALSE);
VARNOT(BSTR, (BSTR)szFalse, BOOL, VARIANT_TRUE);
V_VT(&v) = VT_DECIMAL;
S(U(*pdec)).sign = DECIMAL_NEG;

View File

@ -5026,6 +5026,19 @@ HRESULT WINAPI VarNot(LPVARIANT pVarIn, LPVARIANT pVarOut)
pVarIn = &temp;
}
if (V_VT(pVarIn) == VT_BSTR)
{
V_VT(&varIn) = VT_R8;
hRet = VarR8FromStr( V_BSTR(pVarIn), LOCALE_USER_DEFAULT, 0, &V_R8(&varIn) );
if (FAILED(hRet))
{
V_VT(&varIn) = VT_BOOL;
hRet = VarBoolFromStr( V_BSTR(pVarIn), LOCALE_USER_DEFAULT, VAR_LOCALBOOL, &V_BOOL(&varIn) );
}
if (FAILED(hRet)) goto VarNot_Exit;
pVarIn = &varIn;
}
V_VT(pVarOut) = V_VT(pVarIn);
switch (V_VT(pVarIn))
@ -5066,12 +5079,6 @@ HRESULT WINAPI VarNot(LPVARIANT pVarIn, LPVARIANT pVarOut)
V_I4(pVarOut) = ~V_I4(pVarOut);
V_VT(pVarOut) = VT_I4;
break;
case VT_BSTR:
hRet = VarR8FromStr(V_BSTR(pVarIn), LOCALE_USER_DEFAULT, 0, &V_R8(&varIn));
if (FAILED(hRet))
break;
pVarIn = &varIn;
/* Fall through ... */
case VT_DATE:
case VT_R8:
hRet = VarI4FromR8(V_R8(pVarIn), &V_I4(pVarOut));