Skip to content

Commit 53d9452

Browse files
authored
Change config_get_path/array return back to bool (#17333)
1 parent 0dcf196 commit 53d9452

7 files changed

Lines changed: 18 additions & 15 deletions

File tree

configuration.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6389,7 +6389,7 @@ void input_config_parse_mouse_button(
63896389

63906390
fill_pathname_join_delim(key, s, "mbtn", '_', sizeof(key));
63916391

6392-
if (config_get_array(conf, key, tmp, sizeof(tmp)) > 0)
6392+
if (config_get_array(conf, key, tmp, sizeof(tmp)))
63936393
{
63946394
bind->mbutton = NO_BTN;
63956395

@@ -6460,7 +6460,7 @@ void input_config_parse_joy_axis(
64606460
fill_pathname_join_delim(key_label, s,
64616461
"axis_label", '_', sizeof(key_label));
64626462

6463-
if (config_get_array(conf, key, tmp, sizeof(tmp)) > 0)
6463+
if (config_get_array(conf, key, tmp, sizeof(tmp)))
64646464
{
64656465
if ( tmp[0] == 'n'
64666466
&& tmp[1] == 'u'
@@ -6551,7 +6551,7 @@ void input_config_parse_joy_button(
65516551
fill_pathname_join_delim(key_label, s,
65526552
"btn_label", '_', sizeof(key_label));
65536553

6554-
if (config_get_array(conf, key, tmp, sizeof(tmp)) > 0)
6554+
if (config_get_array(conf, key, tmp, sizeof(tmp)))
65556555
{
65566556
btn = tmp;
65576557
if ( btn[0] == 'n'

gfx/video_filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static bool create_softfilter_graph(rarch_softfilter_t *filt,
142142
name[0] = '\0';
143143
strlcpy(key, "filter", sizeof(key));
144144

145-
if (config_get_array(filt->conf, key, name, sizeof(name)) == 0)
145+
if (!config_get_array(filt->conf, key, name, sizeof(name)))
146146
{
147147
RARCH_ERR("Could not find 'filter' array in config.\n");
148148
return false;

libretro-common/audio/dsp_filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static bool create_filter_graph(retro_dsp_filter_t *dsp, float sample_rate)
112112

113113
snprintf(key, sizeof(key), "filter%u", i);
114114

115-
if (config_get_array(dsp->conf, key, name, sizeof(name)) == 0)
115+
if (!config_get_array(dsp->conf, key, name, sizeof(name)))
116116
return false;
117117

118118
dsp->instances[i].impl = find_implementation(dsp, name);

libretro-common/file/config_file.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,26 +1167,29 @@ size_t config_get_config_path(config_file_t *conf, char *s, size_t len)
11671167
return 0;
11681168
}
11691169

1170-
size_t config_get_array(config_file_t *conf, const char *key,
1170+
bool config_get_array(config_file_t *conf, const char *key,
11711171
char *buf, size_t size)
11721172
{
11731173
const struct config_entry_list *entry = config_get_entry(conf, key);
11741174
if (entry)
11751175
return strlcpy(buf, entry->value, size) < size;
1176-
return 0;
1176+
return false;
11771177
}
11781178

1179-
size_t config_get_path(config_file_t *conf, const char *key,
1179+
bool config_get_path(config_file_t *conf, const char *key,
11801180
char *buf, size_t size)
11811181
{
11821182
#if defined(RARCH_CONSOLE) || !defined(RARCH_INTERNAL)
11831183
return config_get_array(conf, key, buf, size);
11841184
#else
11851185
const struct config_entry_list *entry = config_get_entry(conf, key);
11861186
if (entry)
1187-
return fill_pathname_expand_special(buf, entry->value, size);
1187+
{
1188+
fill_pathname_expand_special(buf, entry->value, size);
1189+
return true;
1190+
}
1191+
return false;
11881192
#endif
1189-
return 0;
11901193
}
11911194

11921195
/**

libretro-common/include/file/config_file.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ bool config_get_char(config_file_t *conf, const char *entry, char *in);
263263
bool config_get_string(config_file_t *conf, const char *entry, char **in);
264264

265265
/* Extracts a string to a preallocated buffer. Avoid memory allocation. */
266-
size_t config_get_array(config_file_t *conf, const char *entry, char *s, size_t len);
266+
bool config_get_array(config_file_t *conf, const char *entry, char *s, size_t len);
267267

268268
/**
269269
* config_get_config_path:
@@ -278,7 +278,7 @@ size_t config_get_config_path(config_file_t *conf, char *s, size_t len);
278278

279279
/* Extracts a string to a preallocated buffer. Avoid memory allocation.
280280
* Recognized magic like ~/. Similar to config_get_array() otherwise. */
281-
size_t config_get_path(config_file_t *conf, const char *entry, char *s, size_t len);
281+
bool config_get_path(config_file_t *conf, const char *entry, char *s, size_t len);
282282

283283
/**
284284
* config_get_bool:

menu/drivers/rgui.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3168,7 +3168,7 @@ static void rgui_load_custom_theme(
31683168

31693169
/* Load wallpaper, if required */
31703170
if (config_get_array(conf, wallpaper_key,
3171-
wallpaper_file, sizeof(wallpaper_file)) > 0)
3171+
wallpaper_file, sizeof(wallpaper_file)))
31723172
{
31733173
char wallpaper_path[PATH_MAX_LENGTH];
31743174
wallpaper_path[0] = '\0';

tasks/task_overlay.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ static bool task_overlay_load_desc(
271271
goto end;
272272
}
273273

274-
if (config_get_array(conf, overlay_desc_key, overlay, sizeof(overlay)) == 0)
274+
if (!config_get_array(conf, overlay_desc_key, overlay, sizeof(overlay)))
275275
{
276276
RARCH_ERR("[Overlay]: Didn't find key: %s.\n", overlay_desc_key);
277277
ret = false;
@@ -836,7 +836,7 @@ static void task_overlay_deferred_load(retro_task_t *task)
836836
overlay->w = overlay->h = 1.0f;
837837

838838
if (config_get_array(conf, overlay->config.rect.key,
839-
overlay->config.rect.array, sizeof(overlay->config.rect.array)) > 0)
839+
overlay->config.rect.array, sizeof(overlay->config.rect.array)))
840840
{
841841
char *tok, *save;
842842
char *elem0 = NULL;

0 commit comments

Comments
 (0)