featuremgmt/featuremgr/src/serverexe/featmgrfeatureregistry.cpp
changeset 51 7d4490026038
parent 40 b8bdbc8f59c7
equal deleted inserted replaced
40:b8bdbc8f59c7 51:7d4490026038
   518     return countSupported;
   518     return countSupported;
   519     }
   519     }
   520 
   520 
   521 // -----------------------------------------------------------------------------
   521 // -----------------------------------------------------------------------------
   522 
   522 
   523 TInt CFeatMgrFeatureRegistry::ResetFeatures()
   523 void CFeatMgrFeatureRegistry::ResetFeaturesL()
   524     {
   524     {
   525     FUNC_LOG
   525     FUNC_LOG
   526     
   526     
   527     // backup the feature list before it is destroyed
   527     // backup the feature list before it is destroyed
   528     iFeatureListBackup.Reset();
   528     iFeatureListBackup.Reset();
   529     TInt count = iFeatureList.Count();
   529     const TInt KCount = iFeatureList.Count();
   530     
   530    	iFeatureListBackup.ReserveL(KCount);
   531     for( TInt i=0; i < count; i++ )
   531 	for(TInt i(0); i < KCount; i++)
   532         {
   532 		{
   533         iFeatureListBackup.Append( iFeatureList[i] );
   533 		// The main error here would be KErrNoMemory which should not happen as
   534         }
   534 		// we have already reserved the space. However, we should still check.
   535     
   535 		iFeatureListBackup.AppendL(iFeatureList[i]);
       
   536 		}
       
   537 	    
   536     // destroy the feature list
   538     // destroy the feature list
   537     iFeatureList.Reset();
   539     iFeatureList.Reset();
   538     iFeatureList.Close();
   540     iFeatureList.Close();
   539     
   541     
   540     iRangeList.Reset();
   542     iRangeList.Reset();
   541     iRangeList.Close();
   543     iRangeList.Close();
   542 
       
   543     return( 0 );
       
   544     }
   544     }
   545 
   545 
   546 /**
   546 /**
   547  * Get the fully qualified path and filename to the features.dat
   547  * Get the fully qualified path and filename to the features.dat
   548  * data file.
   548  * data file.
   750         if ( (err != KErrNone) && flags.IsSet(EFeatureRuntime) )
   750         if ( (err != KErrNone) && flags.IsSet(EFeatureRuntime) )
   751         	{
   751         	{
   752         	continue;
   752         	continue;
   753        		}
   753        		}
   754         
   754         
   755         tempFeatureArray.Insert( entry, i);
   755 		tempFeatureArray.InsertL( entry, i);
   756         
       
   757         }
   756         }
   758 
   757 
   759     // Reserve memory if list still empty
   758     // Reserve memory if list still empty
   760     if( !iFeatureList.Count() )
   759     if( !iFeatureList.Count() )
   761         {
   760         {
   769  
   768  
   770         TInt index = SearchFeature( entry.FeatureUid() );
   769         TInt index = SearchFeature( entry.FeatureUid() );
   771         
   770         
   772         if( index == KErrNotFound)
   771         if( index == KErrNotFound)
   773             {
   772             {
   774             User::LeaveIfError( iFeatureList.InsertInOrder( entry, FindByUid ) );
   773             iFeatureList.InsertInOrderL( entry, FindByUid );
   775             }
   774             }
   776         else
   775         else
   777             {
   776             {
   778             INFO_LOG1( "CFeatMgrFeatureRegistry::ReadFileL - replacing uid 0x%08x",
   777             INFO_LOG1( "CFeatMgrFeatureRegistry::ReadFileL - replacing uid 0x%08x",
   779                 iFeatureList[index].FeatureUid().iUid );
   778                 iFeatureList[index].FeatureUid().iUid );