summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-08-30 22:31:15 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-08-30 22:36:42 -0700
commit6151f36336cac11d804f7a40cf2b0f3d0565d643 (patch)
tree94f9a963b60a115b0441d8a44b0b8cab56c121da
parentf0e8f027b48127b44f33188508efdd13670b8be3 (diff)
til/mem_fb: handle baking errors in mem_fb_setup()
More setup_func conversion to returning the failed setting on errors during res_setup baking.
-rw-r--r--src/mem_fb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mem_fb.c b/src/mem_fb.c
index bd25265..94566d7 100644
--- a/src/mem_fb.c
+++ b/src/mem_fb.c
@@ -143,10 +143,10 @@ til_fb_ops_t mem_fb_ops = {
static int mem_fb_setup(const til_settings_t *settings, til_setting_t **res_setting, const til_setting_desc_t **res_desc, til_setup_t **res_setup)
{
- const char *size;
+ til_setting_t *size;
int r;
- r = til_settings_get_and_describe_value(settings,
+ r = til_settings_get_and_describe_setting(settings,
&(til_setting_spec_t){
.name = "Virtual window size",
.key = "size",
@@ -168,8 +168,8 @@ static int mem_fb_setup(const til_settings_t *settings, til_setting_t **res_sett
if (!setup)
return -ENOMEM;
- /* TODO FIXME: parse errors */
- sscanf(size, "%ux%u", &setup->width, &setup->height);
+ if (sscanf(size->value, "%ux%u", &setup->width, &setup->height) != 2)
+ return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, size, res_setting, -EINVAL);
*res_setup = &setup->til_setup;
}
© All Rights Reserved