void UT_CMceEventReferMoEstablishedState::UT_CMceEventReferMoEstablishedState_HandleReceiveRequestL4L()
{
    // With contenttype, subscription state active && event
    RPointerArray<CSIPHeaderBase> hdrs;
    CSIPHeaderBase::PushLC( &hdrs );
    HBufC8* content = KContent().AllocLC();
    CSIPContentTypeHeader* ct = CSIPContentTypeHeader::DecodeL( KContentTypeRefer );
    CleanupStack::PushL( ct );
    // put content for coverage
    iMsgElem->SetContentL( content, ct );
    CleanupStack::Pop( ct );
    CleanupStack::Pop( content );

    CSIPSubscriptionStateHeader* ss = CSIPSubscriptionStateHeader::DecodeL( KSubscrStateActive );
    CleanupStack::PushL( ss );
    hdrs.AppendL( ss );
    CleanupStack::Pop( ss );

    CSIPEventHeader* e = CSIPEventHeader::DecodeL( KReferEventPackage );
    CleanupStack::PushL( e );
    hdrs.AppendL( e );
    CleanupStack::Pop( e );
    iMsgElem->SetUserHeadersL( hdrs );
    CleanupStack::Pop( &hdrs );
    iState->HandleReceiveRequestL( *iEvent );
    EUNIT_ASSERT( iReceived == ENotifyRequest );
    EUNIT_ASSERT(iEvent->EventContext().CurrentState()==
                 KMceEstablishedEventStateIndex);

}
void CTzUserDataTest::TestCreateUserDefinedTzL()
	{
	test.Next(_L("@SYMTestCaseID PIM-APPSERV-TZS-CO-0001 Create user-defined Time Zone"));

	// Offset 60 There is no DST 
	test.Printf(_L("Offset 60 There is no DST\n"));

	CTzId* id = CreateUserDefinedTzL(60, 60, ETrue);
	CleanupStack::PushL(id);
	iTzIds.AppendL(id);
	CleanupStack::Pop(id);

	// Offset - 60 There is no DST
	test.Printf(_L("Offset -60 There is no DST\n"));
	id = CreateUserDefinedTzL(-60, -60, ETrue);
	CleanupStack::PushL(id);
	iTzIds.AppendL(id);
	CleanupStack::Pop(id);
	
	// Offset 60 There is DST of 60
	id = CreateUserDefinedTzL(60, 120, ETrue);
	CleanupStack::PushL(id);
	iTzIds.AppendL(id);
	CleanupStack::Pop(id);

	// Offset - 60 There is DST of 60
	test.Printf(_L("Offset - 60 There is DST of 60\n"));
	id = CreateUserDefinedTzL(-60, 0, ETrue);
	CleanupStack::PushL(id);
	iTzIds.AppendL(id);
	CleanupStack::Pop(id);
	}
void UT_CMceEventReferMoEstablishedState::UT_CMceEventReferMoEstablishedState_HandleReceiveRequestL7L()
{
    // With contenttype, subscription state terminated && event && silent suppression
    iEvent->SetSilentSuppressionOn();
    RPointerArray<CSIPHeaderBase> hdrs;
    CSIPHeaderBase::PushLC( &hdrs );
    CSIPContentTypeHeader* ct = CSIPContentTypeHeader::DecodeL( KContentType );
    CleanupStack::PushL( ct );
    hdrs.AppendL( ct );
    CleanupStack::Pop( ct );

    CSIPSubscriptionStateHeader* ss = CSIPSubscriptionStateHeader::DecodeL( KSubscrStateTerminated );
    CleanupStack::PushL( ss );
    hdrs.AppendL( ss );
    CleanupStack::Pop( ss );

    CSIPEventHeader* e = CSIPEventHeader::DecodeL( KReferEventPackage );
    CleanupStack::PushL( e );
    hdrs.AppendL( e );
    CleanupStack::Pop( e );
    iMsgElem->SetUserHeadersL( hdrs );
    CleanupStack::Pop( &hdrs );
    iState->HandleReceiveRequestL( *iEvent );
    EUNIT_ASSERT( iReceived == ENoRequest );
    EUNIT_ASSERT( iEventState != CMceRefer::ETerminated );
    EUNIT_ASSERT(iEvent->EventContext().CurrentState()==
                 KMceTerminatedEventStateIndex );
}
Beispiel #4
0
void CViewManager::GetDefinitionsOfExistingViewsL(RPointerArray<CContactDefaultViewDefinition>& aViewDefs)
	{
	__ASSERT_DEBUG(aViewDefs.Count() == 0, User::Leave(KErrArgument));

	TInt i;
	CContactDefaultViewDefinition* viewDef;
	
	// Anonymous views.
	for (i = 0; i < iLocalViews.Count(); i++)
		{
		CContactLocalView* view = iLocalViews[i].iLocalView;
		viewDef = CContactDefaultViewDefinition::NewLC(CContactDefaultViewDefinition::ERemoteView,
														KNullDesC, view->SortOrderL(), 
														view->ContactViewPreferences(), 
														KNullDesC8/*pluginName*/);
		aViewDefs.AppendL(viewDef);
		CleanupStack::Pop(viewDef);
		}
	
	// Named views.
	for (i = 0; i < iNamedLocalViews.Count(); i++)
		{
		CContactNamedLocalView* view = iNamedLocalViews[i];
		viewDef = CContactDefaultViewDefinition::NewLC(CContactDefaultViewDefinition::ENamedRemoteView,
														view->Name(), view->SortOrderL(), 
														view->ContactViewPreferences(), 
														KNullDesC8/*pluginName*/);
		aViewDefs.AppendL(viewDef);
		CleanupStack::Pop(viewDef);		
		}
	}
// -----------------------------------------------------------------------------
// ReadArrayFromStringL
// Reads the array from the string
// -----------------------------------------------------------------------------
//
LOCAL_C void ReadArrayFromStringL( const TDesC8& aString,
                                   RPointerArray<HBufC8>& aArray )
    {
    RMemReadStream inRead( static_cast<const TAny*>( aString.Ptr() ), aString.Size() );
    TInt size = 0;
    HBufC8* addData = NULL;
    TPtr8 dataBuffer(NULL,0,0);
    CleanupClosePushL( inRead );


    aArray.ResetAndDestroy();


    for( TInt i = 0; i < aString.Size();)
        {
        // If there is not enough data to read the integer
        // it means that it's an old version and the whole thing is the
        // string since in previous versions only one string is stored
        if(( aString.Size() - i) < sizeof(TInt) )
            {
            aArray.ResetAndDestroy();
            addData = aString.AllocLC();
            aArray.AppendL( addData );
            CleanupStack::Pop();
            CleanupStack::PopAndDestroy(); // inRead
            return;
            }

        size = inRead.ReadInt32L();
        i += sizeof(TInt);

        // If the size is negative or the size left is not large enough
        // it means that it's an old version and the whole thing is the
        // string since in previous versions only one string is stored.
        if( size < 0 || size > ( aString.Size() - i ) )
            {
            aArray.ResetAndDestroy();
            addData = aString.AllocLC();
            aArray.AppendL( addData );
            CleanupStack::Pop();
            CleanupStack::PopAndDestroy(); // inRead
            return;
            }
        addData = HBufC8::NewMaxLC( size );

        // Set the read buffer:
        dataBuffer.Set(const_cast<TUint8*>(addData->Ptr()), 0, size);

        // Read the data:
        inRead.ReadL( dataBuffer );

        aArray.AppendL( addData );
        CleanupStack::Pop( addData );

        i += size;
        }
    CleanupStack::PopAndDestroy();
    return;
    }
Beispiel #6
0
void CCmdFind::DoRunL()
	{
	RFs& fs = FsL();
	iPath.SetIsDirectoryL();
	if (!iName)
		{
		LeaveIfErr(KErrArgument, _L("You must specify a name to match against"));
		}

	iSearchDirs.AppendL(iPath.AllocLC());
	CleanupStack::Pop();

	while (iSearchDirs.Count())
		{
		const TDesC& path = *iSearchDirs[0];

		TInt err;
		CDir* matchingFiles = NULL;
		iTempName.Copy(path);
		iTempName.AppendComponentL(*iName, TFileName2::EFile);
		// Look for files in this directory first
		err = fs.GetDir(iTempName, KEntryAttNormal|KEntryAttDir, ESortByName, matchingFiles);
		if (!err)
			{
			for (TInt i = 0; i < matchingFiles->Count(); i++)
				{
				const TEntry& entry = (*matchingFiles)[i];
				FoundFile(path, entry.iName, entry.IsDir());
				}
			}
		delete matchingFiles;

		// Then add all this dir's subdirectories to the list of ones to be scanned
		CDir* dirsToRecurse = NULL;
		err = fs.GetDir(path, KEntryAttDir|KEntryAttMatchExclusive, ESortNone, dirsToRecurse);
		if (!err)
			{
			CleanupStack::PushL(dirsToRecurse);
			for (TInt i = 0; i < dirsToRecurse->Count(); i++)
				{
				const TEntry& entry = (*dirsToRecurse)[i];
				iTempName.Copy(path);
				iTempName.AppendComponentL(entry);
				iSearchDirs.AppendL(iTempName.AllocLC());
				CleanupStack::Pop();
				}
			CleanupStack::PopAndDestroy(dirsToRecurse);
			}
		delete iSearchDirs[0];
		iSearchDirs.Remove(0);
		}
	}
// ---------------------------------------------------------------------------
// Creates and returns all the available trigger stores.
// ---------------------------------------------------------------------------
//
void LbtTriggerStoreFactory::CreateTriggerStoresL(RPointerArray<MLbtTriggerStore>& aStoreArray)
    {
    CleanupClosePushL(aStoreArray);
    CLbtDbTriggersManager* dbTriggerStore = CLbtDbTriggersManager::NewL();
    CleanupStack::PushL( dbTriggerStore );
    
    aStoreArray.AppendL( dbTriggerStore );
    
    CLbtRamTriggersManager* ramTriggerStore = CLbtRamTriggersManager::NewL();
    CleanupStack::PushL( ramTriggerStore );
    
    aStoreArray.AppendL( ramTriggerStore );
    
    CleanupStack::Pop( 3, &aStoreArray );
    }
	void RemoveContainerL()
	{
		if ( iContainer )
			{
				AppUi()->RemoveFromViewStack( *this, iContainer );
			}

		RPointerArray<MSettingFactory> deactivated;		
		for (TInt ordinal = 0; ordinal < iItemDefs.Count(); ordinal++)
			{
				TItemDef def = iItemDefs[ ordinal ];

				MSettingFactory* factory = def.iFactory;
				
				if ( deactivated.Find( factory) == KErrNotFound )
					{
						factory->DeactivateL();
						deactivated.AppendL( factory );
					}
			}
		deactivated.Close();


		delete iListbox;
		iListbox = NULL;
		
		if ( iSettingItemArray )
			iSettingItemArray->ResetAndDestroy();
		delete iSettingItemArray;
		iSettingItemArray = NULL;
		
		delete iContainer;
		iContainer = NULL;
	}
	void UpdateListBoxL()
    {
		iSettingItemArray->ResetAndDestroy();
		
		RPointerArray<MSettingFactory> activated;

		for (TInt ordinal = 0; ordinal < iItemDefs.Count(); ordinal++)
			{
				TItemDef def = iItemDefs[ ordinal ];

				MSettingFactory* factory = def.iFactory;
				
				if ( activated.Find( factory) == KErrNotFound )
					{
						factory->ActivateL();
						activated.AppendL( factory );
					}

				CAknSettingItem* item = factory->CreateItemL( def.iIdentifier, ordinal );
				iSettingItemArray->InsertL( ordinal, item );
				//item->SetParentListBox( iListbox );
			}
		
		activated.Close();

		iSettingItemArray->RecalculateVisibleIndicesL();
		// Calling HandleItemAdditional redraws whole list.
		iListbox->HandleItemAdditionL();
 		iListbox->UpdateScrollBarsL();
    }
// -----------------------------------------------------------------------------
// BufferToArrayL
// Created buffer will contain <amount of elements:int32, element data1, element data2...>
// -----------------------------------------------------------------------------
//
LOCAL_C RPointerArray<HBufC8> BufferToArrayL( TDesC8& aBuffer )
    {
    TInt32 count = 0;
    HBufC8* element = NULL;
    RPointerArray<HBufC8> array;
    TInt size = aBuffer.Size();
    RMemReadStream stream( (TAny*)( aBuffer.Ptr() ), size );
    CleanupClosePushL( stream );

    CleanupResetAndDestroyPushL( array );

    // amount of elements
    count = stream.ReadInt32L();

    // for each in RPointerArray
    for ( TInt i = 0; i < count; i++ )
        {
        // Read the element and append it to array
        element = HBufC8::NewLC( stream, KMaxElementLength );
        array.AppendL( element );
        CleanupStack::Pop( element );
        }

    CleanupStack::Pop( &array );
    CleanupStack::PopAndDestroy( &stream );

    return array;
    }
//1. make a copy(A) of supported oids
//2. set supported oids to list from config
//3. reset supported oids
//4. get supported oids(B)
//5. iterate over B, find and remove first match in A.  if not found we error
//6. if A is not empty we error
void CPkixCertResetSupportedOidsStep::PerformTestL()
	{
	CPkixCertStepBase::PerformTestL();
	
	//1. make a copy(A) of supported oids
	const RPointerArray<TDesC>& suppOids = iCertChain->SupportedCriticalExtensions();	
	//CleanupClosePushL(suppOids);	//don't need to do this as a ref and done in stepbase destructor
	RPointerArray<HBufC> startSuppOids;
	CleanupResetAndDestroy<RPointerArray<HBufC> >::PushL(startSuppOids);
		
	HBufC* des;
	TInt i;
	for (i=0; i < suppOids.Count(); ++i)
		{
		des = (suppOids[i])->AllocLC();
		startSuppOids.AppendL(des);
		CleanupStack::Pop(des);
		}

	//2. set supported oids to list from config
	iCertChain->SetSupportedCriticalExtensionsL(iProcessedOids);
	//3. reset supported oids
	iCertChain->ResetSupportedCriticalExtsToDefaultL();
	//4. get supported oids(B)
	const RPointerArray<TDesC>& suppOids2 = iCertChain->SupportedCriticalExtensions();
	
	//5. iterate over B, find and remove first match in A.  if not found we error
	TBool found;
	for (i=0; i < suppOids2.Count(); ++i)
		{
		found = EFalse;
		for (TInt j=0; j < startSuppOids.Count(); ++j)
			{
			if ((*suppOids2[i]) == (*startSuppOids[j]))
				{
				found = ETrue;
				delete (startSuppOids[j]);
				startSuppOids.Remove(j);
				break;
				}
			}
		if (!found)	
			{
			ERR_PRINTF2(_L("ERROR: Extra OID found in result: %S"), suppOids2[i]);
			User::Leave(KErrGeneral);
			}
		}
		
	//6. if A is not empty we error
	if (startSuppOids.Count() != 0)
		{
		for (TInt j=0; j < startSuppOids.Count(); ++j)
			{	
			ERR_PRINTF2(_L("ERROR: OID missing from result: %S"), startSuppOids[j]);
			}
		User::Leave(KErrGeneral);
		}		
	
	CleanupStack::PopAndDestroy(2, iCertChain);	
	}
void CMceComAudioCodec::DoDecodeAudioL( 
    TInt aCodecIndex,
    RPointerArray<CMceSrvStream>& aStreams,
    CMceComAudioStream& aAudio,
    CMceMediaManager& aManager )
    {
    if ( aCodecIndex == 0 || IS_RECEIVESTREAM( &aAudio ) )
        {
        SetEnabled( ETrue );
        }

    for( TInt sinkNdx = 0; sinkNdx < aAudio.Sinks().Count(); sinkNdx++ )
        {
        CMceSrvStream* srvStream = 
            CMceSrvStream::NewL( aManager, 
                                 aAudio, 
                                 *aAudio.Source(),
                                 *aAudio.Sinks()[ sinkNdx ],
                                 *this );
        CleanupStack::PushL( srvStream );
        MCEMM_DEBUG_STREAM( "CMceComAudioCodec::DoDecodeAudioL(): decoded audio", 
                            *srvStream );
        aStreams.AppendL( srvStream );
        CleanupStack::Pop( srvStream );
        } 
    }
Beispiel #13
0
void AppendArrayL(RPointerArray<T>& aTarget, RPointerArray<T>& aSource)
	{
	for (TInt i=0; i < aSource.Count(); ++i)
		{
		aTarget.AppendL(aSource[i]); 
		}
	}
// ---------------------------------------------------------------------------
// Loops over the requested messages noticing the ends of the message array
// ---------------------------------------------------------------------------
//
TBool CIpsPlgMsgIterator::NextL(
    TInt aStart,
    CMsvEntrySelection* aMessageEntries,
    TUint aCount,
    RPointerArray<CFSMailMessage>& aMessages)
    {
    FUNC_LOG;
    TInt i = aStart;
    TInt counter( 0 );
    CFSMailMessage* fsMsg;
        
    while (( counter < aCount ) && ( i < aMessageEntries->Count() ) )
        {
        const TMsvEmailEntry& entry( 
            iFolderEntry->ChildDataL( aMessageEntries->At(i) ) );
        if ( ( EDisconnectedDeleteOperation != entry.DisconnectedOperation() ) &&
        	(( entry.iMtm != KSenduiMtmImap4Uid )  || !entry.DeletedIMAP4Flag() ) &&
        	 ( entry.iType == KUidMsvMessageEntry ) )
            {
            fsMsg = iMsgMapper->GetMailMessageL( iMailboxId, entry, 
                iRequestedDetails );
            aMessages.AppendL( fsMsg );
            counter++;
            }
        i++;
        }
    
    return ( i < aMessageEntries->Count() );
    }
// -----------------------------------------------------------------------------
// CSIPParamContainerBase::ToTextLC
// -----------------------------------------------------------------------------
//
HBufC8* CSIPParamContainerBase::ToTextLC () const
	{
	TUint encodedLength = 0;

	RPointerArray<HBufC8> paramsAsText;
	CleanupStack::PushL (TCleanupItem(ResetAndDestroy,&paramsAsText));

	for (TInt i=0; i < iParams.Count(); i++)
		{
		HBufC8* paramAsText = iParams[i]->ToTextLC();
		encodedLength += paramAsText->Length();
		if (i < iParams.Count()-1) 
		    {
		    encodedLength += 1; // param separator
		    }
		paramsAsText.AppendL(paramAsText);
		CleanupStack::Pop(paramAsText);
		}
	
	HBufC8* encodedParams = HBufC8::NewL (encodedLength);
	TPtr8 encodedParamsPtr = encodedParams->Des();

	for (TInt j=0; j < paramsAsText.Count(); j++)
		{
		encodedParamsPtr.Append (*paramsAsText[j]);
		if (j < paramsAsText.Count()-1)
			{
			encodedParamsPtr.Append(iParamSeparator);
			}
		}

	CleanupStack::PopAndDestroy(1); // paramsAsText
	CleanupStack::PushL(encodedParams);
	return encodedParams;
	}
// -----------------------------------------------------------------------------
// CMceComAudioStream::UpdateL
// -----------------------------------------------------------------------------
//
void CMceComAudioStream::UpdateL( CMceComMediaStream& aStream )
    {  
    CMceComMediaStream::UpdateL( aStream );

    CMceComAudioStream* stream = static_cast<CMceComAudioStream*>( &aStream );
    
    RPointerArray<CMceComAudioCodec> updated;
    
    MceCleanupResetAndDestroyPushL( updated );

    for ( TInt i = 0 ; i < stream->CodecCount() ; ++i )
        {
        CMceComAudioCodec* update = stream->CodecL( i );
        TBool isUpdated = EFalse;
        TInt j = 0;

        while( !isUpdated && j < CodecCount() )
            {
            CMceComAudioCodec* codec = CodecL( j );
            if ( codec->Id() == update->Id() )
                {
                codec->UpdateL( *update );
                stream->RemoveCodecFromListL( i );
                delete update;
                updated.AppendL( codec );
                RemoveCodecFromListL( j );
                i--;
                isUpdated = ETrue;
                }
            j++;
            }
        }
        
    if ( CodecCount() > 0 )	//	Codecs have been removed
        {
        Session()->IsStructureChanged() = ETrue;
        }
        
    DestroyCodecs();
    
    while( updated.Count() > 0 )
        {
        AddCodecL( updated[0] );
        updated.Remove( 0 );
        }
        
    CleanupStack::PopAndDestroy();	// updated
            
    if ( stream->CodecCount() > 0 )	// Streams have been added
        {
        Session()->IsStructureChanged() = ETrue;
            
        while( stream->CodecCount() > 0 )
            {
            CMceComAudioCodec* add = stream->CodecL( 0 );
            AddCodecL( add );
            stream->RemoveCodecFromListL( 0 );
            }
        }
    }
void UT_CFCSession::UT_CFCSession_IsFmtAttributeValid2L()
	{
	RPointerArray<CSdpFmtAttributeField>* atts = 
	    new (ELeave) RPointerArray<CSdpFmtAttributeField>(1);
    CleanupStack::PushL(atts);
  
	CSdpFmtAttributeField* fmtatt = CSdpFmtAttributeField::DecodeLC(KInvalid4);
	atts->AppendL(fmtatt);
	
	iFCSession->SetFormatAttributeFieldsL(atts);
	RPointerArray<CSdpFmtAttributeField>& temparray=iFCSession->FormatAttributeFields();

	TInt temp;
	for (TInt aCount=0; aCount < temparray.Count(); aCount++)
    	{
    		if (fmtatt == temparray[ aCount ])
    		{
    			temp=aCount;
    		}
    	}
    EUNIT_ASSERT(iFCSession->IsFmtAttributeValid()==false)
	EUNIT_PRINT(_L( "test is fmtAttributeValid"));
	
	temparray.Close();
	CleanupStack::Pop(fmtatt);//fmtatt
	atts->Close();
	CleanupStack::Pop(atts);//atts
    }
void CSenLayeredXmlProperties::ElementsL(RPointerArray<CSenElement>& aProps) const
    {
    if ( ipChildProperties )
        {
        ipChildProperties->ElementsL(aProps);
        }
            
    RPointerArray<CSenElement>& elements = ipFragment->AsElement().ElementsL();
    TInt elementCount(elements.Count());
    TInt propsCount(0);
    TBool found;
    for (TInt i=0; i<elementCount; i++)
        {
        found = EFalse;
        propsCount = aProps.Count();
        for (TInt j=0; j<propsCount; j++)
            {
             if ( elements[i]->LocalName() == aProps[j]->LocalName() )
                {
                found = ETrue;
                break;
                }
            }
        if ( !found )
            {
#ifdef EKA2
            aProps.AppendL(elements[i]);
#else
            User::LeaveIfError(aProps.Append(elements[i]));
#endif
            }
        }
    }
// -----------------------------------------------------------------------------
// CSIPSupportedHeader::BaseDecodeL
// -----------------------------------------------------------------------------
//
RPointerArray<CSIPHeaderBase> 
CSIPSupportedHeader::BaseDecodeL (const TDesC8& aValue)
	{
	RPointerArray<CSIPHeaderBase> headers;
    CSIPHeaderBase::PushLC(&headers);
	TLex8 lex(aValue);
	lex.SkipSpace();
	if (lex.Remainder().Length() > 0)
		{
		CSIPTokenizer* tokenizer = CSIPTokenizer::NewLC(aValue, ',');
		for (TInt i=0; i < tokenizer->Tokens().Count(); i++)
			{
			CSIPSupportedHeader* header = new(ELeave)CSIPSupportedHeader;
			CleanupStack::PushL(header);
			header->ConstructL(tokenizer->Tokens()[i]);
			User::LeaveIfError (headers.Append(header));
			CleanupStack::Pop(header);
			}
		CleanupStack::PopAndDestroy(tokenizer);
		}
	else
		{
		CSIPSupportedHeader* header = new(ELeave)CSIPSupportedHeader;
		CleanupStack::PushL(header);
		header->ConstructL(KNullDesC8,ETrue);
		headers.AppendL(header);
		CleanupStack::Pop(header);
		}
	CleanupStack::Pop(); // headers 
	return headers;
	}	
