Commit 7c1d8b29 authored by Alexandre Julliard's avatar Alexandre Julliard

ole32/tests: Use nameless unions/structs.

parent 61a06d4b
......@@ -20,7 +20,6 @@
#define COBJMACROS
#define CONST_VTABLE
#define NONAMELESSUNION
#include <stdarg.h>
#include <stdio.h>
......@@ -275,7 +274,7 @@ static HRESULT WINAPI DataObjectImpl_GetData(IDataObject* iface, FORMATETC *pfor
DataObjectImpl_GetData_calls++;
ok(pmedium->tymed == 0, "pmedium->tymed = %lu\n", pmedium->tymed);
ok(U(*pmedium).hGlobal == NULL, "pmedium->hGlobal = %p\n", U(*pmedium).hGlobal);
ok(pmedium->hGlobal == NULL, "pmedium->hGlobal = %p\n", pmedium->hGlobal);
ok(pmedium->pUnkForRelease == NULL, "pmedium->pUnkForRelease = %p\n", pmedium->pUnkForRelease);
if(pformatetc->lindex != -1)
......@@ -293,24 +292,24 @@ static HRESULT WINAPI DataObjectImpl_GetData(IDataObject* iface, FORMATETC *pfor
if(pformatetc->cfFormat == CF_TEXT || pformatetc->cfFormat == cf_global)
{
pmedium->tymed = TYMED_HGLOBAL;
U(*pmedium).hGlobal = This->text;
pmedium->hGlobal = This->text;
}
else if(pformatetc->cfFormat == cf_stream)
{
pmedium->tymed = TYMED_ISTREAM;
IStream_AddRef(This->stm);
U(*pmedium).pstm = This->stm;
pmedium->pstm = This->stm;
}
else if(pformatetc->cfFormat == cf_storage || pformatetc->cfFormat == cf_another)
{
pmedium->tymed = TYMED_ISTORAGE;
IStorage_AddRef(This->stg);
U(*pmedium).pstg = This->stg;
pmedium->pstg = This->stg;
}
else if(pformatetc->cfFormat == CF_METAFILEPICT)
{
pmedium->tymed = TYMED_MFPICT;
U(*pmedium).hMetaFilePict = This->hmfp;
pmedium->hMetaFilePict = This->hmfp;
}
return S_OK;
}
......@@ -1412,7 +1411,7 @@ static void test_flushed_getdata(void)
ok(hr == S_OK, "got %08lx\n", hr);
ok(med.tymed == TYMED_ISTORAGE, "got %lx\n", med.tymed);
if(SUCCEEDED(hr)) {
hr = IStorage_Stat(med.u.pstg, &stat, STATFLAG_NONAME);
hr = IStorage_Stat(med.pstg, &stat, STATFLAG_NONAME);
ok(hr == S_OK, "got %08lx\n", hr);
ok(stat.grfMode == (STGM_SHARE_EXCLUSIVE | STGM_READWRITE), "got %08lx\n", stat.grfMode);
ReleaseStgMedium(&med);
......@@ -1704,7 +1703,7 @@ static void test_nonole_clipboard(void)
InitFormatEtc(fmt, CF_ENHMETAFILE, TYMED_ENHMF);
hr = IDataObject_GetData(get, &fmt, &med);
ok(hr == S_OK, "got %08lx\n", hr);
obj_type = GetObjectType(U(med).hEnhMetaFile);
obj_type = GetObjectType(med.hEnhMetaFile);
ok(obj_type == OBJ_ENHMETAFILE, "got %ld\n", obj_type);
if(SUCCEEDED(hr)) ReleaseStgMedium(&med);
......@@ -1753,7 +1752,7 @@ static void test_getdatahere(void)
med.pUnkForRelease = NULL;
med.tymed = TYMED_HGLOBAL;
U(med).hGlobal = GlobalAlloc(GMEM_MOVEABLE, 100);
med.hGlobal = GlobalAlloc(GMEM_MOVEABLE, 100);
hr = IDataObject_GetDataHere(get, &fmt, &med);
ok(hr == S_OK, "got %08lx\n", hr);
ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
......@@ -1765,7 +1764,7 @@ static void test_getdatahere(void)
med.pUnkForRelease = NULL;
med.tymed = TYMED_HGLOBAL;
U(med).hGlobal = GlobalAlloc(GMEM_MOVEABLE, 100);
med.hGlobal = GlobalAlloc(GMEM_MOVEABLE, 100);
hr = IDataObject_GetDataHere(get, &fmt, &med);
ok(hr == S_OK, "got %08lx\n", hr);
ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
......@@ -1775,7 +1774,7 @@ static void test_getdatahere(void)
med.pUnkForRelease = NULL;
med.tymed = TYMED_HGLOBAL;
U(med).hGlobal = GlobalAlloc(GMEM_MOVEABLE, 1);
med.hGlobal = GlobalAlloc(GMEM_MOVEABLE, 1);
hr = IDataObject_GetDataHere(get, &fmt, &med);
ok(hr == E_FAIL, "got %08lx\n", hr);
ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
......@@ -1785,7 +1784,7 @@ static void test_getdatahere(void)
med.pUnkForRelease = NULL;
med.tymed = TYMED_ISTREAM;
CreateStreamOnHGlobal(NULL, TRUE, &U(med).pstm);
CreateStreamOnHGlobal(NULL, TRUE, &med.pstm);
hr = IDataObject_GetDataHere(get, &fmt, &med);
ok(hr == S_OK, "got %08lx\n", hr);
ok(med.tymed == TYMED_ISTREAM, "got %lx\n", med.tymed);
......@@ -1795,7 +1794,7 @@ static void test_getdatahere(void)
med.pUnkForRelease = NULL;
med.tymed = TYMED_ISTORAGE;
StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, 0, &U(med).pstg);
StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, 0, &med.pstg);
hr = IDataObject_GetDataHere(get, &fmt, &med);
ok(hr == E_FAIL, "got %08lx\n", hr);
ok(med.tymed == TYMED_ISTORAGE, "got %lx\n", med.tymed);
......@@ -1807,7 +1806,7 @@ static void test_getdatahere(void)
med.pUnkForRelease = NULL;
med.tymed = TYMED_HGLOBAL;
U(med).hGlobal = GlobalAlloc(GMEM_MOVEABLE, 100);
med.hGlobal = GlobalAlloc(GMEM_MOVEABLE, 100);
hr = IDataObject_GetDataHere(get, &fmt, &med);
ok(hr == S_OK, "got %08lx\n", hr);
ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
......@@ -1817,7 +1816,7 @@ static void test_getdatahere(void)
med.pUnkForRelease = NULL;
med.tymed = TYMED_ISTREAM;
CreateStreamOnHGlobal(NULL, TRUE, &U(med).pstm);
CreateStreamOnHGlobal(NULL, TRUE, &med.pstm);
hr = IDataObject_GetDataHere(get, &fmt, &med);
ok(hr == S_OK, "got %08lx\n", hr);
ok(med.tymed == TYMED_ISTREAM, "got %lx\n", med.tymed);
......@@ -1827,7 +1826,7 @@ static void test_getdatahere(void)
med.pUnkForRelease = NULL;
med.tymed = TYMED_ISTORAGE;
StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, 0, &U(med).pstg);
StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, 0, &med.pstg);
hr = IDataObject_GetDataHere(get, &fmt, &med);
ok(hr == E_FAIL, "got %08lx\n", hr);
ok(med.tymed == TYMED_ISTORAGE, "got %lx\n", med.tymed);
......@@ -1839,7 +1838,7 @@ static void test_getdatahere(void)
med.pUnkForRelease = NULL;
med.tymed = TYMED_HGLOBAL;
U(med).hGlobal = GlobalAlloc(GMEM_MOVEABLE, 3000);
med.hGlobal = GlobalAlloc(GMEM_MOVEABLE, 3000);
hr = IDataObject_GetDataHere(get, &fmt, &med);
ok(hr == S_OK, "got %08lx\n", hr);
ok(med.tymed == TYMED_HGLOBAL, "got %lx\n", med.tymed);
......@@ -1849,7 +1848,7 @@ static void test_getdatahere(void)
med.pUnkForRelease = NULL;
med.tymed = TYMED_ISTREAM;
CreateStreamOnHGlobal(NULL, TRUE, &U(med).pstm);
CreateStreamOnHGlobal(NULL, TRUE, &med.pstm);
hr = IDataObject_GetDataHere(get, &fmt, &med);
ok(hr == S_OK, "got %08lx\n", hr);
ok(med.tymed == TYMED_ISTREAM, "got %lx\n", med.tymed);
......@@ -1859,7 +1858,7 @@ static void test_getdatahere(void)
med.pUnkForRelease = NULL;
med.tymed = TYMED_ISTORAGE;
StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, 0, &U(med).pstg);
StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DELETEONRELEASE, 0, &med.pstg);
hr = IDataObject_GetDataHere(get, &fmt, &med);
ok(hr == S_OK, "got %08lx\n", hr);
ok(med.tymed == TYMED_ISTORAGE, "got %lx\n", med.tymed);
......
......@@ -1414,8 +1414,8 @@ static HRESULT WINAPI CustomMarshal_MarshalInterface(IMarshal *iface, IStream *s
hr = IStream_Stat(stream, &stat, STATFLAG_DEFAULT);
ok_ole_success(hr, IStream_Stat);
ok(U(stat.cbSize).LowPart == 0, "stream is not empty (%ld)\n", U(stat.cbSize).LowPart);
ok(U(stat.cbSize).HighPart == 0, "stream is not empty (%ld)\n", U(stat.cbSize).HighPart);
ok(stat.cbSize.LowPart == 0, "stream is not empty (%ld)\n", stat.cbSize.LowPart);
ok(stat.cbSize.HighPart == 0, "stream is not empty (%ld)\n", stat.cbSize.HighPart);
hr = CoGetStandardMarshal(riid, (IUnknown*)iface,
dwDestContext, NULL, mshlflags, &std_marshal);
......
......@@ -815,7 +815,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
expect_buffer_end = WdtpInterfacePointer_UserMarshal(&umcb.Flags, umcb.Flags, expect_buffer + 2 * sizeof(DWORD), unk, &IID_IUnknown);
med.tymed = TYMED_NULL;
U(med).pstg = NULL;
med.pstg = NULL;
med.pUnkForRelease = unk;
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
......@@ -837,7 +837,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
Test_Unknown2.refs = 1;
med2.tymed = TYMED_NULL;
U(med2).pstm = NULL;
med2.pstm = NULL;
med2.pUnkForRelease = &Test_Unknown2.IUnknown_iface;
STGMEDIUM_UserUnmarshal(&umcb.Flags, buffer, &med2);
......@@ -852,7 +852,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, expect_buffer, expect_size, MSHCTX_DIFFERENTMACHINE);
med2.tymed = TYMED_NULL;
U(med2).pstm = NULL;
med2.pstm = NULL;
med2.pUnkForRelease = NULL;
STGMEDIUM_UserUnmarshal(&umcb.Flags, expect_buffer, &med2);
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
......@@ -882,7 +882,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
expect_buffer_end = WdtpInterfacePointer_UserMarshal(&umcb.Flags, umcb.Flags, expect_buffer_end, unk, &IID_IUnknown);
med.tymed = TYMED_ISTREAM;
U(med).pstm = stm;
med.pstm = stm;
med.pUnkForRelease = unk;
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
......@@ -907,13 +907,13 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
Test_Stream2.refs = 1;
Test_Unknown2.refs = 1;
med2.tymed = TYMED_ISTREAM;
U(med2).pstm = &Test_Stream2.IStream_iface;
med2.pstm = &Test_Stream2.IStream_iface;
med2.pUnkForRelease = &Test_Unknown2.IUnknown_iface;
STGMEDIUM_UserUnmarshal(&umcb.Flags, buffer, &med2);
ok(med2.tymed == TYMED_ISTREAM, "got tymed %lx\n", med2.tymed);
ok(U(med2).pstm != NULL, "Incorrectly unmarshalled\n");
ok(med2.pstm != NULL, "Incorrectly unmarshalled\n");
ok(med2.pUnkForRelease != NULL, "Incorrectly unmarshalled\n");
ok(Test_Stream2.refs == 0, "got %ld\n", Test_Stream2.refs);
ok(Test_Unknown2.refs == 0, "got %ld\n", Test_Unknown2.refs);
......@@ -924,7 +924,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, expect_buffer, expect_size, MSHCTX_DIFFERENTMACHINE);
med2.tymed = TYMED_NULL;
U(med2).pstm = NULL;
med2.pstm = NULL;
med2.pUnkForRelease = NULL;
STGMEDIUM_UserUnmarshal(&umcb.Flags, expect_buffer, &med2);
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
......@@ -941,7 +941,7 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
expect_size = 3 * sizeof(DWORD);
med.tymed = TYMED_ISTREAM;
U(med).pstm = NULL;
med.pstm = NULL;
med.pUnkForRelease = NULL;
init_user_marshal_cb(&umcb, &stub_msg, &rpc_msg, NULL, 0, MSHCTX_DIFFERENTMACHINE);
......@@ -965,13 +965,13 @@ static void marshal_STGMEDIUM(BOOL client, BOOL in, BOOL out)
Test_Stream2.refs = 1;
Test_Unknown2.refs = 1;
med2.tymed = TYMED_ISTREAM;
U(med2).pstm = &Test_Stream2.IStream_iface;
med2.pstm = &Test_Stream2.IStream_iface;
med2.pUnkForRelease = &Test_Unknown2.IUnknown_iface;
STGMEDIUM_UserUnmarshal(&umcb.Flags, buffer, &med2);
ok(med2.tymed == TYMED_ISTREAM, "got tymed %lx\n", med2.tymed);
ok(U(med2).pstm == NULL, "Incorrectly unmarshalled\n");
ok(med2.pstm == NULL, "Incorrectly unmarshalled\n");
ok(med2.pUnkForRelease == &Test_Unknown2.IUnknown_iface, "Incorrectly unmarshalled\n");
ok(Test_Stream2.refs == 0, "got %ld\n", Test_Stream2.refs);
ok(Test_Unknown2.refs == 1, "got %ld\n", Test_Unknown2.refs);
......@@ -1307,8 +1307,8 @@ static HRESULT WINAPI obj_DO_GetDataHere(IDataObject *iface, FORMATETC *fmt,
if (fmt->cfFormat == 2)
{
IStream_Release(U(med)->pstm);
U(med)->pstm = &Test_Stream2.IStream_iface;
IStream_Release(med->pstm);
med->pstm = &Test_Stream2.IStream_iface;
}
return S_OK;
......@@ -1363,7 +1363,7 @@ static void test_GetDataHere_Proxy(void)
fmt.ptd = NULL;
fmt.dwAspect = DVASPECT_CONTENT;
fmt.lindex = -1;
U(med).pstm = NULL;
med.pstm = NULL;
med.pUnkForRelease = &Test_Unknown.IUnknown_iface;
fmt.tymed = med.tymed = TYMED_NULL;
......@@ -1384,13 +1384,13 @@ static void test_GetDataHere_Proxy(void)
ok( hr == DV_E_TYMED, "got %08lx\n", hr );
fmt.tymed = med.tymed = TYMED_ISTREAM;
U(med).pstm = &Test_Stream.IStream_iface;
med.pstm = &Test_Stream.IStream_iface;
med.pUnkForRelease = &Test_Unknown.IUnknown_iface;
hr = IDataObject_GetDataHere( data, &fmt, &med );
ok( hr == S_OK, "got %08lx\n", hr );
ok( U(med).pstm == &Test_Stream.IStream_iface, "stm changed\n" );
ok( med.pstm == &Test_Stream.IStream_iface, "stm changed\n" );
ok( med.pUnkForRelease == &Test_Unknown.IUnknown_iface, "punk changed\n" );
ok( Test_Stream.refs == 1, "got %ld\n", Test_Stream.refs );
......@@ -1398,13 +1398,13 @@ static void test_GetDataHere_Proxy(void)
fmt.cfFormat = 2;
fmt.tymed = med.tymed = TYMED_ISTREAM;
U(med).pstm = &Test_Stream.IStream_iface;
med.pstm = &Test_Stream.IStream_iface;
med.pUnkForRelease = &Test_Unknown.IUnknown_iface;
hr = IDataObject_GetDataHere( data, &fmt, &med );
ok( hr == S_OK, "got %08lx\n", hr );
ok( U(med).pstm == &Test_Stream.IStream_iface, "stm changed\n" );
ok( med.pstm == &Test_Stream.IStream_iface, "stm changed\n" );
ok( med.pUnkForRelease == &Test_Unknown.IUnknown_iface, "punk changed\n" );
ok( Test_Stream.refs == 1, "got %ld\n", Test_Stream.refs );
......
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