summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-08-30 22:36:10 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-08-30 22:36:44 -0700
commit7e7db8eb8e8f73f04ca3acdfc2078a7122932fd2 (patch)
tree347c2dc5ae9a9bb62657e06da6f4b4fe90db006f /src
parent6151f36336cac11d804f7a40cf2b0f3d0565d643 (diff)
til/sdl_fb: handle baking errors in sdl_fb_setup()
More setup_func conversion to returning the failed setting on errors during res_setup baking.
Diffstat (limited to 'src')
-rw-r--r--src/sdl_fb.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/sdl_fb.c b/src/sdl_fb.c
index 69d50c4..4ccf0ed 100644
--- a/src/sdl_fb.c
+++ b/src/sdl_fb.c
@@ -279,11 +279,11 @@ static int sdl_fb_setup(const til_settings_t *settings, til_setting_t **res_sett
"on",
NULL
};
- const char *fullscreen;
- const char *size;
+ til_setting_t *fullscreen;
+ 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 = "SDL fullscreen mode",
.key = "fullscreen",
@@ -298,8 +298,8 @@ static int sdl_fb_setup(const til_settings_t *settings, til_setting_t **res_sett
if (r)
return r;
- if (!strcasecmp(fullscreen, "off")) {
- r = til_settings_get_and_describe_value(settings,
+ if (!strcasecmp(fullscreen->value, "off")) {
+ r = til_settings_get_and_describe_setting(settings,
&(til_setting_spec_t){
.name = "SDL window size",
.key = "size",
@@ -313,7 +313,7 @@ static int sdl_fb_setup(const til_settings_t *settings, til_setting_t **res_sett
res_desc);
if (r)
return r;
- } else if ((size = til_settings_get_value_by_key(settings, "size", res_setting)) && !(*res_setting)->desc) {
+ } else if ((size = til_settings_get_setting_by_key(settings, "size", res_setting)) && !size->desc) {
/* if fullscreen=on AND size=WxH is specified, we'll do a more legacy style SDL fullscreen
* where it tries to change the video mode. But if size is unspecified, it'll be a desktop
* style fullscreen where it just uses a fullscreen window in the existing video mode, and
@@ -346,11 +346,11 @@ static int sdl_fb_setup(const til_settings_t *settings, til_setting_t **res_sett
if (!setup)
return -ENOMEM;
- if (!strcasecmp(fullscreen, "on"))
+ if (!strcasecmp(fullscreen->value, "on"))
setup->fullscreen = 1;
- if (size)
- sscanf(size, "%u%*[xX]%u", &setup->width, &setup->height);
+ if (size && sscanf(size->value, "%u%*[xX]%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