diff --git a/configuration.c b/configuration.c index 6b202341b00..8098143c08b 100644 --- a/configuration.c +++ b/configuration.c @@ -6389,7 +6389,7 @@ void input_config_parse_mouse_button( fill_pathname_join_delim(key, s, "mbtn", '_', sizeof(key)); - if (config_get_array(conf, key, tmp, sizeof(tmp)) > 0) + if (config_get_array(conf, key, tmp, sizeof(tmp))) { bind->mbutton = NO_BTN; @@ -6460,7 +6460,7 @@ void input_config_parse_joy_axis( fill_pathname_join_delim(key_label, s, "axis_label", '_', sizeof(key_label)); - if (config_get_array(conf, key, tmp, sizeof(tmp)) > 0) + if (config_get_array(conf, key, tmp, sizeof(tmp))) { if ( tmp[0] == 'n' && tmp[1] == 'u' @@ -6551,7 +6551,7 @@ void input_config_parse_joy_button( fill_pathname_join_delim(key_label, s, "btn_label", '_', sizeof(key_label)); - if (config_get_array(conf, key, tmp, sizeof(tmp)) > 0) + if (config_get_array(conf, key, tmp, sizeof(tmp))) { btn = tmp; if ( btn[0] == 'n' diff --git a/gfx/video_filter.c b/gfx/video_filter.c index 0f260faed51..d367aab4a12 100644 --- a/gfx/video_filter.c +++ b/gfx/video_filter.c @@ -142,7 +142,7 @@ static bool create_softfilter_graph(rarch_softfilter_t *filt, name[0] = '\0'; strlcpy(key, "filter", sizeof(key)); - if (config_get_array(filt->conf, key, name, sizeof(name)) == 0) + if (!config_get_array(filt->conf, key, name, sizeof(name))) { RARCH_ERR("Could not find 'filter' array in config.\n"); return false; diff --git a/libretro-common/audio/dsp_filter.c b/libretro-common/audio/dsp_filter.c index df7bb779605..3dd27807ee9 100644 --- a/libretro-common/audio/dsp_filter.c +++ b/libretro-common/audio/dsp_filter.c @@ -112,7 +112,7 @@ static bool create_filter_graph(retro_dsp_filter_t *dsp, float sample_rate) snprintf(key, sizeof(key), "filter%u", i); - if (config_get_array(dsp->conf, key, name, sizeof(name)) == 0) + if (!config_get_array(dsp->conf, key, name, sizeof(name))) return false; dsp->instances[i].impl = find_implementation(dsp, name); diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 976a6de99cb..f2edb10408a 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -1167,16 +1167,16 @@ size_t config_get_config_path(config_file_t *conf, char *s, size_t len) return 0; } -size_t config_get_array(config_file_t *conf, const char *key, +bool config_get_array(config_file_t *conf, const char *key, char *buf, size_t size) { const struct config_entry_list *entry = config_get_entry(conf, key); if (entry) return strlcpy(buf, entry->value, size) < size; - return 0; + return false; } -size_t config_get_path(config_file_t *conf, const char *key, +bool config_get_path(config_file_t *conf, const char *key, char *buf, size_t size) { #if defined(RARCH_CONSOLE) || !defined(RARCH_INTERNAL) @@ -1184,9 +1184,12 @@ size_t config_get_path(config_file_t *conf, const char *key, #else const struct config_entry_list *entry = config_get_entry(conf, key); if (entry) - return fill_pathname_expand_special(buf, entry->value, size); + { + fill_pathname_expand_special(buf, entry->value, size); + return true; + } + return false; #endif - return 0; } /** diff --git a/libretro-common/include/file/config_file.h b/libretro-common/include/file/config_file.h index 22ffbc27e61..f3e16981989 100644 --- a/libretro-common/include/file/config_file.h +++ b/libretro-common/include/file/config_file.h @@ -263,7 +263,7 @@ bool config_get_char(config_file_t *conf, const char *entry, char *in); bool config_get_string(config_file_t *conf, const char *entry, char **in); /* Extracts a string to a preallocated buffer. Avoid memory allocation. */ -size_t config_get_array(config_file_t *conf, const char *entry, char *s, size_t len); +bool config_get_array(config_file_t *conf, const char *entry, char *s, size_t len); /** * config_get_config_path: @@ -278,7 +278,7 @@ size_t config_get_config_path(config_file_t *conf, char *s, size_t len); /* Extracts a string to a preallocated buffer. Avoid memory allocation. * Recognized magic like ~/. Similar to config_get_array() otherwise. */ -size_t config_get_path(config_file_t *conf, const char *entry, char *s, size_t len); +bool config_get_path(config_file_t *conf, const char *entry, char *s, size_t len); /** * config_get_bool: diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 5af1d3c3d00..2ca60b46d53 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -3168,7 +3168,7 @@ static void rgui_load_custom_theme( /* Load wallpaper, if required */ if (config_get_array(conf, wallpaper_key, - wallpaper_file, sizeof(wallpaper_file)) > 0) + wallpaper_file, sizeof(wallpaper_file))) { char wallpaper_path[PATH_MAX_LENGTH]; wallpaper_path[0] = '\0'; diff --git a/tasks/task_overlay.c b/tasks/task_overlay.c index 38fe1f97125..b369c1546e6 100644 --- a/tasks/task_overlay.c +++ b/tasks/task_overlay.c @@ -271,7 +271,7 @@ static bool task_overlay_load_desc( goto end; } - if (config_get_array(conf, overlay_desc_key, overlay, sizeof(overlay)) == 0) + if (!config_get_array(conf, overlay_desc_key, overlay, sizeof(overlay))) { RARCH_ERR("[Overlay]: Didn't find key: %s.\n", overlay_desc_key); ret = false; @@ -836,7 +836,7 @@ static void task_overlay_deferred_load(retro_task_t *task) overlay->w = overlay->h = 1.0f; if (config_get_array(conf, overlay->config.rect.key, - overlay->config.rect.array, sizeof(overlay->config.rect.array)) > 0) + overlay->config.rect.array, sizeof(overlay->config.rect.array))) { char *tok, *save; char *elem0 = NULL;