From c84a122828d3f8be87be3af8a1f7b0a21cf8b456 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 3 Dec 2023 21:45:53 -0800 Subject: modules/spokes: uint setup->{thickness,iterations} Let's not handle negative values for these in the setup, even if it's all multiple choice options that don't include erroneous negatives. Technically you can feed in whatever using the ":" force prefix... --- src/modules/spokes/spokes.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/spokes/spokes.c b/src/modules/spokes/spokes.c index 0aa8eed..2b5fbe3 100644 --- a/src/modules/spokes/spokes.c +++ b/src/modules/spokes/spokes.c @@ -25,9 +25,9 @@ typedef struct spokes_context_t { typedef struct spokes_setup_t { til_setup_t til_setup; - int iterations; + unsigned iterations; float twist; - int thickness; + unsigned thickness; } spokes_setup_t; static void spokes_draw_line(til_fb_fragment_t *fragment, int x1, int y1, int x2, int y2, uint32_t color, int thickness) @@ -331,13 +331,13 @@ int spokes_setup(const til_settings_t *settings, til_setting_t **res_setting, co if (!setup) return -ENOMEM; - if (sscanf(iterations->value, "%i", &setup->iterations) != 1) + if (sscanf(iterations->value, "%u", &setup->iterations) != 1) return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, iterations, res_setting, -EINVAL); if (sscanf(twist->value, "%f", &setup->twist) != 1) return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, twist, res_setting, -EINVAL); - if (sscanf(thickness->value, "%i", &setup->thickness) != 1) + if (sscanf(thickness->value, "%u", &setup->thickness) != 1) return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, thickness, res_setting, -EINVAL); *res_setup = &setup->til_setup; -- cgit v1.2.3