propsys: Use integer conversion functions in PropVariantCompareEx.

This commit is contained in:
Vincent Povirk 2012-09-13 17:16:26 -05:00 committed by Alexandre Julliard
parent c66b5ac4c3
commit 60dae84bc6
2 changed files with 74 additions and 2 deletions

View File

@ -215,9 +215,81 @@ HRESULT WINAPI PropVariantToUInt64(REFPROPVARIANT propvarIn, ULONGLONG *ret)
HRESULT WINAPI PropVariantChangeType(PROPVARIANT *ppropvarDest, REFPROPVARIANT propvarSrc,
PROPVAR_CHANGE_FLAGS flags, VARTYPE vt)
{
HRESULT hr;
FIXME("(%p, %p, %d, %d, %d): semi-stub!\n", ppropvarDest, propvarSrc,
propvarSrc->vt, flags, vt);
switch (vt)
{
case VT_I2:
{
SHORT res;
hr = PropVariantToInt16(propvarSrc, &res);
if (SUCCEEDED(hr))
{
ppropvarDest->vt = VT_I2;
ppropvarDest->u.iVal = res;
}
return hr;
}
case VT_UI2:
{
USHORT res;
hr = PropVariantToUInt16(propvarSrc, &res);
if (SUCCEEDED(hr))
{
ppropvarDest->vt = VT_UI2;
ppropvarDest->u.uiVal = res;
}
return hr;
}
case VT_I4:
{
LONG res;
hr = PropVariantToInt32(propvarSrc, &res);
if (SUCCEEDED(hr))
{
ppropvarDest->vt = VT_I4;
ppropvarDest->u.lVal = res;
}
return hr;
}
case VT_UI4:
{
ULONG res;
hr = PropVariantToUInt32(propvarSrc, &res);
if (SUCCEEDED(hr))
{
ppropvarDest->vt = VT_UI4;
ppropvarDest->u.ulVal = res;
}
return hr;
}
case VT_I8:
{
LONGLONG res;
hr = PropVariantToInt64(propvarSrc, &res);
if (SUCCEEDED(hr))
{
ppropvarDest->vt = VT_I8;
ppropvarDest->u.hVal.QuadPart = res;
}
return hr;
}
case VT_UI8:
{
ULONGLONG res;
hr = PropVariantToUInt64(propvarSrc, &res);
if (SUCCEEDED(hr))
{
ppropvarDest->vt = VT_UI8;
ppropvarDest->u.uhVal.QuadPart = res;
}
return hr;
}
}
switch (propvarSrc->vt)
{
case VT_FILETIME:

View File

@ -716,13 +716,13 @@ static void test_PropVariantCompare(void)
ok(res == -1, "res=%i\n", res);
res = PropVariantCompareEx(&i4_large, &i2_0, 0, 0);
todo_wine ok(res == 1, "res=%i\n", res);
ok(res == 1, "res=%i\n", res);
res = PropVariantCompareEx(&i4_largeneg, &i2_0, 0, 0);
ok(res == -1, "res=%i\n", res);
res = PropVariantCompareEx(&i2_2, &i4_2, 0, 0);
todo_wine ok(res == 0, "res=%i\n", res);
ok(res == 0, "res=%i\n", res);
res = PropVariantCompareEx(&i2_2, &str_2, 0, 0);
todo_wine ok(res == 0, "res=%i\n", res);