Ignore:
Timestamp:
Sep 5, 2001, 3:19:02 PM (24 years ago)
Author:
bird
Message:

Added $Id:$ keyword.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/oleaut32/connpt.c

    r4837 r6648  
     1/* $Id: connpt.c,v 1.2 2001-09-05 13:18:59 bird Exp $ */
    12/*
    23 * Implementation of a generic ConnectionPoint object.
     
    7273  CONNECTDATA *pCD;
    7374  DWORD nConns;
    74  
     75
    7576  /* Next connection to enumerate from */
    7677  DWORD nCur;
     
    7980
    8081static EnumConnectionsImpl *EnumConnectionsImpl_Construct(IUnknown *pUnk,
    81                                                           DWORD nSinks,
    82                                                           CONNECTDATA *pCD);
     82                              DWORD nSinks,
     83                              CONNECTDATA *pCD);
    8384
    8485
     
    8788 */
    8889static ConnectionPointImpl *ConnectionPointImpl_Construct(IUnknown *pUnk,
    89                                                           REFIID riid)
     90                              REFIID riid)
    9091{
    9192  ConnectionPointImpl *Obj;
     
    9798  Obj->iid =  *riid;
    9899  Obj->maxSinks = MAXSINKS;
    99   Obj->sinks = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
    100                         sizeof(IUnknown*) * MAXSINKS);
     100  Obj->sinks = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
     101            sizeof(IUnknown*) * MAXSINKS);
    101102  Obj->nSinks = 0;
    102103  return Obj;
     
    139140  if ( (This==0) || (ppvObject==0) )
    140141    return E_INVALIDARG;
    141  
     142
    142143  /*
    143144   * Initialize the return parameter.
    144145   */
    145146  *ppvObject = 0;
    146  
     147
    147148  /*
    148149   * Compare the riid with the interface IDs implemented by this object.
    149150   */
    150   if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 
     151  if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
    151152  {
    152153    *ppvObject = (IConnectionPoint*)This;
    153154  }
    154   else if (memcmp(&IID_IConnectionPoint, riid, sizeof(IID_IConnectionPoint)) == 0) 
     155  else if (memcmp(&IID_IConnectionPoint, riid, sizeof(IID_IConnectionPoint)) == 0)
    155156  {
    156157    *ppvObject = (IConnectionPoint*)This;
    157158  }
    158  
     159
    159160  /*
    160161   * Check that we obtained an interface.
     
    165166    return E_NOINTERFACE;
    166167  }
    167  
     168
    168169  /*
    169170   * Query Interface always increases the reference count by one when it is
     
    189190  return This->ref;
    190191}
    191        
     192
    192193/************************************************************************
    193194 * ConnectionPointImpl_Release (IUnknown)
     
    195196 * See Windows documentation for more details on IUnknown methods.
    196197 */
    197 static ULONG WINAPI ConnectionPointImpl_Release( 
     198static ULONG WINAPI ConnectionPointImpl_Release(
    198199      IConnectionPoint* iface)
    199200{
     
    215216    return 0;
    216217  }
    217  
     218
    218219  return This->ref;
    219220}
     
    224225 */
    225226static HRESULT WINAPI ConnectionPointImpl_GetConnectionInterface(
    226                                                IConnectionPoint *iface,
    227                                                IID              *piid)
     227                           IConnectionPoint *iface,
     228                           IID              *piid)
    228229{
    229230  ICOM_THIS(ConnectionPointImpl, iface);
     
    238239 */
    239240static HRESULT WINAPI ConnectionPointImpl_GetConnectionPointContainer(
    240                                       IConnectionPoint           *iface,
    241                                       IConnectionPointContainer  **ppCPC)
     241                      IConnectionPoint           *iface,
     242                      IConnectionPointContainer  **ppCPC)
    242243{
    243244  ICOM_THIS(ConnectionPointImpl, iface);
     
    245246
    246247  return IUnknown_QueryInterface(This->Obj,
    247                                 &IID_IConnectionPointContainer,
    248                                 (LPVOID)ppCPC);
     248                &IID_IConnectionPointContainer,
     249                (LPVOID)ppCPC);
    249250}
    250251
     
    254255 */
    255256static HRESULT WINAPI ConnectionPointImpl_Advise(IConnectionPoint *iface,
    256                                                 IUnknown *lpUnk,
    257                                                 DWORD *pdwCookie)
     257                        IUnknown *lpUnk,
     258                        DWORD *pdwCookie)
    258259{
    259260  DWORD i;
     
    273274    This->maxSinks += MAXSINKS;
    274275    This->sinks = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->sinks,
    275                               This->maxSinks * sizeof(IUnknown *));
     276                  This->maxSinks * sizeof(IUnknown *));
    276277  }
    277278  This->sinks[i] = lpSink;
     
    287288 */
    288289static HRESULT WINAPI ConnectionPointImpl_Unadvise(IConnectionPoint *iface,
    289                                                    DWORD dwCookie)
     290                           DWORD dwCookie)
    290291{
    291292  ICOM_THIS(ConnectionPointImpl, iface);
     
    307308 */
    308309static HRESULT WINAPI ConnectionPointImpl_EnumConnections(
    309                                                     IConnectionPoint *iface,
    310                                                     LPENUMCONNECTIONS *ppEnum)
    311 { 
     310                            IConnectionPoint *iface,
     311                            LPENUMCONNECTIONS *ppEnum)
     312{
    312313  ICOM_THIS(ConnectionPointImpl, iface);
    313314  CONNECTDATA *pCD;
     
    317318
    318319  TRACE("(%p)->(%p)\n", This, ppEnum);
    319  
     320
    320321  *ppEnum = NULL;
    321322
     
    339340  EnumObj = EnumConnectionsImpl_Construct((IUnknown*)This, This->nSinks, pCD);
    340341  hr = IEnumConnections_QueryInterface((IEnumConnections*)EnumObj,
    341                                   &IID_IEnumConnections, (LPVOID)ppEnum);
     342                  &IID_IEnumConnections, (LPVOID)ppEnum);
    342343  IEnumConnections_Release((IEnumConnections*)EnumObj);
    343344
     
    367368 */
    368369static EnumConnectionsImpl *EnumConnectionsImpl_Construct(IUnknown *pUnk,
    369                                                           DWORD nSinks,
    370                                                           CONNECTDATA *pCD)
     370                              DWORD nSinks,
     371                              CONNECTDATA *pCD)
    371372{
    372373  EnumConnectionsImpl *Obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*Obj));
     
    420421  if ( (This==0) || (ppvObject==0) )
    421422    return E_INVALIDARG;
    422  
     423
    423424  /*
    424425   * Initialize the return parameter.
    425426   */
    426427  *ppvObject = 0;
    427  
     428
    428429  /*
    429430   * Compare the riid with the interface IDs implemented by this object.
    430431   */
    431   if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) 
     432  if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
    432433  {
    433434    *ppvObject = (IEnumConnections*)This;
    434435  }
    435   else if (memcmp(&IID_IEnumConnections, riid, sizeof(IID_IEnumConnections)) == 0) 
     436  else if (memcmp(&IID_IEnumConnections, riid, sizeof(IID_IEnumConnections)) == 0)
    436437  {
    437438    *ppvObject = (IEnumConnections*)This;
    438439  }
    439  
     440
    440441  /*
    441442   * Check that we obtained an interface.
     
    446447    return E_NOINTERFACE;
    447448  }
    448  
     449
    449450  /*
    450451   * Query Interface always increases the reference count by one when it is
     
    470471  return This->ref;
    471472}
    472        
     473
    473474/************************************************************************
    474475 * EnumConnectionsImpl_Release (IUnknown)
     
    497498    return 0;
    498499  }
    499  
     500
    500501  return This->ref;
    501502}
     
    506507 */
    507508static HRESULT WINAPI EnumConnectionsImpl_Next(IEnumConnections* iface,
    508                                                ULONG cConn, LPCONNECTDATA pCD,
    509                                                ULONG *pEnum)
     509                           ULONG cConn, LPCONNECTDATA pCD,
     510                           ULONG *pEnum)
    510511{
    511512  ICOM_THIS(EnumConnectionsImpl, iface);
     
    542543 */
    543544static HRESULT WINAPI EnumConnectionsImpl_Skip(IEnumConnections* iface,
    544                                                ULONG cSkip)
     545                           ULONG cSkip)
    545546{
    546547  ICOM_THIS(EnumConnectionsImpl, iface);
     
    576577 */
    577578static HRESULT WINAPI EnumConnectionsImpl_Clone(IEnumConnections* iface,
    578                                                 LPENUMCONNECTIONS *ppEnum)
     579                        LPENUMCONNECTIONS *ppEnum)
    579580{
    580581  ICOM_THIS(EnumConnectionsImpl, iface);
    581582  EnumConnectionsImpl *newObj;
    582583  TRACE("(%p)->(%p)\n", This, ppEnum);
    583  
     584
    584585  newObj = EnumConnectionsImpl_Construct(This->pUnk, This->nConns, This->pCD);
    585586  newObj->nCur = This->nCur;
     
    588589  return S_OK;
    589590}
    590  
     591
    591592static ICOM_VTABLE(IEnumConnections) EnumConnectionsImpl_VTable =
    592593{
     
    616617 */
    617618HRESULT CreateConnectionPoint(IUnknown *pUnk, REFIID riid,
    618                               IConnectionPoint **pCP)
     619                  IConnectionPoint **pCP)
    619620{
    620621  ConnectionPointImpl *Obj;
     
    624625  if(!Obj) return E_OUTOFMEMORY;
    625626
    626   hr = IConnectionPoint_QueryInterface((IConnectionPoint *)Obj, 
    627                                        &IID_IConnectionPoint, (LPVOID)pCP);
     627  hr = IConnectionPoint_QueryInterface((IConnectionPoint *)Obj,
     628                       &IID_IConnectionPoint, (LPVOID)pCP);
    628629  IConnectionPoint_Release((IConnectionPoint *)Obj);
    629630  return hr;
Note: See TracChangeset for help on using the changeset viewer.