Re-merge foundation certs(Bug 1993) and fix for Bug 2121. RCL_3 PDK_3.0.4
authorPat Downey <patd@symbian.org>
Tue, 26 Oct 2010 15:52:41 +0100
branchRCL_3
changeset 89 c38f396e1cd0
parent 88 c1bd57533c56 (diff)
parent 78 b72c2d56e34a (current diff)
Re-merge foundation certs(Bug 1993) and fix for Bug 2121.
--- a/commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsView.cpp	Fri Sep 17 17:32:40 2010 +0100
+++ b/commondrm/drmrightsmanagerui/src/DRMRightsMgrDetailsView.cpp	Tue Oct 26 15:52:41 2010 +0100
@@ -437,6 +437,7 @@
     iDetails.iIndividualConstraint = aIndividualConstraint;
     iDetails.iUsageAllowed = aUsageAllowed;
     iDetails.iActiveROindex = 0;
+    DeleteConstraints();
     iDetails.iRights->Reset();
     iDetails.iDrmScheme = aDrmScheme;
 
--- a/commondrm/drmutility/src/DrmUiHandlingImpl.cpp	Fri Sep 17 17:32:40 2010 +0100
+++ b/commondrm/drmutility/src/DrmUiHandlingImpl.cpp	Tue Oct 26 15:52:41 2010 +0100
@@ -389,6 +389,10 @@
     {
     DRM::CDrmUiHandlingData* data( PopFront() );
 
+    // reset the current observer
+    // it may already be deleted so don't do any calls to it.
+    iObserver = NULL;
+
     // Empty the queue:
     while ( data )
         {
@@ -1126,17 +1130,26 @@
             break;
         }
 
-    // Complete the client request
-    iObserver->OperationCompleted( iOperationId, KErrNone );
-
+    // if the observer exists and it has not been deleted, call complete
+    // for the operation and get ready for another round
+    // this should prevent crashes in case the class is deleted before
+    // and operation finihes.
+    
+    if( iObserver && reinterpret_cast<TInt>(iObserver) != 0xDEDEDEDE )
+        {
+        // Complete the client request
+        iObserver->OperationCompleted( iOperationId, KErrNone );
+
+        // Get ready for another round:
+        SetActive();
+
+        // complete internal request:
+        User::RequestComplete( status, KErrNone );
+        }
+        
     // destroy the object:
     CleanupStack::PopAndDestroy( data );
 
-    // Get ready for another round:
-    SetActive();
-
-    // complete internal request:
-    User::RequestComplete( status, KErrNone );
     }
 
 // -----------------------------------------------------------------------------
--- a/commondrm/drmutility/src/DrmUtility.cpp	Fri Sep 17 17:32:40 2010 +0100
+++ b/commondrm/drmutility/src/DrmUtility.cpp	Tue Oct 26 15:52:41 2010 +0100
@@ -215,6 +215,7 @@
     TInt64 headerSize( 0 );
     TBool isDrmFile( EFalse );
     TPtr8 headerPtr( NULL, 0 );
+    TInt dataLength = 0;
 
     aProtected = DRM::EUUnprotected;
     aAgent.Set( KNullDesC );
