Commit f07c9784 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

oleaut32: Cleanup connection point methods a bit.

parent 72eaeb14
...@@ -118,7 +118,6 @@ static void ConnectionPointImpl_Destroy(ConnectionPointImpl *Obj) ...@@ -118,7 +118,6 @@ static void ConnectionPointImpl_Destroy(ConnectionPointImpl *Obj)
return; return;
} }
static ULONG WINAPI ConnectionPointImpl_AddRef(IConnectionPoint* iface);
/************************************************************************ /************************************************************************
* ConnectionPointImpl_QueryInterface (IUnknown) * ConnectionPointImpl_QueryInterface (IUnknown)
* *
...@@ -135,7 +134,7 @@ static HRESULT WINAPI ConnectionPointImpl_QueryInterface( ...@@ -135,7 +134,7 @@ static HRESULT WINAPI ConnectionPointImpl_QueryInterface(
/* /*
* Perform a sanity check on the parameters. * Perform a sanity check on the parameters.
*/ */
if ( (This==0) || (ppvObject==0) ) if (!ppvObject)
return E_INVALIDARG; return E_INVALIDARG;
/* /*
...@@ -143,28 +142,20 @@ static HRESULT WINAPI ConnectionPointImpl_QueryInterface( ...@@ -143,28 +142,20 @@ static HRESULT WINAPI ConnectionPointImpl_QueryInterface(
*/ */
*ppvObject = 0; *ppvObject = 0;
/*
* Compare the riid with the interface IDs implemented by this object. if (IsEqualIID(&IID_IConnectionPoint, riid) || IsEqualIID(&IID_IUnknown, riid))
*/ *ppvObject = iface;
if (IsEqualIID(&IID_IUnknown, riid))
*ppvObject = This;
else if (IsEqualIID(&IID_IConnectionPoint, riid))
*ppvObject = This;
/* /*
* Check that we obtained an interface. * Check that we obtained an interface.
*/ */
if ((*ppvObject)==0) if ((*ppvObject)==0)
{ {
FIXME("() : asking for un supported interface %s\n",debugstr_guid(riid)); FIXME("() : asking for unsupported interface %s\n", debugstr_guid(riid));
return E_NOINTERFACE; return E_NOINTERFACE;
} }
/* IUnknown_AddRef((IUnknown*)*ppvObject);
* Query Interface always increases the reference count by one when it is
* successful
*/
ConnectionPointImpl_AddRef(&This->IConnectionPoint_iface);
return S_OK; return S_OK;
} }
...@@ -320,9 +311,9 @@ static HRESULT WINAPI ConnectionPointImpl_EnumConnections( ...@@ -320,9 +311,9 @@ static HRESULT WINAPI ConnectionPointImpl_EnumConnections(
/* Bump the ref count of this object up by one. It gets Released in /* Bump the ref count of this object up by one. It gets Released in
IEnumConnections_Release */ IEnumConnections_Release */
IUnknown_AddRef((IUnknown*)This); IConnectionPoint_AddRef(iface);
EnumObj = EnumConnectionsImpl_Construct((IUnknown*)This, This->nSinks, pCD); EnumObj = EnumConnectionsImpl_Construct((IUnknown*)iface, This->nSinks, pCD);
hr = IEnumConnections_QueryInterface(&EnumObj->IEnumConnections_iface, hr = IEnumConnections_QueryInterface(&EnumObj->IEnumConnections_iface,
&IID_IEnumConnections, (void**)ppEnum); &IID_IEnumConnections, (void**)ppEnum);
IEnumConnections_Release(&EnumObj->IEnumConnections_iface); IEnumConnections_Release(&EnumObj->IEnumConnections_iface);
...@@ -345,7 +336,6 @@ static const IConnectionPointVtbl ConnectionPointImpl_VTable = ...@@ -345,7 +336,6 @@ static const IConnectionPointVtbl ConnectionPointImpl_VTable =
static const IEnumConnectionsVtbl EnumConnectionsImpl_VTable; static const IEnumConnectionsVtbl EnumConnectionsImpl_VTable;
static ULONG WINAPI EnumConnectionsImpl_AddRef(IEnumConnections* iface);
/************************************************************************ /************************************************************************
* EnumConnectionsImpl_Construct * EnumConnectionsImpl_Construct
...@@ -402,7 +392,7 @@ static HRESULT WINAPI EnumConnectionsImpl_QueryInterface( ...@@ -402,7 +392,7 @@ static HRESULT WINAPI EnumConnectionsImpl_QueryInterface(
/* /*
* Perform a sanity check on the parameters. * Perform a sanity check on the parameters.
*/ */
if ( (This==0) || (ppvObject==0) ) if (!ppvObject)
return E_INVALIDARG; return E_INVALIDARG;
/* /*
...@@ -410,28 +400,19 @@ static HRESULT WINAPI EnumConnectionsImpl_QueryInterface( ...@@ -410,28 +400,19 @@ static HRESULT WINAPI EnumConnectionsImpl_QueryInterface(
*/ */
*ppvObject = 0; *ppvObject = 0;
/* if (IsEqualIID(&IID_IEnumConnections, riid) || IsEqualIID(&IID_IUnknown, riid))
* Compare the riid with the interface IDs implemented by this object. *ppvObject = iface;
*/
if (IsEqualIID(&IID_IUnknown, riid))
*ppvObject = This;
else if (IsEqualIID(&IID_IEnumConnections, riid))
*ppvObject = This;
/* /*
* Check that we obtained an interface. * Check that we obtained an interface.
*/ */
if ((*ppvObject)==0) if ((*ppvObject)==0)
{ {
FIXME("() : asking for un supported interface %s\n",debugstr_guid(riid)); FIXME("() : asking for unsupported interface %s\n", debugstr_guid(riid));
return E_NOINTERFACE; return E_NOINTERFACE;
} }
/* IUnknown_AddRef((IUnknown*)*ppvObject);
* Query Interface always increases the reference count by one when it is
* successful
*/
EnumConnectionsImpl_AddRef((IEnumConnections*)This);
return S_OK; return S_OK;
} }
...@@ -558,7 +539,7 @@ static HRESULT WINAPI EnumConnectionsImpl_Clone(IEnumConnections* iface, ...@@ -558,7 +539,7 @@ static HRESULT WINAPI EnumConnectionsImpl_Clone(IEnumConnections* iface,
newObj = EnumConnectionsImpl_Construct(This->pUnk, This->nConns, This->pCD); newObj = EnumConnectionsImpl_Construct(This->pUnk, This->nConns, This->pCD);
newObj->nCur = This->nCur; newObj->nCur = This->nCur;
*ppEnum = (LPENUMCONNECTIONS)newObj; *ppEnum = &newObj->IEnumConnections_iface;
IUnknown_AddRef(This->pUnk); IUnknown_AddRef(This->pUnk);
return S_OK; return S_OK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment