VirtualBox

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


Ignore:
Timestamp:
Jul 12, 2020 1:14:44 PM (5 years ago)
Author:
vboxsync
Message:

Main/PerformanceImpl.cpp: C++11 deprecated std::mem_fun -> std::mem_fn, hoping that's the right conversion... Some signed/unsigned conversion issues. bugref:9790

File:
1 edited

Legend:

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

    r82968 r85273  
    322322
    323323    aMetrics.resize(filteredMetrics.size());
    324     int i = 0;
     324    size_t i = 0;
    325325    for (it = filteredMetrics.begin(); it != filteredMetrics.end(); ++it)
    326326    {
     
    330330            rc = metric->init(*it);
    331331        AssertComRCReturnRC(rc);
    332         LogFlow(("PerformanceCollector::GetMetrics() store a metric at retMetrics[%d]...\n", i));
     332        LogFlow(("PerformanceCollector::GetMetrics() store a metric at retMetrics[%zu]...\n", i));
    333333        aMetrics[i++] = metric;
    334334    }
     
    375375
    376376    aAffectedMetrics.resize(filteredMetrics.size());
    377     int i = 0;
     377    size_t i = 0;
    378378    for (it = filteredMetrics.begin();
    379379         it != filteredMetrics.end() && SUCCEEDED(rc); ++it)
     
    409409
    410410    aAffectedMetrics.resize(filteredMetrics.size());
    411     int i = 0;
     411    size_t i = 0;
    412412    for (it = filteredMetrics.begin();
    413413         it != filteredMetrics.end() && SUCCEEDED(rc); ++it)
     
    445445
    446446    aAffectedMetrics.resize(filteredMetrics.size());
    447     int i = 0;
     447    size_t i = 0;
    448448    for (it = filteredMetrics.begin();
    449449         it != filteredMetrics.end() && SUCCEEDED(rc); ++it)
     
    484484        }
    485485
    486     int i = 0;
    487486    size_t flatIndex = 0;
    488487    size_t numberOfMetrics = filteredMetrics.size();
     
    496495    aReturnData.resize(flatSize);
    497496
     497    size_t i = 0;
    498498    for (it = filteredMetrics.begin(); it != filteredMetrics.end(); ++it, ++i)
    499499    {
     
    699699     */
    700700    Log7Func(("{%p}: before remove_if: toBeCollected.size()=%d\n", this, toBeCollected.size()));
     701#if RT_CPLUSPLUS_PREREQ(201100) /* mem_fun is deprecated in C++11 and removed in C++17 */
     702    toBeCollected.remove_if(std::mem_fn(&pm::BaseMetric::isUnregistered));
     703#else
    701704    toBeCollected.remove_if(std::mem_fun(&pm::BaseMetric::isUnregistered));
     705#endif
    702706    Log7Func(("{%p}: after remove_if: toBeCollected.size()=%d\n", this, toBeCollected.size()));
    703707    Log7Func(("{%p}: before remove_if: m.baseMetrics.size()=%d\n", this, m.baseMetrics.size()));
     
    719723
    720724    /* Finally, collect the data */
    721     std::for_each(toBeCollected.begin(), toBeCollected.end(),
    722                   std::mem_fun(&pm::BaseMetric::collect));
     725#if RT_CPLUSPLUS_PREREQ(201100) /* mem_fun is deprecated in C++11 and removed in C++17 */
     726    std::for_each(toBeCollected.begin(), toBeCollected.end(), std::mem_fn(&pm::BaseMetric::collect));
     727#else
     728    std::for_each(toBeCollected.begin(), toBeCollected.end(), std::mem_fun(&pm::BaseMetric::collect));
     729#endif
    723730    Log4Func(("{%p}: LEAVE\n", this));
    724731}
     
    770777    m.count       = aMetric->getLength();
    771778    m.unit        = aMetric->getUnit();
    772     m.min         = aMetric->getMinValue();
    773     m.max         = aMetric->getMaxValue();
     779    /** @todo r=bird: LONG/ULONG mixup.   */
     780    m.min         = (LONG)aMetric->getMinValue();
     781    m.max         = (LONG)aMetric->getMaxValue();
    774782
    775783    autoInitSpan.setSucceeded();
     
    789797    m.count       = aMetric->getLength();
    790798    m.unit        = aMetric->getUnit();
    791     m.min         = aMetric->getMinValue();
    792     m.max         = aMetric->getMaxValue();
     799    /** @todo r=bird: LONG/ULONG mixup.   */
     800    m.min         = (LONG)aMetric->getMinValue();
     801    m.max         = (LONG)aMetric->getMaxValue();
    793802
    794803    autoInitSpan.setSucceeded();
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