void CPolicyStore::ConnectionMethodsLC(
    RArray<TUint32>& aVpnConnections,
    RCmManager& aCmManager,
    const TVpnPolicyId& aPolicyId,
    TBool& aPolicyActive)
    {
using namespace CMManager;         
    LOG_1("CPolicyStore::ConnectionMethodsLC : %S", &aPolicyId);
    CleanupClosePushL( aVpnConnections );

    aCmManager.ConnectionMethodL( 
        aVpnConnections,
        ETrue,
        EFalse,
        EFalse ); 
    LOG_1("CPolicyStore::ConnectionMethodsLC cnt: %d", 
        aVpnConnections.Count());
    
    TInt index(aVpnConnections.Count());
    
    while( index )
        {
        --index;
        LOG_1("CPolicyStore::ConnectionMethodsLC at: %d", index);
        TUint32 id(aVpnConnections[index]);
        RCmConnectionMethod connectioMethod = 
            aCmManager.ConnectionMethodL( id );
        CleanupClosePushL( connectioMethod );  
        if( connectioMethod.GetIntAttributeL(ECmBearerType) != 
            KPluginVPNBearerTypeUid )
            {
            aVpnConnections.Remove( index );
            }
        else
            {
            HBufC* policyId = connectioMethod.GetStringAttributeL(
                EVpnServicePolicy);
            if( aPolicyId.Compare( *policyId ) )
                {
                aVpnConnections.Remove( index );
                }
            else
                {
                if( connectioMethod.GetBoolAttributeL(ECmConnected) )
                    {
                    LOG_1("PolicyActiveL:%d", index);
                    aPolicyActive = ETrue;
                    }
                }
            delete policyId;      
            }
        CleanupStack::PopAndDestroy(); // connectioMethod 
        }
    }
Beispiel #2
0
/**
    Setup dir structure for testing and verifying functional results
    @param	datastr			data structure to setup directory
    @param  iOperation   	Operation to be performed 
    @param  SrcDrive		Source drive
    @param	Targetdrive		Target drive input
    @panic					if data structure definition is incorrect
*/
void SetupDirFiles(const TDesC& aPath, const TDirSetupFiles& aDirFiles)
	{
	TFileName path = aPath;
	if (path.Length() == 0)
		{
		test.Printf(_L("ERROR<SetupDirFiles()>: Zero length src path!\n"));
		test(EFalse);
		}
	
	MakeDir(path);
	
	RArray<TInt> addBlockDataArray;
	RArray<TInt> deductBlockDataArray;
	
	ParsingDirDataBlock(aDirFiles.iAddingBlock, addBlockDataArray);
	ParsingDirDataBlock(aDirFiles.iDeductBlock, deductBlockDataArray);
	
	if (addBlockDataArray.Count() == 0)
	// empty dir setup
		{
		return;
		}
	for (TInt i = 0; i < deductBlockDataArray.Count(); ++i)
		{
		TInt idxToDelete = addBlockDataArray.FindInOrder(deductBlockDataArray[i]);
		if (idxToDelete >= 0)
			{
			addBlockDataArray.Remove(idxToDelete);
			}
		else if (idxToDelete == KErrNotFound)
			{
			continue;
			}
		else
			{
			test.Printf(_L("ERROR<<SetupDir>>: wrong dir data setup! err=%d\n"), idxToDelete);
			test(EFalse);
			}
		}
	if (addBlockDataArray.Count() > 0)
		{
		for (TInt i = 0; i < addBlockDataArray.Count(); ++i)
			{
			TInt idx = addBlockDataArray[i];
			path = aPath;
			path += gDirPatterns[idx];
			if (path[path.Length() - 1] == '\\')
				{
				MakeDir(path);
				}
			else
				{
				MakeFile(path, _L8("blahblah"));
				}
			}
		}
	
	addBlockDataArray.Reset();
	deductBlockDataArray.Reset();
	}
void UT_CIceValidList::UT_CICEValidList_HasPairForComponentsL()
    {
    RArray<TUint> components;
    CleanupClosePushL( components );
    
    components.AppendL( 5 );
    EUNIT_ASSERT( 
        EFalse == iValidList->HasPairForComponents( components ) );
    
    UT_CICEValidList_AddValidPairLL();
    EUNIT_ASSERT( 
        EFalse == iValidList->HasPairForComponents( components ) );
    components.AppendL( KComponentIdRtp );
    EUNIT_ASSERT( 
        EFalse == iValidList->HasPairForComponents( components ) );
    components.Remove( 0 );
    EUNIT_ASSERT( 
        ETrue == iValidList->HasPairForComponents( components ) );
    
    components.Reset();
    EUNIT_ASSERT_PANIC( 
        iValidList->HasPairForComponents( components ), "USER", 0 );
    
    CleanupStack::PopAndDestroy( &components );
    }
// ---------------------------------------------------------------------------
// Find entry ids of given properties.
// ---------------------------------------------------------------------------
//
EXPORT_C TInt CCenRepDatabaseUtil::FindEntryIdsFromPropertiesL( 
    const RIpAppPropArray& aPropertyArray, 
    RArray<TInt>& aEntryIds )
    {
    //CENREPDATABASELOG( "CCenRepDatabaseUtil::FindEntryIdsFromPropertiesL - IN" );
    
    TInt err = FindEntryIdsL( aEntryIds );
    if( err == KErrNone )
        {
        TInt count = aEntryIds.Count();
        TInt removed = 0;
        
        for( TInt i = 0; i < count; i++ )
            {
            TBool ok = EFalse;
            TUint32 entryId = aEntryIds[ i - removed ];
            CheckEntryHasPropertiesL( entryId, aPropertyArray, ok );
            
            if( !ok )
                {
                aEntryIds.Remove( i - removed );
                removed++;
                }
            }
        }
        
    //CENREPDATABASELOG( "CCenRepDatabaseUtil::FindEntryIdsFromPropertiesL - OUT" );
        
    return err;
    }
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//
void PosLmLandmarkHandler::RemoveNonExistingCategoriesL(
    CPosLmLocalDbAccess& aDbAccess,
    RArray<TPosLmItemId>& aCategoryIdArray)
    {
    RArray<TPosLmItemId> categoriesInDatabase;
    CleanupClosePushL(categoriesInDatabase);

    PosLmCategoryHandler::GetAllCategoryIdsL(aDbAccess,
        CPosLmCategoryManager::ECategorySortOrderNone, categoriesInDatabase);

    if (categoriesInDatabase.Count() == 0)
        {
        aCategoryIdArray.Reset();
        }

    for (TInt i = 0; i < aCategoryIdArray.Count();)
        {
        if (categoriesInDatabase.Find(aCategoryIdArray[i]) == KErrNotFound)
            {
            aCategoryIdArray.Remove(i);
            }
        else
            {
            i++;
            }
        }

    CleanupStack::PopAndDestroy(&categoriesInDatabase);
    }
void CMemoryView::HandleDeletedChunk(TUint32 aAddress)
{
    TChunkInfo chunkInfo(aAddress);
    TInt pos = iChunkList.Find(chunkInfo, TChunkInfo::Match);
    if (pos < 0)
    {
        PrintWarning(_L("Couldn't handle deletion of chunk 0x%08x: %d"), aAddress, pos);
    }
    else
    {
        TChunkInfo& c = iChunkList[pos];

        // Rejuvenate chunks that haven't been updated since this one last was.
        const TInt numChunks = iChunkList.Count();
        for (TInt i = 0; i < numChunks; ++i)
        {
            TChunkInfo& d = iChunkList[i];
            if (d.iUpdateCount > c.iUpdateCount)
            {
                --d.iUpdateCount;
            }
        }

        iChunkList.Remove(pos);
        if (iChunkList.Count() <= iNumConsoleLines)
        {
            iVerticalOffset = 0;
        }
    }
}
Beispiel #7
0
void CResponseHandler::RunL()
{
    // if any existing -> Send response
    if (iResponseArray.Count()) {
        CompleteAnyKey(iResponseArray[0]);
        // Remove already completed key
        iResponseArray.Remove(0);
        iResponseArray.Compress();
    }
}
// -----------------------------------------------------------------------------
// CTCStateTiltListenData::PrepareArray
// -----------------------------------------------------------------------------
//
// Prepares array for item insertion
static void PrepareArray( RArray<TTiltXYZValue>& aArray, TInt aItemsToInsert, TInt aMaxItems )
    {
    FUNC_LOG;
    
    TInt count = aArray.Count();
    TInt i = count + aItemsToInsert;
    while( i-- > aMaxItems ) // Delete old items from end
        {
        aArray.Remove( --count );
        }
    }
// NB: this test suite needs each test run to start with keyspaces with values from
// the initialization files in ROM dir. The best way to archive this is to send the
// EGetSetParameters IPC to centrep server to flush cache and then delete
// the .cre files. This option requires the CENTREP_SERVER_CACHETEST macro
// which is not available in release ONB.  The second choice is to wait enough
// time for centrep server to flush out cache, then delete the .cre files from
// persists dir. This approach does not work well on the emulator because centrep
// server's cache timer sometimes is late by as much as a few seconds.
// Hence instead of wait and delete the .cre files, this RTest uses the ResetAll
// API. This trick works for the use case of this RTest but may not work in other
// situations. E.g., in this RTest centrep server always open repositories
// from cache. This changes the timing pattern and does not exercise the
// cache eviction code path.
LOCAL_C void ResetModifiedRepsL()
	{
	for (TInt i = RepsToReset.Count() - 1; i >= 0; i--)
		{
		CRepository* rep;
		User::LeaveIfNull( rep = CRepository::NewL(RepsToReset[i]) );
		rep->Reset();
		delete rep;

		RepsToReset.Remove(i);
		}
	}
void CHuiFxEffectCache::Remove(RArray<IDNode> &aMap, MHuiFxEffectCacheNode *aNode)
    {
    TInt size = aMap.Count();
    for(TInt i=0;i<size;i++)
        {
        const IDNode &n = aMap[i];
        if (n.iNode == aNode)
            {
            aMap.Remove(i);
            return;
            }
        }
    }
