aboutsummaryrefslogtreecommitdiff
path: root/plugins/simtech/mm-broadband-modem-simtech.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-01-30 18:54:23 +0100
committerAleksander Morgado <aleksander@aleksander.es>2020-01-31 15:18:35 +0100
commitbbeabb495e1bd2df3d938b850fbce4e61a61d9fa (patch)
treec2074f172166da03b5a20a4044a1ac2759523b2c /plugins/simtech/mm-broadband-modem-simtech.c
parentb856f3625db670346a248967a53d6d0119e725b7 (diff)
helpers: new macro to CLAMP high threshold only
Useful when clamping a unsigned integer with low threshold set to 0, which would give us compiler warnings with -Wtype-limits when using CLAMP(), e.g.: via/mm-broadband-modem-via.c: In function ‘handle_evdo_quality_change’: /usr/include/glib-2.0/glib/gmacros.h:811:63: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] 811 | #define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) | ^ via/mm-broadband-modem-via.c:284:19: note: in expansion of macro ‘CLAMP’ 284 | quality = CLAMP (quality, 0, 100); | ^~~~~
Diffstat (limited to 'plugins/simtech/mm-broadband-modem-simtech.c')
-rw-r--r--plugins/simtech/mm-broadband-modem-simtech.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/simtech/mm-broadband-modem-simtech.c b/plugins/simtech/mm-broadband-modem-simtech.c
index 21781dc9..246ce682 100644
--- a/plugins/simtech/mm-broadband-modem-simtech.c
+++ b/plugins/simtech/mm-broadband-modem-simtech.c
@@ -116,7 +116,7 @@ simtech_signal_changed (MMPortSerialAt *port,
return;
if (quality != 99)
- quality = CLAMP (quality, 0, 31) * 100 / 31;
+ quality = MM_CLAMP_HIGH (quality, 31) * 100 / 31;
else
quality = 0;