Commit 497de3cc authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

propsys/tests: Use nameless unions.

parent 1d8e5079
TESTDLL = propsys.dll
IMPORTS = propsys ole32 oleaut32
EXTRADEFS = -DWINE_NO_NAMELESS_EXTENSION
C_SRCS = \
propsys.c
......@@ -495,9 +495,9 @@ static void test_InitPropVariantFromGUIDAsString(void)
hres = InitPropVariantFromGUIDAsString(testcases[i].guid, &propvar);
ok(hres == S_OK, "%d) InitPropVariantFromGUIDAsString returned %x\n", i, hres);
ok(propvar.vt == VT_LPWSTR, "%d) propvar.vt = %d\n", i, propvar.vt);
ok(!lstrcmpW(propvar.u.pwszVal, testcases[i].str), "%d) propvar.u.pwszVal = %s\n",
i, wine_dbgstr_w(propvar.u.pwszVal));
CoTaskMemFree(propvar.u.pwszVal);
ok(!lstrcmpW(propvar.pwszVal, testcases[i].str), "%d) propvar.pwszVal = %s\n",
i, wine_dbgstr_w(propvar.pwszVal));
CoTaskMemFree(propvar.pwszVal);
memset(&var, 0, sizeof(VARIANT));
hres = InitVariantFromGUIDAsString(testcases[i].guid, &var);
......@@ -523,14 +523,14 @@ static void test_InitPropVariantFromBuffer(void)
hres = InitPropVariantFromBuffer(NULL, 0, &propvar);
ok(hres == S_OK, "InitPropVariantFromBuffer returned %x\n", hres);
ok(propvar.vt == (VT_VECTOR|VT_UI1), "propvar.vt = %d\n", propvar.vt);
ok(propvar.u.caub.cElems == 0, "cElems = %d\n", propvar.u.caub.cElems == 0);
ok(propvar.caub.cElems == 0, "cElems = %d\n", propvar.caub.cElems == 0);
PropVariantClear(&propvar);
hres = InitPropVariantFromBuffer(data_in, 4, &propvar);
ok(hres == S_OK, "InitPropVariantFromBuffer returned %x\n", hres);
ok(propvar.vt == (VT_VECTOR|VT_UI1), "propvar.vt = %d\n", propvar.vt);
ok(propvar.u.caub.cElems == 4, "cElems = %d\n", propvar.u.caub.cElems == 0);
ok(!memcmp(propvar.u.caub.pElems, data_in, 4), "Data inside array is incorrect\n");
ok(propvar.caub.cElems == 4, "cElems = %d\n", propvar.caub.cElems == 0);
ok(!memcmp(propvar.caub.pElems, data_in, 4), "Data inside array is incorrect\n");
PropVariantClear(&propvar);
hres = InitVariantFromBuffer(NULL, 0, &var);
......@@ -588,14 +588,14 @@ static void test_PropVariantToGUID(void)
ok(IsEqualGUID(&dummy_guid, &guid), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
ok(propvar.vt == VT_LPWSTR, "incorrect PROPVARIANT type: %d\n", propvar.vt);
propvar.u.pwszVal[1] = 'd';
propvar.u.pwszVal[2] = 'E';
propvar.u.pwszVal[3] = 'a';
propvar.pwszVal[1] = 'd';
propvar.pwszVal[2] = 'E';
propvar.pwszVal[3] = 'a';
hres = PropVariantToGUID(&propvar, &guid);
ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres);
ok(IsEqualGUID(&dummy_guid, &guid), "incorrect GUID created: %s\n", wine_dbgstr_guid(&guid));
propvar.u.pwszVal[1] = 'z';
propvar.pwszVal[1] = 'z';
hres = PropVariantToGUID(&propvar, &guid);
ok(hres == E_INVALIDARG, "PropVariantToGUID returned %x\n", hres);
PropVariantClear(&propvar);
......@@ -623,7 +623,7 @@ static void test_PropVariantToGUID(void)
V_BSTR(&var)[1] = 'd';
propvar.vt = V_VT(&var);
propvar.u.bstrVal = V_BSTR(&var);
propvar.bstrVal = V_BSTR(&var);
V_VT(&var) = VT_EMPTY;
hres = PropVariantToGUID(&propvar, &guid);
ok(hres == S_OK, "PropVariantToGUID failed %x\n", hres);
......@@ -651,8 +651,8 @@ static void test_PropVariantToStringAlloc(void)
CoTaskMemFree(str);
prop.vt = VT_LPSTR;
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
strcpy(prop.u.pszVal, topic);
prop.pszVal = CoTaskMemAlloc(strlen(topic)+1);
strcpy(prop.pszVal, topic);
hres = PropVariantToStringAlloc(&prop, &str);
ok(hres == S_OK, "returned %x\n", hres);
ok(!lstrcmpW(str, topicW), "got %s\n", wine_dbgstr_w(str));
......@@ -690,7 +690,7 @@ static void test_PropVariantCompare(void)
empty.vt = VT_EMPTY;
null.vt = VT_NULL;
emptyarray.vt = VT_ARRAY | VT_I4;
emptyarray.u.parray = &emptysafearray;
emptyarray.parray = &emptysafearray;
emptysafearray.cDims = 1;
emptysafearray.fFeatures = FADF_FIXEDSIZE;
emptysafearray.cbElements = 4;
......@@ -699,35 +699,35 @@ static void test_PropVariantCompare(void)
emptysafearray.rgsabound[0].cElements = 0;
emptysafearray.rgsabound[0].lLbound = 0;
i2_0.vt = VT_I2;
i2_0.u.iVal = 0;
i2_0.iVal = 0;
i2_2.vt = VT_I2;
i2_2.u.iVal = 2;
i2_2.iVal = 2;
i4_large.vt = VT_I4;
i4_large.u.lVal = 65536;
i4_large.lVal = 65536;
i4_largeneg.vt = VT_I4;
i4_largeneg.u.lVal = -65536;
i4_largeneg.lVal = -65536;
i4_2.vt = VT_I4;
i4_2.u.lVal = 2;
i4_2.lVal = 2;
str_2.vt = VT_BSTR;
str_2.u.bstrVal = SysAllocString(str_2W);
str_2.bstrVal = SysAllocString(str_2W);
str_02.vt = VT_BSTR;
str_02.u.bstrVal = SysAllocString(str_02W);
str_02.bstrVal = SysAllocString(str_02W);
str_b.vt = VT_BSTR;
str_b.u.bstrVal = SysAllocString(str_bW);
str_b.bstrVal = SysAllocString(str_bW);
clsid_null.vt = VT_CLSID;
clsid_null.u.puuid = NULL;
clsid_null.puuid = NULL;
clsid.vt = VT_CLSID;
clsid.u.puuid = (GUID *)&dummy_guid;
clsid.puuid = (GUID *)&dummy_guid;
clsid2.vt = VT_CLSID;
clsid2.u.puuid = (GUID *)&GUID_NULL;
clsid2.puuid = (GUID *)&GUID_NULL;
r4_0.vt = VT_R4;
r4_0.u.fltVal = 0.0f;
r4_0.fltVal = 0.0f;
r4_2.vt = VT_R4;
r4_2.u.fltVal = 2.0f;
r4_2.fltVal = 2.0f;
r8_0.vt = VT_R8;
r8_0.u.dblVal = 0.0;
r8_0.dblVal = 0.0;
r8_2.vt = VT_R8;
r8_2.u.dblVal = 2.0;
r8_2.dblVal = 2.0;
res = PropVariantCompareEx(&empty, &empty, 0, 0);
ok(res == 0, "res=%i\n", res);
......@@ -847,9 +847,9 @@ todo_wine
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);
SysFreeString(str_2.bstrVal);
SysFreeString(str_02.bstrVal);
SysFreeString(str_b.bstrVal);
}
static void test_intconversions(void)
......@@ -871,7 +871,7 @@ static void test_intconversions(void)
PropVariantClear(&propvar);
propvar.vt = VT_I8;
propvar.u.hVal.QuadPart = (ULONGLONG)1 << 63;
propvar.hVal.QuadPart = (ULONGLONG)1 << 63;
hr = PropVariantToInt64(&propvar, &llval);
ok(hr == S_OK, "hr=%x\n", hr);
......@@ -893,7 +893,7 @@ static void test_intconversions(void)
ok(hr == HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW), "hr=%x\n", hr);
propvar.vt = VT_UI8;
propvar.u.uhVal.QuadPart = 5;
propvar.uhVal.QuadPart = 5;
hr = PropVariantToInt64(&propvar, &llval);
ok(hr == S_OK, "hr=%x\n", hr);
......@@ -920,7 +920,7 @@ static void test_intconversions(void)
ok(usval == 5, "got wrong value %d\n", usval);
propvar.vt = VT_I8;
propvar.u.hVal.QuadPart = -5;
propvar.hVal.QuadPart = -5;
hr = PropVariantToInt64(&propvar, &llval);
ok(hr == S_OK, "hr=%x\n", hr);
......@@ -944,28 +944,28 @@ static void test_intconversions(void)
ok(hr == HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW), "hr=%x\n", hr);
propvar.vt = VT_UI4;
propvar.u.ulVal = 6;
propvar.ulVal = 6;
hr = PropVariantToInt64(&propvar, &llval);
ok(hr == S_OK, "hr=%x\n", hr);
ok(llval == 6, "got wrong value %s\n", wine_dbgstr_longlong(llval));
propvar.vt = VT_I4;
propvar.u.lVal = -6;
propvar.lVal = -6;
hr = PropVariantToInt64(&propvar, &llval);
ok(hr == S_OK, "hr=%x\n", hr);
ok(llval == -6, "got wrong value %s\n", wine_dbgstr_longlong(llval));
propvar.vt = VT_UI2;
propvar.u.uiVal = 7;
propvar.uiVal = 7;
hr = PropVariantToInt64(&propvar, &llval);
ok(hr == S_OK, "hr=%x\n", hr);
ok(llval == 7, "got wrong value %s\n", wine_dbgstr_longlong(llval));
propvar.vt = VT_I2;
propvar.u.iVal = -7;
propvar.iVal = -7;
hr = PropVariantToInt64(&propvar, &llval);
ok(hr == S_OK, "hr=%x\n", hr);
......@@ -991,21 +991,21 @@ static void test_PropVariantToBoolean(void)
/* VT_BOOL */
propvar.vt = VT_BOOL;
propvar.u.boolVal = VARIANT_FALSE;
propvar.boolVal = VARIANT_FALSE;
val = TRUE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == FALSE, "Unexpected value %d\n", val);
propvar.vt = VT_BOOL;
propvar.u.boolVal = 1;
propvar.boolVal = 1;
val = TRUE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == FALSE, "Unexpected value %d\n", val);
propvar.vt = VT_BOOL;
propvar.u.boolVal = VARIANT_TRUE;
propvar.boolVal = VARIANT_TRUE;
val = FALSE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
......@@ -1013,7 +1013,7 @@ static void test_PropVariantToBoolean(void)
/* VT_EMPTY */
propvar.vt = VT_EMPTY;
propvar.u.boolVal = VARIANT_TRUE;
propvar.boolVal = VARIANT_TRUE;
val = TRUE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
......@@ -1021,28 +1021,28 @@ static void test_PropVariantToBoolean(void)
/* test integer conversion */
propvar.vt = VT_I4;
propvar.u.lVal = 0;
propvar.lVal = 0;
val = TRUE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == FALSE, "Unexpected value %d\n", val);
propvar.vt = VT_I4;
propvar.u.lVal = 1;
propvar.lVal = 1;
val = FALSE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == TRUE, "Unexpected value %d\n", val);
propvar.vt = VT_I4;
propvar.u.lVal = 67;
propvar.lVal = 67;
val = FALSE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == TRUE, "Unexpected value %d\n", val);
propvar.vt = VT_I4;
propvar.u.lVal = -67;
propvar.lVal = -67;
val = FALSE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
......@@ -1050,84 +1050,84 @@ static void test_PropVariantToBoolean(void)
/* test string conversion */
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = str_0;
propvar.pwszVal = str_0;
val = TRUE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == FALSE, "Unexpected value %d\n", val);
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = str_1;
propvar.pwszVal = str_1;
val = FALSE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == TRUE, "Unexpected value %d\n", val);
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = str_7;
propvar.pwszVal = str_7;
val = FALSE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == TRUE, "Unexpected value %d\n", val);
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = str_n7;
propvar.pwszVal = str_n7;
val = FALSE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == TRUE, "Unexpected value %d\n", val);
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = str_true;
propvar.pwszVal = str_true;
val = FALSE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == TRUE, "Unexpected value %d\n", val);
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = str_true_case;
propvar.pwszVal = str_true_case;
val = FALSE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == TRUE, "Unexpected value %d\n", val);
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = str_true2;
propvar.pwszVal = str_true2;
val = FALSE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == TRUE, "Unexpected value %d\n", val);
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = str_false;
propvar.pwszVal = str_false;
val = TRUE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == FALSE, "Unexpected value %d\n", val);
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = str_false2;
propvar.pwszVal = str_false2;
val = TRUE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == FALSE, "Unexpected value %d\n", val);
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = str_true_space;
propvar.pwszVal = str_true_space;
val = TRUE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == DISP_E_TYPEMISMATCH, "Unexpected hr %#x.\n", hr);
ok(val == FALSE, "Unexpected value %d\n", val);
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = str_yes;
propvar.pwszVal = str_yes;
val = TRUE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == DISP_E_TYPEMISMATCH, "Unexpected hr %#x.\n", hr);
ok(val == FALSE, "Unexpected value %d\n", val);
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = NULL;
propvar.pwszVal = NULL;
val = TRUE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == DISP_E_TYPEMISMATCH, "Unexpected hr %#x.\n", hr);
......@@ -1135,49 +1135,49 @@ static void test_PropVariantToBoolean(void)
/* VT_LPSTR */
propvar.vt = VT_LPSTR;
propvar.u.pszVal = (char *)"#TruE#";
propvar.pszVal = (char *)"#TruE#";
val = TRUE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == DISP_E_TYPEMISMATCH, "Unexpected hr %#x.\n", hr);
ok(val == FALSE, "Unexpected value %d\n", val);
propvar.vt = VT_LPSTR;
propvar.u.pszVal = (char *)"#TRUE#";
propvar.pszVal = (char *)"#TRUE#";
val = FALSE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == TRUE, "Unexpected value %d\n", val);
propvar.vt = VT_LPSTR;
propvar.u.pszVal = (char *)"tRUe";
propvar.pszVal = (char *)"tRUe";
val = FALSE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == TRUE, "Unexpected value %d\n", val);
propvar.vt = VT_LPSTR;
propvar.u.pszVal = (char *)"#FALSE#";
propvar.pszVal = (char *)"#FALSE#";
val = TRUE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == FALSE, "Unexpected value %d\n", val);
propvar.vt = VT_LPSTR;
propvar.u.pszVal = (char *)"fALSe";
propvar.pszVal = (char *)"fALSe";
val = TRUE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == FALSE, "Unexpected value %d\n", val);
propvar.vt = VT_LPSTR;
propvar.u.pszVal = (char *)"1";
propvar.pszVal = (char *)"1";
val = FALSE;
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == TRUE, "Unexpected value %d\n", val);
propvar.vt = VT_LPSTR;
propvar.u.pszVal = (char *)"-1";
propvar.pszVal = (char *)"-1";
hr = PropVariantToBoolean(&propvar, &val);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(val == TRUE, "Unexpected value %d\n", val);
......@@ -1204,83 +1204,83 @@ static void test_PropVariantToStringWithDefault(void)
ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
propvar.vt = VT_BOOL;
propvar.u.boolVal = VARIANT_TRUE;
propvar.boolVal = VARIANT_TRUE;
result = PropVariantToStringWithDefault(&propvar, default_value);
ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
propvar.vt = VT_I4;
propvar.u.lVal = 15;
propvar.lVal = 15;
result = PropVariantToStringWithDefault(&propvar, default_value);
ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
/* VT_LPWSTR */
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = NULL;
propvar.pwszVal = NULL;
result = PropVariantToStringWithDefault(&propvar, default_value);
ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = wstr_empty;
propvar.pwszVal = wstr_empty;
result = PropVariantToStringWithDefault(&propvar, default_value);
ok(result == wstr_empty, "Unexpected value %s\n", wine_dbgstr_w(result));
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = wstr_space;
propvar.pwszVal = wstr_space;
result = PropVariantToStringWithDefault(&propvar, default_value);
ok(result == wstr_space, "Unexpected value %s\n", wine_dbgstr_w(result));
propvar.vt = VT_LPWSTR;
propvar.u.pwszVal = wstr_test2;
propvar.pwszVal = wstr_test2;
result = PropVariantToStringWithDefault(&propvar, default_value);
ok(result == wstr_test2, "Unexpected value %s\n", wine_dbgstr_w(result));
/* VT_LPSTR */
propvar.vt = VT_LPSTR;
propvar.u.pszVal = NULL;
propvar.pszVal = NULL;
result = PropVariantToStringWithDefault(&propvar, default_value);
ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
propvar.vt = VT_LPSTR;
propvar.u.pszVal = str_empty;
propvar.pszVal = str_empty;
result = PropVariantToStringWithDefault(&propvar, default_value);
ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
propvar.vt = VT_LPSTR;
propvar.u.pszVal = str_space;
propvar.pszVal = str_space;
result = PropVariantToStringWithDefault(&propvar, default_value);
ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
propvar.vt = VT_LPSTR;
propvar.u.pszVal = str_test2;
propvar.pszVal = str_test2;
result = PropVariantToStringWithDefault(&propvar, default_value);
ok(result == default_value, "Unexpected value %s\n", wine_dbgstr_w(result));
/* VT_BSTR */
propvar.vt = VT_BSTR;
propvar.u.bstrVal = NULL;
propvar.bstrVal = NULL;
result = PropVariantToStringWithDefault(&propvar, default_value);
ok(!lstrcmpW(result, wstr_empty), "Unexpected value %s\n", wine_dbgstr_w(result));
propvar.vt = VT_BSTR;
propvar.u.bstrVal = SysAllocString(wstr_empty);
propvar.bstrVal = SysAllocString(wstr_empty);
result = PropVariantToStringWithDefault(&propvar, default_value);
ok(!lstrcmpW(result, wstr_empty), "Unexpected value %s\n", wine_dbgstr_w(result));
SysFreeString(propvar.u.bstrVal);
SysFreeString(propvar.bstrVal);
propvar.vt = VT_BSTR;
propvar.u.bstrVal = SysAllocString(wstr_space);
propvar.bstrVal = SysAllocString(wstr_space);
result = PropVariantToStringWithDefault(&propvar, default_value);
ok(!lstrcmpW(result, wstr_space), "Unexpected value %s\n", wine_dbgstr_w(result));
SysFreeString(propvar.u.bstrVal);
SysFreeString(propvar.bstrVal);
propvar.vt = VT_BSTR;
propvar.u.bstrVal = SysAllocString(wstr_test2);
propvar.bstrVal = SysAllocString(wstr_test2);
result = PropVariantToStringWithDefault(&propvar, default_value);
ok(!lstrcmpW(result, wstr_test2), "Unexpected value %s\n", wine_dbgstr_w(result));
SysFreeString(propvar.u.bstrVal);
SysFreeString(propvar.bstrVal);
}
static void test_PropVariantChangeType_LPWSTR(void)
......@@ -1294,27 +1294,27 @@ static void test_PropVariantChangeType_LPWSTR(void)
hr = PropVariantChangeType(&dest, &src, 0, VT_LPWSTR);
ok(hr == S_OK, "hr=%x\n", hr);
ok(dest.vt == VT_LPWSTR, "got %d\n", dest.vt);
ok(!lstrcmpW(dest.u.pwszVal, emptyW), "got %s\n", wine_dbgstr_w(dest.u.pwszVal));
ok(!lstrcmpW(dest.pwszVal, emptyW), "got %s\n", wine_dbgstr_w(dest.pwszVal));
PropVariantClear(&dest);
PropVariantClear(&src);
src.vt = VT_LPSTR;
src.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
strcpy(src.u.pszVal, topic);
src.pszVal = CoTaskMemAlloc(strlen(topic)+1);
strcpy(src.pszVal, topic);
hr = PropVariantChangeType(&dest, &src, 0, VT_LPWSTR);
ok(hr == S_OK, "hr=%x\n", hr);
ok(dest.vt == VT_LPWSTR, "got %d\n", dest.vt);
ok(!lstrcmpW(dest.u.pwszVal, topicW), "got %s\n", wine_dbgstr_w(dest.u.pwszVal));
ok(!lstrcmpW(dest.pwszVal, topicW), "got %s\n", wine_dbgstr_w(dest.pwszVal));
PropVariantClear(&dest);
PropVariantClear(&src);
src.vt = VT_LPWSTR;
src.u.pwszVal = CoTaskMemAlloc( (lstrlenW(topicW)+1) * sizeof(WCHAR));
lstrcpyW(src.u.pwszVal, topicW);
src.pwszVal = CoTaskMemAlloc( (lstrlenW(topicW)+1) * sizeof(WCHAR));
lstrcpyW(src.pwszVal, topicW);
hr = PropVariantChangeType(&dest, &src, 0, VT_LPWSTR);
ok(hr == S_OK, "hr=%x\n", hr);
ok(dest.vt == VT_LPWSTR, "got %d\n", dest.vt);
ok(!lstrcmpW(dest.u.pwszVal, topicW), "got %s\n", wine_dbgstr_w(dest.u.pwszVal));
ok(!lstrcmpW(dest.pwszVal, topicW), "got %s\n", wine_dbgstr_w(dest.pwszVal));
PropVariantClear(&dest);
PropVariantClear(&src);
}
......@@ -1327,13 +1327,13 @@ static void test_InitPropVariantFromCLSID(void)
memset(&propvar, 0, sizeof(propvar));
propvar.vt = VT_I4;
propvar.u.lVal = 15;
propvar.lVal = 15;
memset(&clsid, 0xcc, sizeof(clsid));
hr = InitPropVariantFromCLSID(&clsid, &propvar);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(propvar.vt == VT_CLSID, "Unexpected type %d.\n", propvar.vt);
ok(IsEqualGUID(propvar.u.puuid, &clsid), "Unexpected puuid value.\n");
ok(IsEqualGUID(propvar.puuid, &clsid), "Unexpected puuid value.\n");
PropVariantClear(&propvar);
}
......@@ -1345,49 +1345,49 @@ static void test_PropVariantToDouble(void)
PropVariantInit(&propvar);
propvar.vt = VT_R8;
propvar.u.dblVal = 15.0;
propvar.dblVal = 15.0;
hr = PropVariantToDouble(&propvar, &value);
ok(hr == S_OK, "PropVariantToDouble failed: 0x%08x.\n", hr);
ok(value == 15.0, "Unexpected value: %f.\n", value);
PropVariantClear(&propvar);
propvar.vt = VT_I4;
propvar.u.lVal = 123;
propvar.lVal = 123;
hr = PropVariantToDouble(&propvar, &value);
ok(hr == S_OK, "PropVariantToDouble failed: 0x%08x.\n", hr);
ok(value == 123.0, "Unexpected value: %f.\n", value);
PropVariantClear(&propvar);
propvar.vt = VT_I4;
propvar.u.lVal = -256;
propvar.lVal = -256;
hr = PropVariantToDouble(&propvar, &value);
ok(hr == S_OK, "PropVariantToDouble failed: 0x%08x.\n", hr);
ok(value == -256, "Unexpected value: %f\n", value);
PropVariantClear(&propvar);
propvar.vt = VT_I8;
propvar.u.lVal = 65536;
propvar.lVal = 65536;
hr = PropVariantToDouble(&propvar, &value);
ok(hr == S_OK, "PropVariantToDouble failed: 0x%08x.\n", hr);
ok(value == 65536.0, "Unexpected value: %f.\n", value);
PropVariantClear(&propvar);
propvar.vt = VT_I8;
propvar.u.lVal = -321;
propvar.lVal = -321;
hr = PropVariantToDouble(&propvar, &value);
ok(hr == S_OK, "PropVariantToDouble failed: 0x%08x.\n", hr);
ok(value == 4294966975.0, "Unexpected value: %f.\n", value);
PropVariantClear(&propvar);
propvar.vt = VT_UI4;
propvar.u.ulVal = 6;
propvar.ulVal = 6;
hr = PropVariantToDouble(&propvar, &value);
ok(hr == S_OK, "PropVariantToDouble failed: 0x%08x.\n", hr);
ok(value == 6.0, "Unexpected value: %f.\n", value);
PropVariantClear(&propvar);
propvar.vt = VT_UI8;
propvar.u.uhVal.QuadPart = 8;
propvar.uhVal.QuadPart = 8;
hr = PropVariantToDouble(&propvar, &value);
ok(hr == S_OK, "PropVariantToDouble failed: 0x%08x.\n", hr);
ok(value == 8.0, "Unexpected value: %f.\n", value);
......@@ -1403,7 +1403,7 @@ static void test_PropVariantToString(void)
PropVariantInit(&propvar);
propvar.vt = VT_EMPTY;
U(propvar).pwszVal = stringW;
propvar.pwszVal = stringW;
bufferW[0] = 65;
hr = PropVariantToString(&propvar, bufferW, 0);
ok(hr == E_INVALIDARG, "PropVariantToString should fail: 0x%08x.\n", hr);
......@@ -1413,7 +1413,7 @@ static void test_PropVariantToString(void)
PropVariantInit(&propvar);
propvar.vt = VT_EMPTY;
U(propvar).pwszVal = stringW;
propvar.pwszVal = stringW;
bufferW[0] = 65;
hr = PropVariantToString(&propvar, bufferW, ARRAY_SIZE(bufferW));
ok(hr == S_OK, "PropVariantToString failed: 0x%08x.\n", hr);
......@@ -1423,7 +1423,7 @@ static void test_PropVariantToString(void)
PropVariantInit(&propvar);
propvar.vt = VT_NULL;
U(propvar).pwszVal = stringW;
propvar.pwszVal = stringW;
bufferW[0] = 65;
hr = PropVariantToString(&propvar, bufferW, ARRAY_SIZE(bufferW));
ok(hr == S_OK, "PropVariantToString failed: 0x%08x.\n", hr);
......@@ -1433,7 +1433,7 @@ static void test_PropVariantToString(void)
PropVariantInit(&propvar);
propvar.vt = VT_I4;
U(propvar).lVal = 22;
propvar.lVal = 22;
hr = PropVariantToString(&propvar, bufferW, ARRAY_SIZE(bufferW));
todo_wine ok(hr == S_OK, "PropVariantToString failed: 0x%08x.\n", hr);
todo_wine ok(!lstrcmpW(bufferW, L"22"), "got wrong string: \"%s\".\n", wine_dbgstr_w(bufferW));
......@@ -1442,7 +1442,7 @@ static void test_PropVariantToString(void)
PropVariantInit(&propvar);
propvar.vt = VT_LPWSTR;
U(propvar).pwszVal = stringW;
propvar.pwszVal = stringW;
hr = PropVariantToString(&propvar, bufferW, ARRAY_SIZE(bufferW));
ok(hr == S_OK, "PropVariantToString failed: 0x%08x.\n", hr);
ok(!lstrcmpW(bufferW, stringW), "got wrong string: \"%s\".\n", wine_dbgstr_w(bufferW));
......@@ -1450,7 +1450,7 @@ static void test_PropVariantToString(void)
PropVariantInit(&propvar);
propvar.vt = VT_LPSTR;
U(propvar).pszVal = string;
propvar.pszVal = string;
hr = PropVariantToString(&propvar, bufferW, ARRAY_SIZE(bufferW));
ok(hr == S_OK, "PropVariantToString failed: 0x%08x.\n", hr);
ok(!lstrcmpW(bufferW, stringW), "got wrong string: \"%s\".\n", wine_dbgstr_w(bufferW));
......@@ -1458,7 +1458,7 @@ static void test_PropVariantToString(void)
PropVariantInit(&propvar);
propvar.vt = VT_LPWSTR;
U(propvar).pwszVal = stringW;
propvar.pwszVal = stringW;
hr = PropVariantToString(&propvar, bufferW, 4);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "PropVariantToString returned: 0x%08x.\n", hr);
ok(!memcmp(bufferW, stringW, 4), "got wrong string.\n");
......@@ -1466,7 +1466,7 @@ static void test_PropVariantToString(void)
PropVariantInit(&propvar);
propvar.vt = VT_LPSTR;
U(propvar).pszVal = string;
propvar.pszVal = string;
hr = PropVariantToString(&propvar, bufferW, 4);
ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER, "PropVariantToString returned: 0x%08x.\n", hr);
ok(!memcmp(bufferW, stringW, 4), "got wrong string.\n");
......@@ -1474,12 +1474,12 @@ static void test_PropVariantToString(void)
PropVariantInit(&propvar);
propvar.vt = VT_BSTR;
propvar.u.bstrVal = SysAllocString(stringW);
propvar.bstrVal = SysAllocString(stringW);
hr = PropVariantToString(&propvar, bufferW, ARRAY_SIZE(bufferW));
ok(hr == S_OK, "PropVariantToString failed: 0x%08x.\n", hr);
ok(!lstrcmpW(bufferW, stringW), "got wrong string: \"%s\".\n", wine_dbgstr_w(bufferW));
memset(bufferW, 0, sizeof(bufferW));
SysFreeString(propvar.u.bstrVal);
SysFreeString(propvar.bstrVal);
}
static void test_PropVariantToBuffer(void)
......@@ -1536,7 +1536,7 @@ static void test_PropVariantToBuffer(void)
memcpy(pdata, data, sizeof(data));
hr = SafeArrayUnaccessData(sa);
ok(hr == S_OK, "SafeArrayUnaccessData failed: 0x%08x.\n", hr);
U(propvar).parray = sa;
propvar.parray = sa;
buffer[0] = 99;
hr = PropVariantToBuffer(&propvar, buffer, 11);
todo_wine ok(hr == E_FAIL, "PropVariantToBuffer returned: 0x%08x.\n", hr);
......@@ -1556,7 +1556,7 @@ static void test_PropVariantToBuffer(void)
memcpy(pdata, data, sizeof(data));
hr = SafeArrayUnaccessData(sa);
ok(hr == S_OK, "SafeArrayUnaccessData failed: 0x%08x.\n", hr);
U(propvar).parray = sa;
propvar.parray = sa;
hr = PropVariantToBuffer(&propvar, buffer, sizeof(data));
todo_wine ok(hr == S_OK, "PropVariantToBuffer failed: 0x%08x.\n", hr);
todo_wine ok(!memcmp(buffer, data, 10) && !buffer[10], "got wrong buffer.\n");
......@@ -1565,9 +1565,9 @@ static void test_PropVariantToBuffer(void)
PropVariantInit(&propvar);
propvar.vt = VT_VECTOR|VT_I1;
U(propvar).caub.pElems = CoTaskMemAlloc(sizeof(data_int8));
U(propvar).caub.cElems = sizeof(data_int8);
memcpy(U(propvar).caub.pElems, data_int8, sizeof(data_int8));
propvar.caub.pElems = CoTaskMemAlloc(sizeof(data_int8));
propvar.caub.cElems = sizeof(data_int8);
memcpy(propvar.caub.pElems, data_int8, sizeof(data_int8));
hr = PropVariantToBuffer(&propvar, buffer, sizeof(data_int8));
ok(hr == E_INVALIDARG, "PropVariantToBuffer failed: 0x%08x.\n", hr);
PropVariantClear(&propvar);
......@@ -1584,7 +1584,7 @@ static void test_PropVariantToBuffer(void)
memcpy(pdata, data_int8, sizeof(data_int8));
hr = SafeArrayUnaccessData(sa);
ok(hr == S_OK, "SafeArrayUnaccessData failed: 0x%08x.\n", hr);
U(propvar).parray = sa;
propvar.parray = sa;
hr = PropVariantToBuffer(&propvar, buffer, sizeof(data_int8));
ok(hr == E_INVALIDARG, "PropVariantToBuffer failed: 0x%08x.\n", hr);
PropVariantClear(&propvar);
......@@ -1633,7 +1633,7 @@ static void test_inmemorystore(void)
memset(&propvar, 0, sizeof(propvar));
propvar.vt = VT_I4;
propvar.u.lVal = 12345;
propvar.lVal = 12345;
if (0)
{
......@@ -1677,7 +1677,7 @@ static void test_inmemorystore(void)
hr = IPropertyStoreCache_GetValue(propcache, &pkey, &propvar);
ok(hr == S_OK, "GetValue failed, hr=%x\n", hr);
ok(propvar.vt == VT_I4, "expected VT_I4, got %d\n", propvar.vt);
ok(propvar.u.lVal == 12345, "expected 12345, got %d\n", propvar.u.lVal);
ok(propvar.lVal == 12345, "expected 12345, got %d\n", propvar.lVal);
pkey.fmtid = PKEY_WineTest;
pkey.pid = 10;
......@@ -1722,7 +1722,7 @@ static void test_inmemorystore(void)
ok(state == 10, "expected 10, got %d\n", state);
propvar.vt = VT_I4;
propvar.u.lVal = 12346;
propvar.lVal = 12346;
hr = IPropertyStoreCache_SetValueAndState(propcache, &pkey, &propvar, 5);
ok(hr == S_OK, "SetValueAndState failed, hr=%x\n", hr);
......@@ -1731,7 +1731,7 @@ static void test_inmemorystore(void)
hr = IPropertyStoreCache_GetValueAndState(propcache, &pkey, &propvar, &state);
ok(hr == S_OK, "GetValueAndState failed, hr=%x\n", hr);
ok(propvar.vt == VT_I4, "expected VT_I4, got %d\n", propvar.vt);
ok(propvar.u.lVal == 12346, "expected 12346, got %d\n", propvar.vt);
ok(propvar.lVal == 12346, "expected 12346, got %d\n", propvar.vt);
ok(state == 5, "expected 5, got %d\n", state);
/* Set new field with state */
......@@ -1739,7 +1739,7 @@ static void test_inmemorystore(void)
pkey.pid = 8;
propvar.vt = VT_I4;
propvar.u.lVal = 12347;
propvar.lVal = 12347;
hr = IPropertyStoreCache_SetValueAndState(propcache, &pkey, &propvar, PSC_DIRTY);
ok(hr == S_OK, "SetValueAndState failed, hr=%x\n", hr);
......@@ -1748,7 +1748,7 @@ static void test_inmemorystore(void)
hr = IPropertyStoreCache_GetValueAndState(propcache, &pkey, &propvar, &state);
ok(hr == S_OK, "GetValueAndState failed, hr=%x\n", hr);
ok(propvar.vt == VT_I4, "expected VT_I4, got %d\n", propvar.vt);
ok(propvar.u.lVal == 12347, "expected 12347, got %d\n", propvar.vt);
ok(propvar.lVal == 12347, "expected 12347, got %d\n", propvar.vt);
ok(state == PSC_DIRTY, "expected PSC_DIRTY, got %d\n", state);
IPropertyStoreCache_Release(propcache);
......@@ -1876,7 +1876,7 @@ static void test_propertystore(void)
PropVariantInit(&propvar);
propvar.vt = VT_I4;
U(propvar).lVal = 123;
propvar.lVal = 123;
propkey.fmtid = DUMMY_GUID1;
propkey.pid = PID_FIRST_USABLE;
hr = IPropertyStore_SetValue(propstore, &propkey, &propvar);
......@@ -1891,7 +1891,7 @@ static void test_propertystore(void)
hr = IPropertyStore_GetValue(propstore, &propkey, &ret_propvar);
ok(hr == S_OK, "IPropertyStore_GetValue failed: 0x%08x.\n", hr);
ok(ret_propvar.vt == VT_I4, "got wrong property type: %x.\n", ret_propvar.vt);
ok(U(ret_propvar).lVal == 123, "got wrong value: %d, expected 123.\n", U(ret_propvar).lVal);
ok(ret_propvar.lVal == 123, "got wrong value: %d, expected 123.\n", ret_propvar.lVal);
PropVariantClear(&propvar);
PropVariantClear(&ret_propvar);
......@@ -1909,7 +1909,7 @@ static void test_propertystore(void)
hr = IPropertyStore_GetValue(propstore, &propkey, &ret_propvar);
ok(hr == S_OK, "IPropertyStore_GetValue failed: 0x%08x.\n", hr);
ok(ret_propvar.vt == VT_EMPTY, "got wrong property type: %x.\n", ret_propvar.vt);
ok(!U(ret_propvar).lVal, "got wrong value: %d, expected 0.\n", U(ret_propvar).lVal);
ok(!ret_propvar.lVal, "got wrong value: %d, expected 0.\n", ret_propvar.lVal);
PropVariantClear(&propvar);
PropVariantClear(&ret_propvar);
......
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