VirtualBox

Changeset 64218 in vbox for trunk/src


Ignore:
Timestamp:
Oct 12, 2016 10:28:37 AM (8 years ago)
Author:
vboxsync
Message:

VBoxNetDhcp: Instead of complaining in the comments that operator[] is
not const, just use find().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp

    r64215 r64218  
    118118    static int hostDnsServers(const ComHostPtr& host,
    119119                              const RTNETADDRIPV4& networkid,
    120                               /* const */ AddressToOffsetMapping& mapping,
     120                              const AddressToOffsetMapping& mapping,
    121121                              AddressList& servers);
    122122    int fetchAndUpdateDnsInfo();
     
    617617
    618618
    619 /**
    620  * @note: const dropped here, because of map<K,V>::operator[] which
    621  * isn't const, map<K,V>::at() has const variant but it's C++11.
    622  */
    623619int VBoxNetDhcp::hostDnsServers(const ComHostPtr& host,
    624620                                const RTNETADDRIPV4& networkid,
    625                                 /* const */ AddressToOffsetMapping& mapping,
     621                                const AddressToOffsetMapping& mapping,
    626622                                AddressList& servers)
    627623{
     
    650646        if (addr.au8[0] == 127)
    651647        {
    652             /* XXX: here we want map<K,V>::at(const K& k) const */
    653             if (mapping[addr] != 0)
     648            AddressToOffsetMapping::const_iterator remap(mapping.find(addr));
     649
     650            if (remap != mapping.end())
    654651            {
    655                 addr.u = RT_H2N_U32(RT_N2H_U32(networkid.u)
    656                                     + mapping[addr]);
     652                int offset = remap->second;
     653                addr.u = RT_H2N_U32(RT_N2H_U32(networkid.u) + offset);
    657654            }
    658655            else
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