userlibandfileserver/fileserver/sfat/sl_utl.cpp
changeset 15 4122176ea935
parent 0 a41df078684a
child 167 b41fc9c39ca7
--- a/userlibandfileserver/fileserver/sfat/sl_utl.cpp	Mon Oct 19 15:55:17 2009 +0100
+++ b/userlibandfileserver/fileserver/sfat/sl_utl.cpp	Mon Dec 21 16:14:42 2009 +0000
@@ -13,6 +13,15 @@
 // Description:
 //
 
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+//!!
+//!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it
+//!!
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+
 #include "sl_std.h"
 
 //-----------------------------------------------------------------------------
@@ -56,122 +65,122 @@
 
 TTime DosTimeToTTime(TInt aDosTime,TInt aDosDate)
 //
-//	Deciphers the dos time/date entry information and converts to TTime
+//  Deciphers the dos time/date entry information and converts to TTime
 //
-	{
-	TInt secMask=0x1F;
-	TInt minMask=0x07E0;
-	TInt hrMask=0xF800;
-	TInt dayMask=0x1F;
-	TInt monthMask=0x01E0;
-	TInt yearMask=0xFE00;
+    {
+    TInt secMask=0x1F;
+    TInt minMask=0x07E0;
+    TInt hrMask=0xF800;
+    TInt dayMask=0x1F;
+    TInt monthMask=0x01E0;
+    TInt yearMask=0xFE00;
 
-	TInt secs=(aDosTime&secMask)*2;
-	TInt mins=(aDosTime&minMask)>>5;
-	TInt hrs=(aDosTime&hrMask)>>11;
-	TInt days=(aDosDate&dayMask)-1;
-	TMonth months=(TMonth)(((aDosDate&monthMask)>>5)-1);
-	TInt years=((aDosDate&yearMask)>>9)+1980;
-	
-	TDateTime datetime;
-	TInt ret=datetime.Set(years,months,days,hrs,mins,secs,0);
-	if (ret==KErrNone)
-		return(TTime(datetime));
-	return(TTime(0));
-	}
+    TInt secs=(aDosTime&secMask)*2;
+    TInt mins=(aDosTime&minMask)>>5;
+    TInt hrs=(aDosTime&hrMask)>>11;
+    TInt days=(aDosDate&dayMask)-1;
+    TMonth months=(TMonth)(((aDosDate&monthMask)>>5)-1);
+    TInt years=((aDosDate&yearMask)>>9)+1980;
+    
+    TDateTime datetime;
+    TInt ret=datetime.Set(years,months,days,hrs,mins,secs,0);
+    if (ret==KErrNone)
+        return(TTime(datetime));
+    return(TTime(0));
+    }
 
 TInt DosTimeFromTTime(const TTime& aTime)
 //
 // Converts a TTime to a dos time
 //
-	{
-	TDateTime dateTime=aTime.DateTime();
-	TInt dosSecs=dateTime.Second()/2;
-	TInt dosMins=dateTime.Minute()<<5;
-	TInt dosHrs=dateTime.Hour()<<11;
-	return dosSecs|dosMins|dosHrs;
-	}
+    {
+    TDateTime dateTime=aTime.DateTime();
+    TInt dosSecs=dateTime.Second()/2;
+    TInt dosMins=dateTime.Minute()<<5;
+    TInt dosHrs=dateTime.Hour()<<11;
+    return dosSecs|dosMins|dosHrs;
+    }
 
 TInt DosDateFromTTime(const TTime& aTime)
 //
 // Converts a TTime to a dos date
 //
-	{
+    {
 
-	TDateTime dateTime=aTime.DateTime();
-	TInt dosDays=dateTime.Day()+1;
-	TInt dosMonths=(dateTime.Month()+1)<<5;
-	TInt dosYears=(dateTime.Year()-1980)<<9;
-	return dosDays|dosMonths|dosYears;
-	}
+    TDateTime dateTime=aTime.DateTime();
+    TInt dosDays=dateTime.Day()+1;
+    TInt dosMonths=(dateTime.Month()+1)<<5;
+    TInt dosYears=(dateTime.Year()-1980)<<9;
+    return dosDays|dosMonths|dosYears;
+    }
 
 TBuf8<12> DosNameToStdFormat(const TDesC8& aDosName)
 //
 // Converts xxx.yyy to standard format aaaaaaaayyy
 //