// ---------------------------------------------------------------------------
// CPresenceConfigurationItem::CollectSubscriptionPifWithoutCtxL()
// ---------------------------------------------------------------------------
//
EXPORT_C CPresenceInfoFilterImp* 
    CPresenceConfigurationItem::CollectConfigurationPifWithoutCtxL( 
                                                        MXIMPPscContext* aContext )
    {
    TRACE(_L("CPresenceConfigurationItem::CollectSubscriptionPifWithoutCtxL" ) );
    RPointerArray< CPresenceInfoFilterImp > arrayOfPifs;
    CleanupClosePushL( arrayOfPifs );
    
    TInt count = iConfigContexts.Count();
    for( TInt a = 0; a < count; ++a )
        {
        if( iConfigContexts[ a ] != aContext )
            {
            CPresenceInfoFilterImp* filter = iConfigContexts[ a ]->PresenceInfoFilter( 
                        MXIMPPscContext::EGrantPresenceToPresentityFilter, iIdentity );
            if ( filter )
                {
                arrayOfPifs.AppendL( filter );
                }
            }        
        }
    CPresenceInfoFilterImp* pifWithoutCtx = DocumentUtils::InfoFilterUnionL( arrayOfPifs );    
    CleanupStack::PopAndDestroy(); // arrayOfPifs
    return pifWithoutCtx;
    }
