diff src/power/macosx/SDL_syspower.c @ 3186:51750b7a966f

indent
author Sam Lantinga <slouken@libsdl.org>
date Wed, 10 Jun 2009 13:34:20 +0000
parents b7a48f533966
children f7b03b6838cb
line wrap: on
line diff
--- a/src/power/macosx/SDL_syspower.c	Wed Jun 10 08:09:04 2009 +0000
+++ b/src/power/macosx/SDL_syspower.c	Wed Jun 10 13:34:20 2009 +0000
@@ -37,10 +37,10 @@
 
 /* Note that AC power sources also include a laptop battery it is charging. */
 static void
-checkps(CFDictionaryRef dict, SDL_bool *have_ac, SDL_bool *have_battery,
-        SDL_bool *charging, int *seconds, int *percent)
+checkps(CFDictionaryRef dict, SDL_bool * have_ac, SDL_bool * have_battery,
+        SDL_bool * charging, int *seconds, int *percent)
 {
-    CFStringRef strval;  /* don't CFRelease() this. */
+    CFStringRef strval;         /* don't CFRelease() this. */
     CFBooleanRef bval;
     CFNumberRef numval;
     SDL_bool charge = SDL_FALSE;
@@ -51,7 +51,7 @@
     int pct = -1;
 
     if ((GETVAL(kIOPSIsPresentKey, &bval)) && (bval == kCFBooleanFalse)) {
-        return;  /* nothing to see here. */
+        return;                 /* nothing to see here. */
     }
 
     if (!GETVAL(kIOPSPowerSourceStateKey, &strval)) {
@@ -61,7 +61,7 @@
     if (STRMATCH(strval, CFSTR(kIOPSACPowerValue))) {
         is_ac = *have_ac = SDL_TRUE;
     } else if (!STRMATCH(strval, CFSTR(kIOPSBatteryPowerValue))) {
-        return;  /* not a battery? */
+        return;                 /* not a battery? */
     }
 
     if ((GETVAL(kIOPSIsChargingKey, &bval)) && (bval == kCFBooleanTrue)) {
@@ -92,12 +92,12 @@
 
         /* Mac OS X reports 0 minutes until empty if you're plugged in. :( */
         if ((val == 0) && (is_ac)) {
-            val = -1;  /* !!! FIXME: calc from timeToFull and capacity? */
+            val = -1;           /* !!! FIXME: calc from timeToFull and capacity? */
         }
 
         secs = (int) val;
         if (secs > 0) {
-            secs *= 60;  /* value is in minutes, so convert to seconds. */
+            secs *= 60;         /* value is in minutes, so convert to seconds. */
         }
     }
 
@@ -108,7 +108,7 @@
     }
 
     if ((pct > 0) && (maxpct > 0)) {
-    	pct = (int) ((((double)pct)/((double)maxpct)) * 100.0);
+        pct = (int) ((((double) pct) / ((double) maxpct)) * 100.0);
     }
 
     if (pct > 100) {
@@ -121,7 +121,7 @@
      */
     if ((secs < 0) && (*seconds < 0)) {
         if ((pct < 0) && (*percent < 0)) {
-            choose = SDL_TRUE; /* at least we know there's a battery. */
+            choose = SDL_TRUE;  /* at least we know there's a battery. */
         }
         if (pct > *percent) {
             choose = SDL_TRUE;
@@ -142,7 +142,7 @@
 
 
 SDL_bool
-SDL_GetPowerInfo_MacOSX(SDL_PowerState *state, int *seconds, int *percent)
+SDL_GetPowerInfo_MacOSX(SDL_PowerState * state, int *seconds, int *percent)
 {
     CFTypeRef blob = IOPSCopyPowerSourcesInfo();
 
@@ -161,7 +161,8 @@
             CFIndex i;
             for (i = 0; i < total; i++) {
                 CFTypeRef ps = (CFTypeRef) CFArrayGetValueAtIndex(list, i);
-                CFDictionaryRef dict = IOPSGetPowerSourceDescription(blob, ps);
+                CFDictionaryRef dict =
+                    IOPSGetPowerSourceDescription(blob, ps);
                 if (dict != NULL) {
                     checkps(dict, &have_ac, &have_battery, &charging,
                             seconds, percent);
@@ -183,11 +184,10 @@
         CFRelease(blob);
     }
 
-    return SDL_TRUE;  /* always the definitive answer on Mac OS X. */
+    return SDL_TRUE;            /* always the definitive answer on Mac OS X. */
 }
 
 #endif /* SDL_POWER_MACOSX */
 #endif /* SDL_POWER_DISABLED */
 
 /* vi: set ts=4 sw=4 expandtab: */
-