summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-12-03 21:45:53 -0800
committerVito Caputo <vcaputo@pengaru.com>2023-12-03 21:45:53 -0800
commitc84a122828d3f8be87be3af8a1f7b0a21cf8b456 (patch)
treecf61d448483f7bca961a6518841dbd882c72c513 /src
parent5586fd914abec44a1fe9eab3d64d83572edf306e (diff)
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...
Diffstat (limited to 'src')
-rw-r--r--src/modules/spokes/spokes.c8
1 files 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;
© All Rights Reserved