// ----------------------------------------------------------------------------
// CSipHeaderStrategyBase::EliminateClientsL
// ----------------------------------------------------------------------------
//
void CSipHeaderStrategyBase::EliminateClientsL(
    CSIPRequest& aRequest,
    RArray<TUid>& aUids )
    {
	for ( TInt i=0; i < aUids.Count();i++ )
		{
		MSipClient* client = iSipClients.GetByUID( aUids[i] );
		if ( client && !CompareHeaders( aRequest,*client) )
			{
			aUids.Remove( i );
			i--;
			}	
		}
    }
// ---------------------------------------------------------------------------
// CSdpMediaField::RemoveFormatL
// ---------------------------------------------------------------------------
//
EXPORT_C void CSdpMediaField::RemoveFormatL(const TDesC8& aFormat)
{
    if ( !iFormatList || iFormatList->Des().Length() == 0 )
    {
        User::Leave( KErrSdpCodecMediaField );
    }
    TLex8 lexer( *iFormatList );
    TBool tokenRemoved( EFalse );
    while ( !tokenRemoved && !lexer.Eos() )
    {
        lexer.SkipSpaceAndMark();
        lexer.SkipCharacters();
        if ( lexer.TokenLength() > 0 )
        {
            if ( aFormat.CompareF(lexer.MarkedToken()) == 0)
            {
                RArray<TInt> removedObjs;
                CleanupClosePushL( removedObjs );
                for ( TInt i( 0 ); i < iFmtAttrFields->Count(); i++ )
                {
                    if (aFormat.CompareF((*iFmtAttrFields)[i]->Format()) == 0)
                    {
                        User::LeaveIfError( removedObjs.Append(i) );
                    }
                }
                // Remove all format attributes of type format
                TInt removedCount( 0 );
                while ( removedObjs.Count() > 0 )
                {
                    CSdpFmtAttributeField* obj =
                        (*iFmtAttrFields)[removedObjs[0] - removedCount];
                    delete obj;
                    obj = 0;
                    iFmtAttrFields->Remove( removedObjs[0] - removedCount);
                    removedObjs.Remove(0);
                    removedCount++;
                }
                CleanupStack::PopAndDestroy();  // removedObjs

                // Remove format from format list
                iFormatList->Des().Delete( lexer.MarkedOffset(),
                                           lexer.Offset() - lexer.MarkedOffset());
                iFormatList->Des().TrimAll();
                tokenRemoved = ETrue;
            }
        }
    }
}
Beispiel #13
0
inline void RemoveAndCompress(RArray<T>& aContainer, TInt aIndex)
/**
	Remove the indexed item from the supplied array and compress
	the array.
	
	Without compression, the memory at the end of the array will
	not be freed.  Unless the memory is freed, memory leak testing
	will fail.
	
	@param	aContainer		Array from which item must be removed.
	@param	aIndex			Item to remove from array.
 */
	{
	aContainer.Remove(aIndex);
	aContainer.Compress();
	}
// ---------------------------------------------------------------------------
// CSdpMediaField::KeepFormatL
// ---------------------------------------------------------------------------
//
EXPORT_C void CSdpMediaField::KeepFormatL(const TDesC8& aFormat)
{
    if ( !iFormatList )
    {
        User::Leave( KErrSdpCodecMediaField );
    }
    // Empty set will continue to be empty
    if ( iFormatList->Des().Length() > 0 )
    {
        HBufC8* formatList = aFormat.AllocLC();
        // Mark all format attributes not aFormat so that they will be deleted
        RArray<TInt> removedObjs;
        CleanupClosePushL( removedObjs );
        for ( TInt i( 0 ); i < iFmtAttrFields->Count(); i++ )
        {
            if (aFormat.CompareF((*iFmtAttrFields)[i]->Format()) != 0)
            {
                User::LeaveIfError( removedObjs.Append( i ) );
            }
        }
        // Delete attribute fields
        TInt removedCount( 0 );
        while ( removedObjs.Count() > 0 )
        {
            CSdpFmtAttributeField* obj =
                (*iFmtAttrFields)[removedObjs[0] - removedCount];
            delete obj;
            iFmtAttrFields->Remove( removedObjs[0] - removedCount );
            removedObjs.Remove( 0 );
            removedCount++;
        }
        CleanupStack::PopAndDestroy();  // removedObjs
        // Change format list
        delete iFormatList;
        iFormatList = formatList;
        CleanupStack::Pop();    // formatList
    }
}
/** Get the sequence of all active transforms, ordered in order of execution.
 
@param aTransformSequence
	   an empty array to be populated with sequence of transform UIDs, 
	   where transform entries with smaller index are executed earlier. 
	
@leave KErrNoMemory Out of memory.  
*/
EXPORT_C void CCamera::CCameraImageProcessing::GetActiveTransformSequenceL(RArray<TUid>& aTransformSequence) const
	{
	iImpl->GetActiveTransformSequenceL(aTransformSequence);
	
	/* if CCamera::New2L() or CCamera::NewDuplicate2L() is not used to create CCamera object, it is assumed that 
    application is not prepared to receive extra added uid values (new settings added). So, any extra uid value passed 
    from the implementation will be filtered at this point.
    To receive extra added uid values, application should rather use CCamera::New2L() or CCamera::NewDuplicate2L() 
    to create camera object. In this case, application is assumed to be prepared to receive unrecognised uid values */
	if(iOwner.CameraVersion() == KCameraDefaultVersion)
		{
		for(TInt index =0; index < aTransformSequence.Count(); index++)
			{
			/** KBaselinedImageProcessing is the baseline. Any image processing attribute with greater uid value means that
			it has been added in later versions */
			if(aTransformSequence[index].iUid > KBaselinedImageProcessing)
				{
				aTransformSequence.Remove(index);
				index--;
				}
			}
		}
	}
//takes away from aOidsToCheckAgainst
void CValidateCertChainStep::CheckCriticalExtsPresentAndRemoveL(const RPointerArray<TDesC>& aOidsToLookFor, RArray<TPtrC>& aOidsToCheckAgainst)
	{
	TBool found;
	for (TInt oid_index=0; oid_index < aOidsToLookFor.Count(); ++oid_index)
		{
		found = EFalse;
		for (TInt k=0; k < aOidsToCheckAgainst.Count(); ++k)
			{
			if ((*aOidsToLookFor[oid_index])==(aOidsToCheckAgainst[k]))
				{
				found = ETrue;
				aOidsToCheckAgainst.Remove(k);
				break;
				}
			}
				
		if (!found)	
			{
			ERR_PRINTF2(_L("ERROR: Critical extension OID not present: %S"), aOidsToLookFor[oid_index]);
			User::Leave(KErrGeneral);	
			}
		}		
	}
void CValidateCertChainStep::CheckWarningsPresentAndRemoveL(const RArray<TValidationStatus>& aWarningsToCheckFor, RArray<TValidationStatus>& aWarningsToCheckIn)
	{
	TBool found;
	for (TInt warnings_index=0; warnings_index < aWarningsToCheckFor.Count(); ++warnings_index)
		{
		found = EFalse;
		for (TInt k=0; k < aWarningsToCheckIn.Count(); ++k)
			{
			if (ValidationStatusEqual(aWarningsToCheckFor[warnings_index], aWarningsToCheckIn[k]))
				{
				found = ETrue;
				aWarningsToCheckIn.Remove(k);
				break;
				}
			}
				
		if (!found)	
			{	
			ERR_PRINTF2(_L("ERROR: Warning not present: %d"), aWarningsToCheckFor[warnings_index].iReason);
			User::Leave(KErrGeneral); 
			}
		}	
	}