// ---------------------------------------------------------------------------
// CAccPolAudioUnitBase::GetAudioControlsL
// ---------------------------------------------------------------------------
//
EXPORT_C void CAccPolAudioUnitBase::GetAudioUnitListL(
    RPointerArray<CAccPolAudioUnitBase>& aAudioUnits ) const
    {
    API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolAudioUnitBase::GetAudioUnitListL() - Enter" );
    RPointerArray<CAccPolAudioUnitBase> audioUnits;

    reinterpret_cast<CAccPolAudioTopologyObjectCon*> ( iObjectContainer )->GetAudioUnitsL(
        audioUnits );
    TInt audioUnitCount = audioUnits.Count();
    TInt sourceIdCount = iSourceId.Count();
    API_TRACE_1( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolAudioUnitBase::GetAudioUnitListL() - Source id count=%d", sourceIdCount );
    for( TInt i = 0; i < sourceIdCount; i++ )
        {
        for( TInt j = 0; j < audioUnitCount; j++ )
            {
            if( iSourceId.operator[]( i )
                == audioUnits.operator[]( j )->UnitId() )
                {
                aAudioUnits.AppendL( audioUnits.operator[]( j ) );
                audioUnits.operator[]( j )->SetPreviousUnitId( UnitId() ); //JNI               
                }
            }
        }
    API_TRACE_( "[AccFW: ACCPOLAUDIODEVICETOPOLOGY] CAccPolAudioUnitBase::GetAudioUnitListL() - Return" );
    }
// ----------------------------------------------------------------------------
// CSIPClientResolver::AddClientDataL
// ----------------------------------------------------------------------------
//
void CSIPClientResolver::AddClientDataL( 
    RPointerArray< CSIPClientData >& aRegistry,
    CImplementationInformation& aInfo, 
    TBool aRomClient )
    {
	TLex8 lex( aInfo.DataType() );
    TUint32 uidValue( 0 );
    User::LeaveIfError( lex.Val( uidValue, EHex ) );
    TUid clientUid;
    clientUid.iUid = uidValue;     
    const TBool romBased = ( aRomClient && aInfo.RomBased() );
    TPtrC8 xml( aInfo.OpaqueData() );
    const TBool dynamicCaps = ( xml.Length() == 0 );
    
    CSIPClientData* clientData = 
        CSIPClientData::NewLC( aInfo.ImplementationUid(), clientUid,
                               romBased, dynamicCaps );    
    if ( !dynamicCaps )
        {
        // XML specified in resource-file.
        iClientDataParser->ParseL( clientData, xml );
        }
    aRegistry.AppendL( clientData );
    CleanupStack::Pop( clientData );
    }
// -----------------------------------------------------------------------------
// CUpnpSecurityDbConnection::GetAllFilenamesL
// Get all filenames. 
// -----------------------------------------------------------------------------
//
void CUpnpSecurityDbConnection::GetAllFilenamesL(
    RPointerArray<HBufC>& aFilenameArray )
    {
    TInt err;
    RSqlStatement statement;
    User::LeaveIfError( statement.Prepare( iDatabase, KUpnpSecSqlSelectAllFiles ) );
    CleanupClosePushL( statement );

    TInt columnIndex = statement.ColumnIndex( KUpnpSecSqlFilename );

    while ( (err = statement.Next()) == KSqlAtRow )
        {
        TPtrC data = statement.ColumnTextL( columnIndex );
        HBufC* filename = data.AllocLC();
        aFilenameArray.AppendL( filename );
        CleanupStack::Pop( filename );
        }

    if ( err != KSqlAtEnd )
        {
        User::LeaveIfError( err );
        }

    CleanupStack::PopAndDestroy( &statement );
    }
void CDummyCalendarApp::RepeatExceptedEntryEditInstancesL(
    RPointerArray<CCalInstance>& aInstances )
	{
	CleanupResetAndDestroyPushL(aInstances);	
	
	// Delete all entries.
	iEntries.ResetAndDestroy();
	
	TTime start(TDateTime(2006, EMarch, 6, 10, 0, 0, 0));
	TTime end(TDateTime(2006, EMarch, 6, 14, 0, 0, 0));	
	
	// Re-create all the entries that previously existed.
	CCalEntry* entry = NULL;
	for (TUint i = 0; i < aInstances.Count(); ++i)
		{
		HBufC8* guid = KGUIDInc081869().AllocLC();	
		entry = CCalEntry::NewL( CCalEntry::EAppt, guid, CCalEntry::EMethodAdd,
		    i, aInstances[i]->Time(), CalCommon::EThisOnly );
		CleanupStack::Pop( guid );
		iEntries.AppendL( entry );
		
		SetEntryStartAndEndTimeL(entry, start, end);		
		}
	
	CleanupStack::PopAndDestroy(&aInstances);
	
	// Store the entries again, there should be 2.
	TInt entriesStored = 0;
	SynCGetEntryViewL().StoreL(iEntries, entriesStored);
	test(entriesStored == iEntries.Count());
	}
void CCalCategoryManagerImpl::GetFilteredEntryL(CArrayFixSeg<TAgnEntryId>& aEntryId, RPointerArray<CCalEntry>& aEntries, CCalSessionImpl& aCalSessionImpl)
	{// Get the light entry by its entry id and fill in it into the array past in by the client
	aCalSessionImpl.Server().FilterCategoryL(aEntryId, aCalSessionImpl.FileId());
	TInt count=aEntryId.Count();
	for (TInt ii=0;ii<count;++ii)
		{
		CAgnSimpleEntry* simpleEntry=aCalSessionImpl.Server().GetSimpleEntryL(aEntryId[ii], aCalSessionImpl.CollectionId());
		if (simpleEntry)
			{
			TCleanSimpleEntry simpleEntryCleanupItem(*simpleEntry, aCalSessionImpl.Server().SimpleEntryAllocator());
			CleanupStack::PushL(TCleanupItem(TCleanSimpleEntry::DestroySimpleEntry, &simpleEntryCleanupItem));
			CCalLiteEntry* liteEntry = CCalLiteEntry::NewL(*simpleEntry, aCalSessionImpl.Server());
			CleanupStack::Pop();
			CleanupStack::PushL(liteEntry);
			CCalEntryImpl* entryImpl = CCalEntryImpl::NewL(*liteEntry, aCalSessionImpl);
			CleanupStack::Pop(liteEntry);
			CleanupStack::PushL(entryImpl);
			CCalEntry* entry=CCalEntry::NewL(entryImpl);
			CleanupStack::Pop(entryImpl);
			CleanupStack::PushL(entry);
			aEntries.AppendL(entry);
			CleanupStack::Pop(entry);
			}		
		}
	}
// ---------------------------------------------------------
// CPosLmLocalDatabaseManager::ListDatabasesL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosLmLocalDatabaseManager::ListDatabasesL(
    RPointerArray<HPosLmDatabaseInfo>& aDatabaseInfoArray)
    {
    // list URIs
    CDesCArray* dbUriArray = ListDatabasesLC();
    // list registered databases
    Session().ListDatabasesL(aDatabaseInfoArray, KFileProtocol);
    // delete from URI list those databases that are registered
    for (TInt i = aDatabaseInfoArray.Count() - 1; i >= 0; i--)
        {
        TInt index;
        if (dbUriArray->Find(aDatabaseInfoArray[i]->DatabaseUri(), index) == 0)
            {
            dbUriArray->Delete(index);
            }
        }

    // for each remaining URI in the list, fill in database info
    // and add to list
    TInt count = dbUriArray->Count();
    for (TInt i = 0; i < count; i++)
        {
        HPosLmDatabaseInfo* info = HPosLmDatabaseInfo::NewLC((*dbUriArray)[i]);
        aDatabaseInfoArray.AppendL(info);
        CleanupStack::Pop(info); // transfer of ownership to array
        }

    CleanupStack::PopAndDestroy(dbUriArray);
    // database drive, database media and default flag
    // will be filled in by database management provider.
    }
