oleaut32: Simplify connection point creation.
This commit is contained in:
parent
39a5a1c696
commit
72eaeb14a6
|
@ -66,9 +66,6 @@ typedef struct ConnectionPointImpl {
|
||||||
DWORD nSinks;
|
DWORD nSinks;
|
||||||
} ConnectionPointImpl;
|
} ConnectionPointImpl;
|
||||||
|
|
||||||
static const IConnectionPointVtbl ConnectionPointImpl_VTable;
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Implementation of IEnumConnections
|
* Implementation of IEnumConnections
|
||||||
*/
|
*/
|
||||||
|
@ -104,26 +101,6 @@ static inline EnumConnectionsImpl *impl_from_IEnumConnections(IEnumConnections *
|
||||||
return CONTAINING_RECORD(iface, EnumConnectionsImpl, IEnumConnections_iface);
|
return CONTAINING_RECORD(iface, EnumConnectionsImpl, IEnumConnections_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
|
||||||
* ConnectionPointImpl_Construct
|
|
||||||
*/
|
|
||||||
static ConnectionPointImpl *ConnectionPointImpl_Construct(IUnknown *pUnk,
|
|
||||||
REFIID riid)
|
|
||||||
{
|
|
||||||
ConnectionPointImpl *Obj;
|
|
||||||
|
|
||||||
Obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*Obj));
|
|
||||||
Obj->IConnectionPoint_iface.lpVtbl = &ConnectionPointImpl_VTable;
|
|
||||||
Obj->Obj = pUnk;
|
|
||||||
Obj->ref = 1;
|
|
||||||
Obj->iid = *riid;
|
|
||||||
Obj->maxSinks = MAXSINKS;
|
|
||||||
Obj->sinks = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
||||||
sizeof(IUnknown*) * MAXSINKS);
|
|
||||||
Obj->nSinks = 0;
|
|
||||||
return Obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* ConnectionPointImpl_Destroy
|
* ConnectionPointImpl_Destroy
|
||||||
*/
|
*/
|
||||||
|
@ -615,13 +592,22 @@ HRESULT CreateConnectionPoint(IUnknown *pUnk, REFIID riid,
|
||||||
IConnectionPoint **pCP)
|
IConnectionPoint **pCP)
|
||||||
{
|
{
|
||||||
ConnectionPointImpl *Obj;
|
ConnectionPointImpl *Obj;
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
Obj = ConnectionPointImpl_Construct(pUnk, riid);
|
TRACE("(%p %s %p)\n", pUnk, debugstr_guid(riid), pCP);
|
||||||
if(!Obj) return E_OUTOFMEMORY;
|
|
||||||
|
|
||||||
hr = IConnectionPoint_QueryInterface(&Obj->IConnectionPoint_iface,
|
*pCP = NULL;
|
||||||
&IID_IConnectionPoint, (void**)pCP);
|
Obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*Obj));
|
||||||
IConnectionPoint_Release(&Obj->IConnectionPoint_iface);
|
if (!Obj)
|
||||||
return hr;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
Obj->IConnectionPoint_iface.lpVtbl = &ConnectionPointImpl_VTable;
|
||||||
|
Obj->Obj = pUnk;
|
||||||
|
Obj->ref = 1;
|
||||||
|
Obj->iid = *riid;
|
||||||
|
Obj->maxSinks = MAXSINKS;
|
||||||
|
Obj->sinks = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IUnknown*) * MAXSINKS);
|
||||||
|
Obj->nSinks = 0;
|
||||||
|
|
||||||
|
*pCP = &Obj->IConnectionPoint_iface;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue