mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp
changeset 51 e61a04404bdf
parent 44 d141fc1ad77b
child 62 b276843a15ba
--- a/mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp	Tue Jul 06 14:48:59 2010 +0300
+++ b/mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp	Wed Aug 18 10:16:02 2010 +0300
@@ -110,14 +110,8 @@
                     if ( mime->CompareF( KMimeTypeAudio3gpp ) == 0
                         || mime->CompareF( KMimeTypeVideo3gpp ) == 0 )
                         {
-                        delete mime;
-                        mime = NULL;
                         format = EMTPFormatCode3GPContainer;
                         }
-                    }
-
-                if ( mime != NULL )
-                    {
                     delete mime;
                     mime = NULL;
                     }
@@ -525,34 +519,15 @@
 HBufC8* MmMtpDpUtility::OdfMimeTypeL( const TDesC& aFullPath )
     {
     PRINT( _L( "MM MTP => MmMtpDpUtility::OdfMimeTypeL" ) );
-    HBufC8* mimebuf = NULL;
 
-    CContent* content = CContent::NewL( aFullPath );
-    CleanupStack::PushL( content ); // + content
-
-    HBufC* buffer = HBufC::NewL( KMimeTypeMaxLength );
-    CleanupStack::PushL( buffer ); // + buffer
+    CContent* content = CContent::NewLC( aFullPath ); // + content
+    HBufC* buffer = HBufC::NewLC( KMimeTypeMaxLength ); // + buffer
 
     TPtr data = buffer->Des();
-    TInt err = content->GetStringAttribute( EMimeType, data );
-
-    if ( err == KErrNone )
-        {
-        mimebuf = HBufC8::New( buffer->Length() );
+    User::LeaveIfError( content->GetStringAttribute( EMimeType, data ) );
 
-        if ( mimebuf == NULL )
-            {
-            User::LeaveIfError( KErrNotFound );
-            }
-
-        mimebuf->Des().Copy( *buffer );
-        }
-
-    // leave if NULL
-    if ( mimebuf == NULL )
-        {
-        User::Leave( KErrNotFound );
-        }
+    HBufC8* mimebuf = HBufC8::NewL( buffer->Length() );
+    mimebuf->Des().Copy( *buffer );
 
     CleanupStack::PopAndDestroy( buffer ); // - buffer
     CleanupStack::PopAndDestroy( content ); // - content