diff --git a/gfx/drivers/ctr_gfx.c b/gfx/drivers/ctr_gfx.c index 3af7029c91..cee6524b4e 100644 --- a/gfx/drivers/ctr_gfx.c +++ b/gfx/drivers/ctr_gfx.c @@ -275,7 +275,7 @@ static const char *ctr_texture_path(unsigned id) snprintf(texture_path, sizeof(texture_path), "%s.png", state_path); - return path_basename(texture_path); + return path_basename_nocompression(texture_path); } default: break; diff --git a/input/input_driver.c b/input/input_driver.c index a311b1858b..a6a5f23a9f 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -2950,7 +2950,7 @@ void input_config_set_device_config_path(unsigned port, const char *path) if (fill_pathname_parent_dir_name(parent_dir_name, path, sizeof(parent_dir_name))) fill_pathname_join(input_st->input_device_info[port].config_path, - parent_dir_name, path_basename(path), + parent_dir_name, path_basename_nocompression(path), sizeof(input_st->input_device_info[port].config_path)); } } @@ -3036,8 +3036,8 @@ const char *input_config_get_mouse_display_name(unsigned port) void input_config_set_mouse_display_name(unsigned port, const char *name) { + char name_ascii[NAME_MAX_LENGTH]; input_driver_state_t *input_st = &input_driver_st; - char name_ascii[256]; name_ascii[0] = '\0'; @@ -3081,7 +3081,7 @@ void config_read_keybinds_conf(void *data) for (j = 0; input_config_bind_map_get_valid(j); j++) { - char str[256]; + char str[NAME_MAX_LENGTH]; const struct input_bind_map *keybind = (const struct input_bind_map*)INPUT_CONFIG_BIND_MAP_GET(j); struct retro_keybind *bind = &input_config_binds[i][j]; diff --git a/menu/cbs/menu_cbs_start.c b/menu/cbs/menu_cbs_start.c index bdd5ca6053..de9d8e259e 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -635,7 +635,7 @@ static int action_start_core_lock( core_name = core_info->display_name; /* If not, use core file name */ else - core_name = path_basename(core_path); + core_name = path_basename_nocompression(core_path); /* Build error message */ strlcpy(msg, msg_hash_to_str(MSG_CORE_UNLOCK_FAILED), sizeof(msg)); @@ -696,7 +696,7 @@ static int action_start_core_set_standalone_exempt( core_name = core_info->display_name; /* If not, use core file name */ else - core_name = path_basename(core_path); + core_name = path_basename_nocompression(core_path); /* Build error message */ strlcpy(msg, diff --git a/runloop.c b/runloop.c index c2b7e2451b..797ec883c9 100644 --- a/runloop.c +++ b/runloop.c @@ -1097,7 +1097,7 @@ static bool validate_game_options( const char *core_name, char *s, size_t len, bool mkdir) { - const char *game_name = path_basename(path_get(RARCH_PATH_BASENAME)); + const char *game_name = path_basename_nocompression(path_get(RARCH_PATH_BASENAME)); return validate_per_core_options(s, len, mkdir, core_name, game_name); } @@ -4310,8 +4310,9 @@ static void *input_list_element_constructor(void) element->port = 0; element->device = 0; element->index = 0; - element->state = (int16_t*)calloc(256, sizeof(int16_t)); - element->state_size = 256; + element->state = (int16_t*)calloc(NAME_MAX_LENGTH, + sizeof(int16_t)); + element->state_size = NAME_MAX_LENGTH; return ptr; } @@ -6215,7 +6216,7 @@ void core_options_flush(void) /* Get options file name for display purposes */ if (!string_is_empty(path_core_options)) - core_options_file = path_basename(path_core_options); + core_options_file = path_basename_nocompression(path_core_options); if (string_is_empty(core_options_file)) core_options_file = msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UNKNOWN); diff --git a/tasks/task_audio_mixer.c b/tasks/task_audio_mixer.c index aa63fd58f8..3ff0da2179 100644 --- a/tasks/task_audio_mixer.c +++ b/tasks/task_audio_mixer.c @@ -117,7 +117,7 @@ static void task_audio_mixer_handle_upload_ogg(retro_task_t *task, params.buf = img->buf; params.bufsize = img->bufsize; params.cb = NULL; - params.basename = !string_is_empty(img->path) ? strdup(path_basename(img->path)) : NULL; + params.basename = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL; audio_driver_mixer_add_stream(¶ms); @@ -149,7 +149,7 @@ static void task_audio_mixer_handle_upload_ogg_and_play(retro_task_t *task, params.buf = img->buf; params.bufsize = img->bufsize; params.cb = NULL; - params.basename = !string_is_empty(img->path) ? strdup(path_basename(img->path)) : NULL; + params.basename = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL; audio_driver_mixer_add_stream(¶ms); @@ -181,7 +181,7 @@ static void task_audio_mixer_handle_upload_flac(retro_task_t *task, params.buf = img->buf; params.bufsize = img->bufsize; params.cb = NULL; - params.basename = !string_is_empty(img->path) ? strdup(path_basename(img->path)) : NULL; + params.basename = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL; audio_driver_mixer_add_stream(¶ms); @@ -213,7 +213,7 @@ static void task_audio_mixer_handle_upload_flac_and_play(retro_task_t *task, params.buf = img->buf; params.bufsize = img->bufsize; params.cb = NULL; - params.basename = !string_is_empty(img->path) ? strdup(path_basename(img->path)) : NULL; + params.basename = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL; audio_driver_mixer_add_stream(¶ms); @@ -245,7 +245,7 @@ static void task_audio_mixer_handle_upload_mp3(retro_task_t *task, params.buf = img->buf; params.bufsize = img->bufsize; params.cb = NULL; - params.basename = !string_is_empty(img->path) ? strdup(path_basename(img->path)) : NULL; + params.basename = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL; audio_driver_mixer_add_stream(¶ms); @@ -277,7 +277,7 @@ static void task_audio_mixer_handle_upload_mp3_and_play(retro_task_t *task, params.buf = img->buf; params.bufsize = img->bufsize; params.cb = NULL; - params.basename = !string_is_empty(img->path) ? strdup(path_basename(img->path)) : NULL; + params.basename = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL; audio_driver_mixer_add_stream(¶ms); @@ -309,7 +309,7 @@ static void task_audio_mixer_handle_upload_mod(retro_task_t *task, params.buf = img->buf; params.bufsize = img->bufsize; params.cb = NULL; - params.basename = !string_is_empty(img->path) ? strdup(path_basename(img->path)) : NULL; + params.basename = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL; audio_driver_mixer_add_stream(¶ms); @@ -341,7 +341,7 @@ static void task_audio_mixer_handle_upload_mod_and_play(retro_task_t *task, params.buf = img->buf; params.bufsize = img->bufsize; params.cb = NULL; - params.basename = !string_is_empty(img->path) ? strdup(path_basename(img->path)) : NULL; + params.basename = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL; audio_driver_mixer_add_stream(¶ms); @@ -374,7 +374,7 @@ static void task_audio_mixer_handle_upload_wav(retro_task_t *task, params.buf = img->buf; params.bufsize = img->bufsize; params.cb = NULL; - params.basename = !string_is_empty(img->path) ? strdup(path_basename(img->path)) : NULL; + params.basename = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL; audio_driver_mixer_add_stream(¶ms); @@ -406,7 +406,7 @@ static void task_audio_mixer_handle_upload_wav_and_play(retro_task_t *task, params.buf = img->buf; params.bufsize = img->bufsize; params.cb = NULL; - params.basename = !string_is_empty(img->path) ? strdup(path_basename(img->path)) : NULL; + params.basename = !string_is_empty(img->path) ? strdup(path_basename_nocompression(img->path)) : NULL; audio_driver_mixer_add_stream(¶ms); diff --git a/tasks/task_database.c b/tasks/task_database.c index 23fe7fbc76..db4b9562bd 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -757,7 +757,7 @@ static int database_info_list_iterate_found_match( entry_path_str[0] = '\0'; fill_pathname(db_playlist_base_str, - path_basename(db_path), "", str_len); + path_basename_nocompression(db_path), "", str_len); path_remove_extension(db_playlist_base_str); strlcat(db_playlist_base_str, ".lpl", str_len); diff --git a/tasks/task_patch.c b/tasks/task_patch.c index e315b883c5..42d1d28fb4 100644 --- a/tasks/task_patch.c +++ b/tasks/task_patch.c @@ -637,7 +637,7 @@ static bool apply_patch_content(uint8_t **buf, /* Show an OSD message */ if (show_notification) { - const char *patch_filename = path_basename(patch_path); + const char *patch_filename = path_basename_nocompression(patch_path); char msg[256]; msg[0] = '\0'; diff --git a/tasks/task_screenshot.c b/tasks/task_screenshot.c index ad49659218..9dc3ddfed3 100644 --- a/tasks/task_screenshot.c +++ b/tasks/task_screenshot.c @@ -301,14 +301,14 @@ static bool screenshot_dump( screenshot_name = system_info.library_name; } else - screenshot_name = path_basename(name_base); + screenshot_name = path_basename_nocompression(name_base); fill_str_dated_filename(state->shotname, screenshot_name, IMG_EXT, sizeof(state->shotname)); } else { - strlcpy(state->shotname, path_basename(name_base), + strlcpy(state->shotname, path_basename_nocompression(name_base), sizeof(state->shotname)); strlcat(state->shotname, ".png", sizeof(state->shotname)); }