diff options
author | Sam Lantinga <slouken@libsdl.org> | 2013-05-18 14:17:52 -0700 |
---|---|---|
committer | Sam Lantinga <slouken@libsdl.org> | 2013-05-18 14:17:52 -0700 |
commit | 0d9b661db8cc2714df2012ad26ea677879ebbd17 (patch) | |
tree | 8161d6fe30938bba2d1cdb4689221b6beac618e5 /src/power | |
parent | 3beb70c4bcbd2ea9ef4e69cbcfe75c6650fbea50 (diff) |
File style cleanup for the SDL 2.0 release
Diffstat (limited to 'src/power')
-rw-r--r-- | src/power/beos/SDL_syspower.c | 4 | ||||
-rw-r--r-- | src/power/linux/SDL_syspower.c | 4 | ||||
-rw-r--r-- | src/power/psp/SDL_syspower.c | 32 | ||||
-rw-r--r-- | src/power/uikit/SDL_syspower.m | 15 |
4 files changed, 28 insertions, 27 deletions
diff --git a/src/power/beos/SDL_syspower.c b/src/power/beos/SDL_syspower.c index 5c7b47cd2e..8f172cc0e8 100644 --- a/src/power/beos/SDL_syspower.c +++ b/src/power/beos/SDL_syspower.c @@ -50,8 +50,8 @@ SDL_GetPowerInfo_BeOS(SDL_PowerState * state, int *seconds, int *percent) uint8 battery_flags; uint8 battery_life; uint32 battery_time; - int rc; - + int rc; + if (fd == -1) { return SDL_FALSE; /* maybe some other method will work? */ } diff --git a/src/power/linux/SDL_syspower.c b/src/power/linux/SDL_syspower.c index a019e39922..d9616de257 100644 --- a/src/power/linux/SDL_syspower.c +++ b/src/power/linux/SDL_syspower.c @@ -64,7 +64,7 @@ load_acpi_file(const char *base, const char *node, const char *key, if (br < 0) { return SDL_FALSE; } - buf[br] = '\0'; // null-terminate the string. + buf[br] = '\0'; /* null-terminate the string. */ return SDL_TRUE; } @@ -342,7 +342,7 @@ SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState * state, return SDL_FALSE; } - buf[br] = '\0'; // null-terminate the string. + buf[br] = '\0'; /* null-terminate the string. */ if (!next_string(&ptr, &str)) { /* driver version */ return SDL_FALSE; } diff --git a/src/power/psp/SDL_syspower.c b/src/power/psp/SDL_syspower.c index 363c952d00..8c791bba4d 100644 --- a/src/power/psp/SDL_syspower.c +++ b/src/power/psp/SDL_syspower.c @@ -25,7 +25,7 @@ #if SDL_POWER_PSP #include "SDL_power.h" -#include <psppower.h> +#include <psppower.h> SDL_bool @@ -34,31 +34,31 @@ SDL_GetPowerInfo_PSP(SDL_PowerState * state, int *seconds, { int battery = scePowerIsBatteryExist(); int plugged = scePowerIsPowerOnline(); - int charging = scePowerIsBatteryCharging(); + int charging = scePowerIsBatteryCharging(); *state = SDL_POWERSTATE_UNKNOWN; - *seconds = -1; - *percent = -1; - - if (!battery) { - *state = SDL_POWERSTATE_NO_BATTERY; - *seconds = -1; - *percent = -1; + *seconds = -1; + *percent = -1; + + if (!battery) { + *state = SDL_POWERSTATE_NO_BATTERY; + *seconds = -1; + *percent = -1; } else if (charging) { *state = SDL_POWERSTATE_CHARGING; - *percent = scePowerGetBatteryLifePercent(); - *seconds = scePowerGetBatteryLifeTime()*60; + *percent = scePowerGetBatteryLifePercent(); + *seconds = scePowerGetBatteryLifeTime()*60; } else if (plugged) { *state = SDL_POWERSTATE_CHARGED; - *percent = scePowerGetBatteryLifePercent(); - *seconds = scePowerGetBatteryLifeTime()*60; + *percent = scePowerGetBatteryLifePercent(); + *seconds = scePowerGetBatteryLifeTime()*60; } else { *state = SDL_POWERSTATE_ON_BATTERY; - *percent = scePowerGetBatteryLifePercent(); - *seconds = scePowerGetBatteryLifeTime()*60; + *percent = scePowerGetBatteryLifePercent(); + *seconds = scePowerGetBatteryLifeTime()*60; } - + return SDL_TRUE; /* always the definitive answer on PSP. */ } diff --git a/src/power/uikit/SDL_syspower.m b/src/power/uikit/SDL_syspower.m index cb309fcb42..3364da56ee 100644 --- a/src/power/uikit/SDL_syspower.m +++ b/src/power/uikit/SDL_syspower.m @@ -30,7 +30,7 @@ #include "SDL_assert.h" #include "SDL_syspower.h" -// turn off the battery monitor if it's been more than X ms since last check. +/* turn off the battery monitor if it's been more than X ms since last check. */ static const int BATTERY_MONITORING_TIMEOUT = 3000; static Uint32 SDL_UIKitLastPowerInfoQuery = 0; @@ -41,7 +41,7 @@ SDL_UIKit_UpdateBatteryMonitoring(void) const Uint32 prev = SDL_UIKitLastPowerInfoQuery; const UInt32 now = SDL_GetTicks(); const UInt32 ticks = now - prev; - // if timer wrapped (now < prev), shut down, too. + /* if timer wrapped (now < prev), shut down, too. */ if ((now < prev) || (ticks >= BATTERY_MONITORING_TIMEOUT)) { UIDevice *uidev = [UIDevice currentDevice]; SDL_assert([uidev isBatteryMonitoringEnabled] == YES); @@ -61,13 +61,14 @@ SDL_GetPowerInfo_UIKit(SDL_PowerState * state, int *seconds, int *percent) [uidev setBatteryMonitoringEnabled:YES]; } - // UIKit_GL_SwapWindow() (etc) will check this and disable the battery - // monitoring if the app hasn't queried it in the last X seconds. - // Apparently monitoring the battery burns battery life. :) - // Apple's docs say not to monitor the battery unless you need it. + /* UIKit_GL_SwapWindow() (etc) will check this and disable the battery + * monitoring if the app hasn't queried it in the last X seconds. + * Apparently monitoring the battery burns battery life. :) + * Apple's docs say not to monitor the battery unless you need it. + */ SDL_UIKitLastPowerInfoQuery = SDL_GetTicks(); - *seconds = -1; // no API to estimate this in UIKit. + *seconds = -1; /* no API to estimate this in UIKit. */ switch ([uidev batteryState]) { |