diff -r c7a0ce20c48c -r a77889bee936 kernel/eka/include/drivers/resourcecontrol.inl --- a/kernel/eka/include/drivers/resourcecontrol.inl Fri Aug 06 16:34:38 2010 +0100 +++ b/kernel/eka/include/drivers/resourcecontrol.inl Thu Aug 12 11:55:14 2010 +0100 @@ -30,7 +30,7 @@ /** Second stage constructor Allocates the specified size in kernel heap and creates a virtual link */ template -inline TInt DResourceCon::Initialise(TUint16 aInitialSize) +inline TInt DResourceCon::Initialise(TInt aInitialSize) { __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DResourceCon::Initialise")); __KTRACE_OPT(KRESMANAGER, Kern::Printf("aInitialSize %d", aInitialSize)); @@ -47,8 +47,8 @@ for(TInt c = 0; c < aInitialSize; c++) iArray[c] = (T*)(c+1); } - iAllocated = aInitialSize; - iGrowBy = aInitialSize < 2 ? aInitialSize : TUint16(aInitialSize/2); + iAllocated = (TUint16)aInitialSize; + iGrowBy = (TUint16) (aInitialSize < 2 ? aInitialSize : aInitialSize/2); iCount = 0; iInstanceCount = 0; iFreeLoc = 0; @@ -65,7 +65,7 @@ /** Resize the array */ template -inline TInt DResourceCon::ReSize(TUint16 aGrowBy) +inline TInt DResourceCon::ReSize(TInt aGrowBy) { __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DResourceCon::ReSize")); __KTRACE_OPT(KRESMANAGER, Kern::Printf("aGrowBy %d\n", aGrowBy)); @@ -73,7 +73,7 @@ TInt r = Kern::SafeReAlloc((TAny*&)iArray, iAllocated * sizeof(T*), (iAllocated+aGrowBy)*sizeof(T*)); if(r != KErrNone) return r; - TUint16 c = iAllocated; + TInt c = iAllocated; //Virtually link the free ones while(c<(iAllocated+aGrowBy)) { @@ -94,11 +94,12 @@ inline void DResourceCon::Delete() { delete []iArray; + iArray = NULL; } /** Find the object at the specified location */ template -inline T* DResourceCon::operator[](TUint16 anIndex) +inline T* DResourceCon::operator[](TInt anIndex) { __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DResourceCon::operator[], anIndex = %d", anIndex)); // Check if passed index is inside allocated range and is not free. @@ -109,17 +110,17 @@ /** Remove the specified object from the container */ template -inline TInt DResourceCon::Remove(T* /*aObj */, TUint16 aIndex) +inline TInt DResourceCon::Remove(T* /*aObj */, TInt aIndex) { __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DResourceCon::Remove")); - if(aIndex>=iAllocated) + if(aIndex>=(TInt)iAllocated) { __KTRACE_OPT(KRESMANAGER, Kern::Printf("Object not found, iAllocated = %d, index = %d", iAllocated, aIndex)); DPowerResourceController::Panic(DPowerResourceController::EObjectNotFoundInList); } // Add the entry to the free location iArray[aIndex] = (T*)iFreeLoc; - iFreeLoc = aIndex; + iFreeLoc = (TUint16)aIndex; iCount--; //Decrement valid client count __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DResourceCon::Remove")); return KErrNone; @@ -136,9 +137,9 @@ //Update in the array in the free location aId = ((++iInstanceCount & INSTANCE_COUNT_BIT_MASK) << INSTANCE_COUNT_POS); //Instance count aId |= (iFreeLoc & ID_INDEX_BIT_MASK); //Array index - TUint16 nextFreeLoc = (TUint16)(TUint)iArray[iFreeLoc]; + TUint nextFreeLoc = (TUint)iArray[iFreeLoc]; iArray[iFreeLoc] = aObj; - iFreeLoc = nextFreeLoc; + iFreeLoc = (TUint16)nextFreeLoc; __KTRACE_OPT(KRESMANAGER, Kern::Printf("iFreeLoc %d", iFreeLoc)); iCount++; //Increment the valid client count return KErrNone; @@ -151,7 +152,7 @@ __KTRACE_OPT(KRESMANAGER, Kern::Printf(">DResourceCon::Find, aName %S", &aName)); anEntry = NULL; T* pC=anEntry; - for(TUint count = 0; count