infosoft: Use an iface instead of a vtbl pointer in wordbreaker_impl.

This commit is contained in:
Michael Stefaniuc 2010-12-08 22:59:32 +01:00 committed by Alexandre Julliard
parent 965aea8d8e
commit 38b4a4d7d7
1 changed files with 11 additions and 6 deletions

View File

@ -36,14 +36,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(infosoft);
typedef struct tag_wordbreaker_impl typedef struct tag_wordbreaker_impl
{ {
const IWordBreakerVtbl *lpVtbl; IWordBreaker IWordBreaker_iface;
LONG ref; LONG ref;
} wordbreaker_impl; } wordbreaker_impl;
static inline wordbreaker_impl *impl_from_IWordBreaker(IWordBreaker *iface)
{
return CONTAINING_RECORD(iface, wordbreaker_impl, IWordBreaker_iface);
}
static HRESULT WINAPI wb_QueryInterface( IWordBreaker *iface, static HRESULT WINAPI wb_QueryInterface( IWordBreaker *iface,
REFIID riid, LPVOID *ppvObj) REFIID riid, LPVOID *ppvObj)
{ {
wordbreaker_impl *This = (wordbreaker_impl *)iface; wordbreaker_impl *This = impl_from_IWordBreaker(iface);
TRACE("(%p)->(%s)\n",This,debugstr_guid(riid)); TRACE("(%p)->(%s)\n",This,debugstr_guid(riid));
@ -62,13 +67,13 @@ static HRESULT WINAPI wb_QueryInterface( IWordBreaker *iface,
static ULONG WINAPI wb_AddRef( IWordBreaker *iface ) static ULONG WINAPI wb_AddRef( IWordBreaker *iface )
{ {
wordbreaker_impl *This = (wordbreaker_impl *)iface; wordbreaker_impl *This = impl_from_IWordBreaker(iface);
return InterlockedIncrement(&This->ref); return InterlockedIncrement(&This->ref);
} }
static ULONG WINAPI wb_Release(IWordBreaker *iface) static ULONG WINAPI wb_Release(IWordBreaker *iface)
{ {
wordbreaker_impl *This = (wordbreaker_impl *)iface; wordbreaker_impl *This = impl_from_IWordBreaker(iface);
LONG refcount; LONG refcount;
refcount = InterlockedDecrement(&This->ref); refcount = InterlockedDecrement(&This->ref);
@ -190,9 +195,9 @@ HRESULT WINAPI wb_Constructor(IUnknown* pUnkOuter, REFIID riid, LPVOID *ppvObjec
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->ref = 1; This->ref = 1;
This->lpVtbl = &wordbreaker_vtbl; This->IWordBreaker_iface.lpVtbl = &wordbreaker_vtbl;
wb = (IWordBreaker*) This; wb = &This->IWordBreaker_iface;
return IWordBreaker_QueryInterface(wb, riid, ppvObject); return IWordBreaker_QueryInterface(wb, riid, ppvObject);
} }