summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLandry Breuil <landry@openbsd.org>2022-08-09 19:01:46 +0200
committerBastien Nocera <hadess@hadess.net>2023-04-18 16:38:59 +0200
commit99d2659efca889f1ef8ab5b168e49f63de8edadb (patch)
tree499236fd5a5b263cfeff27215dc2e06a30da53b9
parent46cb137d56d75008bbcfca635c3d802aea0692a1 (diff)
downloadupower-99d2659efca889f1ef8ab5b168e49f63de8edadb.tar.gz
battery: Fix some warnings
building natively on OpenBSD with clang 13, i get those warnings: ../src/up-device-battery.c:128:53: warning: absolute value function 'abs' given an argument of type 'gint64' (aka 'long long') but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value] if (abs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - abs (td)) > abs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td)) ^ ../src/up-device-battery.c:128:53: note: use function 'llabs' instead if (abs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - abs (td)) > abs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td)) ^~~ llabs ../src/up-device-battery.c:128:65: warning: absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value] if (abs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - abs (td)) > abs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td)) ^ ../src/up-device-battery.c:128:65: note: use function 'llabs' instead if (abs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - abs (td)) > abs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td)) ^~~ llabs
-rw-r--r--src/up-device-battery.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/up-device-battery.c b/src/up-device-battery.c
index c814d9f..b2ed74f 100644
--- a/src/up-device-battery.c
+++ b/src/up-device-battery.c
@@ -125,7 +125,7 @@ up_device_battery_estimate_power (UpDeviceBattery *self, UpBatteryValues *cur)
continue;
/* Stop searching if the new reference is further away from the long timeout. */
- if (abs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - abs (td)) > abs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td))
+ if (ABS(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - ABS (td)) > ABS(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td))
break;
ref_td = td;