mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataproviderenumerator.cpp
branchRCL_3
changeset 14 05b0d2323768
parent 9 bee149131e4b
child 28 f56ec6ce2732
--- a/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataproviderenumerator.cpp	Fri Feb 19 23:18:32 2010 +0200
+++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataproviderenumerator.cpp	Fri Mar 12 15:44:36 2010 +0200
@@ -219,7 +219,11 @@
         const CMTPStorageMetaData& storage( iFramework.StorageMgr().StorageL( iStorages[0] ) );
         TFileName root( storage.DesC( CMTPStorageMetaData::EStorageSuid ) );
         GetModifiedContentL( root );
-        iDataProvider.GetWrapperL().UpdateMusicCollectionL();
+        TRAPD( err, iDataProvider.GetWrapperL().UpdateMusicCollectionL() );
+        if ( err != KErrNone )
+            {
+            PRINT1( _L("MM MTP <> ScanNextStorageL, UpdateMusicCollectionL err =%d "), err );            
+            }
 
         iStorages.Remove( 0 );
         ScanStorageL( iStorages[0] );
@@ -419,7 +423,8 @@
 //
 TInt CMediaMtpDataProviderEnumerator::RunError( TInt aError )
     {
-    PRINT1( _L( "MM MTP <> CMediaMtpDataProviderEnumerator::RunError with error %d" ), aError );
+    if ( aError != KErrNone )
+        PRINT1( _L( "MM MTP <> CMediaMtpDataProviderEnumerator::RunError with error %d" ), aError );
 
     TRAP_IGNORE( SignalCompleteL( iDataProvider ) );
 
@@ -468,34 +473,39 @@
     {
     PRINT( _L( "MM MTP => CMediaMtpDataProviderEnumerator::ProcessEntriesL" ) );
 
-    TBuf<KMaxFileName> path = iPath.DriveAndPath();
+    TFileName path = iPath.DriveAndPath();
 
     while ( !IsOverThreshold() && iFirstUnprocessed < iEntries.Count() )
         {
         const TEntry& entry = iEntries[iFirstUnprocessed];
-        path.Append( entry.iName );
-        PRINT1( _L( "MM MTP <> path = %S" ), &path );
 
         TInt len = entry.iName.Length();
 
-        if ( entry.IsDir() )
+        // Skip object with too long name
+        if ( KMaxFileName >= path.Length() + len )
             {
-            path.Append( '\\' );
-            ++len;
+            path.Append( entry.iName );
+            PRINT1( _L( "MM MTP <> path = %S" ), &path );
+
+            if ( entry.IsDir() )
+                {
+                path.Append( '\\' );
+                ++len;
 
-            // we don't need to process folder, just remember
-            // the folder
-            TEntry* dirEntry = new TEntry( entry );
-            User::LeaveIfNull( dirEntry );
-            iDirStack.AppendL( dirEntry );
+                // we don't need to process folder, just remember
+                // the folder
+                TEntry* dirEntry = new TEntry( entry );
+                User::LeaveIfNull( dirEntry );
+                iDirStack.AppendL( dirEntry );
+                }
+            else if ( IsFileAccepted( path ) )
+                {
+                AddEntryL( path );
+                }
+
+            // Remove filename part
+            path.SetLength( path.Length() - len );
             }
-        else if ( IsFileAccepted( path ) )
-            {
-            AddEntryL( path );
-            }
-
-        // Remove filename part
-        path.SetLength( path.Length() - len );
 
         iFirstUnprocessed++;
         }
@@ -619,7 +629,9 @@
     CDesCArray* modifiedContents = new ( ELeave ) CDesCArrayFlat( KMTPDriveGranularity );
     CleanupStack::PushL( modifiedContents ); // + modifiedContents
 
-    iDataProvider.GetWrapperL().GetModifiedContentL( aStorageRoot, arrayCount, *modifiedContents );
+    TRAPD( err, iDataProvider.GetWrapperL().GetModifiedContentL( aStorageRoot, arrayCount, *modifiedContents ) );
+    if ( err != KErrNone )
+        PRINT1( _L("MM MTP <> GetModifiedContentL err =%d "), err );   
 
     if ( arrayCount > 0 )
         {