/**
GetObjectHandles request handler
*/	
void CMTPGetObjectHandles::ServiceL()
	{
    OstTraceFunctionEntry0( CMTPGETOBJECTHANDLES_SERVICEL_ENTRY );
    
    if(iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted)
        {
        TUint storageId = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
        TUint handle = Request().Uint32(TMTPTypeRequest::ERequestParameter3);
        TUint enumerateState = iSingletons.DpController().StorageEnumerateState(storageId);
        if ( (enumerateState < CMTPDataProviderController::EEnumeratingPhaseOneDone)
            || (enumerateState != CMTPDataProviderController::EEnumeratedFulllyCompleted && handle != KMTPHandleAll))
            {
            if (iTimeoutCount++ >= KMTPGetObjectHandlesTimeOut)
                {
                OstTrace0( TRACE_NORMAL, CMTPGETOBJECTHANDLES_SERVICEL, 
                        "Wait for enumeration time out, return busy." );
                SendResponseL(EMTPRespCodeDeviceBusy);
                iTimeoutCount = 0;
                OstTraceFunctionExit0( CMTPGETOBJECTHANDLES_SERVICEL_EXIT );
                return;
                }
            else
                {
                OstTrace0( TRACE_NORMAL, DUP1_CMTPGETOBJECTHANDLES_SERVICEL, 
                        "Enumeration not completed, suspend request." );
                RegisterPendingRequest(20);
                OstTraceFunctionExit0( DUP1_CMTPGETOBJECTHANDLES_SERVICEL_EXIT );
                return; 
                }
            }
        }
    
    iTimeoutCount = 0;
    
	delete iHandles;
	iHandles = NULL;
	iHandles = CMTPTypeArray::NewL(EMTPTypeAUINT32);

	OstTraceExt2( TRACE_NORMAL, DUP2_CMTPGETOBJECTHANDLES_SERVICEL, 
	        "IsConnectMac = %d; ERequestParameter2 = %d", iDevDpSingletons.DeviceDataStore().IsConnectMac(), Request().Uint32(TMTPTypeRequest::ERequestParameter2));	
    if(iDevDpSingletons.DeviceDataStore().IsConnectMac()
       &&(KMTPFormatsAll == Request().Uint32(TMTPTypeRequest::ERequestParameter2)))
        {
        OstTrace0( TRACE_NORMAL, DUP3_CMTPGETOBJECTHANDLES_SERVICEL, "ConnectMac and Fetch all." );
        HandleObjectHandlesUnderMacL(*iHandles);
        }
    else
        {
    	RMTPObjectMgrQueryContext   context;
    	RArray<TUint>               handles;
    	CleanupClosePushL(context);
    	CleanupClosePushL(handles);        
    	TMTPObjectMgrQueryParams    params(Request().Uint32(TMTPTypeRequest::ERequestParameter1), Request().Uint32(TMTPTypeRequest::ERequestParameter2), Request().Uint32(TMTPTypeRequest::ERequestParameter3));	
    	do
    	    {
        	iFramework.ObjectMgr().GetObjectHandlesL(params, context, handles);
			
        	TUint32 storageId = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
        	TUint32 parentHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter3);
        	if ( storageId != KMTPStorageAll && parentHandle == KMTPHandleNoParent )
	            {
	            const CMTPStorageMetaData& storage(iFramework.StorageMgr().StorageL(storageId));
	            HBufC* StorageSuid = storage.DesC(CMTPStorageMetaData::EStorageSuid).AllocL();
            
	            RBuf suid;
	            suid.CleanupClosePushL();
	            suid.CreateL(KMaxFileName);
	            suid = *StorageSuid;
	            _LIT(WMPInfoXml,"WMPInfo.xml");
	            suid.Append(WMPInfoXml); 
	            TUint32 handle = iFramework.ObjectMgr().HandleL(suid);
	            if ( handle != KMTPHandleNone )
	                {
	                TInt index = handles.Find(handle);
	                if ( index != KErrNotFound )
	                    {
	                    handles.Remove(index);
	                    handles.InsertL(handle,0);
	                    }
	                }   
	            delete StorageSuid;
	            StorageSuid = NULL;
	            CleanupStack::PopAndDestroy();
            	}
        	iHandles->AppendL(handles);
    	    }
    	while (!context.QueryComplete()); 
    	CleanupStack::PopAndDestroy(&handles);
    	CleanupStack::PopAndDestroy(&context);        
        }        
    						
	SendDataL(*iHandles);
	OstTraceFunctionExit0( DUP2_CMTPGETOBJECTHANDLES_SERVICEL_EXIT );
	}
// ---------------------------------------------------------------------------
// CAtPhbkStoreRead::ParseResponseL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CAtPhbkStoreRead::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if( iState == ESetStoreNameComplete )
	    {
		if (CurrentLine().Match(KLtsyOkString) == 0)
			{
			iError = KErrNone;
			}
		else
			{
			iError = KErrGeneral;
			}
	    }
	else if( iState == EReadEntryComplete )
		{
		/**
		* +CPBR = <index>,<number>,<129/145>,<text> 
		* OK    
		*/
		RArray<TPtrC8> array;
		CleanupClosePushL(array);
		iParser->ParseRespondedBuffer(array,Buffer());
		// remove the string of AT+CPBR=..
		if(array[0].MatchF(KAnyATCommand) != KErrNotFound)
			{
			array.Remove(0);
			}
		TInt count = array.Count();
#ifdef _DEBUG		
		for( TInt i=0;i<count;i++ )
			{
			LOGTEXT3(_L8("CAtPhbkStoreRead::ParseResponseL\tarray[%d]=%S"),i,&array[i]); 
			}
#endif		
		if((array[1].Match(KLtsyOkString) == KErrNone))
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNone;
			iEndFlag = ETrue;
			return; 
			}
		else if((array[1].Match(KLtsyErrorString) == KErrNone))
			{
			CleanupStack::PopAndDestroy();
			iError = KErrGeneral;
			iEndFlag = ETrue;
			return; 
			}
	  
		iError = KErrNone;
		//remove number line if it has 
		if( array[0].MatchF(KCPBRSResponseString) == KErrNotFound )
			{
			array.Remove(0);
			}
		if( array[0].MatchF(KCPBRSResponseString) == KErrNotFound )
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		//parse index
		TLex8 lex(array[1]);
		TUint16 val;
		TInt ret = lex.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		//Index  
		iReadEntry.iIndex = val;             
		iReadEntry.iNumber.Copy(array[2]);   
		//Parse TON/NPI
		TLex8 lex1(array[3]);
		TUint16 val1;
		ret = lex1.Val(val1,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		 //TON/NPI
		iReadEntry.iTon = (TUint8)val1;  
		iReadEntry.iText.Copy(array[4]);
		CleanupStack::PopAndDestroy();
		} 
  	}
/**
Does comm_addr updating on an address-by-address basis.
Takes 3 lists of new addresses and a list of free comm_addr_ids.
*/
void CPplCommAddrTable::DoUpdateCommAddrsL(RArray<TMatch>& aNewPhones, RArray<TPtrC>& aNewEmails, RArray<TPtrC>& aNewSips,
					  RArray<TInt>& aFreeCommAddrIds, const TInt aItemId, CPplCommAddrTable::TCommAddrExtraInfoType 
                      aExtraInfoType)
	{
	// if we have free ids to recycle and new comm_addrs, insert them by UPDATE
	const TInt KFirstElementId(0);
	while (aFreeCommAddrIds.Count() && (aNewPhones.Count() || aNewEmails.Count() || aNewSips.Count() ) )
		{
		if(aNewPhones.Count() )
			{
			DoPhoneNumWriteOpL(aNewPhones[KFirstElementId], EUpdate, aItemId, aFreeCommAddrIds[KFirstElementId],aExtraInfoType);
			aNewPhones.Remove(KFirstElementId);
			aFreeCommAddrIds.Remove(KFirstElementId);
			}
		else if(aNewEmails.Count() )
			{
			DoNonPhoneWriteOpL(aNewEmails[KFirstElementId], EUpdate, aItemId, EEmailAddress,
								aFreeCommAddrIds[KFirstElementId]);
			aNewEmails.Remove(KFirstElementId);
			aFreeCommAddrIds.Remove(KFirstElementId);
			}
		else if(aNewSips.Count() )
			{
			DoNonPhoneWriteOpL(aNewSips[KFirstElementId], EUpdate, aItemId, ESipAddress,
								aFreeCommAddrIds[KFirstElementId]);
			aNewSips.Remove(KFirstElementId);
			aFreeCommAddrIds.Remove(KFirstElementId);
			}
		}

	// if we still have free ids to recycle but no new comm_addrs,
	// delete the existing comm_addrs for these ids
	const TInt KNumFreeIds(aFreeCommAddrIds.Count() );
	for (TInt i = 0; i < KNumFreeIds; ++i)
		{
		TBool lowDiskErr(EFalse);
		DeleteSingleCommAddrL(aFreeCommAddrIds[i], lowDiskErr);
		if (lowDiskErr)
			{
			User::Leave(KErrDiskFull);
			}
		}

	// if we still have new comm_addrs but no free ids to recycle,
	// put them in the database using INSERT
	const TInt KNumNewPhones(aNewPhones.Count() );
	const TInt KNumNewEmails(aNewEmails.Count() );
	const TInt KNumNewSips(aNewSips.Count() );
	for (TInt i = 0; i < KNumNewPhones; ++i)
		{
	    DoPhoneNumWriteOpL(aNewPhones[i], EInsert, aItemId, EPhoneNumber, aExtraInfoType);
		}
	for (TInt i = 0; i < KNumNewEmails; ++i)
		{
		DoNonPhoneWriteOpL(aNewEmails[i], EInsert, aItemId, EEmailAddress);
		}
	for (TInt i = 0; i < KNumNewSips; ++i)
		{
		DoNonPhoneWriteOpL(aNewSips[i], EInsert, aItemId, ESipAddress);
		}
	}
