cmmanager/cmmgr/Framework/Src/ccmpluginbaseeng.cpp
branchRCL_3
changeset 55 fc7b30ed2058
parent 0 5a93021fdf25
--- a/cmmanager/cmmgr/Framework/Src/ccmpluginbaseeng.cpp	Thu Jul 15 19:05:04 2010 +0300
+++ b/cmmanager/cmmgr/Framework/Src/ccmpluginbaseeng.cpp	Thu Aug 19 10:18:49 2010 +0300
@@ -710,24 +710,18 @@
 
     HBufC8* retVal = NULL;
     
-    switch ( aAttribute )
-        {
-        default:
-            {
-            TUint32 attribute = CheckForCommonAttribute( aAttribute );
-            CMDBField<TDesC8>* field;
-                        
-            FindFieldL( attribute, ECmText8, (CMDBElement*&)field );
+    TUint32 attribute = CheckForCommonAttribute( aAttribute );
+    CMDBField<TDesC8>* field;
+                
+    FindFieldL( attribute, ECmText8, (CMDBElement*&)field );
 
-            if ( !field->IsNull() )
-                {
-                retVal = field->GetL().AllocL();
-                }
-            else
-                {
-                retVal = KNullDesC8().AllocL();
-                }
-            }
+    if ( !field->IsNull() )
+        {
+        retVal = field->GetL().AllocL();
+        }
+    else
+        {
+        retVal = KNullDesC8().AllocL();
         }
         
     return retVal;
@@ -950,24 +944,17 @@
     {
     LOGGER_ENTERFN( "CCmPluginBaseEng::SetString8AttributeL" );
 
-    switch ( aAttribute )
+    TUint32 attribute = CheckForCommonAttribute( aAttribute );
+    CMDBField<TDesC8>* field;
+
+    TValidationFunctionL func = FindFieldL( attribute, ECmText8, (CMDBElement*&)field );
+
+    if( func )
         {
-        default:
-            {
-            TUint32 attribute = CheckForCommonAttribute( aAttribute );
-            CMDBField<TDesC8>* field;
-            
-            TValidationFunctionL func = 
-                        FindFieldL( attribute, ECmText8, (CMDBElement*&)field );
-            
-            if( func )
-                {
-                func( this, attribute, (const TAny*)&aValue );
-                }
+        func( this, attribute, (const TAny*)&aValue );
+        }
 
-            field->SetL( aValue );
-            }
-        }
+    field->SetL( aValue );
     }
     
 // ---------------------------------------------------------------------------
@@ -2427,7 +2414,9 @@
                 {
                 pf /= 10;
                 if ( !pf )
+                    {
                     break;
+                    }
                 }
             TPtr sgdptr( temp->Des() );
             TPtr sgdptr2( temp2->Des() );
@@ -2783,7 +2772,7 @@
     }
     
 // ---------------------------------------------------------------------------
-// CCmPluginBaseEng::AddConverstionTableL
+// CCmPluginBaseEng::AddCommonConversionTableL
 // ---------------------------------------------------------------------------
 //
 EXPORT_C void CCmPluginBaseEng::AddCommonConversionTableL( 
@@ -2822,7 +2811,8 @@
     {
     LOGGER_ENTERFN( "CCmPluginBaseEng::RemoveCommonConversionTable" );
 
-    for ( TInt i = 0; i < iPriv->iCommonConvTblArray.Count(); ++i )
+    // When calling Remove(), it's safer to loop starting from end.
+    for ( TInt i = iPriv->iCommonConvTblArray.Count()-1; i >= 0; i-- )
         {
         if ( iPriv->iCommonConvTblArray[i] == aConvTable )
             {
@@ -2876,10 +2866,6 @@
                 {
                 aElement = &field;
                 }
-            else
-                {
-                User::Leave( KErrNotSupported );
-                }
             }
             break;
 
@@ -2889,10 +2875,6 @@
                 {
                 aElement = &field;
                 }
-            else
-                {
-                User::Leave( KErrNotSupported );
-                }
             }
             break;
             
@@ -2905,10 +2887,6 @@
                 {
                 aElement = &field;
                 }
-            else
-                {
-                User::Leave( KErrNotSupported );
-                }
             }
             break;