userlibandfileserver/fileserver/sfat32/sl_vfat.cpp
branchRCL_3
changeset 80 597aaf25e343
parent 62 4a8fed1c0ef6
child 87 2f92ad2dc5db
equal deleted inserted replaced
62:4a8fed1c0ef6 80:597aaf25e343
   571     @param  aLen        length of the remaining name
   571     @param  aLen        length of the remaining name
   572     @param  aCheckSum   DOS entry name checksum.
   572     @param  aCheckSum   DOS entry name checksum.
   573 */
   573 */
   574 void TFatDirEntry::SetVFatEntry(const TDesC& aName, TUint aLen, TUint8 aCheckSum)
   574 void TFatDirEntry::SetVFatEntry(const TDesC& aName, TUint aLen, TUint8 aCheckSum)
   575 	{
   575 	{
       
   576     //-- LFN in the last entry must be padded with FFs
       
   577     Mem::Fill(iData,sizeof(iData),0xFF);
       
   578 
   576     //-- initialise some VFAT entry specific fields
   579     //-- initialise some VFAT entry specific fields
   577 	iData[0x0B]=0x0F;
   580 	iData[0x0B]=0x0F;
   578 	iData[0x0C]=0x00; iData[0x0D]=aCheckSum;
   581 	iData[0x0C]=0x00; iData[0x0D]=aCheckSum;
   579 	iData[0x1A]=0x00; iData[0x1B]=0x00;
   582 	iData[0x1A]=0x00; iData[0x1B]=0x00;
   580 
   583 
   658         {
   661         {
   659         TInt posInBuf = 0;
   662         TInt posInBuf = 0;
   660         startPos = aPos;
   663         startPos = aPos;
   661         TBool movedCluster = EFalse;
   664         TBool movedCluster = EFalse;
   662 
   665 
       
   666         TUint nRemLen = KMaxVFatEntryName*(numEntries-1);
       
   667 
   663         while(numEntries)
   668         while(numEntries)
   664             {
   669             {
   665             TFatDirEntry* pEntry = (TFatDirEntry*)(&scratchBuf[posInBuf]);
   670             TFatDirEntry* pEntry = (TFatDirEntry*)(&scratchBuf[posInBuf]);
   666             pEntry->SetVFatEntry(aLongName, KMaxVFatEntryName*(numEntries-1), cksum); //KMaxVFatEntryName=13  
   671             
       
   672             pEntry->SetVFatEntry(aLongName, nRemLen, cksum);  
   667 
   673 
   668             posInBuf += KSizeOfFatDirEntry;
   674             posInBuf += KSizeOfFatDirEntry;
   669             MoveToNextEntryL(aPos);
   675             MoveToNextEntryL(aPos);
   670 
   676 
   671             numEntries--;
   677             numEntries--;
   672             movedCluster = (startPos.Cluster() != aPos.Cluster()); //-- if moved to another cluser, need to flush buffer
   678             movedCluster = (startPos.Cluster() != aPos.Cluster()); //-- if moved to another cluser, need to flush buffer
   673             
   679             
   674             if(!numEntries || movedCluster)
   680             if(!numEntries || movedCluster)
   675                 break; //-- VFAT entryset is completed
   681                 break; //-- VFAT entryset is completed
       
   682             
       
   683             ASSERT(nRemLen >= (TUint)KMaxVFatEntryName);
       
   684             nRemLen -= KMaxVFatEntryName;
   676             }
   685             }
   677     
   686     
   678         if(movedCluster)
   687         if(movedCluster)
   679             {
   688             {
   680             DirWriteL(startPos, TPtrC8(&scratchBuf[0], posInBuf));
   689             DirWriteL(startPos, TPtrC8(&scratchBuf[0], posInBuf));