Beispiel #21
0
//-----------------------------------------------------------------------------
//Function Name : void* DlSymByDependencyOrdering(const void* aHandle,
//													const char* aName)
//Description   : To search for symbol named name in statically dependent dll 
//				  on aSymInfoHeader, is dependencies, also dependencies of 
//				  dependencies using Dependency-ordering. 
//Return Value  : Valid address if name found otherwise NULL
//-----------------------------------------------------------------------------
void* DlSymByDependencyOrdering(const void* aHandle,const char* aName)
	{
	//Get 0th ordinal datastructure of dll denoted by handle.
	LoadedDlls()->Lock();
	TInt idx = LoadedDlls()->Find(aHandle);
	//check if handle not found	
	if ( KErrNotFound == idx )
		{
		LoadedDlls()->UnLock();
		SetError(KDlSymErrBadHandle);
		return NULL;
		}
	TDllEntry& dllEntry = LoadedDlls()->At(idx);
	
	// The below 'if' condition prevents the symbol lookup on non-STDDLL
	// Check for the symbol information, if not found
	// return with KDlSymErrNoSupport 
	if( !dllEntry.iSymbolHeader )
		{
		LoadedDlls()->UnLock();
		SetError(KDlSymErrNoSupport);
		return NULL;
		}

	TBuf8<KMaxFileName> fileName;
	if(CnvUtfConverter::ConvertFromUnicodeToUtf8(fileName,dllEntry.iLibrary.FileName()) != 0)
		{
		LoadedDlls()->UnLock();
		return NULL;
		}
	TE32ExpSymInfoHdr* symInfoHeader = dllEntry.iSymbolHeader;
	//Queue for using Breadthfirst search / Dependency ordering.
	RArray<TImageData> dependentDllQue;
	TImageData imageData((char*)fileName.PtrZ(), symInfoHeader);
	//add first item in queue
	TInt err = dependentDllQue.Append(imageData);
	if ( KErrNone != err )
		{
		LoadedDlls()->UnLock();
		dependentDllQue.Close();
		SetError(KDlSymErrNoMemory);	
		return NULL;		
		}
	char* curDll = NULL;
	char* dependentDll = NULL;
	HMODULE handleToDll = NULL;
	TBuf<KMaxFileName> dependentfileName;	
	TE32ExpSymInfoHdr* tempSymInfoHeader = NULL;
	void* symAddr = NULL;
	TPtrC8 tempPtr;
	//Array of searched dlls. Used to check circular dependency
	//this is array of pointer to name of dll in image
	RPointerArray<TE32ExpSymInfoHdr> searchedDlls;
	//Breath First search for Dependancy ordering.
	while(dependentDllQue.Count())
		{
		imageData = dependentDllQue[0];
		curDll = imageData.iFileName;
		symInfoHeader = imageData.iSymInfoHeader;
		dependentDllQue.Remove(0);
		
		// The below 'if' condition prevents the symbol lookup on dependent non-STDDLL
		if(!symInfoHeader)
			{
			continue;
			}

		tempPtr.Set((unsigned char*)curDll, strlen(curDll));
		dependentfileName.Copy(tempPtr);
		TParsePtr pParser(dependentfileName);
		dependentfileName = pParser.NameAndExt();
	  	//Search in this dll's symbol table	
		handleToDll = Emulator::GetModuleHandle(dependentfileName.PtrZ());
		symAddr = Emulator::GetProcAddress(handleToDll,aName);
		//check if symbol is found
		if( symAddr )
			{
			LoadedDlls()->UnLock();
			dependentDllQue.Close();
			searchedDlls.Close();
			return symAddr;
			}
		//Insert this to searched list
		err = searchedDlls.Append(symInfoHeader);
		if ( KErrNone != err )
			{
			LoadedDlls()->UnLock();
			dependentDllQue.Close();
			searchedDlls.Close();	
			SetError(KDlSymErrNoMemory);	
			return NULL;		
			}
		//Add list of dependencies
		dependentDll = (char*) symInfoHeader + sizeof(TE32ExpSymInfoHdr);

		//Add at last to make it Queue, needed for Dependency ordering
		for (TInt i = 0; i <  symInfoHeader->iDllCount; i++)
			{
			tempPtr.Set((unsigned char*)dependentDll, strlen(dependentDll));
			dependentfileName.Copy(tempPtr);
			//get i'th dependency
			handleToDll = Emulator::GetModuleHandle(dependentfileName.PtrZ());
			Emulator::TModule aModule((HINSTANCE)handleToDll);
			tempSymInfoHeader  = (TE32ExpSymInfoHdr*)aModule.Section(KWin32SectionName_NmdExpData);
			//check i'th dependency is OE dll e.i. equal to zero or not
			//and also its not already searched
			if ( tempSymInfoHeader && searchedDlls.Find(tempSymInfoHeader) == KErrNotFound )
				{
				imageData.iFileName = dependentDll;
				imageData.iSymInfoHeader = tempSymInfoHeader;
				err = dependentDllQue.Append(imageData);
				if ( KErrNone  != err )
					{
					LoadedDlls()->UnLock();
					dependentDllQue.Close();
					searchedDlls.Close();
					SetError(KDlSymErrNoMemory);	
					return NULL;		
					}
				}
			//advance to next dependent dll	
			dependentDll += tempPtr.Length() + 1;
			}
		}
	LoadedDlls()->UnLock();	
	dependentDllQue.Close();
	searchedDlls.Close();
	//Symbol not found return NULL
	SetError(KDlSymErrNotFound);
	return NULL;	
	}
/**
Removes comm addresses from the 3 lists that are already in the database and have been updated.
It takes the 3 lists in as parameters and modifies them accordingly. It also populates the list
of comm address ids that are free to be recycled during updating.
*/
void CPplCommAddrTable::RemoveNonUpdatedAddrsL(RArray<TMatch>& aNewPhones, RArray<TPtrC>& aNewEmails, RArray<TPtrC>& aNewSips,
					  RArray<TInt>& aFreeCommAddrIds, const TInt aItemId,CPplCommAddrTable::TCommAddrExtraInfoType 
                      aExtraInfoType )
	{
	// build the RSqlStatement
	RSqlStatement stmnt;
	CleanupClosePushL(stmnt);
	stmnt.PrepareL(iDatabase, iWholeSelectStmnt->SqlStringL() );
	const TInt KContactIdParamIndex(KFirstIndex); // first and only parameter in the query
	User::LeaveIfError(stmnt.BindInt(KContactIdParamIndex, aItemId) ) ;

	// fetch the results from the query and compare them with the new comm_addrs we have
	TInt err(KErrNone);
	while ((err = stmnt.Next() ) == KSqlAtRow)
		{
		const TInt KType(stmnt.ColumnInt(iWholeSelectStmnt->ParameterIndex(KCommAddrType() ) ) );
		if (KType == EPhoneNumber)
			{
			TMatch phoneNumber;
			TPtrC valString    = stmnt.ColumnTextL(iWholeSelectStmnt->ParameterIndex(KCommAddrValue() ) );
			TPtrC extValString = stmnt.ColumnTextL(iWholeSelectStmnt->ParameterIndex(KCommAddrExtraValue() ) );
			TInt extTypeInfoString = stmnt.ColumnInt(iWholeSelectStmnt->ParameterIndex(KCommAddrExtraTypeInfo() ) );
			User::LeaveIfError(TLex(valString).Val(phoneNumber.iLowerSevenDigits) );
			User::LeaveIfError(TLex(extValString).Val(phoneNumber.iUpperDigits) );

			TInt matchIndex(aNewPhones.Find(phoneNumber, TIdentityRelation<TMatch>(&TMatch::Equals) ) );
			// remove any phone numbers from the new list if we already
			// have them in the db and they haven't changed...
			if (matchIndex != KErrNotFound  && (extTypeInfoString == aExtraInfoType))
				{
				aNewPhones.Remove(matchIndex);
				}
			// ...and add any spare ids to the recycle list
			else
				{
				aFreeCommAddrIds.AppendL(
					stmnt.ColumnInt(iWholeSelectStmnt->ParameterIndex(KCommAddrId() ) ) );
				}
			}
		else // is Email or SIP
			{
			TPtrC valString = stmnt.ColumnTextL(iWholeSelectStmnt->ParameterIndex(KCommAddrValue() ) );
			TInt matchIndex(0);

			// remove any email and sip addresses from the new list if
			// we already have them in the db and they haven't changed...
			if (KType == EEmailAddress)
				{
				matchIndex = aNewEmails.Find(valString);
				if (matchIndex != KErrNotFound)
					{
					aNewEmails.Remove(matchIndex);
					}
				}
			else // SIP
				{
				matchIndex = aNewSips.Find(valString);
				if (matchIndex != KErrNotFound)
					{
					aNewSips.Remove(matchIndex);
					}
				}

			// ...and add any spare ids to the recycle list
			if (matchIndex == KErrNotFound)
				{
				aFreeCommAddrIds.AppendL(
					stmnt.ColumnInt(iWholeSelectStmnt->ParameterIndex(KCommAddrId() ) ) );
				}
			}
		}
	// leave if we didn't complete going through the results properly
	if(err != KSqlAtEnd)
		{
		User::Leave(err);
		}
	CleanupStack::PopAndDestroy(&stmnt);
	}
// -----------------------------------------------------------------------------
// CDRMHelperServer::CheckExpirationL().
// This function check the time for rights to expire
// -----------------------------------------------------------------------------
//
void CDRMHelperServer::CheckExpirationL(
        const TDesC8& aUri ,
        const TUint8& aPermType ,
        const TUint8& aRegType ,
        TTime& aEndTime )
    {
#ifdef _DRM_TESTING
    WriteL(_L8("CheckExpiration"));
#endif


    RPointerArray<CDRMPermission> rights;
    RArray<TTimeBased> timeList;
    TBool stop = EFalse;
    TInt i = 0;
    TInt err = 0;
    TTimeIntervalYears years(KTimeIntervalYears);
    TTime time = Time::MinTTime();
    TTimeBased item;
    TTimeIntervalSeconds interval = 0;
    RPointerArray<HBufC8> imsi;

    aEndTime = Time::MinTTime();


    TRAP( err , iDrm.GetDBEntriesL(aUri, rights) );
    CleanupClosePushL(rights);
    if ( err == KErrCANoRights || err == KErrCANoPermission )
        {
        aEndTime = Time::MinTTime();
        err = KErrNone;
        stop = ETrue;
        }
    User::LeaveIfError(err);

    TRAP( err, iDrm.GetSupportedIndividualsL( imsi ) );

    if ( err )
        {
        imsi.ResetAndDestroy();
        }

    time.HomeTime();
    // Goes through all the rights associated to this specific URI
    CleanupClosePushL(timeList);

    for (i = 0; i < rights.Count() && !stop; i++)
        {
        CheckPermission( rights[i], aPermType, item, interval ,imsi );
        if (interval.Int()>0 ||
            (item.StartTime()==Time::MinTTime()&&item.EndTime()==Time::MaxTTime()))
            {
            stop = ETrue;
            aEndTime = Time::MaxTTime();
            }
        else
            {
            if (aRegType == CDRMHelperServer::EActive && item.StartTime()>time)
                {
                // dont count future time for active usage
                }
            else
                {
                err = timeList.Append( item );
                if ( err )
                    {
                    rights.ResetAndDestroy();
                    imsi.ResetAndDestroy();
                    }
                User::LeaveIfError(err);
                }
            }
        }
    rights.ResetAndDestroy();
    imsi.ResetAndDestroy();

    // if there were no inactivated interval- or full-rights then calculate the expiration date
    // based on what we stored to timeList
    if( !stop )
        {
        time.HomeTime(); // preset time to current time. This is what we compare against.
        TTime temp;
        TTime pastTime;
        temp = time;
        pastTime = Time::MinTTime();

        TBool action = ETrue;

        // Loop while there are still items in the list and we have done something
        while( action && timeList.Count() > 0 )
            {
            action = EFalse;
            for ( i = 0 ; i < timeList.Count() ; i++ ) // go through the whole timeList
                {
#ifdef _DRM_TESTING
                _LIT8(KCount , "time list count: %d");
                TBuf8<40> buf;
                buf.Format( KCount , timeList.Count());
                WriteL( buf );
#endif
                if ( timeList[i].StartTime() <= time && timeList[i].EndTime() > time )
                    {
                    // Case1: valid rights
                    time = timeList[i].EndTime();
                    timeList.Remove(i);
                    action = ETrue;
#ifdef _DRM_TESTING
                    WriteL(_L8("case 1:"));
                    WriteTimeL( time );
#endif
                    }
                else if ( timeList[i].StartTime() <= time && timeList[i].EndTime() <= time )
                    {
                    // Case2: expired rights
                    if (timeList[i].EndTime()>pastTime) // just in case there is no valid rights
                        {
                        pastTime = timeList[i].EndTime(); // save the latest end time from the expired rights
                        }
                    timeList.Remove(i);
                    action = ETrue;
#ifdef _DRM_TESTING
                    WriteL(_L8("case 2:"));
#endif
                    }
                else if ( timeList[i].StartTime() > time && timeList[i].EndTime() <= time )
                    {
                    // Case3: Illegal case. Start time after end-time.
                    timeList.Remove(i);
                    action = ETrue;
#ifdef _DRM_TESTING
                    WriteL(_L8("case 3:"));
#endif
                    }
                else
                    {
                    // Case4: Only thing left is the not yet valid -rights
#ifdef _DRM_TESTING
                    WriteL(_L8("case 4:"));
#endif
                    }
                }
            }

        if (temp<time)
            {
            aEndTime = time;   // time has been changed, so we use it, otherwise it means there is no valid rights
            }
        else
            {
            aEndTime = pastTime;
            }


#ifdef _DRM_TESTING
        WriteL(_L8("expiration date:"));
        WriteTimeL( aEndTime );
#endif
        }

#ifdef _DRM_TESTING
    WriteL(_L8("Endtime calculation is done:"));
    WriteTimeL( aEndTime );
#endif

    timeList.Reset();
    CleanupStack::PopAndDestroy(&timeList); // timeList
    CleanupStack::PopAndDestroy(&rights); // rights
    }
