Commit 398a4be3 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

propsys: Add support for VT_R4/VT_R8 to PropVariantCompareEx().

parent 0a508e49
......@@ -846,7 +846,7 @@ INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2
else
propvar2_converted = propvar2;
#define CMP_INT_VALUE(var) do { \
#define CMP_NUM_VALUE(var) do { \
if (propvar1->u.var > propvar2_converted->u.var) \
res = 1; \
else if (propvar1->u.var < propvar2_converted->u.var) \
......@@ -858,28 +858,34 @@ INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2
switch (propvar1->vt)
{
case VT_I1:
CMP_INT_VALUE(cVal);
CMP_NUM_VALUE(cVal);
break;
case VT_UI1:
CMP_INT_VALUE(bVal);
CMP_NUM_VALUE(bVal);
break;
case VT_I2:
CMP_INT_VALUE(iVal);
CMP_NUM_VALUE(iVal);
break;
case VT_UI2:
CMP_INT_VALUE(uiVal);
CMP_NUM_VALUE(uiVal);
break;
case VT_I4:
CMP_INT_VALUE(lVal);
CMP_NUM_VALUE(lVal);
break;
case VT_UI4:
CMP_INT_VALUE(uiVal);
CMP_NUM_VALUE(uiVal);
break;
case VT_I8:
CMP_INT_VALUE(hVal.QuadPart);
CMP_NUM_VALUE(hVal.QuadPart);
break;
case VT_UI8:
CMP_INT_VALUE(uhVal.QuadPart);
CMP_NUM_VALUE(uhVal.QuadPart);
break;
case VT_R4:
CMP_NUM_VALUE(fltVal);
break;
case VT_R8:
CMP_NUM_VALUE(dblVal);
break;
case VT_BSTR:
case VT_LPWSTR:
......
......@@ -660,7 +660,7 @@ static void test_PropVariantToStringAlloc(void)
static void test_PropVariantCompare(void)
{
PROPVARIANT empty, null, emptyarray, i2_0, i2_2, i4_large, i4_largeneg, i4_2, str_2, str_02, str_b;
PROPVARIANT clsid_null, clsid, clsid2;
PROPVARIANT clsid_null, clsid, clsid2, r4_0, r4_2, r8_0, r8_2;
INT res;
static const WCHAR str_2W[] = {'2', 0};
static const WCHAR str_02W[] = {'0', '2', 0};
......@@ -711,6 +711,14 @@ static void test_PropVariantCompare(void)
clsid.u.puuid = (GUID *)&dummy_guid;
clsid2.vt = VT_CLSID;
clsid2.u.puuid = (GUID *)&GUID_NULL;
r4_0.vt = VT_R4;
r4_0.u.fltVal = 0.0f;
r4_2.vt = VT_R4;
r4_2.u.fltVal = 2.0f;
r8_0.vt = VT_R8;
r8_0.u.dblVal = 0.0;
r8_2.vt = VT_R8;
r8_2.u.dblVal = 2.0;
res = PropVariantCompareEx(&empty, &empty, 0, 0);
ok(res == 0, "res=%i\n", res);
......@@ -807,6 +815,29 @@ static void test_PropVariantCompare(void)
res = PropVariantCompareEx(&clsid, &clsid_null, 0, PVCF_TREATEMPTYASGREATERTHAN);
ok(res == -1, "res=%i\n", res);
/* VT_R4/VT_R8 */
res = PropVariantCompareEx(&r4_0, &r8_0, 0, 0);
todo_wine
ok(res == 0, "res=%i\n", res);
res = PropVariantCompareEx(&r4_0, &r4_0, 0, 0);
ok(res == 0, "res=%i\n", res);
res = PropVariantCompareEx(&r4_0, &r4_2, 0, 0);
ok(res == -1, "res=%i\n", res);
res = PropVariantCompareEx(&r4_2, &r4_0, 0, 0);
ok(res == 1, "res=%i\n", res);
res = PropVariantCompareEx(&r8_0, &r8_0, 0, 0);
ok(res == 0, "res=%i\n", res);
res = PropVariantCompareEx(&r8_0, &r8_2, 0, 0);
ok(res == -1, "res=%i\n", res);
res = PropVariantCompareEx(&r8_2, &r8_0, 0, 0);
ok(res == 1, "res=%i\n", res);
SysFreeString(str_2.u.bstrVal);
SysFreeString(str_02.u.bstrVal);
SysFreeString(str_b.u.bstrVal);
......
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