userlibandfileserver/fileserver/sfat32/sl_utl.cpp
branchRCL_3
changeset 80 597aaf25e343
parent 36 538db54a451d
child 167 b41fc9c39ca7
--- a/userlibandfileserver/fileserver/sfat32/sl_utl.cpp	Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/sl_utl.cpp	Fri Mar 12 15:50:11 2010 +0200
@@ -117,23 +117,16 @@
 	return result;
 	}
 
-TInt NumberOfVFatEntries(TInt aNameLength)
-//
-// Return the number of VFat entries required to describe a filename of length aNameLength
-//
+/**
+    @param  aNameLength file name length
+    @return the number of VFat entries required to describe a filename of length aNameLength
+*/
+TUint NumberOfVFatEntries(TUint 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);
+    ASSERT(aNameLength);
+    //-- 1 compulsory DOS entry included
+    const TUint numberOfEntries=1+(aNameLength + KMaxVFatEntryName - 1) / KMaxVFatEntryName;	
+	return numberOfEntries;
 	}
 
 //-----------------------------------------------------------------------------