VirtualBox

Changeset 17218 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 27, 2009 6:02:48 PM (16 years ago)
Author:
vboxsync
Message:

Revert r43495 because everything locks forever.

Location:
trunk/src/VBox
Files:
14 edited

Legend:

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

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

    r17200 r17218  
    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             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];
     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()));
    254258                    Bstr name;
    255259                    dvdDrive->COMGETTER(Name)(name.asOutParam());
     
    775779
    776780#endif /* !VBOX_ONLY_DOCS */
    777 /* vi: set tabstop=4 shiftwidth=4 expandtab: */
     781
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r17200 r17218  
    2525#ifndef VBOX_ONLY_DOCS
    2626#include <VBox/com/com.h>
    27 #include <VBox/com/array.h>
    2827#include <VBox/com/ErrorInfo.h>
    2928#include <VBox/com/errorprint2.h>
     
    10921091                ComPtr<IHost> host;
    10931092                CHECK_ERROR(a->virtualBox, COMGETTER(Host)(host.asOutParam()));
    1094                 com::SafeIfaceArray <IHostDVDDrive> hostDVDs;
    1095                 rc = host->COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(hostDVDs));
    1096 
     1093                ComPtr<IHostDVDDriveCollection> hostDVDs;
     1094                CHECK_ERROR(host, COMGETTER(DVDDrives)(hostDVDs.asOutParam()));
    10971095                ComPtr<IHostDVDDrive> hostDVDDrive;
    1098                 rc = host->FindHostDVDDrive(Bstr(dvd + 5), hostDVDDrive.asOutParam());
     1096                rc = hostDVDs->FindByName(Bstr(dvd + 5), hostDVDDrive.asOutParam());
    10991097                if (!hostDVDDrive)
    11001098                {
     
    11071105                        break;
    11081106                    }
    1109                     rc = host->FindHostDVDDrive(Bstr(szPathReal), hostDVDDrive.asOutParam());
     1107                    rc = hostDVDs->FindByName(Bstr(szPathReal), hostDVDDrive.asOutParam());
    11101108                    if (!hostDVDDrive)
    11111109                    {
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r17200 r17218  
    55
    66/*
    7  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    17721772            ComPtr <IHost> host;
    17731773            CHECK_ERROR_BREAK (virtualBox, COMGETTER(Host)(host.asOutParam()));
    1774             SafeIfaceArray <IHostDVDDrive> coll;
    1775             CHECK_ERROR_BREAK (host, COMGETTER(DVDDrives)(ComSafeArrayAsOutParam(coll)));
     1774            ComPtr <IHostDVDDriveCollection> coll;
     1775            CHECK_ERROR_BREAK (host, COMGETTER(DVDDrives)(coll.asOutParam()));
    17761776            ComPtr <IHostDVDDrive> hostDrive;
    1777             rc = host->FindHostDVDDrive (medium, hostDrive.asOutParam());
     1777            rc = coll->FindByName (medium, hostDrive.asOutParam());
    17781778            if (SUCCEEDED (rc))
    17791779            {
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r17201 r17218  
    66
    77/*
    8  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     8 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    30643064
    30653065    hostDVDMap.clear();
    3066     CHostDVDDriveVector drvvec =
    3067         vboxGlobal().virtualBox().GetHost().GetDVDDrives();
    3068     for (int i = 0; i < drvvec.size(); ++i)
    3069     {
    3070         CHostDVDDrive hostDVD = drvvec[i];
     3066    CHostDVDDriveEnumerator en =
     3067        vboxGlobal().virtualBox().GetHost().GetDVDDrives().Enumerate();
     3068    while (en.HasMore())
     3069    {
     3070        CHostDVDDrive hostDVD = en.GetNext();
    30713071        /** @todo set icon */
    30723072        QString drvName = hostDVD.GetName();
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMFirstRunWzd.cpp

    r17200 r17218  
    66
    77/*
    8  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     8 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    176176    {
    177177        /* Search for the host dvd-drives */
    178         CHostDVDDriveVector coll =
     178        CHostDVDDriveCollection coll =
    179179            vboxGlobal().virtualBox().GetHost().GetDVDDrives();
    180         mHostDVDs.resize (coll.size());
    181 
    182         for (int id = 0; id < coll.size(); ++id)
    183         {
    184             CHostDVDDrive hostDVD = coll[id];
     180        mHostDVDs.resize (coll.GetCount());
     181        int id = 0;
     182        CHostDVDDriveEnumerator en = coll.Enumerate();
     183        while (en.HasMore())
     184        {
     185            CHostDVDDrive hostDVD = en.GetNext();
    185186            QString name = hostDVD.GetName();
    186187            QString description = hostDVD.GetDescription();
     
    189190            mCbHost->insertItem (id, fullName);
    190191            mHostDVDs [id] = hostDVD;
     192            ++ id;
    191193        }
    192194
     
    220222
    221223    /* Repopulate the media list */
    222     mCbImage->repopulate();
     224        mCbImage->repopulate();
    223225
    224226    /* Revalidate updated page */
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsCD.cpp

    r17200 r17218  
    66
    77/*
    8  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     8 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    5959
    6060    /* Read out the host DVD drive list and prepare the combobox */
    61     CHostDVDDriveVector coll =
     61    CHostDVDDriveCollection coll =
    6262        vboxGlobal().virtualBox().GetHost().GetDVDDrives();
    63     mHostCDs.resize (coll.size());
     63    mHostCDs.resize (coll.GetCount());
    6464    mCbHostCD->clear();
    65 
    66     for (int id = 0; id < coll.size(); ++id)
    67     {
    68         CHostDVDDrive hostDVD = coll[id];
     65    int id = 0;
     66    CHostDVDDriveEnumerator en = coll.Enumerate();
     67    while (en.HasMore())
     68    {
     69        CHostDVDDrive hostDVD = en.GetNext();
    6970        /// @todo (r=dmik) set icon?
    7071        QString name = hostDVD.GetName();
     
    7475        mCbHostCD->insertItem (id, fullName);
    7576        mHostCDs [id] = hostDVD;
     77        ++ id;
    7678    }
    7779
     
    8789                name :
    8890                QString ("%1 (%2)").arg (description, name);
    89             if (vboxGlobal().virtualBox().GetHost().FindHostDVDDrive (name).isNull())
     91            if (coll.FindByName (name).isNull())
    9092            {
    9193                /* If the DVD drive is not currently available,
  • trunk/src/VBox/Main/DVDDriveImpl.cpp

    r17200 r17218  
    77
    88/*
    9  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     9 * Copyright (C) 2006-2008 Sun Microsystems, Inc.
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    452452        Bstr src = typeNode.stringValue ("src");
    453453
    454         /* find the corresponding object */
     454        /* find the correspoding object */
    455455        ComObjPtr <Host> host = mParent->virtualBox()->host();
    456456
    457         com::SafeIfaceArray <IHostDVDDrive> coll;
    458         rc = host->COMGETTER(DVDDrives) (ComSafeArrayAsOutParam(coll));
     457        ComPtr <IHostDVDDriveCollection> coll;
     458        rc = host->COMGETTER(DVDDrives) (coll.asOutParam());
    459459        AssertComRC (rc);
    460460
    461461        ComPtr <IHostDVDDrive> drive;
    462         rc = host->FindHostDVDDrive (src, drive.asOutParam());
    463 
     462        rc = coll->FindByName (src, drive.asOutParam());
    464463        if (SUCCEEDED (rc))
    465464        {
  • trunk/src/VBox/Main/HostImpl.cpp

    r17200 r17218  
    55
    66/*
    7  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    291291 * @param drives address of result pointer
    292292 */
    293 STDMETHODIMP Host::COMGETTER(DVDDrives) (ComSafeArrayOut (IHostDVDDrive *, aDrives))
    294 {
    295     CheckComArgOutSafeArrayPointerValid(aDrives);
     293STDMETHODIMP Host::COMGETTER(DVDDrives) (IHostDVDDriveCollection **aDrives)
     294{
     295    CheckComArgOutPointerValid(aDrives);
    296296    AutoWriteLock alock (this);
    297297    CHECK_READY();
     
    399399#endif
    400400
    401     SafeIfaceArray <IHostDVDDrive> array (list);
    402     array.detachTo(ComSafeArrayOutArg(aDrives));
     401    ComObjPtr<HostDVDDriveCollection> collection;
     402    collection.createObject();
     403    collection->init (list);
     404    collection.queryInterfaceTo(aDrives);
    403405    return rc;
    404406}
     
    33213323#endif /* VBOX_WITH_RESOURCE_USAGE_API */
    33223324
    3323 STDMETHODIMP Host::FindHostDVDDrive(IN_BSTR aName, IHostDVDDrive **aDrive)
    3324 {
    3325     CheckComArgNotNull(aName);
    3326     CheckComArgOutPointerValid(aDrive);
    3327     AutoReadLock alock (this);
    3328 
    3329     *aDrive = NULL;
    3330 
    3331     SafeIfaceArray <IHostDVDDrive> drivevec;
    3332     HRESULT rc = COMGETTER(DVDDrives) (ComSafeArrayAsOutParam(drivevec));
    3333     CheckComRCReturnRC (rc);
    3334 
    3335     for (size_t i = 0; i < drivevec.size(); ++i)
    3336     {
    3337         Bstr name;
    3338         rc = drivevec[i]->COMGETTER(Name) (name.asOutParam());
    3339         CheckComRCReturnRC (rc);
    3340         if (name == aName)
    3341         {
    3342             ComObjPtr<HostDVDDrive> found;
    3343             found.createObject();
    3344             Bstr udi, description;
    3345             rc = drivevec[i]->COMGETTER(Udi) (udi.asOutParam());
    3346             CheckComRCReturnRC (rc);
    3347             rc = drivevec[i]->COMGETTER(Description) (description.asOutParam());
    3348             CheckComRCReturnRC (rc);
    3349             found->init(name, udi, description);
    3350             return found.queryInterfaceTo(aDrive);
    3351         }
    3352     }
    3353 
    3354     return setError (VBOX_E_OBJECT_NOT_FOUND, HostDVDDrive::tr (
    3355         "The host DVD drive named '%ls' could not be found"), aName);
    3356 }
    3357 
    33583325STDMETHODIMP Host::FindHostNetworkInterfaceByName(IN_BSTR name, IHostNetworkInterface **networkInterface)
    33593326{
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r17200 r17218  
    63416341  </interface>
    63426342
     6343  <enumerator
     6344     name="IHostDVDDriveEnumerator" type="IHostDVDDrive"
     6345     uuid="1ed7cfaf-c363-40df-aa4e-89c1afb7d96b"
     6346     />
     6347
     6348  <collection
     6349     name="IHostDVDDriveCollection" type="IHostDVDDrive"
     6350     enumerator="IHostDVDDriveEnumerator"
     6351     uuid="1909c533-1a1e-445f-a4e1-a267cffc30ed"
     6352     readonly="yes"
     6353     >
     6354    <method name="findByName">
     6355      <desc>
     6356        Searches this collection for a host drive with the given name.
     6357        <note>
     6358          The method returns an error if the given name does not
     6359          correspond to any host drive in the collection.
     6360        </note>
     6361      </desc>
     6362      <param name="name" type="wstring" dir="in">
     6363        <desc>Name of the host drive to search for</desc>
     6364      </param>
     6365      <param name="drive" type="IHostDVDDrive" dir="return">
     6366        <desc>Found host drive object</desc>
     6367      </param>
     6368    </method>
     6369  </collection>
     6370
    63436371  <interface
    63446372     name="IHostFloppyDrive" extends="$unknown"
     
    65156543  <interface
    65166544     name="IHost" extends="$unknown"
    6517      uuid="ba0cb246-478a-4a2b-930e-51ce740ada9c"
     6545     uuid="7c172c42-b209-4bdc-9ddf-a84f222bd59a"
    65186546     wsmap="managed"
    65196547     >
     
    65306558
    65316559    </desc>
    6532     <attribute name="DVDDrives" type="IHostDVDDrive" readonly="yes" safearray="yes">
     6560    <attribute name="DVDDrives" type="IHostDVDDriveCollection" readonly="yes">
    65336561      <desc>List of DVD drives available on the host.</desc>
    65346562    </attribute>
     
    68056833    </method>
    68066834
    6807     <method name="findHostDVDDrive">
    6808       <desc>
    6809         Searches for a host DVD drive with the given @c name.
    6810 
    6811         <result name="VBOX_E_OBJECT_NOT_FOUND">
    6812           Given @c name does not correspond to any host drive.
    6813         </result>
    6814 
    6815       </desc>
    6816       <param name="name" type="wstring" dir="in">
    6817         <desc>Name of the host drive to search for</desc>
    6818       </param>
    6819       <param name="drive" type="IHostDVDDrive" dir="return">
    6820         <desc>Found host drive object</desc>
    6821       </param>
    6822     </method>
    6823 
    68246835    <method name="findHostNetworkInterfaceByName">
    68256836      <desc>
    68266837        Searches through all host network interfaces for an interface with
    6827         the given @c name.
    6828         <note>
    6829           The method returns an error if the given @c name does not
     6838        the given name.
     6839        <note>
     6840          The method returns an error if the given name does not
    68306841          correspond to any host network interface.
    68316842        </note>
  • trunk/src/VBox/Main/include/HostDVDDriveImpl.h

    r17200 r17218  
    55
    66/*
    7  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2424
    2525#include "VirtualBoxBase.h"
     26#include "Collection.h"
    2627
    2728class ATL_NO_VTABLE HostDVDDrive :
     
    8283};
    8384
     85COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN (HostDVDDrive)
     86
     87    STDMETHOD(FindByName) (IN_BSTR aName, IHostDVDDrive **aDrive)
     88    {
     89        if (!aName)
     90            return E_INVALIDARG;
     91        if (!aDrive)
     92            return E_POINTER;
     93
     94        *aDrive = NULL;
     95        Vector::value_type found;
     96        Vector::iterator it = vec.begin();
     97        while (it != vec.end() && !found)
     98        {
     99            Bstr n;
     100            (*it)->COMGETTER(Name) (n.asOutParam());
     101            if (n == aName)
     102                found = *it;
     103            ++ it;
     104        }
     105
     106        if (!found)
     107            return setError (E_INVALIDARG, HostDVDDriveCollection::tr (
     108                "The host DVD drive named '%ls' could not be found"), aName);
     109
     110        return found.queryInterfaceTo (aDrive);
     111    }
     112
     113COM_DECL_READONLY_ENUM_AND_COLLECTION_END (HostDVDDrive)
     114
    84115#endif // ____H_HOSTDVDDRIVEIMPL
    85116/* vi: set tabstop=4 shiftwidth=4 expandtab: */
  • trunk/src/VBox/Main/include/HostImpl.h

    r17200 r17218  
    55
    66/*
    7  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    8181
    8282    // IHost properties
    83     STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut (IHostDVDDrive*, drives));
     83    STDMETHOD(COMGETTER(DVDDrives))(IHostDVDDriveCollection **drives);
    8484    STDMETHOD(COMGETTER(FloppyDrives))(IHostFloppyDriveCollection **drives);
    8585    STDMETHOD(COMGETTER(USBDevices))(IHostUSBDeviceCollection **aUSBDevices);
     
    111111    STDMETHOD(RemoveUSBDeviceFilter) (ULONG aPosition, IHostUSBDeviceFilter **aFilter);
    112112
    113     STDMETHOD(FindHostDVDDrive) (IN_BSTR aName, IHostDVDDrive **aDrive);
    114113    STDMETHOD(FindHostNetworkInterfaceByName) (IN_BSTR aName, IHostNetworkInterface **networkInterface);
    115114    STDMETHOD(FindHostNetworkInterfaceById) (IN_GUID id, IHostNetworkInterface **networkInterface);
  • trunk/src/VBox/Main/webservice/webtest.cpp

    r17200 r17218  
    44 *      functionality of VBoxManage for testing purposes.
    55 *
    6  * Copyright (C) 2006-2009 Sun Microsystems, Inc.
     6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
    77 *
    88 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    233233        {
    234234            unsigned int i,
    235                          c = resp.returnval.size();
     235                         c = resp.returnval->array.size();
    236236            for(i = 0;
    237237                i < c;
    238238                ++i)
    239239            {
    240                 std::cout << "DVD drive " << i << ": objref " << resp.returnval[i] << "\n";
     240                std::cout << "DVD drive " << i << ": objref " << resp.returnval->array[i] << "\n";
    241241            }
    242242        }
  • trunk/src/VBox/Main/xpcom/server.cpp

    r17200 r17218  
    243243
    244244COM_IMPL_READONLY_ENUM_AND_COLLECTION(Snapshot)
     245COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostDVDDrive)
    245246COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostFloppyDrive)
    246247#ifdef VBOX_WITH_USB
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