From 7c5635cd6f38d7bded1e4674da4c803e590844a5 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 9 Oct 2024 14:02:44 +1000 Subject: [PATCH] Silence a compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../src/xf86libinput.c: In function ‘prop_draglock_set_pairs’: ../src/xf86libinput.c:5153:30: warning: comparison is always false due to limited range of data type [-Wtype-limits] 5153 | if (pairs[i] > MAX_BUTTONS) MAX_BUTTONS is defined by the server so let's use a temporary local variable to silence the compiler. Part-of: --- src/xf86libinput.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/xf86libinput.c b/src/xf86libinput.c index 9fe83cd..248d0c8 100644 --- a/src/xf86libinput.c +++ b/src/xf86libinput.c @@ -5132,6 +5132,7 @@ prop_draglock_set_pairs(struct xf86libinput *driver_data, int data[MAX_BUTTONS + 1] = {0}; int i; int highest = 0; + const unsigned int max = MAX_BUTTONS; if (len >= ARRAY_SIZE(data)) return BadMatch; @@ -5142,7 +5143,7 @@ prop_draglock_set_pairs(struct xf86libinput *driver_data, dl = (checkonly) ? &dummy : &driver_data->draglock; for (i = 0; i < len; i += 2) { - if (pairs[i] > MAX_BUTTONS) + if (pairs[i] > max) return BadValue; data[pairs[i]] = pairs[i+1];