From a36f51f35718239a2f6ab4bc5d81e1573ef0b14b Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Wed, 29 Dec 2010 02:53:57 +0100 Subject: [PATCH] xmllite/tests: Use an iface instead of a vtbl pointer in testinput. --- dlls/xmllite/tests/reader.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/dlls/xmllite/tests/reader.c b/dlls/xmllite/tests/reader.c index 316f8f7a5b8..bd6ac1aceb2 100644 --- a/dlls/xmllite/tests/reader.c +++ b/dlls/xmllite/tests/reader.c @@ -19,6 +19,7 @@ */ #define COBJMACROS +#define CONST_VTABLE #include #include @@ -258,13 +259,13 @@ static void test_read_state_(IXmlReader *reader, XmlReadState expected, typedef struct _testinput { - const IUnknownVtbl *lpVtbl; + IUnknown IUnknown_iface; LONG ref; } testinput; static inline testinput *impl_from_IUnknown(IUnknown *iface) { - return (testinput *)((char*)iface - FIELD_OFFSET(testinput, lpVtbl)); + return CONTAINING_RECORD(iface, testinput, IUnknown_iface); } static HRESULT WINAPI testinput_QueryInterface(IUnknown *iface, REFIID riid, void** ppvObj) @@ -317,10 +318,10 @@ static HRESULT testinput_createinstance(void **ppObj) input = HeapAlloc(GetProcessHeap(), 0, sizeof (*input)); if(!input) return E_OUTOFMEMORY; - input->lpVtbl = &testinput_vtbl; + input->IUnknown_iface.lpVtbl = &testinput_vtbl; input->ref = 1; - *ppObj = &input->lpVtbl; + *ppObj = &input->IUnknown_iface; return S_OK; } @@ -372,13 +373,14 @@ static void test_reader_create(void) hr = testinput_createinstance((void**)&input); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - input_iids.count = 0; - hr = IXmlReader_SetInput(reader, input); - ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr); - ok_iids(&input_iids, setinput_full, setinput_full_old, FALSE); - - IUnknown_Release(input); - + if (hr == S_OK) + { + input_iids.count = 0; + hr = IXmlReader_SetInput(reader, input); + ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr); + ok_iids(&input_iids, setinput_full, setinput_full_old, FALSE); + IUnknown_Release(input); + } IXmlReader_Release(reader); }