--- a/kernel/eka/drivers/resourceman/resourcecontrol_extended.cpp Thu Aug 19 11:14:22 2010 +0300
+++ b/kernel/eka/drivers/resourceman/resourcecontrol_extended.cpp Tue Aug 31 16:34:26 2010 +0300
@@ -35,14 +35,14 @@
iResourceLevelPoolCount = (TUint16)(iResourceLevelPoolCount - aCount);
else
{
- TUint allocCount = (iStaticResDependencyCount / 2) + aCount;
+ TUint allocCount = (iStaticResDependencyArray.Count() / 2) + aCount;
// coverity[alloc_fn]
SPowerResourceClientLevel* pCL = new SPowerResourceClientLevel[allocCount];
if(!pCL)
return KErrNoMemory;
for(TUint count = 0;count<(TUint)(allocCount);count++)
LIST_PUSH(iResourceLevelPool, &pCL[count], iNextInList);
- iResourceLevelPoolCount= (TUint16)(iResourceLevelPoolCount + (iStaticResDependencyCount / 2));
+ iResourceLevelPoolCount= (TUint16)(iResourceLevelPoolCount + (iStaticResDependencyArray.Count() / 2));
#ifdef PRM_INSTRUMENTATION_MACRO
TUint size = allocCount * sizeof(SPowerResourceClientLevel);
PRM_MEMORY_USAGE_TRACE
@@ -79,16 +79,16 @@
SNode* pN;
if(aResourceId & KIdMaskDynamic)
{
- DDynamicPowerResourceD* pDR = iDynamicResDependencyList[(TUint16)(aResourceId & ID_INDEX_BIT_MASK)];
+ DDynamicPowerResourceD* pDR = iDynamicResDependencyList[(aResourceId & ID_INDEX_BIT_MASK)];
if(!pDR)
return KErrNotFound;
pN = pDR->iDependencyList;
}
else
{
- if((aResourceId & ID_INDEX_BIT_MASK) > iStaticResDependencyCount)
+ if((aResourceId & ID_INDEX_BIT_MASK) > (TUint)iStaticResDependencyArray.Count())
return KErrNotFound;
- DStaticPowerResourceD* pDR = iStaticResDependencyArray[(TUint16)(aResourceId & ID_INDEX_BIT_MASK) - 1];
+ DStaticPowerResourceD* pDR = iStaticResDependencyArray[(aResourceId & ID_INDEX_BIT_MASK) - 1];
pN = pDR->iDependencyList;
}
*aNumResources = 0;
@@ -123,16 +123,16 @@
SNode* pN;
if(aResourceId & KIdMaskDynamic)
{
- DDynamicPowerResourceD* pDR = iDynamicResDependencyList[(TUint16)(aResourceId & ID_INDEX_BIT_MASK)];
+ DDynamicPowerResourceD* pDR = iDynamicResDependencyList[(aResourceId & ID_INDEX_BIT_MASK)];
if(!pDR)
return KErrNotFound;
pN = pDR->iDependencyList;
}
else
{
- if((aResourceId & ID_INDEX_BIT_MASK) > iStaticResDependencyCount)
+ if((aResourceId & ID_INDEX_BIT_MASK) > (TUint)iStaticResDependencyArray.Count())
return KErrNotFound;
- DStaticPowerResourceD* pDR = iStaticResDependencyArray[(TUint16)(aResourceId & ID_INDEX_BIT_MASK) -1];
+ DStaticPowerResourceD* pDR = iStaticResDependencyArray[(aResourceId & ID_INDEX_BIT_MASK) -1];
pN = pDR->iDependencyList;
}
TUint count = 0;
@@ -184,31 +184,31 @@
//Retrieve resource1 from the corresponding list.
if(aInfo1->iResourceId & KIdMaskDynamic)
{
- pR1 = iDynamicResDependencyList[(TUint16)(aInfo1->iResourceId & ID_INDEX_BIT_MASK)];
+ pR1 = iDynamicResDependencyList[(aInfo1->iResourceId & ID_INDEX_BIT_MASK)];
if(!pR1)
return KErrNotFound;
pN1 = pR1->iDependencyList;
}
else
{
- if((aInfo1->iResourceId & ID_INDEX_BIT_MASK) > iStaticResDependencyCount)
+ if((aInfo1->iResourceId & ID_INDEX_BIT_MASK) > (TUint)iStaticResDependencyArray.Count())
return KErrNotFound;
- pR1 = (DDynamicPowerResourceD*)iStaticResDependencyArray[(TUint16)(aInfo1->iResourceId & ID_INDEX_BIT_MASK) - 1];
+ pR1 = (DDynamicPowerResourceD*)iStaticResDependencyArray[(aInfo1->iResourceId & ID_INDEX_BIT_MASK) - 1];
pN1 = ((DStaticPowerResourceD*)pR1)->iDependencyList;
}
//Retrieve resource2 from the corresponding list.
if(aInfo2->iResourceId & KIdMaskDynamic)
{
- pR2 = iDynamicResDependencyList[(TUint16)(aInfo2->iResourceId & ID_INDEX_BIT_MASK)];
+ pR2 = iDynamicResDependencyList[(aInfo2->iResourceId & ID_INDEX_BIT_MASK)];
if(!pR2)
return KErrNotFound;
pN2 = pR2->iDependencyList;
}
else
{
- if((aInfo2->iResourceId & ID_INDEX_BIT_MASK) > iStaticResDependencyCount)
+ if((aInfo2->iResourceId & ID_INDEX_BIT_MASK) > (TUint)iStaticResDependencyArray.Count())
return KErrNotFound;
- pR2 = (DDynamicPowerResourceD*)iStaticResDependencyArray[(TUint16)(aInfo2->iResourceId & ID_INDEX_BIT_MASK) - 1];
+ pR2 = (DDynamicPowerResourceD*)iStaticResDependencyArray[(aInfo2->iResourceId & ID_INDEX_BIT_MASK) - 1];
pN2 = ((DStaticPowerResourceD*)pR2)->iDependencyList;
}
@@ -325,13 +325,13 @@
//Get the resource from appropriate container
if(aResourceId & KIdMaskResourceWithDependencies)
{
- pDR = iDynamicResDependencyList[(TUint16)(aResourceId & ID_INDEX_BIT_MASK)];
+ pDR = iDynamicResDependencyList[(aResourceId & ID_INDEX_BIT_MASK)];
if(!pDR)
return KErrNotFound;
}
else
{
- pDR = iDynamicResourceList[(TUint16)(aResourceId & ID_INDEX_BIT_MASK)];
+ pDR = iDynamicResourceList[(aResourceId & ID_INDEX_BIT_MASK)];
if(!pDR)
return KErrNotFound;
}
@@ -460,9 +460,9 @@
{
pCL = (SPowerResourceClientLevel*)pRC;
if(pCL->iClientId & USER_SIDE_CLIENT_BIT_MASK)
- pC = iUserSideClientList[(TUint16)(pCL->iClientId & ID_INDEX_BIT_MASK)];
+ pC = iUserSideClientList[(pCL->iClientId & ID_INDEX_BIT_MASK)];
else
- pC = iClientList[(TUint16)(pCL->iClientId & ID_INDEX_BIT_MASK)];
+ pC = iClientList[(pCL->iClientId & ID_INDEX_BIT_MASK)];
LIST_REMOVE(pC->iLevelList, pCL, iNextInList, SPowerResourceClientLevel);
LIST_PUSH(iClientLevelPool, pCL, iNextInList);
if(pC->iUnderFlowClCount > 0)
@@ -477,12 +477,12 @@
aClientPtr->iDynamicResCount--;
if(aResourceId & KIdMaskResourceWithDependencies)
{
- iDynamicResDependencyList.Remove((DDynamicPowerResourceD*)pDR, (TUint16)(pDR->iResourceId & ID_INDEX_BIT_MASK));
+ iDynamicResDependencyList.Remove((DDynamicPowerResourceD*)pDR, (pDR->iResourceId & ID_INDEX_BIT_MASK));
iDynamicResDependencyCount--;
}
else
{
- iDynamicResourceList.Remove(pDR, (TUint16)(pDR->iResourceId & ID_INDEX_BIT_MASK));
+ iDynamicResourceList.Remove(pDR, (pDR->iResourceId & ID_INDEX_BIT_MASK));
iDynamicResourceCount--;
}
__KTRACE_OPT(KRESMANAGER, Kern::Printf("<DExtendedResourceController::DeregisterDynamicResource"));
@@ -498,12 +498,10 @@
@prototype 9.6
Default implementation, PSL re-implements this if features supported.
*/
-TInt DPowerResourceController::DoRegisterStaticResourcesDependency(DStaticPowerResourceD**& aStaticResourceDArray,
- TUint16& aStaticResourceDCount)
+TInt DPowerResourceController::DoRegisterStaticResourcesDependency(RPointerArray <DStaticPowerResourceD> & aStaticResourceDArray)
{
__KTRACE_OPT(KRESMANAGER, Kern::Printf("DExtendedResourceController::DoRegisterStaticResourcesDependency default implementation"));
- aStaticResourceDArray = NULL;
- aStaticResourceDCount = 0;
+ aStaticResourceDArray.Reset();
return KErrNone;
}
@@ -708,18 +706,18 @@
{
DStaticPowerResourceD* pResource;
if(aRequest.ClientId() & KIdMaskDynamic)
- pResource = (DStaticPowerResourceD*)iDynamicResDependencyList[(TUint16)(aRequest.ClientId() & ID_INDEX_BIT_MASK)];
+ pResource = (DStaticPowerResourceD*)iDynamicResDependencyList[(aRequest.ClientId() & ID_INDEX_BIT_MASK)];
else
- pResource = iStaticResDependencyArray[(TUint16)(aRequest.ClientId() & ID_INDEX_BIT_MASK) - 1];
+ pResource = iStaticResDependencyArray[(aRequest.ClientId() & ID_INDEX_BIT_MASK) - 1];
name = pResource->iName;
}
else
{
SPowerResourceClient* pClient;
if(aRequest.ClientId() & USER_SIDE_CLIENT_BIT_MASK)
- pClient = iUserSideClientList[(TUint16)(aRequest.ClientId() & ID_INDEX_BIT_MASK)];
+ pClient = iUserSideClientList[(aRequest.ClientId() & ID_INDEX_BIT_MASK)];
else // coverity[returned_null]
- pClient = iClientList[(TUint16)(aRequest.ClientId() & ID_INDEX_BIT_MASK)];
+ pClient = iClientList[(aRequest.ClientId() & ID_INDEX_BIT_MASK)];
name = pClient->iName;
}
}
@@ -762,7 +760,7 @@
if(aResId1 & KIdMaskDynamic)
{
- pDR1 = iDynamicResDependencyList[(TUint16)(aResId1 & ID_INDEX_BIT_MASK)];
+ pDR1 = iDynamicResDependencyList[(aResId1 & ID_INDEX_BIT_MASK)];
if(!pDR1)
UNLOCK_RETURN(KErrNotFound);
pN1 = pDR1->iDependencyList;
@@ -770,7 +768,7 @@
}
else
{
- if((aResId1 & ID_INDEX_BIT_MASK) > iStaticResDependencyCount)
+ if((aResId1 & ID_INDEX_BIT_MASK) > (TUint)iStaticResDependencyArray.Count())
UNLOCK_RETURN(KErrNotFound);
pDR1 = (DDynamicPowerResourceD*)iStaticResDependencyArray[(aResId1 & ID_INDEX_BIT_MASK) - 1];
pN1 = ((DStaticPowerResourceD*)pDR1)->iDependencyList;
@@ -780,7 +778,7 @@
//Get second resource from list
if(aResId2 & KIdMaskDynamic)
{
- pDR2 = iDynamicResDependencyList[(TUint16)(aResId2 & ID_INDEX_BIT_MASK)];
+ pDR2 = iDynamicResDependencyList[(aResId2 & ID_INDEX_BIT_MASK)];
if(!pDR2)
UNLOCK_RETURN(KErrNotFound);
pN2 = pDR2->iDependencyList;
@@ -788,9 +786,9 @@
}
else
{
- if((aResId2 & ID_INDEX_BIT_MASK)> iStaticResDependencyCount)
+ if((aResId2 & ID_INDEX_BIT_MASK)> (TUint)iStaticResDependencyArray.Count())
UNLOCK_RETURN(KErrNotFound);
- pDR2 = (DDynamicPowerResourceD*)iStaticResDependencyArray[(TUint16)(aResId2 & ID_INDEX_BIT_MASK) - 1];
+ pDR2 = (DDynamicPowerResourceD*)iStaticResDependencyArray[(aResId2 & ID_INDEX_BIT_MASK) - 1];
pN2 = ((DStaticPowerResourceD*)pDR2)->iDependencyList;
pCL2 = ((DStaticPowerResourceD*)pDR2)->iResourceClientList;
}