EXPORT_C void CMMFDevVideoPlay::FindDecodersL(const TDesC8& aMimeType, TUint32 aPostProcType, RArray<TUid>& aDecoders, TBool aExactMatch)
	{
#ifdef SYMBIAN_MULTIMEDIA_CODEC_API
	// find PU based plugins
	RImplInfoPtrArray codecPlugins;
	CleanupResetAndDestroyPushL(codecPlugins);
	DevVideoUtilities::FindVideoDecoderPluginsL(aMimeType, codecPlugins);	

	aDecoders.Reset();
	for (TInt i = 0; i < codecPlugins.Count();i++)
		{
		aDecoders.AppendL(codecPlugins[i]->ImplementationUid());
		}
		
	CleanupStack::PopAndDestroy(&codecPlugins);
#endif // SYMBIAN_MULTIMEDIA_CODEC_API
	RImplInfoPtrArray plugins;
	CleanupResetAndDestroyPushL(plugins);

	MmPluginUtils::FindImplementationsL(KUidDevVideoDecoderHwDevice, plugins);

	DevVideoUtilities::SelectPluginBasedOnMatchType(aMimeType, plugins);
		
	DevVideoUtilities::MatchPrePostProcessorCapabilitiesL(plugins, aPostProcType, aDecoders);

	// Perform the extra processing required if an exact match was requested
	if (aExactMatch)
		{
		// We now need to go through each of the plugins returned (which may have been matched using
		// a wildcard), instantiate each one, and perform an exact mime-type match.
		// Any plugins that don't support the desired mime type exactly will be removed from aDecoders.
		CCompressedVideoFormat* format = CCompressedVideoFormat::NewL(aMimeType);
		CleanupStack::PushL(format);

		for (TInt i=aDecoders.Count()-1; i>=0; i--)
			{
			TUid pluginUid = aDecoders[i];
			CVideoDecoderInfo* info = NULL;
			TRAPD(err, info = VideoDecoderInfoLC(pluginUid); CleanupStack::Pop(info););
			if (err == KErrNone)
				{
				if (!info->SupportsFormat(*format))
					{
					// The decoder doesn't support the format, so remove it from the list
					aDecoders.Remove(i);
					}
				delete info;
				}
			else if (err==KErrNotFound)
				{
				// we have a bogus UID so remove it from the list
				aDecoders.Remove(i);
				}
			else
				{
				User::Leave(err);
				}
			}

		CleanupStack::PopAndDestroy(format);
		}
// ---------------------------------------------------------------------------
// CAtPhbkEnGetInfo::ParseResponseL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CAtPhbkEnGetInfo::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if( iState==ESetEnStoreComplete )
		{
		if (CurrentLine().Match(KLtsyOkString) == 0)
			{
			iError = KErrNone;
			}
		else
			{
			iError = KErrGeneral;
			}
		}
	else if( iState==EGetEnStoreInfoComplete )
		{
		/**
		* Here is an Example 
		* +CPBS: "EN",2,16 
        * phonebooken is selected,2 locations are used and 
        * total 16 locations are available
		*/
		iError = KErrNone;
		RArray<TPtrC8> array;
		CleanupClosePushL(array);
		iParser->ParseRespondedBuffer(array,Buffer());
		//remove AT+CPBS
		if(array[0].MatchF(KAnyATCommand)!=KErrNotFound)
			{
			array.Remove(0);
			}
		TInt count = array.Count();
#ifdef _DEBUG			
		for( TInt i=0;i<count;i++ )
			{
		    LOGTEXT3(_L8("CAtPhbkEnGetInfo::ParseResponseL\tarray[%d]=%S"),
		    		      i,&array[i]);     
			}
#endif			
		if (count <= 1)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		if(array[0].MatchF(KCPBSResponseString)==KErrNotFound)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
				
		//parse used
		TLex8 lex(array[2]);
		TUint16 val;
		TInt ret=lex.Val(val,EDecimal);
		if(ret!=KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iUsed = val;
		
		//parse total
		TLex8 lex1(array[3]);
		ret=lex1.Val(val,EDecimal);
		if(ret!=KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iTotal = val;
	    LOGTEXT3(_L8("CAtPhbkEnGetInfo::ParseResponseL\tPreferred store used=%d, total=%d"), 
	    		                                iUsed,iTotal);
		CleanupStack::PopAndDestroy(&array);
		}
	}
Beispiel #26
0
//-----------------------------------------------------------------------------
//Function Name : TInt SearchSymbolByLoadordering(TE32ExpSymInfoHdr* symInfoHeader
//							, char* aFileName, const char* aName, 
//							RPointerArray<TE32ExpSymInfoHdr>& aSearchedDlls,
//							void*& aSymAddress)
//Description   : To search for symbol named name in statically dependent dll 
//				  on aSymInfoHeader, it may be belonging to EXE or a DLL, also 
//				  dependencies of dependencies using Load-ordering. It also sets
//				  valid address in aSymAddress if name found, and all sll it searched in 
//				  aSearchedDlls param.	
//Return Value  : KErrNone if symbol found otherwise system wide error codes.
//-----------------------------------------------------------------------------
TInt SearchSymbolByLoadordering(const TE32ExpSymInfoHdr* symInfoHeader, const char* aFileName,
							    const char* aName,
							    RPointerArray<TE32ExpSymInfoHdr>& aSearchedDlls,
							    void*& aSymAddress)
	{
	//This is used as stack for Load-ordering or Depthfirst search.
	RArray<TImageData> dependentDllStack;
	//here on emulator we need two things one is Name to find symbol in that list,
	//second is TE32ExpSymInfoHdr to find dependencies
	TImageData imageData((char*)aFileName, (TE32ExpSymInfoHdr*)symInfoHeader);
	aSymAddress = NULL;
	//Add exe on the stack
	TInt err = dependentDllStack.Append(imageData);
	if ( KErrNone != err )
		{
		dependentDllStack.Close();
		return KErrNoMemory;
		}

	TE32ExpSymInfoHdr* tempSymInfoHeader = NULL;
	TInt lastIdx = 0;
	char* curDll = NULL;
	char* dependentDll = NULL;
	HMODULE handleToDll = NULL;
	TPtrC8 tempPtr;
	TBuf<KMaxFileName> dependentfileName;
	//Retunn address would be stored in this
	void* symAddr = NULL;
	//user to maintain load ordering
	RArray<TImageData> curDependentDll;
	TImageData tempImageData;
	//Depth First search for Load-ordering.
	while ( lastIdx >= 0 )
		{
		//Take first dll on the stack i.e. topmost
	    imageData = dependentDllStack[lastIdx];
	    symInfoHeader = imageData.iSymInfoHeader;
		//Remove from stack
	    dependentDllStack.Remove(lastIdx);

	    if(!symInfoHeader)
	    	{
	    	//skip non-std binaries...
		    lastIdx = dependentDllStack.Count() - 1;
	    	continue;
	    	}

		curDll = imageData.iFileName;
	 	tempPtr.Set((unsigned char*)curDll, strlen(curDll));
		dependentfileName.Copy(tempPtr);
		TParsePtr pParser(dependentfileName);
		dependentfileName = pParser.NameAndExt();
	  	//Search in this dll's symbol table	
		handleToDll = Emulator::GetModuleHandle(dependentfileName.PtrZ());
		symAddr = Emulator::GetProcAddress(handleToDll,aName);
		//Check if Symbol is found
		if( symAddr )
			{
			dependentDllStack.Close();
			aSymAddress = symAddr;
			return KErrNone;
			}
		//Add this dll to list of searched dlls
		err = aSearchedDlls.Append(symInfoHeader);
		if ( KErrNone != err )
			{
			dependentDllStack.Close();
			return KErrNoMemory;
			}
		dependentDll = (char*) symInfoHeader + sizeof(TE32ExpSymInfoHdr);
	
		//if this image is an exe - the these would be some symbols
		if ( symInfoHeader->iSymCount )
			{//skip all symbol addresse
			char* curSymbolStr = dependentDll + (KFourByteOffset * symInfoHeader->iSymCount);
			//skip all symbol names
			for (TInt i = 0; i < symInfoHeader->iSymCount; ++i )
				{
				curSymbolStr += strlen(curSymbolStr) + 1;
				}
			//initialise first dependent dll name	
			dependentDll = curSymbolStr;
			}
		//Store names of all dependent dlls of current dll/exe store there name in 
		//curDependentDll. This is done to maintain load ordering.
		for (TInt i = 0; i < symInfoHeader->iDllCount; ++i)
			{
			tempPtr.Set((unsigned char*)dependentDll, strlen(dependentDll));
			dependentfileName.Copy(tempPtr);
			handleToDll = Emulator::GetModuleHandle(dependentfileName.PtrZ());
			Emulator::TModule aModule((HINSTANCE)handleToDll);
			tempSymInfoHeader  = (TE32ExpSymInfoHdr*)aModule.Section(KWin32SectionName_NmdExpData);
			if ( tempSymInfoHeader && aSearchedDlls.Find(tempSymInfoHeader) == KErrNotFound )
				{
				tempImageData.iFileName = dependentDll;
				tempImageData.iSymInfoHeader = tempSymInfoHeader;
				err = curDependentDll.Append(tempImageData);
				if ( KErrNone != err )
					{
					dependentDllStack.Close();
					curDependentDll.Close();
					return KErrNoMemory;
					}
				}
			//advance to next dependent dll	
			dependentDll += tempPtr.Length() + 1;
			}
		//add in load order to dependentDllStack
		for (TInt i = curDependentDll.Count() - 1; i >= 0; --i)
			{
			err = dependentDllStack.Append(curDependentDll[i]);
			if ( KErrNone != err )
				{
				dependentDllStack.Close();
				curDependentDll.Close();
				return KErrNoMemory;
				}
			}
		curDependentDll.Close();	
		lastIdx = dependentDllStack.Count() - 1;	
		}
	dependentDllStack.Close();
	return KErrNotFound;
	}
// ---------------------------------------------------------------------------
// CAtPhbkGetPhoneStoreInfo::ParseResponseL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CAtPhbkGetPhoneStoreInfo::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	if( iState == ESetPhoneStoreComplete )
		{
		if (CurrentLine().Match(KLtsyOkString) == 0)
			{
			iError = KErrNone;
			}
		else
			{
			iError = KErrGeneral;
			}
		}
	else if( iState == EGetPhoneStoreInfoComplete )
		{
		/**
		* Here is an Example 
		* +CPBS: "SM",6,250  
        * ADN phonebook is selected,6 locations are used and 
        * total 250 locations are available
		*/
		iError = KErrNone;
		RArray<TPtrC8> array;
		CleanupClosePushL(array);
		iParser->ParseRespondedBuffer(array,Buffer());
		//remove AT+CPBS
		if(array[0].MatchF(KAnyATCommand) != KErrNotFound)
			{
			array.Remove(0);
			}
		TInt count = array.Count();
#ifdef _DEBUG			
		for( TInt i=0;i<count;i++ )
			{
		    LOGTEXT3(_L8("CAtPhbkGetPhoneStoreInfo::ParseResponseL\tarray[%d]=%S"),
		    		      i,&array[i]);     
			}
#endif			
		if (count <= 1)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		if(array[0].MatchF(KCPBSResponseString) == KErrNotFound)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
				
		//parse used
		TLex8 lex(array[2]);
		TUint16 val;
		TInt ret = lex.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iPhoneStoreInfo.iUsedEntries = val;
		
		//parse total
		TLex8 lex1(array[3]);
		ret = lex1.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iPhoneStoreInfo.iTotalEntries = val;
		iPhoneStoreInfo.iType = RMobilePhoneStore::EPhoneBookStore;
	    LOGTEXT3(_L8("CAtPhbkGetPhoneStoreInfo::ParseResponseL\tPreferred store used=%d, total=%d"), 
	    		                                iPhoneStoreInfo.iUsedEntries,iPhoneStoreInfo.iTotalEntries);
		CleanupStack::PopAndDestroy(&array);
		}
	else 
		{
		/**
		* Parse result of AT+CPMS? 
		* Response:+CPMS:<mem1>,<used1>,<total1>,<mem2>,<used2>,<total2>
		* Here only the first mem is used. mem1 is SM
		*/
		iError = KErrNone;
		RArray<TPtrC8> array;
		CleanupClosePushL(array);
		iParser->ParseRespondedBuffer(array,Buffer());
		if(array[0].MatchF(KAnyATCommand) != KErrNotFound)
			{
			array.Remove(0);
			}
		TInt Count = array.Count();
		if (Count <= 1)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		if(array[0].MatchF(KCPMSResponseString) == KErrNotFound)
			{
			CleanupStack::PopAndDestroy();
			iError = KErrNotFound;
			return;
			}
		//parse name 
		TPtrC8 name(array[1]);
		
		//parse used
		TLex8 lex(array[2]);
		TUint16 val;
		TInt ret = lex.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iPhoneStoreInfo.iUsedEntries = val;
		
		//parse total
		TLex8 lex1(array[3]);
		ret = lex1.Val(val,EDecimal);
		if(ret != KErrNone)
			{
			CleanupStack::PopAndDestroy();
			iError = ret;
			return;
			}
		iPhoneStoreInfo.iTotalEntries = val;
		iPhoneStoreInfo.iType = RMobilePhoneStore::EShortMessageStore;
		LOGTEXT3(_L8("CAtPhbkGetPhoneStoreInfo::ParseResponseL\tPreferred store used=%d, total=%d"), 
			    		                        iPhoneStoreInfo.iUsedEntries,iPhoneStoreInfo.iTotalEntries);
		CleanupStack::PopAndDestroy(&array);
		}
	}
// ---------------------------------------------------------
// CPosTp29::DoOutOfDiskTestL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosTp29::DoOutOfDiskTestL(TBool aSync)
    {
    TVolumeInfo volumeInfo;
    TBuf<200> buf;
    CPosLmOperation* op = NULL;

    _LIT(KUID,"Unique ID: %08x\r\n");
	_LIT(KSize,"Size: %d bytes\r\n");
	_LIT(KFree,"Free space: %d bytes\r\n");
	//_LIT(KVolName,"Volume name: %S\r\n");

    TInt err=iFileServer.Volume(volumeInfo, EDriveC);
    if (err != KErrNone) iLog->Put(_L("Error from iFileServer"));

    buf.AppendFormat(KUID, volumeInfo.iUniqueID);
	buf.AppendFormat(KSize, volumeInfo.iSize);
	buf.AppendFormat(KFree, volumeInfo.iFree);
	//buf.AppendFormat(KVolName, &volumeInfo.iName);
    iLog->Put(buf);

    TTime startTime;
    TTime stopTime;

    // Just in case
    ExecuteAndDeleteLD(iLandmarksDb->CompactL());

    RArray<TPosLmItemId> lmIdArray;
    CleanupClosePushL(lmIdArray);

    // 1) Create a low disc space situation
    startTime.UniversalTime();
    ConsumeDiscSpace1L(iCriticalLevel + KSizeLimitOffset1);
    ConsumeDiscSpace2L(iCriticalLevel + KSizeLimitOffset2);
    
    err=iFileServer.Volume(volumeInfo, EDriveC);
    if (err != KErrNone) iLog->Put(_L("Error from iFileServer"));
    buf.AppendFormat(KUID, volumeInfo.iUniqueID);
	buf.AppendFormat(KSize, volumeInfo.iSize);
	buf.AppendFormat(KFree, volumeInfo.iFree);
    iLog->Put(buf);

    stopTime.UniversalTime();
    TTimeIntervalMicroSeconds executionTime = 
        stopTime.MicroSecondsFrom(startTime);

    TInt resse = executionTime.Int64()/1000000;
    buf.Zero();
    buf.Format(_L("ConsumeDiscSpaceL took %d seconds"), resse);
    iLog->Put(buf);

    // 2) Add Landmarks until "disk full" error occur
    if (iLandmarksDb->IsInitializingNeeded())
        {
        iLog->Put(_L("InitializeL"));
        // Synchronous 
        ExecuteAndDeleteLD(iLandmarksDb->InitializeL());        
        }

    CPosLandmark* landmark = CPosLandmark::NewLC();
    landmark->SetLandmarkNameL(_L("LandMarkName1"));
    iLog->Put(_L("Adding landmark1"));
    lmIdArray.Append(iLandmarksDb->AddLandmarkL(*landmark));
    CleanupStack::Pop(landmark);

    landmark = CPosLandmark::NewLC();
    landmark->SetLandmarkNameL(_L("LandMarkName2"));
    iLog->Put(_L("Adding landmark2"));
    lmIdArray.Append(iLandmarksDb->AddLandmarkL(*landmark));
    CleanupStack::Pop(landmark);
    err = KErrNone;
    TPosLmItemId idde;
    TInt i=0;
    
    startTime.UniversalTime();
    iLog->Put(_L("Adding landmark until KErrDiskFull.....1"));
    // some while loop adding landmarks here until "disk full" error occur!!!
    while (err != KErrDiskFull)
        {
        buf.Zero();
        buf.Format(_L("Land Mark___________%d"), i++);
        landmark = CPosLandmark::NewLC();
        landmark->SetLandmarkNameL(buf);
        TRAP(err, idde = iLandmarksDb->AddLandmarkL(*landmark));
        if (err == KErrNone)
            {
            lmIdArray.Append(idde);
            }
        else if (err == KErrLocked) 
            {
            iLog->Put(_L("KErrLocked when adding 1"));
            User::After(100000);
            }
        CleanupStack::Pop(landmark);
        }
    stopTime.UniversalTime();
    executionTime = stopTime.MicroSecondsFrom(startTime);
    resse = executionTime.Int64()/1000000;
    buf.Zero();
    buf.Format(_L("Added %d nr of landmarks, took %d seconds"), i, resse);
    iLog->Put(buf);

    // Check that the filesize limit has not been exceeded 
    err=iFileServer.Volume(volumeInfo, EDriveC);
    buf.Zero();
	buf.AppendFormat(KFree, volumeInfo.iFree);
    iLog->Put(buf);
    if (volumeInfo.iFree < iCriticalLevel)
        {
        LogErrorAndLeave(_L("The max size limit has been exceeded!!!"));
        }

    //Check that the added landmarks can be read
    iLog->Put(_L("Check that it is possible to read landmark"));
    TInt nrOfLandmarks = lmIdArray.Count();
    TInt p=0;
    for (p=0;p<nrOfLandmarks;p++)
        {
        landmark = iLandmarksDb->ReadLandmarkLC(lmIdArray[p]);
        CleanupStack::Pop(landmark);
        }

    // 3) Remove two landmarks and compress landmarks db
    TInt nr = lmIdArray.Count()-1;
    TPosLmItemId id = lmIdArray[nr];
    iLog->Put(_L("Removing landmark1"));
    lmIdArray.Remove(nr);
    TRAP(err, iLandmarksDb->RemoveLandmarkL(id));
    if (err == KErrDiskFull) 
        {
        ExecuteAndDeleteLD(iLandmarksDb->CompactL());

        iLandmarksDb->RemoveLandmarkL(id);
        iLog->Put(_L("DiskFull when removing1"));
        }

    nr = lmIdArray.Count() - 1;
    id = lmIdArray[nr];
    iLog->Put(_L("Removing landmark2"));
    lmIdArray.Remove(nr);
    iLandmarksDb->RemoveLandmarkL(id);
    TRAP(err, iLandmarksDb->RemoveLandmarkL(id));
    if (err == KErrDiskFull) 
        {
        ExecuteAndDeleteLD(iLandmarksDb->CompactL());
        
        iLandmarksDb->RemoveLandmarkL(id);
        iLog->Put(_L("DiskFull when removing2"));
        }
    err = KErrNone;
    iLog->Put(_L("Compacting"));
    ExecuteAndDeleteLD(iLandmarksDb->CompactL());
    
    startTime.UniversalTime();
    iLog->Put(_L("Adding landmark until KErrDiskFull.....2"));
    // 4) Add landmarks until "disk full" error occur!!!
    while (err != KErrDiskFull)
        {
        buf.Zero();
        buf.Format(_L("Land Mark___________%d"), i++);
        landmark = CPosLandmark::NewLC();
        landmark->SetLandmarkNameL(buf);
        //iLog->Put(_L("Adding landmark id to idArray"));
        TRAP(err, idde = iLandmarksDb->AddLandmarkL(*landmark));
        if (err == KErrNone)
            {
            lmIdArray.Append(idde);
            }
        else if (err == KErrLocked) 
            {
            iLog->Put(_L("KErrLocked when adding 2"));
            User::After(100000);
            }
        CleanupStack::Pop(landmark);
        }

    stopTime.UniversalTime();
    executionTime = stopTime.MicroSecondsFrom(startTime);
    resse = executionTime.Int64()/1000000;
    buf.Zero();
    buf.Format(_L("Added %d nr of landmarks, took %d seconds"), i, resse);
    iLog->Put(buf);

    iLog->Put(_L("Check that it is possible to read landmark"));
    //Check that the added landmarks can be read
    nrOfLandmarks = lmIdArray.Count();
    for (p=0;p<nrOfLandmarks;p++)
        {
        landmark = iLandmarksDb->ReadLandmarkLC(lmIdArray[p]);
        CleanupStack::Pop(landmark);
        }

    iLog->Put(_L("Remove all landmarks"));
    err = KErrNone;
    // 5) Remove all landmarks and compact database
    if (!aSync)
        {
        TRAP(err, op = iLandmarksDb->RemoveAllLandmarksL());
        if (err == KErrNone) 
            {
            ExecuteAndDeleteLD(op);
            }
        else if (err == KErrDiskFull)
            {
            iLog->Put(_L("KErrDiskFull when removing all landmarks"));
            ExecuteAndDeleteLD(iLandmarksDb->CompactL());
            
            // Delete KFile2 to free more space on disc, method also open connection to iFile2 again
            DeleteFile2L();

            iLog->Put(_L("Removing after Compact sync"));
            TRAP(err, op = iLandmarksDb->RemoveAllLandmarksL());
            if (err == KErrDiskFull)
                {
                iLog->Put(_L("KErrDiskFull when Removing all landmarks after compact1"));
                RemoveAllLandmarksL();
                }
            else
                {
                ExecuteAndDeleteLD(op);
                }
            }
        }
    else
        {
        iLog->Put(_L("Before RemoveAllLandmarksL(this)"));
        TRAP(err, op = iLandmarksDb->RemoveAllLandmarksL());
        
        if (err == KErrNone) 
            {
            //***iActiveSchedulerWait->Start();
            //***delete op; op=NULL;
            RunAsyncOperationLD(op);
            }
        else if (err == KErrDiskFull)
            {
            iLog->Put(_L("KErrDiskFull when removing all landmarks"));
            ExecuteAndDeleteLD(iLandmarksDb->CompactL());
            
            // Delete KFile2 to free more space on disc, method also open connection to iFile2 again
            DeleteFile2L();

            iLog->Put(_L("Removing after Compact async"));
            TRAP(err, op = iLandmarksDb->RemoveAllLandmarksL());
            if (err == KErrDiskFull)
                {
                iLog->Put(_L("KErrDiskFull when removing all landmarks after compact2"));
                RemoveAllLandmarksL();
                }
            else
                {
                //***iActiveSchedulerWait->Start();
                //***delete op; op=NULL;
                RunAsyncOperationLD(op);
                }
            }
        iLog->Put(_L("After RemoveAllLandmarksL(this)"));
        }
    
    ConsumeDiscSpace2L(iCriticalLevel + KSizeLimitOffset2);

    if (err == KErrDiskFull) iLog->Put(_L("KErrDiskFull when RemoveAllLandmarksL"));
    iLog->Put(_L("Compacting"));
    ExecuteAndDeleteLD(iLandmarksDb->CompactL());
    
    lmIdArray.Reset();
    i=0;
    err = KErrNone;
    startTime.UniversalTime();
    iLog->Put(_L("Adding landmarkcategories until KErrDiskFull....."));

    // 6) Add LandmarkCategories until "disk full" error occur
    while (err != KErrDiskFull)
        {
        buf.Zero();
        buf.Format(_L("Landmark Category _________ %d"), i++);
        CPosLandmarkCategory* lmc = CPosLandmarkCategory::NewLC();
        lmc->SetCategoryNameL(buf);
        lmc->SetIconL(_L("Pelles Icon"), 111, KPosLmIconMaskNotUsed);

        TRAP(err, idde = iCategoryManager->AddCategoryL(*lmc));
        if (err == KErrNone)
            {
            lmIdArray.Append(idde);
            }
        else if (err== KErrLocked)
            {
            iLog->Put(_L("KErrLocked when adding category"));
            User::After(100000);
            }
        CleanupStack::PopAndDestroy(lmc);
        }

    stopTime.UniversalTime();
    executionTime = stopTime.MicroSecondsFrom(startTime);

    resse = executionTime.Int64()/1000000;
    buf.Zero();
    buf.Format(_L("Added %d nr of landmarkcategories, took %d seconds"), i, resse);
    iLog->Put(buf);

    //Check that the added landmarkcategories can be read
    TInt nrOfCategories = lmIdArray.Count();
    for (p=0;p<nrOfCategories;p++)
        {
        CPosLandmarkCategory* lmc = iCategoryManager->ReadCategoryLC(lmIdArray[p]);
        CleanupStack::Pop(lmc);
        }

    // 7) Remove two categories and compress landmarks db
    nr = lmIdArray.Count()-1;
    id = lmIdArray[nr];
    iLog->Put(_L("Removing landmarkcategory1"));
    lmIdArray.Remove(nr);
    op=NULL;
    TRAP(err, op = iCategoryManager->RemoveCategoryL(id));
    if (err == KErrDiskFull)
        {
        ExecuteAndDeleteLD(iLandmarksDb->CompactL());
        ExecuteAndDeleteLD(iCategoryManager->RemoveCategoryL(id));
        iLog->Put(_L("KErrDiskFull when removing landmarkcategory1"));
        }

    if (err == KErrNone)
        {
        ExecuteAndDeleteLD(op);
        }
    else
        {
        delete op;
        op = NULL;
        }

    TBuf<50> buffe;
    buffe.Format(_L("1) Err after RemoveCategoryL: %d"), err);
    iLog->Put(buffe);

    nr = lmIdArray.Count()-1;
    id = lmIdArray[nr];
    iLog->Put(_L("Removing landmarkcategory2"));
    lmIdArray.Remove(nr);

    if (!aSync)
        {
        TRAP(err, op = iCategoryManager->RemoveCategoryL(id));
        if (err == KErrDiskFull)
            {
            delete op;
            op = NULL;
            iLog->Put(_L("KErrDiskFull when removing landmarkcategory2"));
            ExecuteAndDeleteLD(iLandmarksDb->CompactL());
            
            iLog->Put(_L("After compact before removing landmarkcategory2"));
            ExecuteAndDeleteLD(iCategoryManager->RemoveCategoryL(id));
            }
        else if (err == KErrNone)
            {
            ExecuteAndDeleteLD(op);
            }
        else if (err == KErrLocked)
            {
            iLog->Put(_L("KErrLocked returned from iCategoryManager->RemoveCategoryL"));
            delete op;
            op = NULL;
            }
        } 
    else
        {
        TRAP(err, op = iCategoryManager->RemoveCategoryL(id));
        if (err == KErrNone)
            {
            //***iActiveSchedulerWait->Start();
            //***delete op;
            RunAsyncOperationLD(op);
            }
        else if (err == KErrDiskFull)
            {
            delete op;
            op = NULL;
            iLog->Put(_L("KErrDiskFull when removing landmarkcategory2 async"));
            ExecuteAndDeleteLD(iLandmarksDb->CompactL());
            
            iLog->Put(_L("After compact before removing landmarkcategory2 async"));
            op = iCategoryManager->RemoveCategoryL(id);
            
            //***iActiveSchedulerWait->Start();
            //***delete op;
            RunAsyncOperationLD(op);
            }
        else if (err == KErrLocked)
            {
            delete op;
            op = NULL;
            iLog->Put(_L("KErrLocked returned from iCategoryManager->RemoveCategoryL"));
            }
        }

    buffe.Zero();
    buffe.Format(_L("2) Err after RemoveCategoryL: %d"), err);
    iLog->Put(buffe);

    iLog->Put(_L("Compacting"));
    ExecuteAndDeleteLD(iLandmarksDb->CompactL());
    iLog->Put(_L("After Compacting"));
    
    lmIdArray.Reset();
    i=0;
    err = KErrNone;

    startTime.UniversalTime();
    // 8) Add LandmarkCategories until "disk full" error occur
    while (err != KErrDiskFull)
        {
        buf.Zero();
        buf.Format(_L("LandmarkCategory %d"), i++);

        CPosLandmarkCategory* lmc = CPosLandmarkCategory::NewLC();
        lmc->SetCategoryNameL(buf);
        lmc->SetIconL(_L("PellesIcon"), 111, KPosLmIconMaskNotUsed);
        iLog->Put(buf);
        
        TRAP(err, idde = iCategoryManager->AddCategoryL(*lmc));
        if (err == KErrNone)
            {
            lmIdArray.Append(idde);
            }
        else if (err == KErrLocked)
            {
            iLog->Put(_L("KerrLocked when addCategory"));
            User::After(100000);
            }
        CleanupStack::PopAndDestroy(lmc); 
    }
    stopTime.UniversalTime();
    executionTime = stopTime.MicroSecondsFrom(startTime);

    resse = executionTime.Int64()/1000000;
    buf.Zero();
    buf.Format(_L("Added %d nr of landmarkcategories, took %d seconds"), i, resse);
    iLog->Put(buf);

    // 9) Remove all categories and compact db
    // sync method
    // XXXX add async check here
    iLog->Put(_L("Removing all categories"));
    TRAP(err, iCategoryManager->RemoveCategoriesL(lmIdArray));
    if (err == KErrDiskFull) iLog->Put(_L("KErrDiskFull when RemoveCategoriesL"));
    iLog->Put(_L("Compacting"));
    ExecuteAndDeleteLD(iLandmarksDb->CompactL());
    

    // 10) Consume more space then the limit specified in resource file
    ConsumeDiscSpace1L(iCriticalLevel - KSizeLimitOffset2);

    // 11) Try to add a landmark
    buf.Zero();
    buf.Format(_L("LandMark%d"), i++);
    landmark = CPosLandmark::NewLC();
    landmark->SetLandmarkNameL(buf);

    TRAP(err, idde = iLandmarksDb->AddLandmarkL(*landmark));
    if (err != KErrDiskFull)
        {
        buf.Zero();
        buf.Format(_L("Should leave with KErrDiskFull instead %d"), err);
        //LogErrorAndLeave(buf);
        LogErrorAndLeave(buf);
        }
    CleanupStack::PopAndDestroy(landmark);
    CleanupStack::PopAndDestroy(&lmIdArray);
    }
/**
Called when async child completes with >=KErrNone
*/
void CImapOpSyncSubs::DoRunL()
	{
	// Finish if any server errors.
	if (iStatus.Int()!=KErrNone)
		{
		Complete(iStatus.Int());
		}

	switch(iNextSyncAction)
		{
	case CImapSyncManager::EProcessRemoteSubscription:
		{
		// Call returned from the LSUB command. Now process the list.
		// Update folder tree
		TInt folderscount = iImapListFolderInfo.Count();
		CImapListFolderInfo* folder;
		
		for(TInt loop = 0;loop < folderscount; ++loop)
			{
			folder = iImapListFolderInfo[loop];
			iSyncMan.AddSubscribedFolderFromInfoL(folder, iSession.LogId());
			}
		iSyncMan.CreateLocalFolderListL();

		// Now do the remote subscription
		iNextSyncAction = CImapSyncManager::EUpdateRemoteSubscription;
		CompleteSelf();
		SetActive();
		}
		break;
	case CImapSyncManager::EUpdateRemoteSubscription:
		{
		// Process the subscribed and unsubscribed list from the SyncManager.
		// This should be done after checking the online subscription list.

		RArray<TUint>* unsubscribeList = iSyncMan.GetUnSubscribedFolderToDoList();
		RArray<TUint>* subscribeList = iSyncMan.GetSubscribedFolderToDoList();

		// Any subscription to do?
		if (subscribeList->Count())
			{
			// Take it off the head
			TMsvId folderid = (*subscribeList)[0];
			subscribeList->Remove(0);

			// Subscribe to it
			CImapFolder* tempfolder = iSyncMan.GetTempFolderL(folderid);
			CleanupStack::PushL(tempfolder);
			iSession.SubscribeL(iStatus, tempfolder->FullFolderPathL());
			CleanupStack::PopAndDestroy(tempfolder);
			
			// set the subscribed flag for the folder.
			SetEntryL(folderid);
			TMsvEmailEntry entry = iServerEntry.Entry();
			entry.SetSubscribed(ETrue);
			ChangeEntryL(entry);
			
			SetActive();
			}
		// ...or unsubscription?
		else if (unsubscribeList->Count())
			{
			// Take it off the head
			TMsvId folderid = (*unsubscribeList)[0];
			unsubscribeList->Remove(0);

			// Unsubscribe from it
			CImapFolder* tempfolder = iSyncMan.GetTempFolderL(folderid);
			CleanupStack::PushL(tempfolder);
			iSession.UnsubscribeL(iStatus, tempfolder->FullFolderPathL());
			CleanupStack::PopAndDestroy(tempfolder);
			
			// clear the subscribed flag for the folder.
			SetEntryL(folderid);
			TMsvEmailEntry entry = iServerEntry.Entry();
			entry.SetSubscribed(EFalse);
			ChangeEntryL(entry);
			
			SetActive();
			}
		else
			{
			// All done.
			iNextSyncAction = CImapSyncManager::ENotSyncing;
			Complete(iStatus.Int());
			}
		}
		break;
	default:
	break;
		}
	}
// ---------------------------------------------------------------------------
// CAtSmsStoreReadAll::ParseResponseL
// other items were commented in a header
// ---------------------------------------------------------------------------
void CAtSmsStoreReadAll::ParseResponseL(const TDesC8& /*aResponseBuf*/)
	{
	/**
	* Response:+CMGR:<stat>,[<alpha>],<length><CR><LF><pdu>
	*/
	iError = KErrNone;	
	RArray<TPtrC8> array;
	CleanupClosePushL(array);
	iParser->ParseRespondedBuffer(array,Buffer());
	if(array[0].MatchF(KAnyATCommand)!=KErrNotFound)
		{
		array.Remove(0);
		}
	TInt count = array.Count();
#ifdef _DEBUG
	for( TInt i=0;i<count;i++ )
		{
        LOGTEXT3(_L8("CAtSmsStoreReadAll::ParseResponseL\tarray[%d]=%S"),i,&array[i]);  
		}
#endif   
	if (count <= 1)
		{
		CleanupStack::PopAndDestroy();
		iError = KErrNotFound;
		return;
		}
	if(array[0].MatchF(KCMGRResponseString)==KErrNotFound)
		{
		LOGTEXT(_L8("CAtSmsStoreReadAll::ParseResponseL\tFound +CMGR String!"));
		CleanupStack::PopAndDestroy();
		iError = KErrNotFound;
		return;
		}
	// parse the message status
	TLex8 lex(array[1]);
	TUint16 val;
	TInt ret=lex.Val(val,EDecimal);
	if(ret!=KErrNone)
		{
		CleanupStack::PopAndDestroy();
		iError = ret;
		return;
		}
	iSmsData.iMessageStatus = val;
	
	//parse the message length
	TLex8 lex1(array[3]);
	TUint msgLength;
	ret=lex1.Val(msgLength,EDecimal);
	if(ret!=KErrNone)
		{
		CleanupStack::PopAndDestroy();
		iError = ret;
		return;
		}
	LOGTEXT2(_L8("CAtSmsStoreReadAll::ParseResponseL\tMessage Length=%d"),msgLength);
	TBuf8<KMaxAsciiPduLength>  pdu;	   //Binary Message pdu
	SmsAtUtil::ConvertAsciiToBinary(array[4],pdu);
	TPtrC8 pduPtr(pdu);
	
	RMobilePhone::TMobileAddress gsmServiceCentre;   //messages's SCA
	if (msgLength*2 < array[4].Length())
		{
		// There is an SCA prepended so remove this and store it in iGsmServiceCentre
		SmsAtUtil::ReadAndRemoveAddressFromPdu(pduPtr,gsmServiceCentre);
		}
	iSmsData.iSmsMsg = pduPtr;
	iSmsData.iServiceCentre = gsmServiceCentre.iTelNumber;
	iSmsData.iMobileScNPI = gsmServiceCentre.iNumberPlan;
	iSmsData.iMobileScTON = gsmServiceCentre.iTypeOfNumber;
	LOGTEXT2(_L8("CAtSmsStoreReadAll::ParseResponseL\tMessage Status=%d"),
			                          iSmsData.iMessageStatus);
	LOGTEXT3(_L8("CAtSmsStoreReadAll::ParseResponseL\tSmsMsg=%S, ServiceCentre=%S"), 
			                          &iSmsData.iSmsMsg, &iSmsData.iServiceCentre);
	CleanupStack::PopAndDestroy(&array);
	}