VirtualBox

Changeset 49738 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Dec 2, 2013 12:52:51 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
91037
Message:

Main/BandwidthControl: fix regression (iterator incremented twice), plus lots of whitespace cleanup

Location:
trunk/src/VBox/Main/src-server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/BandwidthControlImpl.cpp

    r49644 r49738  
    115115    m->llBandwidthGroups.allocate();
    116116    BandwidthGroupList::const_iterator it;
    117     for(it = aThat->m->llBandwidthGroups->begin();
    118         it != aThat->m->llBandwidthGroups->end();
    119         ++it)
     117    for (it = aThat->m->llBandwidthGroups->begin();
     118         it != aThat->m->llBandwidthGroups->end();
     119         ++it)
    120120    {
    121121        ComObjPtr<BandwidthGroup> group;
     
    157157    m->llBandwidthGroups.allocate();
    158158    BandwidthGroupList::const_iterator it;
    159     for(it = aThat->m->llBandwidthGroups->begin();
    160         it != aThat->m->llBandwidthGroups->end();
    161         ++it)
     159    for (it = aThat->m->llBandwidthGroups->begin();
     160         it != aThat->m->llBandwidthGroups->end();
     161         ++it)
    162162    {
    163163        ComObjPtr<BandwidthGroup> group;
     
    178178 *  represented by @a aThat (locked for reading).
    179179 */
    180 void BandwidthControl::i_copyFrom (BandwidthControl *aThat)
    181 {
    182     AssertReturnVoid (aThat != NULL);
     180void BandwidthControl::i_copyFrom(BandwidthControl *aThat)
     181{
     182    AssertReturnVoid(aThat != NULL);
    183183
    184184    /* sanity */
    185185    AutoCaller autoCaller(this);
    186     AssertComRCReturnVoid (autoCaller.rc());
     186    AssertComRCReturnVoid(autoCaller.rc());
    187187
    188188    /* sanity too */
    189     AutoCaller thatCaller (aThat);
    190     AssertComRCReturnVoid (thatCaller.rc());
     189    AutoCaller thatCaller(aThat);
     190    AssertComRCReturnVoid(thatCaller.rc());
    191191
    192192    /* even more sanity */
    193193    AutoAnyStateDependency adep(m->pParent);
    194     AssertComRCReturnVoid (adep.rc());
     194    AssertComRCReturnVoid(adep.rc());
    195195    /* Machine::copyFrom() may not be called when the VM is running */
    196     AssertReturnVoid (!Global::IsOnline (adep.machineState()));
     196    AssertReturnVoid(!Global::IsOnline(adep.machineState()));
    197197
    198198    /* peer is not modified, lock it for reading (aThat is "master" so locked
     
    205205    m->llBandwidthGroups->clear();
    206206    BandwidthGroupList::const_iterator it;
    207     for(it = aThat->m->llBandwidthGroups->begin();
    208         it != aThat->m->llBandwidthGroups->end();
    209         ++it)
     207    for (it = aThat->m->llBandwidthGroups->begin();
     208         it != aThat->m->llBandwidthGroups->end();
     209         ++it)
    210210    {
    211211        ComObjPtr<BandwidthGroup> group;
    212212        group.createObject();
    213         group->initCopy (this, *it);
     213        group->initCopy(this, *it);
    214214        m->llBandwidthGroups->push_back(group);
    215215    }
     
    235235            /* unitialize all new groups (absent in the backed up list). */
    236236            BandwidthGroupList *backedList = m->llBandwidthGroups.backedUpData();
    237             for(it  = m->llBandwidthGroups->begin();
    238                 it != m->llBandwidthGroups->end();
    239                 ++it)
     237            for (it  = m->llBandwidthGroups->begin();
     238                 it != m->llBandwidthGroups->end();
     239                 ++it)
    240240            {
    241241                if (   std::find(backedList->begin(), backedList->end(), *it)
     
    249249
    250250        /* rollback any changes to groups after restoring the list */
    251         for(it = m->llBandwidthGroups->begin();
    252             it != m->llBandwidthGroups->end();
    253             ++it)
     251        for (it = m->llBandwidthGroups->begin();
     252             it != m->llBandwidthGroups->end();
     253             ++it)
    254254            (*it)->i_rollback();
    255255    }
     
    272272             * peers for those who have peers) */
    273273            BandwidthGroupList *newList = new BandwidthGroupList();
    274             for(it = m->llBandwidthGroups->begin(); it != m->llBandwidthGroups->end(); ++it)
     274            for (it = m->llBandwidthGroups->begin();
     275                 it != m->llBandwidthGroups->end();
     276                 ++it)
    275277            {
    276278                (*it)->i_commit();
     
    292294                /* and add it to the new list */
    293295                newList->push_back(peer);
    294 
    295                 ++it;
    296296            }
    297297
    298298            /* uninit old peer's controllers that are left */
    299             for(it = m->pPeer->m->llBandwidthGroups->begin();
    300                 it != m->pPeer->m->llBandwidthGroups->end();
    301                 ++it)
     299            for (it = m->pPeer->m->llBandwidthGroups->begin();
     300                 it != m->pPeer->m->llBandwidthGroups->end();
     301                 ++it)
    302302                (*it)->uninit();
    303303
     
    321321    if (commitBandwidthGroups)
    322322    {
    323         for(it = m->llBandwidthGroups->begin();
    324             it != m->llBandwidthGroups->end();
    325             ++it)
     323        for (it = m->llBandwidthGroups->begin();
     324             it != m->llBandwidthGroups->end();
     325             ++it)
    326326            (*it)->i_commit();
    327327    }
     
    482482    aBandwidthGroups.resize(0);
    483483    BandwidthGroupList::const_iterator it;
    484     for(it = m->llBandwidthGroups->begin();
    485         it != m->llBandwidthGroups->end();
    486         ++it)
     484    for (it = m->llBandwidthGroups->begin();
     485         it != m->llBandwidthGroups->end();
     486         ++it)
    487487        aBandwidthGroups.push_back(*it);
    488488
     
    497497    AssertComRCReturnRC(autoCaller.rc());
    498498    settings::BandwidthGroupList::const_iterator it;
    499     for(it = data.llBandwidthGroups.begin();
    500         it != data.llBandwidthGroups.end();
    501         ++it)
     499    for (it = data.llBandwidthGroups.begin();
     500         it != data.llBandwidthGroups.end();
     501         ++it)
    502502    {
    503503        const settings::BandwidthGroup &gr = *it;
     
    517517    data.llBandwidthGroups.clear();
    518518    BandwidthGroupList::const_iterator it;
    519     for(it = m->llBandwidthGroups->begin();
    520         it != m->llBandwidthGroups->end();
    521         ++it)
     519    for (it = m->llBandwidthGroups->begin();
     520         it != m->llBandwidthGroups->end();
     521         ++it)
    522522    {
    523523        AutoWriteLock groupLock(*it COMMA_LOCKVAL_SRC_POS);
  • trunk/src/VBox/Main/src-server/BandwidthGroupImpl.cpp

    r49644 r49738  
    127127
    128128        unconst(aThat->m->pPeer) = this;
    129         m->bd.attach (aThat->m->bd);
     129        m->bd.attach(aThat->m->bd);
    130130    }
    131131    else
     
    134134
    135135        AutoReadLock thatLock(aThat COMMA_LOCKVAL_SRC_POS);
    136         m->bd.share (aThat->m->bd);
     136        m->bd.share(aThat->m->bd);
    137137    }
    138138
     
    271271    /* sanity */
    272272    AutoCaller autoCaller(this);
    273     AssertComRCReturnVoid (autoCaller.rc());
     273    AssertComRCReturnVoid(autoCaller.rc());
    274274
    275275    /* sanity too */
    276     AutoCaller peerCaller (m->pPeer);
    277     AssertComRCReturnVoid (peerCaller.rc());
     276    AutoCaller peerCaller(m->pPeer);
     277    AssertComRCReturnVoid(peerCaller.rc());
    278278
    279279    /* lock both for writing since we modify both (m->pPeer is "master" so locked
     
    287287        {
    288288            // attach new data to the peer and reshare it
    289             m->pPeer->m->bd.attach (m->bd);
     289            m->pPeer->m->bd.attach(m->bd);
    290290        }
    291291    }
     
    304304    /* sanity */
    305305    AutoCaller autoCaller(this);
    306     AssertComRCReturnVoid (autoCaller.rc());
     306    AssertComRCReturnVoid(autoCaller.rc());
    307307
    308308    /* sanity too */
    309     AutoCaller peerCaller (m->pPeer);
    310     AssertComRCReturnVoid (peerCaller.rc());
     309    AutoCaller peerCaller(m->pPeer);
     310    AssertComRCReturnVoid(peerCaller.rc());
    311311
    312312    /* peer is not modified, lock it for reading (m->pPeer is "master" so locked
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