Dmitry Timoshkov : windowscodecs: Do not assume that vtable is the first element of the object, avoid not necessary casts.

Alexandre Julliard julliard at winehq.org
Tue Jul 24 14:39:36 CDT 2012


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

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Tue Jul 24 15:03:20 2012 +0900

windowscodecs: Do not assume that vtable is the first element of the object, avoid not necessary casts.

---

 dlls/windowscodecs/clsfactory.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/windowscodecs/clsfactory.c b/dlls/windowscodecs/clsfactory.c
index 40c8df3..6a81a9d 100644
--- a/dlls/windowscodecs/clsfactory.c
+++ b/dlls/windowscodecs/clsfactory.c
@@ -82,9 +82,10 @@ static HRESULT WINAPI ClassFactoryImpl_QueryInterface(IClassFactory *iface,
 
     if (!ppv) return E_INVALIDARG;
 
-    if (IsEqualIID(&IID_IUnknown, iid) || IsEqualIID(&IID_IClassFactory, iid))
+    if (IsEqualIID(&IID_IUnknown, iid) ||
+        IsEqualIID(&IID_IClassFactory, iid))
     {
-        *ppv = This;
+        *ppv = &This->IClassFactory_iface;
     }
     else
     {
@@ -155,8 +156,8 @@ static HRESULT ClassFactoryImpl_Constructor(classinfo *info, REFIID riid, LPVOID
     This->ref = 1;
     This->info = info;
 
-    ret = IClassFactory_QueryInterface((IClassFactory*)This, riid, ppv);
-    IClassFactory_Release((IClassFactory*)This);
+    ret = IClassFactory_QueryInterface(&This->IClassFactory_iface, riid, ppv);
+    IClassFactory_Release(&This->IClassFactory_iface);
 
     return ret;
 }




More information about the wine-cvs mailing list