mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp
branchRCL_3
changeset 23 e42293e811d8
parent 22 b034b1c214c2
equal deleted inserted replaced
22:b034b1c214c2 23:e42293e811d8
   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;
       
   115                         format = EMTPFormatCode3GPContainer;
   113                         format = EMTPFormatCode3GPContainer;
   116                         }
   114                         }
   117                     }
       
   118 
       
   119                 if ( mime != NULL )
       
   120                     {
       
   121                     delete mime;
   115                     delete mime;
   122                     mime = NULL;
   116                     mime = NULL;
   123                     }
   117                     }
   124                 }
   118                 }
   125 #ifdef MMMTPDP_ABSTRACTAUDIOALBUM_SUPPORT
   119 #ifdef MMMTPDP_ABSTRACTAUDIOALBUM_SUPPORT
   523 // -----------------------------------------------------------------------------
   517 // -----------------------------------------------------------------------------
   524 //
   518 //
   525 HBufC8* MmMtpDpUtility::OdfMimeTypeL( const TDesC& aFullPath )
   519 HBufC8* MmMtpDpUtility::OdfMimeTypeL( const TDesC& aFullPath )
   526     {
   520     {
   527     PRINT( _L( "MM MTP => MmMtpDpUtility::OdfMimeTypeL" ) );
   521     PRINT( _L( "MM MTP => MmMtpDpUtility::OdfMimeTypeL" ) );
   528     HBufC8* mimebuf = NULL;
   522 
   529 
   523     CContent* content = CContent::NewLC( aFullPath ); // + content
   530     CContent* content = CContent::NewL( aFullPath );
   524     HBufC* buffer = HBufC::NewLC( KMimeTypeMaxLength ); // + buffer
   531     CleanupStack::PushL( content ); // + content
       
   532 
       
   533     HBufC* buffer = HBufC::NewL( KMimeTypeMaxLength );
       
   534     CleanupStack::PushL( buffer ); // + buffer
       
   535 
   525 
   536     TPtr data = buffer->Des();
   526     TPtr data = buffer->Des();
   537     TInt err = content->GetStringAttribute( EMimeType, data );
   527     User::LeaveIfError( content->GetStringAttribute( EMimeType, data ) );
   538 
   528 
   539     if ( err == KErrNone )
   529     HBufC8* mimebuf = HBufC8::NewL( buffer->Length() );
   540         {
   530     mimebuf->Des().Copy( *buffer );
   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         }
       
   556 
   531 
   557     CleanupStack::PopAndDestroy( buffer ); // - buffer
   532     CleanupStack::PopAndDestroy( buffer ); // - buffer
   558     CleanupStack::PopAndDestroy( content ); // - content
   533     CleanupStack::PopAndDestroy( content ); // - content
   559 
   534 
   560     PRINT( _L( "MM MTP <= MmMtpDpUtility::OdfMimeTypeL" ) );
   535     PRINT( _L( "MM MTP <= MmMtpDpUtility::OdfMimeTypeL" ) );