VirtualBox

Changeset 17739 in vbox


Ignore:
Timestamp:
Mar 12, 2009 12:38:15 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
44256
Message:

Reduce scope of iteration indices.
Convert some commented collection code to safe-array.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r17684 r17739  
    11291129        CHECK_ERROR_RET (USBCtl, COMGETTER(DeviceFilters)(ComSafeArrayAsOutParam(Coll)), rc);
    11301130
    1131         size_t index = 0; // Also used after the "for" below.
    1132 
    11331131        if (Coll.size() == 0)
    11341132        {
     
    11381136        else
    11391137        {
    1140             for (; index < Coll.size(); ++index)
     1138            for (size_t index = 0; index < Coll.size(); ++index)
    11411139            {
    11421140                ComPtr<IUSBDeviceFilter> DevPtr = Coll[index];
     
    12081206        if (console)
    12091207        {
    1210             index = 0;
    12111208            /* scope */
    12121209            {
     
    12241221                else
    12251222                {
    1226                     for (index = 0; index < coll.size(); ++index)
     1223                    for (size_t index = 0; index < coll.size(); ++index)
    12271224                    {
    12281225                        ComPtr <IHostUSBDevice> dev = coll[index];
     
    12981295            }
    12991296
    1300             index = 0;
    13011297            /* scope */
    13021298            {
     
    13141310                else
    13151311                {
    1316                     for (index = 0; index < coll.size(); ++index)
     1312                    for (size_t index = 0; index < coll.size(); ++index)
    13171313                    {
    13181314                        ComPtr <IUSBDevice> dev = coll[index];
     
    13991395    /* globally shared folders first */
    14001396    {
    1401         ComPtr<ISharedFolderCollection> sfColl;
    1402         ComPtr<ISharedFolderEnumerator> sfEnum;
    1403         CHECK_ERROR_RET(virtualBox, COMGETTER(SharedFolders)(sfColl.asOutParam()), rc);
    1404         CHECK_ERROR_RET(sfColl, Enumerate(sfEnum.asOutParam()), rc);
    1405         BOOL fMore;
    1406         sfEnum->HasMore(&fMore);
    1407         while (fMore)
    1408         {
    1409             ComPtr<ISharedFolder> sf;
    1410             CHECK_ERROR_RET(sfEnum, GetNext(sf.asOutParam()), rc);
     1397        SafeIfaceArray <ISharedFolder> sfColl;
     1398        CHECK_ERROR_RET(virtualBox, COMGETTER(SharedFolders)(ComSafeArrayAsOutParam(sfColl)), rc);
     1399        for (size_t i = 0; i < sfColl.size(); ++i)
     1400        {
     1401            ComPtr<ISharedFolder> sf = sfColl[i];
    14111402            Bstr name, hostPath;
    14121403            sf->COMGETTER(Name)(name.asOutParam());
     
    14141405            RTPrintf("Name: '%lS', Host path: '%lS' (global mapping)\n", name.raw(), hostPath.raw());
    14151406            ++numSharedFolders;
    1416             CHECK_ERROR_RET(sfEnum, HasMore(&fMore), rc);
    14171407        }
    14181408    }
Note: See TracChangeset for help on using the changeset viewer.

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