predictivesearch/PcsAlgorithm/Algorithm2/src/CPsDataPluginInterface.cpp
branchRCL_3
changeset 18 d4f567ce2e7c
parent 0 e686773b3f54
--- a/predictivesearch/PcsAlgorithm/Algorithm2/src/CPsDataPluginInterface.cpp	Thu Jul 15 18:22:55 2010 +0300
+++ b/predictivesearch/PcsAlgorithm/Algorithm2/src/CPsDataPluginInterface.cpp	Thu Aug 19 09:41:07 2010 +0300
@@ -15,6 +15,7 @@
 *
 */
 
+
 // INCLUDE FILES
 #include "CPsDataPluginInterface.h"
 #include "CPsDataPlugin.h"
@@ -109,7 +110,8 @@
     
     // Instantiate plugins for all impUIds by calling 
     // InstantiatePlugInFromImpUidL
-    for ( TInt i=0; i<infoArray.Count(); i++ )
+    const TInt infoArrayCount = infoArray.Count();
+    for ( TInt i=0; i < infoArrayCount; i++ )
     {
         // Get imp info
         CImplementationInformation& info( *infoArray[i] );
@@ -178,8 +180,8 @@
 {
 
     PRINT ( _L("Enter CPsDataPluginInterface::RequestForDataL") );
-   
-    for ( TInt idx = 0; idx < iPsDataPluginInstances.Count(); idx++ )
+   const TInt instancesCount = iPsDataPluginInstances.Count();
+    for ( TInt idx = 0; idx < instancesCount; idx++ )
     {
         if(iPsDataPluginInstances[idx]->IsDataStoresSupportedL(aDataStore))
         {
@@ -200,8 +202,8 @@
 {
 
     PRINT ( _L("Enter CPsDataPluginInterface::GetAllSupportedDataStoresL") );
-   
-    for ( TInt idx = 0; idx < iPsDataPluginInstances.Count(); idx++ )
+    const TInt instancesCount = iPsDataPluginInstances.Count();
+    for ( TInt idx = 0; idx < instancesCount; idx++ )
     {       
        iPsDataPluginInstances[idx]->GetSupportedDataStoresL(aDataStores);
     }
@@ -219,20 +221,23 @@
 
     PRINT ( _L("Enter CPsDataPluginInterface::GetAllSupportedDataStoresL") );
    
-    for ( TInt idx = 0; idx < iPsDataPluginInstances.Count(); idx++ )
-    {   
-       RPointerArray<TDesC> aDataStores;    
-       iPsDataPluginInstances[idx]->GetSupportedDataStoresL(aDataStores);
+    const TInt instancesCount = iPsDataPluginInstances.Count();
+    for ( TInt idx = 0; idx < instancesCount; idx++ )
+    {
+       RPointerArray<TDesC> dataStores;
+       CleanupClosePushL( dataStores );
+       iPsDataPluginInstances[idx]->GetSupportedDataStoresL(dataStores);
        
-       for( TInt i(0); i<aDataStores.Count(); i++)
-       {       	
-	       	if( aDataStores[i]->Compare(aUri) == 0)
+       const TInt dataStoresCount = dataStores.Count();
+       for ( TInt i(0); i < dataStoresCount; i++)
+       {
+	       	if ( dataStores[i]->Compare(aUri) == 0)
 	       	{
 	       		iPsDataPluginInstances[idx]->GetSupportedDataFieldsL(aDataFields);
 	       		break;
-	       	}    	
+	       	}
        }
-       aDataStores.Reset();
+       CleanupStack::PopAndDestroy( &dataStores ); // Close
     }
     
     PRINT ( _L("End CPsDataPluginInterface::GetAllSupportedDataStoresL") );