[PATCH] dpnet: Don't assign a COM object to the 3rd param of QueryInterface

Michael Stefaniuc mstefani at winehq.org
Sun Aug 29 07:00:18 CDT 2021


It is supposed to hold a COM interface pointer.
Also do some minor cleanups en passant:
- Rename the 3rd param to better match its use
- Avoid using the IUnknown method names
- Use S_OK instead of DPN_OK

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/dpnet/client.c     | 15 ++++++---------
 dlls/dpnet/lobbiedapp.c | 15 ++++++---------
 dlls/dpnet/peer.c       | 15 ++++++---------
 dlls/dpnet/threadpool.c | 15 ++++++---------
 4 files changed, 24 insertions(+), 36 deletions(-)

diff --git a/dlls/dpnet/client.c b/dlls/dpnet/client.c
index 4459373a14c..b9f55c35b29 100644
--- a/dlls/dpnet/client.c
+++ b/dlls/dpnet/client.c
@@ -56,18 +56,15 @@ static inline IDirectPlay8ClientImpl *impl_from_IDirectPlay8Client(IDirectPlay8C
 
 /* IDirectPlay8Client IUnknown parts follow: */
 static HRESULT WINAPI IDirectPlay8ClientImpl_QueryInterface(IDirectPlay8Client *iface, REFIID riid,
-        void **ppobj)
+        void **ret_iface)
 {
-    IDirectPlay8ClientImpl *This = impl_from_IDirectPlay8Client(iface);
-
-    if (IsEqualGUID(riid, &IID_IUnknown)
-        || IsEqualGUID(riid, &IID_IDirectPlay8Client)) {
-        IUnknown_AddRef(iface);
-        *ppobj = This;
-        return DPN_OK;
+    if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlay8Client)) {
+        IDirectPlay8Client_AddRef(iface);
+        *ret_iface = iface;
+        return S_OK;
     }
 
-    WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
+    WARN("(%p)->(%s,%p): not found\n", iface, debugstr_guid(riid), ret_iface);
     return E_NOINTERFACE;
 }
 
diff --git a/dlls/dpnet/lobbiedapp.c b/dlls/dpnet/lobbiedapp.c
index d58571aca87..71beb2de2cf 100644
--- a/dlls/dpnet/lobbiedapp.c
+++ b/dlls/dpnet/lobbiedapp.c
@@ -42,18 +42,15 @@ static inline IDirectPlay8LobbiedApplicationImpl *impl_from_IDirectPlay8LobbiedA
 
 /* IDirectPlay8LobbiedApplication IUnknown parts follow: */
 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_QueryInterface(IDirectPlay8LobbiedApplication *iface,
-        REFIID riid, void **ppobj)
+        REFIID riid, void **ret_iface)
 {
-    IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
-
-    if (IsEqualGUID(riid, &IID_IUnknown)
-        || IsEqualGUID(riid, &IID_IDirectPlay8LobbiedApplication)) {
-        IUnknown_AddRef(iface);
-        *ppobj = This;
-        return DPN_OK;
+    if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlay8LobbiedApplication)) {
+        IDirectPlay8LobbiedApplication_AddRef(iface);
+        *ret_iface = iface;
+        return S_OK;
     }
 
-    WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
+    WARN("(%p)->(%s,%p): not found\n", iface, debugstr_guid(riid), ret_iface);
     return E_NOINTERFACE;
 }
 
diff --git a/dlls/dpnet/peer.c b/dlls/dpnet/peer.c
index 329d9b3a828..bd143e83176 100644
--- a/dlls/dpnet/peer.c
+++ b/dlls/dpnet/peer.c
@@ -60,19 +60,16 @@ static inline IDirectPlay8PeerImpl *impl_from_IDirectPlay8Peer(IDirectPlay8Peer
 
 /* IUnknown interface follows */
 static HRESULT WINAPI IDirectPlay8PeerImpl_QueryInterface(IDirectPlay8Peer *iface, REFIID riid,
-        void **ppobj)
+        void **ret_iface)
 {
-    IDirectPlay8PeerImpl* This = impl_from_IDirectPlay8Peer(iface);
-
-    if(IsEqualGUID(riid, &IID_IUnknown) ||
-       IsEqualGUID(riid, &IID_IDirectPlay8Peer))
+    if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlay8Peer))
     {
-        IUnknown_AddRef(iface);
-        *ppobj = This;
-        return DPN_OK;
+        IDirectPlay8Peer_AddRef(iface);
+        *ret_iface = iface;
+        return S_OK;
     }
 
-    WARN("(%p)->(%s,%p): not found\n", This, debugstr_guid(riid), ppobj);
+    WARN("(%p)->(%s,%p): not found\n", iface, debugstr_guid(riid), ret_iface);
     return E_NOINTERFACE;
 }
 
diff --git a/dlls/dpnet/threadpool.c b/dlls/dpnet/threadpool.c
index 22d871b40b4..37dda49e84d 100644
--- a/dlls/dpnet/threadpool.c
+++ b/dlls/dpnet/threadpool.c
@@ -46,19 +46,16 @@ static inline IDirectPlay8ThreadPoolImpl *impl_from_IDirectPlay8ThreadPool(IDire
 
 /* IUnknown interface follows */
 static HRESULT WINAPI IDirectPlay8ThreadPoolImpl_QueryInterface(IDirectPlay8ThreadPool *iface,
-        REFIID riid, void **ppobj)
+        REFIID riid, void **ret_iface)
 {
-    IDirectPlay8ThreadPoolImpl *This = impl_from_IDirectPlay8ThreadPool(iface);
-
-    if(IsEqualGUID(riid, &IID_IUnknown) ||
-       IsEqualGUID(riid, &IID_IDirectPlay8ThreadPool))
+    if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlay8ThreadPool))
     {
-        IUnknown_AddRef(iface);
-        *ppobj = This;
-        return DPN_OK;
+        IDirectPlay8ThreadPool_AddRef(iface);
+        *ret_iface = iface;
+        return S_OK;
     }
 
-    WARN("(%p)->(%s,%p): not found\n", This, debugstr_guid(riid), ppobj);
+    WARN("(%p)->(%s,%p): not found\n", iface, debugstr_guid(riid), ret_iface);
     return E_NOINTERFACE;
 }
 
-- 
2.31.1




More information about the wine-devel mailing list