// -----------------------------------------------------------------------------
// CWPInternetAPDB::ReadItemsL
// -----------------------------------------------------------------------------
// 
void CSCOMOAdapterDb::ReadItemsL(RPointerArray<CAMDbItem>& aItemArray,
        TDesC& aSqlQuery)
    {

    RDbView view;
    view.Prepare(iDatabase, TDbQuery(aSqlQuery));
    CleanupClosePushL(view);
    view.EvaluateAll();
    view.FirstL();

    while (view.AtRow())
        {
        view.GetL();

        CAMDbItem *dbitem = new(ELeave) CAMDbItem;
        dbitem->id = view.ColInt(1);
        dbitem->iLUID = view.ColInt(2);
        dbitem->iProfileId = view.ColInt(3);

        dbitem->iServerID = (view.ColDes8(4)).AllocL();
        dbitem->iCorrelator = (view.ColDes8(5)).AllocL();
        dbitem->iSourceURI = (view.ColDes8(6)).AllocL();

        dbitem->iRetryCount = view.ColInt(7);

        aItemArray.AppendL(dbitem);
        view.NextL();
        }

    CleanupStack::PopAndDestroy(); // view

    }
void CMceSrvStream::DecodeVideoL( RPointerArray<CMceSrvStream>& aStreams,
                                  CMceComVideoStream& aVideo,
                                  CMceMediaManager& aManager )
    {
    MCEMM_DEBUG("CMceSrvStream::DecodeVideoL(), Entry ");
    
    for( TInt codecNdx = 0;codecNdx < aVideo.CodecCount();codecNdx++ )
        {
        aVideo.CodecL( codecNdx )->SetEnabled( 
            codecNdx == 0 || IS_RECEIVESTREAM( &aVideo ) );
            
        for( TInt sinkNdx = 0 ; sinkNdx < aVideo.Sinks().Count() ; sinkNdx++ )
            {
            CMceSrvStream* srvStream = NewL( aManager, aVideo, 
                                             *aVideo.Source(),
                                             *aVideo.Sinks()[ sinkNdx ],
                                             *aVideo.CodecL( codecNdx ) );
                CleanupStack::PushL( srvStream );
                MCEMM_DEBUG_STREAM( "CMceSrvStream::DecodeVideoL(): decoded video", *srvStream );
                aStreams.AppendL( srvStream );
                CleanupStack::Pop( srvStream );
            }
        }
    if ( aVideo.BoundStream() && aVideo.Binder() )
        {
        DecodeL( aStreams, aVideo.BoundStreamL(), aManager );
        }
    MCEMM_DEBUG("CMceSrvStream::DecodeVideoL(), Exit ");
    }
// -----------------------------------------------------------------------------
// AppendItemsArrayL
// -----------------------------------------------------------------------------
//
void AppendItemsToArrayL( const TArray<MCLFItem*>& aSourceArray,
                          RPointerArray<MCLFItem>& aDestArray )
{
    for( TInt i = aSourceArray.Count() - 1; i >=0; i--)
    {
        aDestArray.AppendL( aSourceArray[ i ] );
    }
}
//<qmail>
// -----------------------------------------------------------------------------
// CFSMailMessage::SaveMessagePartsL
// -----------------------------------------------------------------------------
EXPORT_C TInt CFSMailMessage::SaveMessagePartsL( MFSMailRequestObserver& aOperationObserver )
{
    NM_FUNCTION;

    RPointerArray<CFSMailMessagePart> messageParts;
    CleanupResetAndDestroyPushL(messageParts);
    
    CFSMailMessagePart *plainTextPart = PlainTextBodyPartL(EDataSourceLocal);
    if (plainTextPart)
        {
        messageParts.AppendL(plainTextPart);
        }
    CFSMailMessagePart *htmlPart = HtmlBodyPartL(EDataSourceLocal);
    if (htmlPart)
        {
        messageParts.AppendL(htmlPart);
        }
        
    TFSPendingRequest request;
    request.iRequestId = 0;
    if (CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetMessageId()))
        {
        request = iRequestHandler->InitAsyncRequestL(
                         GetMessageId().PluginId(), aOperationObserver);
        MFSMailRequestObserver* observer = request.iObserver;
        // Ownership of parts array is transferred to plugin - it will take care about reseting them
        TRAPD(err, plugin->StoreMessagePartsL(messageParts, *observer,
                request.iRequestId));
        if(err != KErrNone)
            {
            iRequestHandler->CompleteRequest(request.iRequestId);
            User::Leave(err);
            }
        // message parts array removed from CleanupStack (not destroyed)
        CleanupStack::Pop(1, &messageParts);
        }
    else
        {
        // message parts array removed from CleanupStack and destroyed
        CleanupStack::PopAndDestroy(1, &messageParts);
        User::Leave(KErrNotFound);
        }

    return request.iRequestId;
}