[3/3] dpnet: Cleanup IDirectPlay8Address
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Sun Jan 19 21:06:59 CST 2014
Hi,
Changelog:
dpnet: Cleanup IDirectPlay8Address
Best Regards
Alistair Leslie-Hughes
-------------- next part --------------
>From 32b91d1fb3a5363ae5498b4ae0e2b0dc346ded97 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Mon, 20 Jan 2014 12:33:29 +1100
Subject: [PATCH] Cleanup IDirectPlay8Address
To: wine-patches <wine-patches at winehq.org>
---
dlls/dpnet/address.c | 45 ++++++++++++++++++++++++++-------------------
1 file changed, 26 insertions(+), 19 deletions(-)
diff --git a/dlls/dpnet/address.c b/dlls/dpnet/address.c
index e7a62bb..ae6b586 100644
--- a/dlls/dpnet/address.c
+++ b/dlls/dpnet/address.c
@@ -60,24 +60,24 @@ static HRESULT WINAPI IDirectPlay8AddressImpl_QueryInterface(IDirectPlay8Address
static ULONG WINAPI IDirectPlay8AddressImpl_AddRef(IDirectPlay8Address *iface)
{
IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
- ULONG refCount = InterlockedIncrement(&This->ref);
+ ULONG ref = InterlockedIncrement(&This->ref);
- TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
+ TRACE("(%p) ref=%d\n", This, ref);
- return refCount;
+ return ref;
}
static ULONG WINAPI IDirectPlay8AddressImpl_Release(IDirectPlay8Address *iface)
{
IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface);
- ULONG refCount = InterlockedDecrement(&This->ref);
+ ULONG ref = InterlockedDecrement(&This->ref);
- TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
+ TRACE("(%p) ref=%d\n", This, ref);
- if (!refCount) {
+ if (!ref) {
HeapFree(GetProcessHeap(), 0, This);
}
- return refCount;
+ return ref;
}
/* returns name of given GUID */
@@ -320,18 +320,25 @@ static const IDirectPlay8AddressVtbl DirectPlay8Address_Vtbl =
IDirectPlay8AddressImpl_BuildFromDirectPlay4Address
};
-HRESULT DPNET_CreateDirectPlay8Address(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) {
- IDirectPlay8AddressImpl* client;
+HRESULT DPNET_CreateDirectPlay8Address(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, LPVOID *ppobj)
+{
+ IDirectPlay8AddressImpl* client;
+ HRESULT ret;
+
+ TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppobj);
- TRACE("(%p, %s, %p)\n", punkOuter, debugstr_guid(riid), ppobj);
-
- client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8AddressImpl));
- if (NULL == client) {
*ppobj = NULL;
- return E_OUTOFMEMORY;
- }
- client->IDirectPlay8Address_iface.lpVtbl = &DirectPlay8Address_Vtbl;
- client->SP_guid = GUID_NULL;
- client->ref = 0; /* will be inited with QueryInterface */
- return IDirectPlay8AddressImpl_QueryInterface (&client->IDirectPlay8Address_iface, riid, ppobj);
+
+ client = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8AddressImpl));
+ if (!client)
+ return E_OUTOFMEMORY;
+
+ client->IDirectPlay8Address_iface.lpVtbl = &DirectPlay8Address_Vtbl;
+ client->ref = 1;
+ client->SP_guid = GUID_NULL;
+
+ ret = IDirectPlay8AddressImpl_QueryInterface(&client->IDirectPlay8Address_iface, riid, ppobj);
+ IDirectPlay8AddressImpl_Release(&client->IDirectPlay8Address_iface);
+
+ return ret;
}
--
1.8.3.2
More information about the wine-patches
mailing list