VirtualBox

Changeset 21176 in vbox for trunk/src/VBox/HostServices


Ignore:
Timestamp:
Jul 2, 2009 4:05:49 PM (16 years ago)
Author:
vboxsync
Message:

Shared folders host service: fixed gcc warnings about signed / unsigned mismatch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedFolders/mappings.cpp

    r21172 r21176  
    3333void vbsfMappingInit(void)
    3434{
    35     int root;
     35    unsigned root;
     36
    3637    for (root = 0; root < RT_ELEMENTS(aIndexFromRoot); root++)
    3738    {
    38         aIndexFromRoot[root] = ~0;
     39        aIndexFromRoot[root] = SHFL_ROOT_NIL;
    3940    }
    4041}
     
    5455    }
    5556
    56     int i;
    57 
     57    SHFLROOT i;
    5858    for (i = 0; i < RT_ELEMENTS(FolderMapping); i++)
    5959    {
     
    8282    if (root < RT_ELEMENTS(aIndexFromRoot))
    8383    {
    84         int iMapping = aIndexFromRoot[root];
    85 
    86         if (0 <= iMapping && iMapping < RT_ELEMENTS(FolderMapping))
     84        SHFLROOT iMapping = aIndexFromRoot[root];
     85
     86        if (   iMapping != SHFL_ROOT_NIL
     87            && iMapping < RT_ELEMENTS(FolderMapping))
    8788        {
    8889            return &FolderMapping[iMapping];
     
    9394}
    9495
    95 static SHFLROOT vbsfMappingGetRootFromIndex(int iMapping)
    96 {
    97     int root;
     96static SHFLROOT vbsfMappingGetRootFromIndex(SHFLROOT iMapping)
     97{
     98    unsigned root;
     99
    98100    for (root = 0; root < RT_ELEMENTS(aIndexFromRoot); root++)
    99101    {
     
    104106    }
    105107
    106     return ~0;
     108    return SHFL_ROOT_NIL;
    107109}
    108110
    109111static MAPPING *vbsfMappingGetByName (PRTUTF16 utf16Name, SHFLROOT *pRoot)
    110112{
    111     int i;
    112 
    113     for (i=0;i<SHFL_MAX_MAPPINGS;i++)
     113    unsigned i;
     114
     115    for (i=0; i<SHFL_MAX_MAPPINGS; i++)
    114116    {
    115117        if (FolderMapping[i].fValid == true)
     
    119121                SHFLROOT root = vbsfMappingGetRootFromIndex(i);
    120122               
    121                 if (root != ~0)
     123                if (root != SHFL_ROOT_NIL)
    122124                {
    123125                    if (pRoot)
     
    138140}
    139141
    140 static void vbsfRootHandleAdd(int iMapping)
    141 {
    142     int root;
     142static void vbsfRootHandleAdd(SHFLROOT iMapping)
     143{
     144    unsigned root;
    143145
    144146    for (root = 0; root < RT_ELEMENTS(aIndexFromRoot); root++)
    145147    {
    146         if (aIndexFromRoot[root] == ~0)
     148        if (aIndexFromRoot[root] == SHFL_ROOT_NIL)
    147149        {
    148150            aIndexFromRoot[root] = iMapping;
     
    152154
    153155    AssertFailed();
    154     return;
    155 }
    156 
    157 static void vbsfRootHandleRemove(int iMapping)
    158 {
    159     int root;
     156}
     157
     158static void vbsfRootHandleRemove(SHFLROOT iMapping)
     159{
     160    unsigned root;
    160161
    161162    for (root = 0; root < RT_ELEMENTS(aIndexFromRoot); root++)
     
    163164        if (aIndexFromRoot[root] == iMapping)
    164165        {
    165             aIndexFromRoot[root] = ~0;
     166            aIndexFromRoot[root] = SHFL_ROOT_NIL;
    166167            return;
    167168        }
     
    169170
    170171    AssertFailed();
    171     return;
    172172}
    173173
     
    181181int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName, uint32_t fWritable)
    182182{
    183     int i;
     183    unsigned i;
    184184
    185185    Assert(pFolderName && pMapName);
     
    188188
    189189    /* check for duplicates */
    190     for (i=0;i<SHFL_MAX_MAPPINGS;i++)
     190    for (i=0; i<SHFL_MAX_MAPPINGS; i++)
    191191    {
    192192        if (FolderMapping[i].fValid == true)
     
    200200    }
    201201
    202     for (i=0;i<SHFL_MAX_MAPPINGS;i++)
     202    for (i=0; i<SHFL_MAX_MAPPINGS; i++)
    203203    {
    204204        if (FolderMapping[i].fValid == false)
     
    261261int vbsfMappingsRemove (PSHFLSTRING pMapName)
    262262{
    263     int i;
     263    unsigned i;
    264264
    265265    Assert(pMapName);
    266266
    267267    Log(("vbsfMappingsRemove %ls\n", pMapName->String.ucs2));
    268     for (i=0;i<SHFL_MAX_MAPPINGS;i++)
     268    for (i=0; i<SHFL_MAX_MAPPINGS; i++)
    269269    {
    270270        if (FolderMapping[i].fValid == true)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette