summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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