From: Keith Packard Date: Thu, 17 Feb 2022 05:44:52 +0000 (-0800) Subject: ao_lco_v2: Use int32_t for temporary box value in step_box X-Git-Tag: 1.9.10.4~6 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=2f06b7c66dfa05c51d8b2afbc1e3c94e20767e4f ao_lco_v2: Use int32_t for temporary box value in step_box Stepping to the next box will generate negative values and values beyond the highest box number. Use a type capable of holding all of those values, instead of int16_t. Signed-off-by: Keith Packard --- diff --git a/src/telelco-v2.0/ao_lco_v2.c b/src/telelco-v2.0/ao_lco_v2.c index a04ceb9f..f71f3d10 100644 --- a/src/telelco-v2.0/ao_lco_v2.c +++ b/src/telelco-v2.0/ao_lco_v2.c @@ -132,7 +132,7 @@ ao_lco_set_select(void) static void ao_lco_step_box(int8_t dir) { - int16_t new_box = ao_lco_box; + int32_t new_box = (int32_t) ao_lco_box; do { new_box += dir; @@ -142,8 +142,8 @@ ao_lco_step_box(int8_t dir) new_box = ao_lco_max_box; if (new_box == ao_lco_box) break; - } while (!ao_lco_box_present(new_box)); - ao_lco_set_box(new_box); + } while (!ao_lco_box_present((uint16_t) new_box)); + ao_lco_set_box((uint16_t) new_box); } static struct ao_task ao_lco_drag_task;