omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp
changeset 87 c938d010410d
parent 84 b09186059647
--- a/omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp	Thu Oct 14 13:45:23 2010 +0300
+++ b/omadrm/drmengine/agentv2/src/Oma2AgentAttributes.cpp	Wed Oct 20 14:56:54 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -346,6 +346,7 @@
     TBool protection = ETrue;
     HBufC8* buffer;
     TInt traperror = KErrNone;
+    TInt ret = KErrNone;
 
     if (aDcfFile.iVersion == 2)
         {
@@ -725,14 +726,16 @@
             case ERightsNone:
                 if (aRightsClient == NULL)
                     {
-                    value = client.Connect();
-                    if (value != KErrCANoRights)
+                    ret = client.Connect();
+                    if (ret != KErrNone)
                         {
+                        value = ret;
                         break;
                         }
                     TUint32 reason = 0;
-                    value = client.CheckRights(EPeek, *aDcfFile.iContentID, reason);
-                    if(value == KErrCANoRights  || KErrCANoPermission)
+                    value = EFalse;
+                    ret = client.CheckRights(EPeek, *aDcfFile.iContentID, reason);
+                    if(ret == KErrCANoRights  || ret == KErrCANoPermission)
                         {
                         value = ETrue;
                         }
@@ -741,8 +744,9 @@
                 else
                     {
                     TUint32 reason = 0;
-                    value = aRightsClient->CheckRights(EPeek, *aDcfFile.iContentID, reason);
-                    if(value == KErrCANoRights  || KErrCANoPermission)
+                    value = EFalse;
+                    ret = aRightsClient->CheckRights(EPeek, *aDcfFile.iContentID, reason);
+                    if(ret == KErrCANoRights  || ret == KErrCANoPermission)
                         {
                         value = ETrue;
                         }
@@ -751,32 +755,42 @@
             case ERightsHaveExpired:
                 if (aRightsClient == NULL)
                     {
-                    value = client.Connect();
-                    if (value != KErrNone)
+                    ret = client.Connect();
+                    if (ret != KErrNone)
                         {
+                        value = ret;
                         break;
                         }
                     value = ETrue;
                     TUint32 reason = 0;
-                    value = client.CheckRights(EPlay, *aDcfFile.iContentID, reason);
-                    if(value != KErrCANoRights  || KErrCANoPermission)
-                        {
-                        value = EFalse;
-                        }
-                    value = client.CheckRights(EView, *aDcfFile.iContentID, reason);
-                    if(value != KErrCANoRights  || KErrCANoPermission)
+                    ret = client.CheckRights(EPlay, *aDcfFile.iContentID, reason);
+                    if(ret != KErrCANoRights && ret != KErrCANoPermission)
                         {
                         value = EFalse;
                         }
-                    value = client.CheckRights(EExecute, *aDcfFile.iContentID, reason);
-                    if(value != KErrCANoRights  || KErrCANoPermission)
-                        {
-                        value = EFalse;
+                    if(value)
+                        { 
+                        ret = client.CheckRights(EView, *aDcfFile.iContentID, reason);
+                        if(ret != KErrCANoRights && ret != KErrCANoPermission)
+                            {
+                            value = EFalse;
+                            }
                         }
-                    value = client.CheckRights(EPrint, *aDcfFile.iContentID, reason);
-                    if(value != KErrCANoRights  || KErrCANoPermission)
+                    if(value)
                         {
-                        value = EFalse;
+                        ret = client.CheckRights(EExecute, *aDcfFile.iContentID, reason);
+                        if(ret != KErrCANoRights && ret != KErrCANoPermission)
+                            {
+                            value = EFalse;
+                            }
+                        }
+                    if(value)
+                        {
+                        ret = client.CheckRights(EPrint, *aDcfFile.iContentID, reason);
+                        if(ret != KErrCANoRights && ret != KErrCANoPermission)
+                            {
+                            value = EFalse;
+                            }
                         }
                     client.Close();
                     }
@@ -784,27 +798,35 @@
                     {
                     value = ETrue;
                     TUint32 reason = 0;
-                    value = aRightsClient->CheckRights(EPlay, *aDcfFile.iContentID, reason);
-                    if(value != KErrCANoRights  || KErrCANoPermission)
-                        {
-                        value = EFalse;
-                        }
-                    value = aRightsClient->CheckRights(EView, *aDcfFile.iContentID, reason);
-                    if(value != KErrCANoRights  || KErrCANoPermission)
+                    ret = aRightsClient->CheckRights(EPlay, *aDcfFile.iContentID, reason);
+                    if(ret != KErrCANoRights && ret != KErrCANoPermission)
                         {
                         value = EFalse;
                         }
-                    value = aRightsClient->CheckRights(EExecute, *aDcfFile.iContentID, reason);
-                    if(value != KErrCANoRights  || KErrCANoPermission)
+                    if(value)
                         {
-                        value = EFalse;
+                        ret = aRightsClient->CheckRights(EView, *aDcfFile.iContentID, reason);
+                        if(ret != KErrCANoRights && ret != KErrCANoPermission)
+                            {
+                            value = EFalse;
+                            }
                         }
-                    value = aRightsClient->CheckRights(EPrint, *aDcfFile.iContentID, reason);
-                    if(value != KErrCANoRights  || KErrCANoPermission)
+                    if(value)
                         {
-                        value = EFalse;
+                        ret = aRightsClient->CheckRights(EExecute, *aDcfFile.iContentID, reason);
+                        if(ret != KErrCANoRights && ret != KErrCANoPermission)
+                            {
+                            value = EFalse;
+                            }
                         }
-
+                    if(value)
+                        {
+                        ret = aRightsClient->CheckRights(EPrint, *aDcfFile.iContentID, reason);
+                        if(ret != KErrCANoRights && ret != KErrCANoPermission)
+                            {
+                            value = EFalse;
+                            }
+                        }
                     }
                 break;
             default:
@@ -854,7 +876,6 @@
     RDRMRightsClient* aRightsClient)
     {
     TInt err = KErrCANotSupported;
-    TInt ret = KErrNone;
     HBufC* b = NULL;
     COma1Dcf* dcf1 = NULL;
     COma2Dcf* dcf2 = NULL;