mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp
branchRCL_3
changeset 67 16db3449d7ba
parent 53 e42293e811d8
equal deleted inserted replaced
63:91d5ad76f5c6 67:16db3449d7ba
   108                     {
   108                     {
   109                     // 3GP
   109                     // 3GP
   110                     if ( mime->CompareF( KMimeTypeAudio3gpp ) == 0
   110                     if ( mime->CompareF( KMimeTypeAudio3gpp ) == 0
   111                         || mime->CompareF( KMimeTypeVideo3gpp ) == 0 )
   111                         || mime->CompareF( KMimeTypeVideo3gpp ) == 0 )
   112                         {
   112                         {
       
   113                         delete mime;
       
   114                         mime = NULL;
   113                         format = EMTPFormatCode3GPContainer;
   115                         format = EMTPFormatCode3GPContainer;
   114                         }
   116                         }
       
   117                     }
       
   118 
       
   119                 if ( mime != NULL )
       
   120                     {
   115                     delete mime;
   121                     delete mime;
   116                     mime = NULL;
   122                     mime = NULL;
   117                     }
   123                     }
   118                 }
   124                 }
   119 #ifdef MMMTPDP_ABSTRACTAUDIOALBUM_SUPPORT
   125 #ifdef MMMTPDP_ABSTRACTAUDIOALBUM_SUPPORT
   517 // -----------------------------------------------------------------------------
   523 // -----------------------------------------------------------------------------
   518 //
   524 //
   519 HBufC8* MmMtpDpUtility::OdfMimeTypeL( const TDesC& aFullPath )
   525 HBufC8* MmMtpDpUtility::OdfMimeTypeL( const TDesC& aFullPath )
   520     {
   526     {
   521     PRINT( _L( "MM MTP => MmMtpDpUtility::OdfMimeTypeL" ) );
   527     PRINT( _L( "MM MTP => MmMtpDpUtility::OdfMimeTypeL" ) );
   522 
   528     HBufC8* mimebuf = NULL;
   523     CContent* content = CContent::NewLC( aFullPath ); // + content
   529 
   524     HBufC* buffer = HBufC::NewLC( KMimeTypeMaxLength ); // + buffer
   530     CContent* content = CContent::NewL( aFullPath );
       
   531     CleanupStack::PushL( content ); // + content
       
   532 
       
   533     HBufC* buffer = HBufC::NewL( KMimeTypeMaxLength );
       
   534     CleanupStack::PushL( buffer ); // + buffer
   525 
   535 
   526     TPtr data = buffer->Des();
   536     TPtr data = buffer->Des();
   527     User::LeaveIfError( content->GetStringAttribute( EMimeType, data ) );
   537     TInt err = content->GetStringAttribute( EMimeType, data );
   528 
   538 
   529     HBufC8* mimebuf = HBufC8::NewL( buffer->Length() );
   539     if ( err == KErrNone )
   530     mimebuf->Des().Copy( *buffer );
   540         {
       
   541         mimebuf = HBufC8::New( buffer->Length() );
       
   542 
       
   543         if ( mimebuf == NULL )
       
   544             {
       
   545             User::LeaveIfError( KErrNotFound );
       
   546             }
       
   547 
       
   548         mimebuf->Des().Copy( *buffer );
       
   549         }
       
   550 
       
   551     // leave if NULL
       
   552     if ( mimebuf == NULL )
       
   553         {
       
   554         User::Leave( KErrNotFound );
       
   555         }
   531 
   556 
   532     CleanupStack::PopAndDestroy( buffer ); // - buffer
   557     CleanupStack::PopAndDestroy( buffer ); // - buffer
   533     CleanupStack::PopAndDestroy( content ); // - content
   558     CleanupStack::PopAndDestroy( content ); // - content
   534 
   559 
   535     PRINT( _L( "MM MTP <= MmMtpDpUtility::OdfMimeTypeL" ) );
   560     PRINT( _L( "MM MTP <= MmMtpDpUtility::OdfMimeTypeL" ) );