diff -r 0ffb4e86fcc9 -r a179b74831c9 userlibandfileserver/fileserver/sfat32/fat_table32.cpp --- a/userlibandfileserver/fileserver/sfat32/fat_table32.cpp Thu Jul 15 20:11:42 2010 +0300 +++ b/userlibandfileserver/fileserver/sfat32/fat_table32.cpp Thu Aug 19 11:14:22 2010 +0300 @@ -402,7 +402,7 @@ Notify the media drive about media areas that shall be treated as "deleted" if this feature is supported. @param aFreedClusters array with FAT numbers of clusters that shall be marked as "deleted" */ -void CFatTable::DoFreedClustersNotify(RClusterArray &aFreedClusters) +void CFatTable::DoFreedClustersNotifyL(RClusterArray &aFreedClusters) { ASSERT(iMediaAtt & KMediaAttDeleteNotify); @@ -423,7 +423,7 @@ const TUint currCluster = aFreedClusters[i]; if (deleteLen == 0) - byteAddress = DataPositionInBytes(currCluster); //-- start of the media range + byteAddress = DataPositionInBytesL(currCluster); //-- start of the media range deleteLen += bytesPerCluster; @@ -438,7 +438,7 @@ {//-- if DeleteNotify() failed, it means that something terribly wrong happened to the NAND media; //-- in normal circumstances it can not happen. One of the reasons: totally worn out media. const TBool platSecEnabled = PlatSec::ConfigSetting(PlatSec::EPlatSecEnforcement); - __PRINT3(_L("CFatTable::DoFreedClustersNotify() DeleteNotify failure! drv:%d err:%d, PlatSec:%d"),iOwner->DriveNumber(), r, platSecEnabled); + __PRINT3(_L("CFatTable::DoFreedClustersNotifyL() DeleteNotify failure! drv:%d err:%d, PlatSec:%d"),iOwner->DriveNumber(), r, platSecEnabled); if(platSecEnabled) { @@ -521,7 +521,7 @@ cntFreedClusters = 0; SetFreeClusterHint(lastKnownFreeCluster); - DoFreedClustersNotify(deletedClusters); + DoFreedClustersNotifyL(deletedClusters); } } @@ -531,7 +531,7 @@ SetFreeClusterHint(lastKnownFreeCluster); if(bFreeClustersNotify) - DoFreedClustersNotify(deletedClusters); + DoFreedClustersNotifyL(deletedClusters); CleanupStack::PopAndDestroy(&deletedClusters); } @@ -671,14 +671,6 @@ return (NumberOfFreeClusters() >= aClustersRequired); } -//----------------------------------------------------------------------------- -/** - @return ETrue if the cluster number aClusterNo is valid, i.e. belongs to the FAT table -*/ -TBool CFatTable::ClusterNumberValid(TUint32 aClusterNo) const - { - return (aClusterNo >= KFatFirstSearchCluster) && (aClusterNo < iMaxEntries); - } @@ -1789,17 +1781,20 @@ /** - Return the location of a Cluster in the data section of the media + Return media position in bytes of the cluster start @param aCluster to find location of @return Byte offset of the cluster data */ -TInt64 CAtaFatTable::DataPositionInBytes(TUint32 aCluster) const +TInt64 CAtaFatTable::DataPositionInBytesL(TUint32 aCluster) const { - - __ASSERT_DEBUG(ClusterNumberValid(aCluster), Fault(EFatTable_InvalidIndex)); - - const TInt clusterBasePosition=iOwner->ClusterBasePosition(); + if(!ClusterNumberValid(aCluster)) + { + __ASSERT_DEBUG(0, Fault(EFatTable_InvalidIndex)); + User::Leave(KErrCorrupt); + } + + const TUint32 clusterBasePosition=iOwner->ClusterBasePosition(); return(((TInt64(aCluster)-KFatFirstSearchCluster) << iOwner->ClusterSizeLog2()) + clusterBasePosition); }