-	{
+    {
 
-	__ASSERT_DEBUG(aDosName.Length()>=0 && aDosName.Length()<=12,Fault(EFatBadDosFormatName));
-	TBuf8<12> result;
-	Mem::Fill((TUint8*)result.Ptr(),result.MaxSize(),' ');
-	TInt dotPos=aDosName.Locate('.');
-	if (dotPos==KErrNotFound)
-		{
-		result=aDosName;
-		result.SetLength(11);
-		return result;
-		}
-	result=aDosName.Left(dotPos);
-	result.SetLength(11);
-	TPtr8 ext(&result[8],3);
-	ext=aDosName.Right(aDosName.Length()-dotPos-1);
-	return result;
-	}
+    __ASSERT_DEBUG(aDosName.Length()>=0 && aDosName.Length()<=12,Fault(EFatBadDosFormatName));
+    TBuf8<12> result;
+    Mem::Fill((TUint8*)result.Ptr(),result.MaxSize(),' ');
+    TInt dotPos=aDosName.Locate('.');
+    if (dotPos==KErrNotFound)
+        {
+        result=aDosName;
+        result.SetLength(11);
+        return result;
+        }
+    result=aDosName.Left(dotPos);
+    result.SetLength(11);
+    TPtr8 ext(&result[8],3);
+    ext=aDosName.Right(aDosName.Length()-dotPos-1);
+    return result;
+    }
 
 TBuf8<12> DosNameFromStdFormat(const TDesC8& aStdFormatName)
 //
 // Converts aaaaaaaayyy to dos name format xxx.yyy
 //
-	{
+    {
 
-	__ASSERT_DEBUG(aStdFormatName.Length()==11,Fault(EFatBadStdFormatName));
-	TBuf8<12> result;
-	TInt nameLen=aStdFormatName.Locate(' ');
-	if (nameLen>8 || nameLen==KErrNotFound)
-		nameLen=8;
-	result=aStdFormatName.Left(nameLen);
-	TPtrC8 ext(&aStdFormatName[8],3);
-	TInt extLen=ext.Locate(' ');
-	if (extLen)
-		result.Append(TChar('.'));
-	if (extLen==KErrNotFound)
-		extLen=3;
-	result.Append(ext.Left(extLen));
+    __ASSERT_DEBUG(aStdFormatName.Length()==11,Fault(EFatBadStdFormatName));
+    TBuf8<12> result;
+    TInt nameLen=aStdFormatName.Locate(' ');
+    if (nameLen>8 || nameLen==KErrNotFound)
+        nameLen=8;
+    result=aStdFormatName.Left(nameLen);
+    TPtrC8 ext(&aStdFormatName[8],3);
+    TInt extLen=ext.Locate(' ');
+    if (extLen)
+        result.Append(TChar('.'));
+    if (extLen==KErrNotFound)
+        extLen=3;
+    result.Append(ext.Left(extLen));
     if(result.Length() && result[0]==0x05 )
-	    {
-	    result[0]=0xE5;
-	    }
-	return result;
-	}
+        {
+        result[0]=0xE5;
+        }
+    return result;
+    }
 
 TInt NumberOfVFatEntries(TInt aNameLength)
 //
 // Return the number of VFat entries required to describe a filename of length aNameLength
 //
-	{
-	TInt numberOfEntries=0;
-	if (aNameLength%KMaxVFatEntryName)
-		aNameLength++;	//	Include a zero terminator
-//	If aNameLength is a exact multiple of KMaxVFatEntryName, don't bother
-//	with a zero terminator - it just adds an unnecessary directory entry		
-	
-	numberOfEntries=(1+(aNameLength/KMaxVFatEntryName));	
-	
-	if (aNameLength%KMaxVFatEntryName)
-		numberOfEntries++;
-	
-	return(numberOfEntries);
-	}
+    {
+    TInt numberOfEntries=0;
+    if (aNameLength%KMaxVFatEntryName)
+        aNameLength++;  //  Include a zero terminator
+//  If aNameLength is a exact multiple of KMaxVFatEntryName, don't bother
+//  with a zero terminator - it just adds an unnecessary directory entry        
+    
+    numberOfEntries=(1+(aNameLength/KMaxVFatEntryName));    
+    
+    if (aNameLength%KMaxVFatEntryName)
+        numberOfEntries++;
+    
+    return(numberOfEntries);
+    }
 
 //-----------------------------------------------------------------------------
 /**