Skip to content

Commit 40a0ced

Browse files
committed
Be consistent with frontend_driver_get_core_extension - core extension
var should at most be 16 chars big, make only one exception once
1 parent 1765d49 commit 40a0ced

File tree

7 files changed

+65
-88
lines changed

7 files changed

+65
-88
lines changed

audio/audio_driver.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static bool audio_driver_free_devices_list(void)
224224
{
225225
audio_driver_state_t *audio_st = &audio_driver_st;
226226
if (
227-
!audio_st->current_audio
227+
!audio_st->current_audio
228228
|| !audio_st->current_audio->device_list_free
229229
|| !audio_st->context_audio_data)
230230
return false;
@@ -274,7 +274,7 @@ static void audio_driver_deinit_resampler(void)
274274
static bool audio_driver_deinit_internal(bool audio_enable)
275275
{
276276
audio_driver_state_t *audio_st = &audio_driver_st;
277-
if ( audio_st->current_audio
277+
if ( audio_st->current_audio
278278
&& audio_st->current_audio->free)
279279
{
280280
if (audio_st->context_audio_data)
@@ -412,7 +412,7 @@ static void audio_driver_flush(
412412
struct resampler_data src_data;
413413
float audio_volume_gain = (audio_st->mute_enable ||
414414
(audio_fastforward_mute && is_fastforward))
415-
? 0.0f
415+
? 0.0f
416416
: audio_st->volume_gain;
417417

418418
src_data.data_out = NULL;
@@ -462,7 +462,7 @@ static void audio_driver_flush(
462462
{
463463
/* Readjust the audio input rate. */
464464
int half_size = (int)(audio_st->buffer_size / 2);
465-
465+
466466
int avail =
467467
(int)audio_st->current_audio->write_avail(
468468
audio_st->context_audio_data);
@@ -526,7 +526,7 @@ static void audio_driver_flush(
526526

527527
audio_st->last_flush_time = flush_time;
528528
}
529-
529+
530530
audio_st->resampler->process(
531531
audio_st->resampler_data, &src_data);
532532

@@ -542,7 +542,7 @@ static void audio_driver_flush(
542542
if (audio_st->mixer_volume_gain == 1.0f)
543543
override = false;
544544
mixer_gain = audio_st->mixer_volume_gain;
545-
545+
546546
}
547547
audio_mixer_mix(audio_st->output_samples_buf,
548548
src_data.output_frames, mixer_gain, override);
@@ -710,7 +710,7 @@ bool audio_driver_init_internal(
710710
audio_driver_st.context_audio_data))
711711
audio_driver_st.flags |= AUDIO_FLAG_USE_FLOAT;
712712

713-
if ( !audio_sync
713+
if ( !audio_sync
714714
&& (audio_driver_st.flags & AUDIO_FLAG_ACTIVE))
715715
{
716716
if ( (audio_driver_st.flags & AUDIO_FLAG_ACTIVE)
@@ -948,9 +948,8 @@ bool audio_driver_dsp_filter_init(const char *device)
948948
retro_dsp_filter_t *audio_driver_dsp = NULL;
949949
struct string_list *plugs = NULL;
950950
#if defined(HAVE_DYLIB) && !defined(HAVE_FILTERS_BUILTIN)
951-
char ext_name[32];
951+
char ext_name[16];
952952
char basedir[256];
953-
ext_name[0] = '\0';
954953
fill_pathname_basedir(basedir, device, sizeof(basedir));
955954
if (!frontend_driver_get_core_extension(ext_name, sizeof(ext_name)))
956955
return false;
@@ -1242,7 +1241,7 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
12421241
* so have to do it here */
12431242
free(buf);
12441243
buf = NULL;
1245-
break;
1244+
break;
12461245
case AUDIO_MIXER_TYPE_OGG:
12471246
handle = audio_mixer_load_ogg(buf, (int32_t)params->bufsize);
12481247
break;
@@ -1627,12 +1626,12 @@ bool audio_driver_callback(void)
16271626
#ifdef HAVE_MENU
16281627
#ifdef HAVE_NETWORKING
16291628
bool core_paused = runloop_paused ||
1630-
( settings->bools.menu_pause_libretro
1629+
( settings->bools.menu_pause_libretro
16311630
&& (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE)
16321631
&& netplay_driver_ctl(RARCH_NETPLAY_CTL_ALLOW_PAUSE, NULL));
16331632
#else
16341633
bool core_paused = runloop_paused ||
1635-
(settings->bools.menu_pause_libretro
1634+
(settings->bools.menu_pause_libretro
16361635
&& (menu_state_get_ptr()->flags & MENU_ST_FLAG_ALIVE));
16371636
#endif
16381637
#else
@@ -1667,7 +1666,7 @@ bool audio_driver_start(bool is_shutdown)
16671666
{
16681667
audio_driver_state_t *audio_st = &audio_driver_st;
16691668
if (
1670-
!audio_st->current_audio
1669+
!audio_st->current_audio
16711670
|| !audio_st->current_audio->start
16721671
|| !audio_st->context_audio_data)
16731672
goto error;

core_backup.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static bool core_backup_get_backup_dir(
8686
* core directory as a base */
8787
fill_pathname_join_special(tmp,
8888
string_is_empty(dir_core_assets)
89-
? dir_libretro
89+
? dir_libretro
9090
: dir_core_assets,
9191
"core_backups", sizeof(tmp));
9292

@@ -174,11 +174,9 @@ bool core_backup_get_backup_path(
174174
/* Returns detected type of specified core backup file */
175175
enum core_backup_type core_backup_get_backup_type(const char *backup_path)
176176
{
177+
char core_ext[16];
177178
const char *backup_ext = NULL;
178179
struct string_list *metadata_list = NULL;
179-
char core_ext[255];
180-
181-
core_ext[0] = '\0';
182180

183181
if (string_is_empty(backup_path) || !path_is_valid(backup_path))
184182
goto error;
@@ -224,7 +222,7 @@ enum core_backup_type core_backup_get_backup_type(const char *backup_path)
224222

225223
string_list_free(metadata_list);
226224
metadata_list = NULL;
227-
225+
228226
return CORE_BACKUP_TYPE_ARCHIVE;
229227
}
230228

@@ -487,7 +485,7 @@ core_backup_list_t *core_backup_list_init(
487485
char core_dir[PATH_MAX_LENGTH];
488486
char backup_dir[PATH_MAX_LENGTH];
489487

490-
core_dir[0] = '\0';
488+
core_dir[0] = '\0';
491489
backup_dir[0] = '\0';
492490

493491
/* Get core filename and parent directory */

frontend/frontend_salamander.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,12 @@ static void salamander_init(char *s, size_t len)
164164

165165
if (!config_valid)
166166
{
167-
char executable_name[PATH_MAX_LENGTH];
168-
169-
executable_name[0] = '\0';
170-
167+
char core_ext[16];
171168
/* No config file - search filesystem for
172169
* first available core */
173170
frontend_driver_get_core_extension(
174-
executable_name, sizeof(executable_name));
175-
find_and_set_first_file(s, len, executable_name);
171+
core_ext, sizeof(core_ext));
172+
find_and_set_first_file(s, len, core_ext);
176173

177174
/* Save result to new config file */
178175
if (!string_is_empty(s))

menu/menu_displaylist.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ static int filebrowser_parse(
257257
filter_ext ? subsystem->roms[content_get_subsystem_rom_id()].valid_extensions : NULL,
258258
true, show_hidden_files, true, false);
259259
}
260-
else if ((type_default == FILE_TYPE_MANUAL_SCAN_DAT)
260+
else if ((type_default == FILE_TYPE_MANUAL_SCAN_DAT)
261261
|| (type_default == FILE_TYPE_SIDELOAD_CORE))
262262
ret = dir_list_initialize(&str_list, path,
263263
exts, true, show_hidden_files, false, false);
@@ -1574,9 +1574,7 @@ static unsigned menu_displaylist_parse_supported_cores(menu_displaylist_info_t *
15741574
* selection of this core
15751575
* 3) Hope that the user does not attempt to
15761576
* load unsupported content... */
1577-
char exts[32];
1578-
exts[0] = '\0';
1579-
1577+
char exts[16];
15801578
/* Attempt to identify 'broken' platforms by fetching
15811579
* the core file extension - if there is none, then
15821580
* it is impossible for RetroArch to populate a
@@ -1926,7 +1924,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
19261924
uint64_t memory_used = memory_total - frontend_driver_get_free_memory();
19271925
if (memory_used != 0 && memory_total != 0)
19281926
{
1929-
_len = strlcpy(entry,
1927+
_len = strlcpy(entry,
19301928
msg_hash_to_str(MSG_MEMORY), sizeof(entry));
19311929
snprintf(entry + _len, sizeof(entry) - _len, ": %" PRIu64 "/%" PRIu64 " MB",
19321930
BYTES_TO_MB(memory_used), BYTES_TO_MB(memory_total));
@@ -1989,7 +1987,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
19891987
{
19901988
gfx_ctx_ident_t ident_info;
19911989
video_context_driver_get_ident(&ident_info);
1992-
1990+
19931991
/* Video Context Driver */
19941992
snprintf(entry, sizeof(entry), "%s: %s",
19951993
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SYSTEM_INFO_VIDEO_CONTEXT_DRIVER),
@@ -2000,7 +1998,7 @@ static unsigned menu_displaylist_parse_system_info(file_list_t *list)
20001998
MENU_ENUM_LABEL_SYSTEM_INFO_ENTRY, MENU_SETTINGS_CORE_INFO_NONE,
20011999
0, 0, NULL))
20022000
count++;
2003-
2001+
20042002
{
20052003
gfx_ctx_metrics_t metrics;
20062004
float val = 0.0f;
@@ -6742,7 +6740,7 @@ unsigned menu_displaylist_build_list(
67426740
count++;
67436741

67446742
if ( string_is_equal(current_input->ident, "android")
6745-
|| (string_is_equal(current_input->ident, "cocoa")
6743+
|| (string_is_equal(current_input->ident, "cocoa")
67466744
&& string_is_equal(os_ver, "iOS")))
67476745
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
67486746
MENU_ENUM_LABEL_ENABLE_DEVICE_VIBRATION,
@@ -10380,8 +10378,8 @@ unsigned menu_displaylist_build_list(
1038010378
#ifdef _3DS
1038110379
u8 device_model = 0xFF;
1038210380
CFGU_GetSystemModel(&device_model);
10383-
if ( (device_model == 2)
10384-
|| (device_model == 4)
10381+
if ( (device_model == 2)
10382+
|| (device_model == 4)
1038510383
|| (device_model == 5))
1038610384
{
1038710385
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
@@ -12200,7 +12198,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
1220012198
char mixer_stream_str[128];
1220112199
unsigned id = info->type - MENU_SETTINGS_AUDIO_MIXER_STREAM_ACTIONS_BEGIN;
1220212200
size_t _len = strlcpy(mixer_stream_str, "mixer_stream_", sizeof(mixer_stream_str));
12203-
12201+
1220412202
lbl[0] = '\0';
1220512203

1220612204
snprintf(mixer_stream_str + _len, sizeof(mixer_stream_str) - _len, "%d", id);
@@ -13122,7 +13120,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
1312213120
MENU_ENUM_LABEL_NO_ENTRIES_TO_DISPLAY,
1312313121
FILE_TYPE_NONE, 0, 0, NULL);
1312413122

13125-
if ( (count != prev_count)
13123+
if ( (count != prev_count)
1312613124
|| (selection >= count))
1312713125
{
1312813126
info->flags |= MD_FLAG_NEED_REFRESH
@@ -14626,8 +14624,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
1462614624
break;
1462714625
case DISPLAYLIST_FILE_BROWSER_SELECT_SIDELOAD_CORE:
1462814626
{
14629-
char ext_names[NAME_MAX_LENGTH];
14630-
ext_names[0] = '\0';
14627+
char ext_names[32];
1463114628

1463214629
info->type_default = FILE_TYPE_SIDELOAD_CORE;
1463314630

@@ -14682,9 +14679,6 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type,
1468214679
menu_entries_clear(info->list);
1468314680
{
1468414681
char ext_name[16];
14685-
14686-
ext_name[0] = '\0';
14687-
1468814682
filebrowser_clear_type();
1468914683
info->type_default = FILE_TYPE_PLAIN;
1469014684
if (frontend_driver_get_core_extension(

0 commit comments

Comments
 (0)