Michael Stefaniuc : msdmo: Use an iface instead of a vtbl pointer in IEnumDMOImpl.

Alexandre Julliard julliard at winehq.org
Mon Nov 29 13:38:37 CST 2010


Module: wine
Branch: master
Commit: 8d959c99497d3b8bd912ecc772e4aee77441f6bf
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8d959c99497d3b8bd912ecc772e4aee77441f6bf

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Mon Nov 29 00:54:16 2010 +0100

msdmo: Use an iface instead of a vtbl pointer in IEnumDMOImpl.

---

 dlls/msdmo/dmoreg.c |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/dlls/msdmo/dmoreg.c b/dlls/msdmo/dmoreg.c
index a3dc930..2c55296 100644
--- a/dlls/msdmo/dmoreg.c
+++ b/dlls/msdmo/dmoreg.c
@@ -85,7 +85,7 @@ static const WCHAR szToGuidFmt[] =
 
 typedef struct
 {
-    const IEnumDMOVtbl         *lpVtbl;
+    IEnumDMO                    IEnumDMO_iface;
     LONG			ref;
     DWORD			index;
     const GUID*                 guidCategory;
@@ -97,6 +97,11 @@ typedef struct
     HKEY                        hkey;
 } IEnumDMOImpl;
 
+static inline IEnumDMOImpl *impl_from_IEnumDMO(IEnumDMO *iface)
+{
+    return CONTAINING_RECORD(iface, IEnumDMOImpl, IEnumDMO_iface);
+}
+
 static HRESULT read_types(HKEY root, LPCWSTR key, ULONG *supplied, ULONG requested, DMO_PARTIAL_MEDIATYPE* types);
 
 static const IEnumDMOVtbl edmovt;
@@ -332,7 +337,7 @@ lend:
 */
 static BOOL IEnumDMO_Destructor(IEnumDMO* iface)
 {
-    IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
+    IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
 
     TRACE("%p\n", This);
 
@@ -366,7 +371,7 @@ static IEnumDMO * IEnumDMO_Constructor(
     if (lpedmo)
     {
         lpedmo->ref = 1;
-        lpedmo->lpVtbl = &edmovt;
+        lpedmo->IEnumDMO_iface.lpVtbl = &edmovt;
         lpedmo->index = -1;
 	lpedmo->guidCategory = guidCategory;
 	lpedmo->dwFlags = dwFlags;
@@ -430,7 +435,7 @@ lerr:
  */
 static ULONG WINAPI IEnumDMO_fnAddRef(IEnumDMO * iface)
 {
-    IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
+    IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
     return InterlockedIncrement(&This->ref);
 }
 
@@ -443,7 +448,7 @@ static HRESULT WINAPI IEnumDMO_fnQueryInterface(
     REFIID riid,
     LPVOID *ppvObj)
 {
-    IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
+    IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
 
     *ppvObj = NULL;
 
@@ -467,7 +472,7 @@ static HRESULT WINAPI IEnumDMO_fnQueryInterface(
  */
 static ULONG WINAPI IEnumDMO_fnRelease(IEnumDMO * iface)
 {
-    IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
+    IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
     ULONG refCount = InterlockedDecrement(&This->ref);
 
     if (!refCount)
@@ -499,7 +504,7 @@ static HRESULT WINAPI IEnumDMO_fnNext(
     UINT count = 0;
     HRESULT hres = S_OK;
 
-    IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
+    IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
 
     TRACE("--> (%p) %d %p %p %p\n", iface, cItemsToFetch, pCLSID, Names, pcItemsFetched);
 
@@ -638,7 +643,7 @@ static HRESULT WINAPI IEnumDMO_fnNext(
  */
 static HRESULT WINAPI IEnumDMO_fnSkip(IEnumDMO * iface, DWORD cItemsToSkip)
 {
-    IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
+    IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
 
     This->index += cItemsToSkip;
 
@@ -651,7 +656,7 @@ static HRESULT WINAPI IEnumDMO_fnSkip(IEnumDMO * iface, DWORD cItemsToSkip)
  */
 static HRESULT WINAPI IEnumDMO_fnReset(IEnumDMO * iface)
 {
-    IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
+    IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
 
     This->index = -1;
 
@@ -664,7 +669,7 @@ static HRESULT WINAPI IEnumDMO_fnReset(IEnumDMO * iface)
  */
 static HRESULT WINAPI IEnumDMO_fnClone(IEnumDMO * iface, IEnumDMO **ppEnum)
 {
-    IEnumDMOImpl *This = (IEnumDMOImpl *)iface;
+    IEnumDMOImpl *This = impl_from_IEnumDMO(iface);
 
     FIXME("(%p)->() to (%p)->() E_NOTIMPL\n", This, ppEnum);
 




More information about the wine-cvs mailing list