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

Added $Id:$ keyword.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/quartz/iunk.c

    r6578 r6649  
     1/* $Id: iunk.c,v 1.3 2001-09-05 13:36:37 bird Exp $ */
    12/*
    23 * An implementation of IUnknown.
     
    2122IUnknown_fnQueryInterface(IUnknown* iface,REFIID riid,LPVOID *ppobj)
    2223{
    23         ICOM_THIS(QUARTZ_IUnkImpl,iface);
    24         size_t  ofs;
    25         DWORD   dwIndex;
     24    ICOM_THIS(QUARTZ_IUnkImpl,iface);
     25    size_t  ofs;
     26    DWORD   dwIndex;
    2627
    27         TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
     28    TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
    2829
    29         if ( ppobj == NULL )
    30                 return E_POINTER;
    31         *ppobj = NULL;
     30    if ( ppobj == NULL )
     31        return E_POINTER;
     32    *ppobj = NULL;
    3233
    33         ofs = 0;
     34    ofs = 0;
    3435
    35         if ( IsEqualGUID( &IID_IUnknown, riid ) )
    36         {
    37                 TRACE("IID_IUnknown - returns inner object.\n");
    38         }
    39         else
    40         {
    41                 for ( dwIndex = 0; dwIndex < This->dwEntries; dwIndex++ )
    42                 {
    43                         if ( IsEqualGUID( This->pEntries[dwIndex].piid, riid ) )
    44                         {
    45                                 ofs = This->pEntries[dwIndex].ofsVTPtr;
    46                                 break;
    47                         }
    48                 }
    49                 if ( dwIndex == This->dwEntries )
    50                 {
    51                         FIXME("unknown interface: %s\n",debugstr_guid(riid));
    52                         return E_NOINTERFACE;
    53                 }
    54         }
     36    if ( IsEqualGUID( &IID_IUnknown, riid ) )
     37    {
     38        TRACE("IID_IUnknown - returns inner object.\n");
     39    }
     40    else
     41    {
     42        for ( dwIndex = 0; dwIndex < This->dwEntries; dwIndex++ )
     43        {
     44            if ( IsEqualGUID( This->pEntries[dwIndex].piid, riid ) )
     45            {
     46                ofs = This->pEntries[dwIndex].ofsVTPtr;
     47                break;
     48            }
     49        }
     50        if ( dwIndex == This->dwEntries )
     51        {
     52            FIXME("unknown interface: %s\n",debugstr_guid(riid));
     53            return E_NOINTERFACE;
     54        }
     55    }
    5556
    56         *ppobj = (LPVOID)(((char*)This) + ofs);
    57         IUnknown_AddRef((IUnknown*)(*ppobj));
     57    *ppobj = (LPVOID)(((char*)This) + ofs);
     58    IUnknown_AddRef((IUnknown*)(*ppobj));
    5859
    59         return S_OK;
     60    return S_OK;
    6061}
    6162
     
    6364IUnknown_fnAddRef(IUnknown* iface)
    6465{
    65         ICOM_THIS(QUARTZ_IUnkImpl,iface);
     66    ICOM_THIS(QUARTZ_IUnkImpl,iface);
    6667
    67         TRACE("(%p)->()\n",This);
     68    TRACE("(%p)->()\n",This);
    6869
    69         return ++(This->ref);
     70    return ++(This->ref);
    7071}
    7172
     
    7374IUnknown_fnRelease(IUnknown* iface)
    7475{
    75         ICOM_THIS(QUARTZ_IUnkImpl,iface);
     76    ICOM_THIS(QUARTZ_IUnkImpl,iface);
    7677
    77         TRACE("(%p)->()\n",This);
    78         if ( (--(This->ref)) > 0 )
    79                 return This->ref;
     78    TRACE("(%p)->()\n",This);
     79    if ( (--(This->ref)) > 0 )
     80        return This->ref;
    8081
    81         QUARTZ_FreeObj(This);
     82    QUARTZ_FreeObj(This);
    8283
    83         return 0;
     84    return 0;
    8485}
    8586
    8687static ICOM_VTABLE(IUnknown) iunknown =
    8788{
    88         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    89         /* IUnknown fields */
    90         IUnknown_fnQueryInterface,
    91         IUnknown_fnAddRef,
    92         IUnknown_fnRelease,
     89    ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     90    /* IUnknown fields */
     91    IUnknown_fnQueryInterface,
     92    IUnknown_fnAddRef,
     93    IUnknown_fnRelease,
    9394};
    9495
     
    9697void QUARTZ_IUnkInit( QUARTZ_IUnkImpl* pImpl, IUnknown* punkOuter )
    9798{
    98         TRACE("(%p)\n",pImpl);
     99    TRACE("(%p)\n",pImpl);
    99100
    100         ICOM_VTBL(pImpl) = &iunknown;
    101         pImpl->pEntries = NULL;
    102         pImpl->dwEntries = 0;
    103         pImpl->ref = 1;
    104         pImpl->punkControl = (IUnknown*)pImpl;
     101    ICOM_VTBL(pImpl) = &iunknown;
     102    pImpl->pEntries = NULL;
     103    pImpl->dwEntries = 0;
     104    pImpl->ref = 1;
     105    pImpl->punkControl = (IUnknown*)pImpl;
    105106
    106         /* for delegation. */
    107         if ( punkOuter != NULL )
    108                 pImpl->punkControl = punkOuter;
     107    /* for delegation. */
     108    if ( punkOuter != NULL )
     109        pImpl->punkControl = punkOuter;
    109110}
    110111
Note: See TracChangeset for help on using the changeset viewer.