Change config_get_path/array return back to bool (#17333)

This commit is contained in:
Eric Warmenhoven 2025-01-02 08:35:33 -05:00 committed by GitHub
parent 0dcf196ee3
commit 53d9452439
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 18 additions and 15 deletions

View File

@ -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'

View File

@ -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;

View File

@ -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);

View File

@ -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;
}
/**

View File

@ -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:

View File

@ -3168,7 +3168,7 @@ end:
/* 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';

View File

@ -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;