Be more careful with config_get_bool

This commit is contained in:
twinaphex 2016-05-24 22:48:15 +02:00
parent bfa6f49ae6
commit a82a8cad51
2 changed files with 24 additions and 11 deletions

View File

@ -1408,10 +1408,13 @@ static bool config_load_file(const char *path, bool set_defaults)
CONFIG_GET_BOOL_BASE(conf, settings, set_supports_no_game_enable, "core_set_supports_no_game_enable"); CONFIG_GET_BOOL_BASE(conf, settings, set_supports_no_game_enable, "core_set_supports_no_game_enable");
#ifdef RARCH_CONSOLE #ifdef RARCH_CONSOLE
{
bool tmp_bool = false;
/* TODO - will be refactored later to make it more clean - it's more /* TODO - will be refactored later to make it more clean - it's more
* important that it works for consoles right now */ * important that it works for consoles right now */
config_get_bool(conf, "custom_bgm_enable", if (config_get_bool(conf, "custom_bgm_enable", &tmp_bool))
&global->console.sound.system_bgm_enable); global->console.sound.system_bgm_enable = tmp_bool;
}
video_driver_load_settings(conf); video_driver_load_settings(conf);
#endif #endif
CONFIG_GET_INT_BASE(conf, settings, state_slot, "state_slot"); CONFIG_GET_INT_BASE(conf, settings, state_slot, "state_slot");
@ -1761,9 +1764,12 @@ static bool config_load_file(const char *path, bool set_defaults)
CONFIG_GET_BOOL_BASE(conf, settings, network_remote_enable, "network_remote_enable"); CONFIG_GET_BOOL_BASE(conf, settings, network_remote_enable, "network_remote_enable");
for (i = 0; i < MAX_USERS; i++) for (i = 0; i < MAX_USERS; i++)
{ {
bool tmp_bool = false;
char tmp[64] = {0}; char tmp[64] = {0};
snprintf(tmp, sizeof(tmp), "network_remote_enable_user_p%u", i + 1); snprintf(tmp, sizeof(tmp), "network_remote_enable_user_p%u", i + 1);
config_get_bool(conf, tmp, &settings->network_remote_enable_user[i]);
if (config_get_bool(conf, tmp, &tmp_bool))
settings->network_remote_enable_user[i] = tmp_bool;
} }
CONFIG_GET_INT_BASE(conf, settings, network_remote_base_port, "network_remote_base_port"); CONFIG_GET_INT_BASE(conf, settings, network_remote_base_port, "network_remote_base_port");

View File

@ -130,7 +130,7 @@ static bool video_shader_parse_pass(config_file_t *conf,
char scale_type_y[64] = {0}; char scale_type_y[64] = {0};
char frame_count_mod[64] = {0}; char frame_count_mod[64] = {0};
struct gfx_fbo_scale *scale = NULL; struct gfx_fbo_scale *scale = NULL;
bool smooth = false; bool tmp_bool = false;
float fattr = 0.0f; float fattr = 0.0f;
int iattr = 0; int iattr = 0;
@ -145,8 +145,12 @@ static bool video_shader_parse_pass(config_file_t *conf,
/* Smooth */ /* Smooth */
snprintf(filter_name_buf, sizeof(filter_name_buf), "filter_linear%u", i); snprintf(filter_name_buf, sizeof(filter_name_buf), "filter_linear%u", i);
if (config_get_bool(conf, filter_name_buf, &smooth))
if (config_get_bool(conf, filter_name_buf, &tmp_bool))
{
bool smooth = tmp_bool;
pass->filter = smooth ? RARCH_FILTER_LINEAR : RARCH_FILTER_NEAREST; pass->filter = smooth ? RARCH_FILTER_LINEAR : RARCH_FILTER_NEAREST;
}
else else
pass->filter = RARCH_FILTER_UNSPEC; pass->filter = RARCH_FILTER_UNSPEC;
@ -163,13 +167,16 @@ static bool video_shader_parse_pass(config_file_t *conf,
/* FBO types and mipmapping */ /* FBO types and mipmapping */
snprintf(srgb_output_buf, sizeof(srgb_output_buf), "srgb_framebuffer%u", i); snprintf(srgb_output_buf, sizeof(srgb_output_buf), "srgb_framebuffer%u", i);
config_get_bool(conf, srgb_output_buf, &pass->fbo.srgb_fbo); if (config_get_bool(conf, srgb_output_buf, &tmp_bool))
pass->fbo.srgb_fbo = tmp_bool;
snprintf(fp_fbo_buf, sizeof(fp_fbo_buf), "float_framebuffer%u", i); snprintf(fp_fbo_buf, sizeof(fp_fbo_buf), "float_framebuffer%u", i);
config_get_bool(conf, fp_fbo_buf, &pass->fbo.fp_fbo); if (config_get_bool(conf, fp_fbo_buf, &tmp_bool))
pass->fbo.fp_fbo = tmp_bool;
snprintf(mipmap_buf, sizeof(mipmap_buf), "mipmap_input%u", i); snprintf(mipmap_buf, sizeof(mipmap_buf), "mipmap_input%u", i);
config_get_bool(conf, mipmap_buf, &pass->mipmap); if (config_get_bool(conf, mipmap_buf, &tmp_bool))
pass->mipmap = tmp_bool;
snprintf(alias_buf, sizeof(alias_buf), "alias%u", i); snprintf(alias_buf, sizeof(alias_buf), "alias%u", i);
if (!config_get_array(conf, alias_buf, pass->alias, sizeof(pass->alias))) if (!config_get_array(conf, alias_buf, pass->alias, sizeof(pass->alias)))