diff -r 0ffb4e86fcc9 -r a179b74831c9 userlibandfileserver/fileserver/sfat32/ram_fat_table32.cpp --- a/userlibandfileserver/fileserver/sfat32/ram_fat_table32.cpp Thu Jul 15 20:11:42 2010 +0300 +++ b/userlibandfileserver/fileserver/sfat32/ram_fat_table32.cpp Thu Aug 19 11:14:22 2010 +0300 @@ -343,9 +343,9 @@ Zero fill RAM area corresponding to the cluster number aCluster @param aCluster a cluster number to be zero-filled */ -void CRamFatTable::ZeroFillCluster(TInt aCluster) +void CRamFatTable::ZeroFillClusterL(TInt aCluster) { - TLinAddr clusterPos= I64LOW(DataPositionInBytes(aCluster)); + TLinAddr clusterPos= I64LOW(DataPositionInBytesL(aCluster)); Mem::FillZ(iRamDiskBase+clusterPos, 1<< iOwner->ClusterSizeLog2()); } @@ -356,9 +356,15 @@ @param aCluster to find location of @return Byte offset of the cluster data */ -TInt64 CRamFatTable::DataPositionInBytes(TUint32 aCluster) const +TInt64 CRamFatTable::DataPositionInBytesL(TUint32 aCluster) const { //__PRINT(_L("CRamFatTable::DataPositionInBytes")); + if(!ClusterNumberValid(aCluster)) + { + __ASSERT_DEBUG(0, Fault(EFatTable_InvalidIndex)); + User::Leave(KErrCorrupt); + } + ReadIndirectionTable(aCluster); return(aCluster<ClusterSizeLog2()); } @@ -417,7 +423,7 @@ __PRINT(_L("CRamFatTable::AllocateSingleClusterL")); iOwner->EnlargeL(1<ClusterSizeLog2()); // First enlarge the RAM drive TInt fileAllocated=CFatTable::AllocateSingleClusterL(aNearestCluster); // Now update the free cluster and fat/fit - ZeroFillCluster(fileAllocated); //-- zero-fill allocated cluster + ZeroFillClusterL(fileAllocated); //-- zero-fill allocated cluster return(fileAllocated); } @@ -458,7 +464,7 @@ DecrementFreeClusterCount(1); WriteL(aCluster,freeCluster); aCluster=freeCluster; - ZeroFillCluster(freeCluster); //-- zero fill just allocated cluster (RAM area) + ZeroFillClusterL(freeCluster); //-- zero fill just allocated cluster (RAM area) } SetFreeClusterHint(aCluster); @@ -493,7 +499,7 @@ endCluster=EOF_32Bit; // endCluster==0 -> file contained FAT loop // Real position in bytes of the start cluster in the data area - TLinAddr startClusterPos=I64LOW(DataPositionInBytes(startCluster)); + TLinAddr startClusterPos=I64LOW(DataPositionInBytesL(startCluster)); // Sliding value when more than one block is freed TLinAddr trg=startClusterPos-(totalFreed< file contained FAT loop // Real position in bytes of the start cluster in the data area - TLinAddr startClusterPos=I64LOW(DataPositionInBytes(startCluster)); + TLinAddr startClusterPos=I64LOW(DataPositionInBytesL(startCluster)); // Sliding value when more than one block is freed TLinAddr trg=startClusterPos-(totalFreed<ClusterSizeLog2()))) + if (GetNextClusterL(endCluster)==EFalse || (endClusterPos=DataPositionInBytesL(endCluster))!=(oldClusterPos+(1<ClusterSizeLog2()))) { endCluster=oldCluster; break;