@@ -101,9 +101,6 @@ static inline EnumConnectionsImpl *impl_from_IEnumConnections(IEnumConnections *
101101 return CONTAINING_RECORD (iface , EnumConnectionsImpl , IEnumConnections_iface );
102102}
103103
104- /************************************************************************
105- * ConnectionPointImpl_Destroy
106- */
107104static void ConnectionPointImpl_Destroy (ConnectionPointImpl * Obj )
108105{
109106 DWORD i ;
@@ -113,16 +110,11 @@ static void ConnectionPointImpl_Destroy(ConnectionPointImpl *Obj)
113110 Obj -> sinks [i ] = NULL ;
114111 }
115112 }
116- HeapFree ( GetProcessHeap (), 0 , Obj -> sinks );
117- HeapFree ( GetProcessHeap (), 0 , Obj );
113+ free ( Obj -> sinks );
114+ free ( Obj );
118115 return ;
119116}
120117
121- /************************************************************************
122- * ConnectionPointImpl_QueryInterface (IUnknown)
123- *
124- * See Windows documentation for more details on IUnknown methods.
125- */
126118static HRESULT WINAPI ConnectionPointImpl_QueryInterface (
127119 IConnectionPoint * iface ,
128120 REFIID riid ,
@@ -160,47 +152,29 @@ static HRESULT WINAPI ConnectionPointImpl_QueryInterface(
160152 return S_OK ;
161153}
162154
163-
164- /************************************************************************
165- * ConnectionPointImpl_AddRef (IUnknown)
166- *
167- * See Windows documentation for more details on IUnknown methods.
168- */
169155static ULONG WINAPI ConnectionPointImpl_AddRef (IConnectionPoint * iface )
170156{
171157 ConnectionPointImpl * This = impl_from_IConnectionPoint (iface );
172158 ULONG refCount = InterlockedIncrement (& This -> ref );
173159
174- TRACE ("(%p)->(ref before=%d) \n" , This , refCount - 1 );
160+ TRACE ("%p, refcount %lu. \n" , iface , refCount );
175161
176162 return refCount ;
177163}
178164
179- /************************************************************************
180- * ConnectionPointImpl_Release (IUnknown)
181- *
182- * See Windows documentation for more details on IUnknown methods.
183- */
184165static ULONG WINAPI ConnectionPointImpl_Release (
185166 IConnectionPoint * iface )
186167{
187168 ConnectionPointImpl * This = impl_from_IConnectionPoint (iface );
188169 ULONG refCount = InterlockedDecrement (& This -> ref );
189170
190- TRACE ("(%p)->(ref before=%d) \n" , This , refCount + 1 );
171+ TRACE ("%p, refcount %lu. \n" , iface , refCount );
191172
192- /*
193- * If the reference count goes down to 0, perform suicide.
194- */
195173 if (!refCount ) ConnectionPointImpl_Destroy (This );
196174
197175 return refCount ;
198176}
199177
200- /************************************************************************
201- * ConnectionPointImpl_GetConnectionInterface (IConnectionPoint)
202- *
203- */
204178static HRESULT WINAPI ConnectionPointImpl_GetConnectionInterface (
205179 IConnectionPoint * iface ,
206180 IID * piid )
@@ -211,10 +185,6 @@ static HRESULT WINAPI ConnectionPointImpl_GetConnectionInterface(
211185 return S_OK ;
212186}
213187
214- /************************************************************************
215- * ConnectionPointImpl_GetConnectionPointContainer (IConnectionPoint)
216- *
217- */
218188static HRESULT WINAPI ConnectionPointImpl_GetConnectionPointContainer (
219189 IConnectionPoint * iface ,
220190 IConnectionPointContainer * * ppCPC )
@@ -225,10 +195,6 @@ static HRESULT WINAPI ConnectionPointImpl_GetConnectionPointContainer(
225195 return IUnknown_QueryInterface (This -> Obj , & IID_IConnectionPointContainer , (void * * )ppCPC );
226196}
227197
228- /************************************************************************
229- * ConnectionPointImpl_Advise (IConnectionPoint)
230- *
231- */
232198static HRESULT WINAPI ConnectionPointImpl_Advise (IConnectionPoint * iface ,
233199 IUnknown * lpUnk ,
234200 DWORD * pdwCookie )
@@ -247,9 +213,9 @@ static HRESULT WINAPI ConnectionPointImpl_Advise(IConnectionPoint *iface,
247213 break ;
248214 }
249215 if (i == This -> maxSinks ) {
216+ This -> sinks = realloc (This -> sinks , (This -> maxSinks + MAXSINKS ) * sizeof (IUnknown * ));
217+ memset (This -> sinks + This -> maxSinks , 0 , MAXSINKS * sizeof (IUnknown * ));
250218 This -> maxSinks += MAXSINKS ;
251- This -> sinks = HeapReAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY , This -> sinks ,
252- This -> maxSinks * sizeof (IUnknown * ));
253219 }
254220 This -> sinks [i ] = lpSink ;
255221 This -> nSinks ++ ;
@@ -258,15 +224,11 @@ static HRESULT WINAPI ConnectionPointImpl_Advise(IConnectionPoint *iface,
258224}
259225
260226
261- /************************************************************************
262- * ConnectionPointImpl_Unadvise (IConnectionPoint)
263- *
264- */
265- static HRESULT WINAPI ConnectionPointImpl_Unadvise (IConnectionPoint * iface ,
266- DWORD dwCookie )
227+ static HRESULT WINAPI ConnectionPointImpl_Unadvise (IConnectionPoint * iface , DWORD dwCookie )
267228{
268229 ConnectionPointImpl * This = impl_from_IConnectionPoint (iface );
269- TRACE ("(%p)->(%d)\n" , This , dwCookie );
230+
231+ TRACE ("%p, %#lx.\n" , iface , dwCookie );
270232
271233 if (dwCookie == 0 || dwCookie > This -> maxSinks ) return E_INVALIDARG ;
272234
@@ -278,13 +240,7 @@ static HRESULT WINAPI ConnectionPointImpl_Unadvise(IConnectionPoint *iface,
278240 return S_OK ;
279241}
280242
281- /************************************************************************
282- * ConnectionPointImpl_EnumConnections (IConnectionPoint)
283- *
284- */
285- static HRESULT WINAPI ConnectionPointImpl_EnumConnections (
286- IConnectionPoint * iface ,
287- LPENUMCONNECTIONS * ppEnum )
243+ static HRESULT WINAPI ConnectionPointImpl_EnumConnections (IConnectionPoint * iface , IEnumConnections * * ppEnum )
288244{
289245 ConnectionPointImpl * This = impl_from_IConnectionPoint (iface );
290246 CONNECTDATA * pCD ;
@@ -298,7 +254,7 @@ static HRESULT WINAPI ConnectionPointImpl_EnumConnections(
298254
299255 if (This -> nSinks == 0 ) return OLE_E_NOCONNECTION ;
300256
301- pCD = HeapAlloc ( GetProcessHeap (), 0 , sizeof (CONNECTDATA ) * This -> nSinks );
257+ pCD = malloc ( sizeof (CONNECTDATA ) * This -> nSinks );
302258
303259 for (i = 0 , nextslot = 0 ; i < This -> maxSinks ; i ++ ) {
304260 if (This -> sinks [i ] != NULL ) {
@@ -318,7 +274,7 @@ static HRESULT WINAPI ConnectionPointImpl_EnumConnections(
318274 & IID_IEnumConnections , (void * * )ppEnum );
319275 IEnumConnections_Release (& EnumObj -> IEnumConnections_iface );
320276
321- HeapFree ( GetProcessHeap (), 0 , pCD );
277+ free ( pCD );
322278 return hr ;
323279}
324280
@@ -337,20 +293,17 @@ static const IConnectionPointVtbl ConnectionPointImpl_VTable =
337293
338294static const IEnumConnectionsVtbl EnumConnectionsImpl_VTable ;
339295
340- /************************************************************************
341- * EnumConnectionsImpl_Construct
342- */
343296static EnumConnectionsImpl * EnumConnectionsImpl_Construct (IUnknown * pUnk ,
344297 DWORD nSinks ,
345298 CONNECTDATA * pCD )
346299{
347- EnumConnectionsImpl * Obj = HeapAlloc ( GetProcessHeap (), 0 , sizeof (* Obj ));
300+ EnumConnectionsImpl * Obj = malloc ( sizeof (* Obj ));
348301 DWORD i ;
349302
350303 Obj -> IEnumConnections_iface .lpVtbl = & EnumConnectionsImpl_VTable ;
351304 Obj -> ref = 1 ;
352305 Obj -> pUnk = pUnk ;
353- Obj -> pCD = HeapAlloc ( GetProcessHeap (), 0 , nSinks * sizeof (CONNECTDATA ));
306+ Obj -> pCD = malloc ( nSinks * sizeof (CONNECTDATA ));
354307 Obj -> nConns = nSinks ;
355308 Obj -> nCur = 0 ;
356309
@@ -361,26 +314,18 @@ static EnumConnectionsImpl *EnumConnectionsImpl_Construct(IUnknown *pUnk,
361314 return Obj ;
362315}
363316
364- /************************************************************************
365- * EnumConnectionsImpl_Destroy
366- */
367317static void EnumConnectionsImpl_Destroy (EnumConnectionsImpl * Obj )
368318{
369319 DWORD i ;
370320
371321 for (i = 0 ; i < Obj -> nConns ; i ++ )
372322 IUnknown_Release (Obj -> pCD [i ].pUnk );
373323
374- HeapFree ( GetProcessHeap (), 0 , Obj -> pCD );
375- HeapFree ( GetProcessHeap (), 0 , Obj );
324+ free ( Obj -> pCD );
325+ free ( Obj );
376326 return ;
377327}
378328
379- /************************************************************************
380- * EnumConnectionsImpl_QueryInterface (IUnknown)
381- *
382- * See Windows documentation for more details on IUnknown methods.
383- */
384329static HRESULT WINAPI EnumConnectionsImpl_QueryInterface (
385330 IEnumConnections * iface ,
386331 REFIID riid ,
@@ -417,56 +362,37 @@ static HRESULT WINAPI EnumConnectionsImpl_QueryInterface(
417362 return S_OK ;
418363}
419364
420-
421- /************************************************************************
422- * EnumConnectionsImpl_AddRef (IUnknown)
423- *
424- * See Windows documentation for more details on IUnknown methods.
425- */
426365static ULONG WINAPI EnumConnectionsImpl_AddRef (IEnumConnections * iface )
427366{
428367 EnumConnectionsImpl * This = impl_from_IEnumConnections (iface );
429368 ULONG refCount = InterlockedIncrement (& This -> ref );
430369
431- TRACE ("(%p)->(ref before=%d) \n" , This , refCount - 1 );
370+ TRACE ("%p, refcount %lu. \n" , iface , refCount );
432371
433372 IUnknown_AddRef (This -> pUnk );
434373 return refCount ;
435374}
436375
437- /************************************************************************
438- * EnumConnectionsImpl_Release (IUnknown)
439- *
440- * See Windows documentation for more details on IUnknown methods.
441- */
442376static ULONG WINAPI EnumConnectionsImpl_Release (IEnumConnections * iface )
443377{
444378 EnumConnectionsImpl * This = impl_from_IEnumConnections (iface );
445379 ULONG refCount = InterlockedDecrement (& This -> ref );
446380
447- TRACE ("(%p)->(ref before=%d) \n" , This , refCount + 1 );
381+ TRACE ("%p, refcount %lu. \n" , iface , refCount );
448382
449383 IUnknown_Release (This -> pUnk );
450384
451- /*
452- * If the reference count goes down to 0, perform suicide.
453- */
454385 if (!refCount ) EnumConnectionsImpl_Destroy (This );
455386
456387 return refCount ;
457388}
458389
459- /************************************************************************
460- * EnumConnectionsImpl_Next (IEnumConnections)
461- *
462- */
463- static HRESULT WINAPI EnumConnectionsImpl_Next (IEnumConnections * iface ,
464- ULONG cConn , LPCONNECTDATA pCD ,
465- ULONG * pEnum )
390+ static HRESULT WINAPI EnumConnectionsImpl_Next (IEnumConnections * iface , ULONG cConn , LPCONNECTDATA pCD , ULONG * pEnum )
466391{
467392 EnumConnectionsImpl * This = impl_from_IEnumConnections (iface );
468393 DWORD nRet = 0 ;
469- TRACE ("(%p)->(%d, %p, %p)\n" , This , cConn , pCD , pEnum );
394+
395+ TRACE ("%p, %lu, %p, %p.\n" , iface , cConn , pCD , pEnum );
470396
471397 if (pEnum == NULL ) {
472398 if (cConn != 1 )
@@ -491,16 +417,11 @@ static HRESULT WINAPI EnumConnectionsImpl_Next(IEnumConnections* iface,
491417 return S_OK ;
492418}
493419
494-
495- /************************************************************************
496- * EnumConnectionsImpl_Skip (IEnumConnections)
497- *
498- */
499- static HRESULT WINAPI EnumConnectionsImpl_Skip (IEnumConnections * iface ,
500- ULONG cSkip )
420+ static HRESULT WINAPI EnumConnectionsImpl_Skip (IEnumConnections * iface , ULONG cSkip )
501421{
502422 EnumConnectionsImpl * This = impl_from_IEnumConnections (iface );
503- TRACE ("(%p)->(%d)\n" , This , cSkip );
423+
424+ TRACE ("%p, %lu.\n" , iface , cSkip );
504425
505426 if (This -> nCur + cSkip >= This -> nConns )
506427 return S_FALSE ;
@@ -510,11 +431,6 @@ static HRESULT WINAPI EnumConnectionsImpl_Skip(IEnumConnections* iface,
510431 return S_OK ;
511432}
512433
513-
514- /************************************************************************
515- * EnumConnectionsImpl_Reset (IEnumConnections)
516- *
517- */
518434static HRESULT WINAPI EnumConnectionsImpl_Reset (IEnumConnections * iface )
519435{
520436 EnumConnectionsImpl * This = impl_from_IEnumConnections (iface );
@@ -525,13 +441,7 @@ static HRESULT WINAPI EnumConnectionsImpl_Reset(IEnumConnections* iface)
525441 return S_OK ;
526442}
527443
528-
529- /************************************************************************
530- * EnumConnectionsImpl_Clone (IEnumConnections)
531- *
532- */
533- static HRESULT WINAPI EnumConnectionsImpl_Clone (IEnumConnections * iface ,
534- LPENUMCONNECTIONS * ppEnum )
444+ static HRESULT WINAPI EnumConnectionsImpl_Clone (IEnumConnections * iface , IEnumConnections * * ppEnum )
535445{
536446 EnumConnectionsImpl * This = impl_from_IEnumConnections (iface );
537447 EnumConnectionsImpl * newObj ;
@@ -577,7 +487,7 @@ HRESULT CreateConnectionPoint(IUnknown *pUnk, REFIID riid,
577487 TRACE ("(%p %s %p)\n" , pUnk , debugstr_guid (riid ), pCP );
578488
579489 * pCP = NULL ;
580- Obj = HeapAlloc ( GetProcessHeap (), 0 , sizeof (* Obj ));
490+ Obj = malloc ( sizeof (* Obj ));
581491 if (!Obj )
582492 return E_OUTOFMEMORY ;
583493
@@ -586,7 +496,7 @@ HRESULT CreateConnectionPoint(IUnknown *pUnk, REFIID riid,
586496 Obj -> ref = 1 ;
587497 Obj -> iid = * riid ;
588498 Obj -> maxSinks = MAXSINKS ;
589- Obj -> sinks = HeapAlloc ( GetProcessHeap (), HEAP_ZERO_MEMORY , sizeof (IUnknown * ) * MAXSINKS );
499+ Obj -> sinks = calloc ( MAXSINKS , sizeof (IUnknown * ));
590500 Obj -> nSinks = 0 ;
591501
592502 * pCP = & Obj -> IConnectionPoint_iface ;
0 commit comments