Module: wine Branch: master Commit: a36f51f35718239a2f6ab4bc5d81e1573ef0b14b URL: http://source.winehq.org/git/wine.git/?a=commit;h=a36f51f35718239a2f6ab4bc5d...
Author: Michael Stefaniuc mstefani@redhat.de Date: Wed Dec 29 02:53:57 2010 +0100
xmllite/tests: Use an iface instead of a vtbl pointer in testinput.
---
dlls/xmllite/tests/reader.c | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/dlls/xmllite/tests/reader.c b/dlls/xmllite/tests/reader.c index 316f8f7..bd6ac1a 100644 --- a/dlls/xmllite/tests/reader.c +++ b/dlls/xmllite/tests/reader.c @@ -19,6 +19,7 @@ */
#define COBJMACROS +#define CONST_VTABLE
#include <stdarg.h> #include <stdio.h> @@ -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); }