Commit dc1d7868 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

oleaut32: Add support for boolean strings in VarNot.

parent 9173de87
......@@ -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;
......
......@@ -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));
......
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