VirtualBox

Changeset 15570 in vbox for trunk/src/VBox/Main/include


Ignore:
Timestamp:
Dec 16, 2008 10:39:34 AM (16 years ago)
Author:
vboxsync
Message:

#3282: Collection got replaced with safe array. Warning, windows builds/tests may break.

Location:
trunk/src/VBox/Main/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/HostImpl.h

    r15051 r15570  
    8585    STDMETHOD(COMGETTER(USBDevices))(IHostUSBDeviceCollection **aUSBDevices);
    8686    STDMETHOD(COMGETTER(USBDeviceFilters))(IHostUSBDeviceFilterCollection ** aUSBDeviceFilters);
    87     STDMETHOD(COMGETTER(NetworkInterfaces))(IHostNetworkInterfaceCollection **networkInterfaces);
     87    STDMETHOD(COMGETTER(NetworkInterfaces))(ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces));
    8888    STDMETHOD(COMGETTER(ProcessorCount))(ULONG *count);
    8989    STDMETHOD(COMGETTER(ProcessorOnlineCount))(ULONG *count);
  • trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h

    r15442 r15570  
    9999};
    100100
    101 COM_DECL_READONLY_ENUM_AND_COLLECTION_BEGIN (HostNetworkInterface)
    102 
    103     STDMETHOD(FindByName) (IN_BSTR name, IHostNetworkInterface **networkInterface)
    104     {
    105         if (!name)
    106             return E_INVALIDARG;
    107         if (!networkInterface)
    108             return E_POINTER;
    109 
    110         *networkInterface = NULL;
    111         Vector::value_type found;
    112         Vector::iterator it = vec.begin();
    113         while (it != vec.end() && !found)
    114         {
    115             Bstr n;
    116             (*it)->COMGETTER(Name) (n.asOutParam());
    117             if (n == name)
    118                 found = *it;
    119             ++ it;
    120         }
    121 
    122         if (!found)
    123             return setError (E_INVALIDARG, HostNetworkInterfaceCollection::tr (
    124                 "The host network interface with the given name could not be found"));
    125 
    126         return found.queryInterfaceTo (networkInterface);
    127     }
    128 
    129     STDMETHOD(FindById) (IN_GUID id, IHostNetworkInterface **networkInterface)
    130     {
    131         if (Guid(id).isEmpty())
    132             return E_INVALIDARG;
    133         if (!networkInterface)
    134             return E_POINTER;
    135 
    136         *networkInterface = NULL;
    137         Vector::value_type found;
    138         Vector::iterator it = vec.begin();
    139         while (it != vec.end() && !found)
    140         {
    141             Guid g;
    142             (*it)->COMGETTER(Id) (g.asOutParam());
    143             if (g == Guid(id))
    144                 found = *it;
    145             ++ it;
    146         }
    147 
    148         if (!found)
    149             return setError (E_INVALIDARG, HostNetworkInterfaceCollection::tr (
    150                 "The host network interface with the given GUID could not be found"));
    151 
    152         return found.queryInterfaceTo (networkInterface);
    153     }
    154 
    155 
    156 COM_DECL_READONLY_ENUM_AND_COLLECTION_END (HostNetworkInterface)
    157 
    158 
    159101#endif // ____H_H_HOSTNETWORKINTERFACEIMPL
    160102/* vi: set tabstop=4 shiftwidth=4 expandtab: */
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