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/ole32/compositemoniker.c

    r5602 r6648  
     1/* $Id: compositemoniker.c,v 1.2 2001-09-05 13:17:08 bird Exp $ */
    12/***************************************************************************************
    2  *                            CompositeMonikers implementation
     3 *                        CompositeMonikers implementation
    34 *
    45 *               Copyright 1999  Noomen Hamza
     
    2627    ICOM_VTABLE(IMoniker)*  lpvtbl1;  /* VTable relative to the IMoniker interface.*/
    2728
    28     /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 
     29    /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether
    2930     * two monikers are equal. That's whay IROTData interface is implemented by monikers.
    3031     */
     
    186187{
    187188    ICOM_THIS(CompositeMonikerImpl,iface);
    188  
     189
    189190    TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
    190191
    191192    /* Perform a sanity check on the parameters.*/
    192193    if ( (This==0) || (ppvObject==0) )
    193         return E_INVALIDARG;
    194  
     194    return E_INVALIDARG;
     195
    195196    /* Initialize the return parameter */
    196197    *ppvObject = 0;
     
    235236    ICOM_THIS(CompositeMonikerImpl,iface);
    236237    ULONG i;
    237    
     238
    238239    TRACE("(%p)\n",This);
    239240
     
    246247        for (i=0;i<This->tabLastIndex;i++)
    247248            IMoniker_Release(This->tabMoniker[i]);
    248        
     249
    249250        CompositeMonikerImpl_Destroy(This);
    250251
     
    263264    if (pClassID==NULL)
    264265        return E_POINTER;
    265            
     266
    266267    *pClassID = CLSID_CompositeMoniker;
    267        
     268
    268269    return S_OK;
    269270}
     
    292293    CLSID clsid;
    293294    WCHAR string[1]={0};
    294    
    295     ICOM_THIS(CompositeMonikerImpl,iface);   
     295
     296    ICOM_THIS(CompositeMonikerImpl,iface);
    296297
    297298    TRACE("(%p,%p)\n",iface,pStm);
     
    349350        /* resize the table if needed */
    350351        if (++This->tabLastIndex==This->tabSize){
    351                
     352
    352353            This->tabSize+=BLOCK_TAB_SIZE;
    353354            This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker));
     
    370371    IMoniker *pmk;
    371372    DWORD constant=3;
    372    
     373
    373374    TRACE("(%p,%p,%d)\n",iface,pStm,fClearDirty);
    374375
     
    445446    IMoniker *tempMk;
    446447    HRESULT res;
    447    
     448
    448449    TRACE("(%p,%p,%p)\n",This,pmkFirst,pmkRest);
    449450
     
    471472
    472473        IMoniker_Enum(pmkFirst,TRUE,&enumMoniker);
    473        
     474
    474475        while(IEnumMoniker_Next(enumMoniker,1,&This->tabMoniker[This->tabLastIndex],NULL)==S_OK){
    475476
    476477
    477478            if (++This->tabLastIndex==This->tabSize){
    478                
     479
    479480                This->tabSize+=BLOCK_TAB_SIZE;
    480481                This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker));
     
    491492
    492493    IMoniker_IsSystemMoniker(pmkRest,&mkSys);
    493    
     494
    494495    if (mkSys!=MKSYS_GENERICCOMPOSITE){
    495496
     
    498499        res=IMoniker_ComposeWith(This->tabMoniker[This->tabLastIndex-1],pmkRest,TRUE,&tempMk);
    499500
    500         if (res==MK_E_NEEDGENERIC){ 
     501        if (res==MK_E_NEEDGENERIC){
    501502
    502503            /* there's no simplification in this case */
     
    507508            IMoniker_AddRef(pmkRest);
    508509        }
    509         else if (tempMk==NULL){ 
     510        else if (tempMk==NULL){
    510511
    511512            /* we have an antimoniker after a simple moniker so we can make a simplification in this case */
     
    525526        /* resize tabMoniker if needed */
    526527        if (This->tabLastIndex==This->tabSize){
    527                
     528
    528529            This->tabSize+=BLOCK_TAB_SIZE;
    529530
     
    562563
    563564            if (This->tabLastIndex==This->tabSize){
    564                
     565
    565566                This->tabSize+=BLOCK_TAB_SIZE;
    566567
     
    605606    IMoniker *tempMk,*antiMk,*mostRigthMk;
    606607    IEnumMoniker *enumMoniker;
    607    
     608
    608609    TRACE("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvResult);
    609610
    610611    if (ppvResult==NULL)
    611612        return E_POINTER;
    612    
     613
    613614    *ppvResult=0;
    614615    /* If pmkToLeft is NULL, this method looks for the moniker in the ROT, and if found, queries the retrieved */
     
    634635        IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
    635636        IEnumMoniker_Release(enumMoniker);
    636        
     637
    637638        res=CreateAntiMoniker(&antiMk);
    638639        res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
    639640        IMoniker_Release(antiMk);
    640        
     641
    641642        res=CompositeMonikerImpl_BindToObject(mostRigthMk,pbc,tempMk,riid,ppvResult);
    642643
     
    669670
    670671    if (pmkToLeft!=NULL){
    671        
     672
    672673        IMoniker_Enum(iface,FALSE,&enumMoniker);
    673674        IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
    674675        IEnumMoniker_Release(enumMoniker);
    675        
     676
    676677        res=CreateAntiMoniker(&antiMk);
    677678        res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
    678679        IMoniker_Release(antiMk);
    679        
     680
    680681        res=CompositeMonikerImpl_BindToStorage(mostRigthMk,pbc,tempMk,riid,ppvResult);
    681682
     
    715716        IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
    716717        IEnumMoniker_Release(enumMoniker);
    717        
     718
    718719        res=CreateAntiMoniker(&antiMk);
    719720        res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
     
    732733        IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL);
    733734        IEnumMoniker_Release(enumMoniker);
    734        
     735
    735736        res=CreateAntiMoniker(&antiMk);
    736737        res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk);
     
    768769
    769770    if ((ppmkComposite==NULL)||(pmkRight==NULL))
    770         return E_POINTER;
     771    return E_POINTER;
    771772
    772773    *ppmkComposite=0;
     
    775776    /* otherwise, the method returns the result of combining the two monikers by calling the */
    776777    /* CreateGenericComposite function */
    777    
     778
    778779    if (fOnlyIfNotGeneric)
    779780        return MK_E_NEEDGENERIC;
    780    
     781
    781782    return CreateGenericComposite(iface,pmkRight,ppmkComposite);
    782783}
     
    793794    if (ppenumMoniker == NULL)
    794795        return E_POINTER;
    795    
     796
    796797    return EnumMonikerImpl_CreateEnumMoniker(This->tabMoniker,This->tabLastIndex,0,fForward,ppenumMoniker);
    797798}
     
    805806    IMoniker *tempMk1,*tempMk2;
    806807    HRESULT res1,res2,res;
    807    
     808
    808809    TRACE("(%p,%p)\n",iface,pmkOtherMoniker);
    809810
     
    817818    if (enumMoniker1==NULL)
    818819        return S_FALSE;
    819    
     820
    820821    IMoniker_Enum(iface,TRUE,&enumMoniker2);
    821822
     
    824825        res1=IEnumMoniker_Next(enumMoniker1,1,&tempMk1,NULL);
    825826        res2=IEnumMoniker_Next(enumMoniker2,1,&tempMk2,NULL);
    826        
     827
    827828        if((res1==S_OK)&&(res2==S_OK)){
    828829
     
    894895        /* If pmkToLeft is NULL, this method returns S_OK if pmkNewlyRunning is non-NULL and is equal */
    895896        /* to this moniker */
    896        
     897
    897898        if (pmkNewlyRunning!=NULL)
    898899
     
    912913            /* IMoniker::IsRunning on the rightmost component of the composite, passing the remainder of */
    913914            /* the composite as the pmkToLeft parameter for that call.                                   */
    914            
     915
    915916             res=IBindCtx_GetRunningObjectTable(pbc,&rot);
    916917
     
    956957    IMoniker *tempMk,*antiMk,*mostRigthMk;
    957958    IEnumMoniker *enumMoniker;
    958    
     959
    959960    TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pCompositeTime);
    960961
     
    10531054    IEnumMoniker *enumMoniker1,*enumMoniker2;
    10541055    ULONG i,nbCommonMk=0;
    1055    
     1056
    10561057    /* If the other moniker is a composite, this method compares the components of each composite from left  */
    10571058    /* to right. The returned common prefix moniker might also be a composite moniker, depending on how many */
     
    10601061    if (ppmkPrefix==NULL)
    10611062        return E_POINTER;
    1062    
     1063
    10631064    *ppmkPrefix=0;
    10641065
    10651066    if (pmkOther==NULL)
    10661067        return MK_E_NOPREFIX;
    1067    
     1068
    10681069    IMoniker_IsSystemMoniker(pmkOther,&mkSys);
    10691070
     
    11291130            IMoniker_Release(tempMk1);
    11301131            IMoniker_Release(tempMk2);
    1131            
     1132
    11321133            /* compose all common monikers in a composite moniker */
    11331134            for(i=0;i<nbCommonMk;i++){
     
    11401141
    11411142                IMoniker_Release(tempMk1);
    1142                
     1143
    11431144                *ppmkPrefix=tempMk2;
    11441145            }
     
    11811182    DWORD mkSys;
    11821183    HRESULT res1,res2;
    1183    
     1184
    11841185    *restMk=0;
    11851186
     
    12791280
    12801281    /* finds the common prefix of the two monikers */
    1281     res=IMoniker_CommonPrefixWith(iface,pmkOther,&commonMk);   
     1282    res=IMoniker_CommonPrefixWith(iface,pmkOther,&commonMk);
    12821283
    12831284    /* if there's no common prefix or the two moniker are equal the relative is the other moniker */
     
    13361337    if (ppszDisplayName==NULL)
    13371338        return E_POINTER;
    1338    
     1339
    13391340    *ppszDisplayName=CoTaskMemAlloc(sizeof(WCHAR));
    13401341
     
    13481349
    13491350    IMoniker_Enum(iface,TRUE,&enumMoniker);
    1350    
     1351
    13511352    while(IEnumMoniker_Next(enumMoniker,1,&tempMk,NULL)==S_OK){
    13521353
     
    14081409    if (!pwdMksys)
    14091410        return E_POINTER;
    1410    
     1411
    14111412    (*pwdMksys)=MKSYS_GENERICCOMPOSITE;
    14121413
     
    14451446{
    14461447    ICOM_THIS_From_IROTData(IMoniker, iface);
    1447    
     1448
    14481449    TRACE("(%p)\n",iface);
    14491450
     
    14691470{
    14701471    ICOM_THIS(EnumMonikerImpl,iface);
    1471  
     1472
    14721473    TRACE("(%p,%p,%p)\n",This,riid,ppvObject);
    14731474
    14741475    /* Perform a sanity check on the parameters.*/
    14751476    if ( (This==0) || (ppvObject==0) )
    1476         return E_INVALIDARG;
    1477  
     1477    return E_INVALIDARG;
     1478
    14781479    /* Initialize the return parameter */
    14791480    *ppvObject = 0;
     
    15201521    /* destroy the object if there's no more reference on it */
    15211522    if (This->ref==0){
    1522        
     1523
    15231524        for(i=0;i<This->tabSize;i++)
    15241525            IMoniker_Release(This->tabMoniker[i]);
     
    15471548    if (pceltFethed!=NULL)
    15481549        *pceltFethed= i;
    1549    
     1550
    15501551    if (i==celt)
    15511552        return S_OK;
     
    15651566
    15661567    This->currentPos+=celt;
    1567    
     1568
    15681569    return S_OK;
    15691570}
     
    16111612    if (currentPos > tabSize)
    16121613        return E_INVALIDARG;
    1613    
     1614
    16141615    /* Initialize the virtual function table. */
    16151616    ICOM_VTBL(newEnumMoniker)    = &VT_EnumMonikerImpl;
     
    16431644
    16441645/******************************************************************************
    1645  *        CreateGenericComposite        [OLE.55]
     1646 *        CreateGenericComposite    [OLE.55]
    16461647 ******************************************************************************/
    16471648HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite)
     
    16541655    if (ppmkComposite==NULL)
    16551656        return E_POINTER;
    1656    
     1657
    16571658    *ppmkComposite=0;
    16581659
     
    16921693
    16931694/******************************************************************************
    1694  *        MonikerCommonPrefixWith       [OLE.55]
     1695 *        MonikerCommonPrefixWith   [OLE.55]
    16951696 ******************************************************************************/
    16961697HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon)
Note: See TracChangeset for help on using the changeset viewer.