@@ -306,11 +307,17 @@
             {
             // set the mimetype from the buffer which is in the beginning
             // starting from byte 3 with the length specified at position 2
-            TPtrC8 mimeType( buffer->Des().Mid(3, (buffer->Des())[1]) );
-            if( !mimeType.CompareF( *iOmaBasedMimeType ) )
-                {
-                aAgent.Set( *DRM::CDrmUtility::iOmaBasedAgentName );
-                isDrmFile = ETrue;
+            // also make sure the data length is greater or equal to the
+            // position + the 2nd byte of the content
+            dataLength = 3 + (buffer->Des())[1];
+            if( buffer->Length() >= dataLength )
+                {           
+                TPtrC8 mimeType( buffer->Des().Mid(3, (buffer->Des())[1]) );
+                if( !mimeType.CompareF( *iOmaBasedMimeType ) )
+                    {
+                    aAgent.Set( *DRM::CDrmUtility::iOmaBasedAgentName );
+                    isDrmFile = ETrue;
+                    }
                 }
             }
         CleanupStack::PopAndDestroy( buffer );
@@ -333,6 +340,7 @@
     TPtr8 asfPtr( NULL, 0 );
     TBuf8< 32 > asfGuidHex;
     TBool isDrmFile( EFalse );
+    TInt dataLength = 0;
 
     aProtected = DRM::EUUnprotected;
     aAgent.Set( KNullDesC );
@@ -401,12 +409,18 @@
             {
             // set the mimetype from the buffer which is in the beginning
             // starting from byte 3 with the length specified at position 2
-            TPtrC8 mimeType( aContent.Mid(3, (aContent)[1]) );
-            if( !mimeType.CompareF( *iOmaBasedMimeType ) )
+            // also make sure the data length is greater or equal to the
+            // position + the 2nd byte of the content
+            dataLength = 3 + (aContent)[1];
+            if( aContent.Length() >= dataLength )
                 {
-                aAgent.Set( *DRM::CDrmUtility::iOmaBasedAgentName );
-                isDrmFile = ETrue;
-                aProtected = DRM::EUProtected;
+                TPtrC8 mimeType( aContent.Mid(3, (aContent)[1]) );
+                if( !mimeType.CompareF( *iOmaBasedMimeType ) )
+                    {
+                    aAgent.Set( *DRM::CDrmUtility::iOmaBasedAgentName );
+                    isDrmFile = ETrue;
+                    aProtected = DRM::EUProtected;
+                    }
                 }
             }
         }
--- a/commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp	Fri Sep 17 17:32:40 2010 +0100
+++ b/commondrm/drmutility/src/drmutilitywmdrmwrapper.cpp	Tue Oct 26 15:52:41 2010 +0100
@@ -598,7 +598,7 @@
             // call given HandleErrorObserver
             if( value > 0 )
                 {
-                aObserver->RightsAvailable( aOperationId, KErrNone );              
+                CallRightsAvailable( aObserver, aOperationId, KErrNone );              
                 }
             }
         CleanupStack::PopAndDestroy( &file );
--- a/omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp	Fri Sep 17 17:32:40 2010 +0100
+++ b/omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp	Tue Oct 26 15:52:41 2010 +0100
@@ -469,7 +469,9 @@
                             DRM::EDrmAllowAudioBluetooth | 
                             DRM::EDrmAllowVideoMacroVision | 
                             DRM::EDrmAllowAudioFmTransmitter | 
-                            DRM::EDrmAllowAudioUsb;
+                            DRM::EDrmAllowAudioUsb |
+                            DRM::EDrmAllowAudioHdmiHdcpRequired |
+                            DRM::EDrmAllowVideoHdmiHdcpRequired;    
                     }
                 else
                     {
@@ -712,7 +714,9 @@
                             DRM::EDrmAllowAudioBluetooth | 
                             DRM::EDrmAllowVideoMacroVision | 
                             DRM::EDrmAllowAudioFmTransmitter | 
-                            DRM::EDrmAllowAudioUsb;
+                            DRM::EDrmAllowAudioUsb |
+                            DRM::EDrmAllowAudioHdmiHdcpRequired |
+                            DRM::EDrmAllowVideoHdmiHdcpRequired;    
                     }
                 else
                     {
--- a/omadrm/drmengine/roap/src/RoapEng.cpp	Fri Sep 17 17:32:40 2010 +0100
+++ b/omadrm/drmengine/roap/src/RoapEng.cpp	Tue Oct 26 15:52:41 2010 +0100
@@ -32,7 +32,7 @@
 #ifndef __WINS__
 #include <etelmm.h>
 #include <mmtsy_names.h>
-#include <sysutil.h>
+#include <SysUtil.h>
 #endif
 
 #include <flogger.h>