VirtualBox

Ignore:
Timestamp:
Feb 27, 2009 12:48:14 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
43495
Message:

#3551: “Main: Replace remaining collections with safe arrays”
Take two. Convert HostDVDDriveCollection. This time for all plattforms.

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
3 edited

Legend:

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

    r17193 r17200  
    671671                ComPtr<IHost> host;
    672672                CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
    673                 ComPtr<IHostDVDDriveCollection> hostDVDs;
    674                 CHECK_ERROR(host, COMGETTER(DVDDrives)(hostDVDs.asOutParam()));
     673                com::SafeIfaceArray <IHostDVDDrive> hostDVDs;
     674                rc = host->COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(hostDVDs));
     675
    675676                ComPtr<IHostDVDDrive> hostDVDDrive;
    676                 rc = hostDVDs->FindByName(Bstr(a->argv[2] + 5), hostDVDDrive.asOutParam());
     677                rc = host->FindHostDVDDrive(Bstr(a->argv[2] + 5), hostDVDDrive.asOutParam());
    677678                if (!hostDVDDrive)
    678679                {
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp

    r17193 r17200  
    224224            {
    225225                /*
    226                 * Iterate through the collection.
    227                 */
     226                 * Iterate through the collection.
     227                 */
    228228                for (size_t i = 0; i < coll.size(); ++ i)
    229229                {
     
    245245            ComPtr<IHost> host;
    246246            CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
    247             ComPtr<IHostDVDDriveCollection> coll;
    248             ComPtr<IHostDVDDriveEnumerator> enumerator;
    249             CHECK_ERROR(host, COMGETTER(DVDDrives)(coll.asOutParam()));
    250             if (SUCCEEDED(rc) && coll)
    251             {
    252                 CHECK_ERROR(coll, Enumerate(enumerator.asOutParam()));
    253                 BOOL hasMore;
    254                 while (SUCCEEDED(enumerator->HasMore(&hasMore)) && hasMore)
    255                 {
    256                     ComPtr<IHostDVDDrive> dvdDrive;
    257                     CHECK_ERROR_BREAK(enumerator, GetNext(dvdDrive.asOutParam()));
     247            com::SafeIfaceArray <IHostDVDDrive> coll;
     248            CHECK_ERROR(host, COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(coll)));
     249            if (SUCCEEDED(rc))
     250            {
     251                for (size_t i = 0; i < coll.size(); ++ i)
     252                {
     253                    ComPtr<IHostDVDDrive> dvdDrive = coll[i];
    258254                    Bstr name;
    259255                    dvdDrive->COMGETTER(Name)(name.asOutParam());
     
    779775
    780776#endif /* !VBOX_ONLY_DOCS */
    781 
     777/* vi: set tabstop=4 shiftwidth=4 expandtab: */
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r17193 r17200  
    2525#ifndef VBOX_ONLY_DOCS
    2626#include <VBox/com/com.h>
     27#include <VBox/com/array.h>
    2728#include <VBox/com/ErrorInfo.h>
    2829#include <VBox/com/errorprint2.h>
     
    10911092                ComPtr<IHost> host;
    10921093                CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
    1093                 ComPtr<IHostDVDDriveCollection> hostDVDs;
    1094                 CHECK_ERROR(host, COMGETTER(DVDDrives)(hostDVDs.asOutParam()));
     1094                com::SafeIfaceArray <IHostDVDDrive> hostDVDs;
     1095                rc = host->COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(hostDVDs));
     1096
    10951097                ComPtr<IHostDVDDrive> hostDVDDrive;
    1096                 rc = hostDVDs->FindByName(Bstr(dvd + 5), hostDVDDrive.asOutParam());
     1098                rc = host->FindHostDVDDrive(Bstr(dvd + 5), hostDVDDrive.asOutParam());
    10971099                if (!hostDVDDrive)
    10981100                {
     
    11051107                        break;
    11061108                    }
    1107                     rc = hostDVDs->FindByName(Bstr(szPathReal), hostDVDDrive.asOutParam());
     1109                    rc = host->FindHostDVDDrive(Bstr(szPathReal), hostDVDDrive.asOutParam());
    11081110                    if (!hostDVDDrive)
    11091111                    {
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