From 30bf8a4303bc5df3cb87b7e6555592dbf8d95cf1 Mon Sep 17 00:00:00 2001 From: Quantum Date: Thu, 28 Jul 2022 02:25:31 -0400 Subject: [PATCH] seat/pointer: fix uninitialized variable warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This results in the following warning, which in release mode causes an error due to -Werror: ../types/seat/wlr_seat_pointer.c: In function ‘wlr_seat_pointer_send_axis’: ../types/seat/wlr_seat_pointer.c:344:25: error: ‘low_res_value_discrete’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 343 | if (version < WL_POINTER_AXIS_VALUE120_SINCE_VERSION && | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 344 | value_discrete != 0 && low_res_value_discrete == 0) { | ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors --- types/seat/wlr_seat_pointer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/seat/wlr_seat_pointer.c b/types/seat/wlr_seat_pointer.c index 36ce42b3..2b49b79f 100644 --- a/types/seat/wlr_seat_pointer.c +++ b/types/seat/wlr_seat_pointer.c @@ -328,7 +328,7 @@ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time, } double low_res_value; - int32_t low_res_value_discrete; + int32_t low_res_value_discrete = 0; update_value120_accumulators(client, orientation, value, value_discrete, &low_res_value, &low_res_value_discrete);