userlibandfileserver/fileserver/sfile/sf_memory_man.cpp
changeset 176 af6ec97d9189
parent 90 947f0dc9f7a8
child 257 3e88ff8f41d5
child 269 d57b86b1867a
--- a/userlibandfileserver/fileserver/sfile/sf_memory_man.cpp	Wed Jun 23 11:59:44 2010 +0100
+++ b/userlibandfileserver/fileserver/sfile/sf_memory_man.cpp	Wed Jun 23 12:52:28 2010 +0100
@@ -81,7 +81,7 @@
 	TInt r = UserHal::MemoryInfo(meminfo);
 	ASSERT(r==KErrNone);
 	User::LeaveIfError(r);
-	iLowMemoryThreshold = (meminfo().iTotalRamInBytes * TGlobalCacheMemorySettings::LowMemoryThreshold()) / 100;
+	iLowMemoryThreshold = (TInt) (meminfo().iTotalRamInBytes * (TGlobalCacheMemorySettings::LowMemoryThreshold() / 100.00));
 	TChunkCreateInfo createInfo;
 	createInfo.SetCache(iSizeInBytes);
 	createInfo.SetOwner(EOwnerProcess);
@@ -287,6 +287,10 @@
 */
 void CCacheMemoryManagerFactory::CreateL()
 	{
+	// Panic in DEBUG mode when GlobalCacheMemorySize is set as a negative value.  
+	ASSERT(TGlobalCacheMemorySettings::CacheSize() >= 0);
+	ASSERT(TGlobalCacheMemorySettings::LowMemoryThreshold() >= 0);
+	
 	if (TGlobalCacheMemorySettings::CacheSize() > 0)
 	    iCacheMemoryManager = CCacheMemoryManager::NewL(TGlobalCacheMemorySettings::CacheSize());
 	else
@@ -337,12 +341,12 @@
 		iLowMemoryThreshold = lowMemoryThreshold;
 	}
 
-TInt TGlobalCacheMemorySettings::CacheSize()
+TInt32 TGlobalCacheMemorySettings::CacheSize()
 	{
 	return iCacheSizeInBytes;
 	}
 
-TInt TGlobalCacheMemorySettings::LowMemoryThreshold()
+TInt32 TGlobalCacheMemorySettings::LowMemoryThreshold()
 	{
 	return iLowMemoryThreshold;
 	}