userlibandfileserver/fileserver/fs_utils/filesystem_utils.cpp
changeset 45 329ab0095843
equal deleted inserted replaced
44:36bfc973b146 45:329ab0095843
       
     1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 //  Collection of common constants, utility functions, etc. for the file server and file systems.
       
    16 //  Definitions here must be filesystem-agnostic, i.e. generic enougs to be used by every file system
       
    17 //
       
    18 //  This is the internal file and must not be exported.
       
    19 
       
    20 /**
       
    21     @file
       
    22     @internalTechnology
       
    23 */
       
    24 
       
    25 #include "filesystem_utils.h"
       
    26 
       
    27 //-----------------------------------------------------------------------------
       
    28 
       
    29 /**
       
    30     Calculates the log2 of a number
       
    31 
       
    32     @param aNum Number to calulate the log two of
       
    33     @return The log two of the number passed in
       
    34 */
       
    35 TUint32 Log2(TUint32 aVal)
       
    36     {
       
    37     return Log2_inline(aVal);
       
    38     }
       
    39 
       
    40 //-----------------------------------------------------------------------------
       
    41 /**
       
    42     Calculates number of '1' bits in the aVal
       
    43 
       
    44     @param aVal some value
       
    45     @return number of '1' bits in the aVal
       
    46 */
       
    47 TUint32 Count1Bits(TUint32 aVal)
       
    48     {
       
    49     return Count1Bits_inline(aVal);
       
    50     }
       
    51 
       
    52 //-----------------------------------------------------------------------------
       
    53 /**
       
    54     Removes trailing dots from aName.
       
    55     @return new string descriptor that may have its length adjusted
       
    56 */
       
    57 TPtrC RemoveTrailingDots(const TDesC& aName)
       
    58     {
       
    59     TInt len = aName.Length();
       
    60     
       
    61     while(len > 0)
       
    62         {
       
    63         if(aName[len-1] == '.')
       
    64             len--;
       
    65         else
       
    66             break;
       
    67         }
       
    68 
       
    69     TPtrC ptrNoDots(aName.Ptr(), len);
       
    70     return ptrNoDots;
       
    71     }
       
    72 
       
    73 
       
    74 
       
    75 
       
    76 
       
    77 
       
    78 
       
    79 
       
    80 
       
    81 
       
    82 
       
    83 
       
    84 
       
    85 
       
    86 
       
    87 
       
    88 
       
    89 
       
    90 
       
    91