summaryrefslogtreecommitdiffstats
path: root/openbsd
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-11-25 12:46:00 +0100
committerChristian Göttsche <cgzones@googlemail.com>2020-11-25 12:47:07 +0100
commit601ad61e7ddd5a79a0c650ff617b617470fafe07 (patch)
tree03734ee31c6dac9009cefe3286beaebbab43f7b6 /openbsd
parenta3221f367779288090715f4098d9a874cd113ad3 (diff)
Unify naming of first argument of Platform_getBattery
Use percent throughout
Diffstat (limited to 'openbsd')
-rw-r--r--openbsd/Platform.c8
-rw-r--r--openbsd/Platform.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/openbsd/Platform.c b/openbsd/Platform.c
index 550e2584..38fbab67 100644
--- a/openbsd/Platform.c
+++ b/openbsd/Platform.c
@@ -349,7 +349,7 @@ static bool findDevice(const char* name, int* mib, struct sensordev* snsrdev, si
}
}
-void Platform_getBattery(double* level, ACPresence* isOnAC) {
+void Platform_getBattery(double* percent, ACPresence* isOnAC) {
static int mib[] = {CTL_HW, HW_SENSORS, 0, 0, 0};
struct sensor s;
size_t slen = sizeof(struct sensor);
@@ -358,7 +358,7 @@ void Platform_getBattery(double* level, ACPresence* isOnAC) {
bool found = findDevice("acpibat0", mib, &snsrdev, &sdlen);
- *level = NAN;
+ *percent = NAN;
if (found) {
/* last full capacity */
mib[3] = 7;
@@ -372,9 +372,9 @@ void Platform_getBattery(double* level, ACPresence* isOnAC) {
mib[4] = 3;
if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1) {
double charge = s.value;
- *level = 100 * (charge / last_full_capacity);
+ *percent = 100 * (charge / last_full_capacity);
if (charge >= last_full_capacity) {
- *level = 100;
+ *percent = 100;
}
}
}
diff --git a/openbsd/Platform.h b/openbsd/Platform.h
index dd5c6529..07cde2f8 100644
--- a/openbsd/Platform.h
+++ b/openbsd/Platform.h
@@ -61,6 +61,6 @@ bool Platform_getNetworkIO(unsigned long int* bytesReceived,
unsigned long int* bytesTransmitted,
unsigned long int* packetsTransmitted);
-void Platform_getBattery(double* level, ACPresence* isOnAC);
+void Platform_getBattery(double* percent, ACPresence* isOnAC);
#endif

© 2014-2024 Faster IT GmbH | imprint | privacy policy