VirtualBox

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


Ignore:
Timestamp:
Jul 11, 2020 11:58:17 PM (5 years ago)
Author:
vboxsync
Message:

Main/HostPowerDarwin.cpp: float/double constant mix. bugref:9790

File:
1 edited

Legend:

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

    r82968 r85259  
    201201                    powerSource = POWER_SOURCE_BATTERY;
    202202
     203
     204                /* Fetch the current capacity value of the power source */
    203205                int curCapacity = 0;
    204                 int maxCapacity = 1;
    205                 float remCapacity = 0.0f;
    206 
    207                 /* Fetch the current capacity value of the power source */
    208206                result = CFDictionaryGetValueIfPresent(pSource, CFSTR(kIOPSCurrentCapacityKey), &psValue);
    209207                if (result)
    210208                    CFNumberGetValue((CFNumberRef)psValue, kCFNumberSInt32Type, &curCapacity);
     209
    211210                /* Fetch the maximum capacity value of the power source */
     211                int maxCapacity = 1;
    212212                result = CFDictionaryGetValueIfPresent(pSource, CFSTR(kIOPSMaxCapacityKey), &psValue);
    213213                if (result)
     
    215215
    216216                /* Calculate the remaining capacity in percent */
    217                 remCapacity = ((float)curCapacity/(float)maxCapacity * 100.0);
     217                float remCapacity = ((float)curCapacity/(float)maxCapacity * 100.0f);
    218218
    219219                /* Check for critical. 5 percent is default. */
     
    222222                if (result)
    223223                    CFNumberGetValue((CFNumberRef)psValue, kCFNumberSInt32Type, &criticalValue);
    224                 critical = (remCapacity < criticalValue);
     224                critical = remCapacity < criticalValue;
     225
    225226                /* We have to take action only if we are on battery, the
    226227                 * previous state wasn't critical, the state has changed & the
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