mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 00:39:53 +00:00
Clean up more string variables on heap - move to stack
This commit is contained in:
parent
0c5611d10e
commit
216190b826
@ -305,7 +305,8 @@ struct libretro_vfs_implementation_file
|
||||
libretro_vfs_implementation_file *retro_vfs_file_open_impl(
|
||||
const char *path, unsigned mode, unsigned hints)
|
||||
{
|
||||
char *dirpath, *filename;
|
||||
char dirpath[PATH_MAX_LENGTH];
|
||||
char filename[PATH_MAX_LENGTH];
|
||||
wchar_t *dirpath_wide;
|
||||
wchar_t *filename_wide;
|
||||
Platform::String^ filename_str;
|
||||
@ -322,20 +323,18 @@ libretro_vfs_implementation_file *retro_vfs_file_open_impl(
|
||||
if (PATH_CHAR_IS_SLASH(path[strlen(path) - 1]))
|
||||
return NULL;
|
||||
|
||||
dirpath = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
fill_pathname_basedir(dirpath, path, PATH_MAX_LENGTH);
|
||||
dirpath[0] = filename[0] = '\0';
|
||||
|
||||
fill_pathname_basedir(dirpath, path, sizeof(dirpath));
|
||||
dirpath_wide = utf8_to_utf16_string_alloc(dirpath);
|
||||
windowsize_path(dirpath_wide);
|
||||
dirpath_str = ref new Platform::String(dirpath_wide);
|
||||
free(dirpath_wide);
|
||||
free(dirpath);
|
||||
|
||||
filename = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
fill_pathname_base(filename, path, PATH_MAX_LENGTH);
|
||||
fill_pathname_base(filename, path, sizeof(filename));
|
||||
filename_wide = utf8_to_utf16_string_alloc(filename);
|
||||
filename_str = ref new Platform::String(filename_wide);
|
||||
free(filename_wide);
|
||||
free(filename);
|
||||
|
||||
retro_assert(!dirpath_str->IsEmpty() && !filename_str->IsEmpty());
|
||||
|
||||
|
@ -3250,23 +3250,18 @@ static unsigned menu_displaylist_parse_cores(
|
||||
#endif
|
||||
|
||||
{
|
||||
char *out_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
char out_dir[PATH_MAX_LENGTH];
|
||||
|
||||
out_dir[0] = '\0';
|
||||
|
||||
fill_pathname_parent_dir(out_dir, path,
|
||||
PATH_MAX_LENGTH * sizeof(char));
|
||||
fill_pathname_parent_dir(out_dir, path, sizeof(out_dir));
|
||||
|
||||
if (string_is_empty(out_dir))
|
||||
{
|
||||
menu_entries_prepend(info->list,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY),
|
||||
path,
|
||||
MENU_ENUM_LABEL_PARENT_DIRECTORY,
|
||||
FILE_TYPE_PARENT_DIRECTORY, 0, 0);
|
||||
}
|
||||
|
||||
free(out_dir);
|
||||
}
|
||||
|
||||
if (!str_list)
|
||||
@ -3388,20 +3383,16 @@ static unsigned menu_displaylist_parse_cores(
|
||||
|
||||
if (type == FILE_TYPE_CORE)
|
||||
{
|
||||
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
||||
char *core_path = (char*)malloc(path_size);
|
||||
char *display_name = (char*)malloc(path_size);
|
||||
char core_path[PATH_MAX_LENGTH];
|
||||
char display_name[PATH_MAX_LENGTH];
|
||||
core_path[0] =
|
||||
display_name[0] = '\0';
|
||||
|
||||
fill_pathname_join(core_path, dir, path, path_size);
|
||||
fill_pathname_join(core_path, dir, path, sizeof(core_path));
|
||||
|
||||
if (core_info_list_get_display_name(list,
|
||||
core_path, display_name, path_size))
|
||||
core_path, display_name, sizeof(display_name)))
|
||||
file_list_set_alt_at_offset(info->list, i, display_name);
|
||||
|
||||
free(core_path);
|
||||
free(display_name);
|
||||
}
|
||||
}
|
||||
info->need_sort = true;
|
||||
|
@ -230,31 +230,27 @@ finish:
|
||||
STRLEN_CONST(".index-dirs")
|
||||
))
|
||||
{
|
||||
char *parent_dir = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
char *parent_dir_encoded = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
char parent_dir[PATH_MAX_LENGTH];
|
||||
char parent_dir_encoded[PATH_MAX_LENGTH];
|
||||
file_transfer_t *transf = NULL;
|
||||
|
||||
parent_dir[0] = '\0';
|
||||
parent_dir_encoded[0] = '\0';
|
||||
|
||||
fill_pathname_parent_dir(parent_dir,
|
||||
state->path,
|
||||
PATH_MAX_LENGTH * sizeof(char));
|
||||
state->path, sizeof(parent_dir));
|
||||
strlcat(parent_dir,
|
||||
".index-dirs",
|
||||
PATH_MAX_LENGTH * sizeof(char));
|
||||
".index-dirs", sizeof(parent_dir));
|
||||
|
||||
transf = (file_transfer_t*)malloc(sizeof(*transf));
|
||||
|
||||
transf->enum_idx = MSG_UNKNOWN;
|
||||
strlcpy(transf->path, parent_dir, sizeof(transf->path));
|
||||
|
||||
net_http_urlencode_full(parent_dir_encoded, parent_dir, PATH_MAX_LENGTH * sizeof(char));
|
||||
net_http_urlencode_full(parent_dir_encoded, parent_dir,
|
||||
sizeof(parent_dir_encoded));
|
||||
task_push_http_transfer_file(parent_dir_encoded, true,
|
||||
"index_dirs", cb_net_generic_subdir, transf);
|
||||
|
||||
free(parent_dir);
|
||||
free(parent_dir_encoded);
|
||||
}
|
||||
|
||||
if (state)
|
||||
|
31
retroarch.c
31
retroarch.c
@ -6013,7 +6013,11 @@ bool menu_entries_append_enum(
|
||||
free(list_info.fullpath);
|
||||
|
||||
file_list_free_actiondata(list, idx);
|
||||
cbs = (menu_file_list_cbs_t*)malloc(sizeof(menu_file_list_cbs_t));
|
||||
cbs = (menu_file_list_cbs_t*)
|
||||
malloc(sizeof(menu_file_list_cbs_t));
|
||||
|
||||
if (!cbs)
|
||||
return false;
|
||||
|
||||
cbs->action_sublabel_cache[0] = '\0';
|
||||
cbs->action_title_cache[0] = '\0';
|
||||
@ -6098,7 +6102,8 @@ void menu_entries_prepend(file_list_t *list,
|
||||
free(list_info.fullpath);
|
||||
|
||||
file_list_free_actiondata(list, idx);
|
||||
cbs = (menu_file_list_cbs_t*)malloc(sizeof(menu_file_list_cbs_t));
|
||||
cbs = (menu_file_list_cbs_t*)
|
||||
malloc(sizeof(menu_file_list_cbs_t));
|
||||
|
||||
if (!cbs)
|
||||
return;
|
||||
@ -37051,23 +37056,18 @@ void retroarch_menu_running_finished(bool quit)
|
||||
**/
|
||||
static bool rarch_game_specific_options(char **output)
|
||||
{
|
||||
size_t game_path_size = PATH_MAX_LENGTH * sizeof(char);
|
||||
char *game_path = (char*)malloc(game_path_size);
|
||||
char game_path[PATH_MAX_LENGTH];
|
||||
|
||||
game_path[0] ='\0';
|
||||
|
||||
if (!retroarch_validate_game_options(game_path,
|
||||
game_path_size, false) || !path_is_valid(game_path))
|
||||
{
|
||||
free(game_path);
|
||||
sizeof(game_path), false) || !path_is_valid(game_path))
|
||||
return false;
|
||||
}
|
||||
|
||||
RARCH_LOG("%s %s\n",
|
||||
msg_hash_to_str(MSG_GAME_SPECIFIC_CORE_OPTIONS_FOUND_AT),
|
||||
game_path);
|
||||
*output = strdup(game_path);
|
||||
free(game_path);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -37642,8 +37642,7 @@ static bool retroarch_load_shader_preset_internal(
|
||||
const char *special_name)
|
||||
{
|
||||
unsigned i;
|
||||
char *shader_path = (char*)
|
||||
malloc(PATH_MAX_LENGTH);
|
||||
char shader_path[PATH_MAX_LENGTH];
|
||||
|
||||
static enum rarch_shader_type types[] =
|
||||
{
|
||||
@ -37663,16 +37662,17 @@ static bool retroarch_load_shader_preset_internal(
|
||||
shader_directory, core_name,
|
||||
special_name,
|
||||
video_shader_get_preset_extension(types[i]),
|
||||
PATH_MAX_LENGTH);
|
||||
sizeof(shader_path));
|
||||
else
|
||||
{
|
||||
if (string_is_empty(special_name))
|
||||
break;
|
||||
|
||||
fill_pathname_join(shader_path, shader_directory, special_name, PATH_MAX_LENGTH);
|
||||
fill_pathname_join(shader_path, shader_directory,
|
||||
special_name, sizeof(shader_path));
|
||||
strlcat(shader_path,
|
||||
video_shader_get_preset_extension(types[i]),
|
||||
PATH_MAX_LENGTH);
|
||||
sizeof(shader_path));
|
||||
}
|
||||
|
||||
if (!path_is_valid(shader_path))
|
||||
@ -37682,12 +37682,9 @@ static bool retroarch_load_shader_preset_internal(
|
||||
RARCH_LOG("[Shaders]: Specific shader preset found at %s.\n",
|
||||
shader_path);
|
||||
retroarch_set_runtime_shader_preset(p_rarch, shader_path);
|
||||
|
||||
free(shader_path);
|
||||
return true;
|
||||
}
|
||||
|
||||
free(shader_path);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -978,7 +978,7 @@ static bool content_file_load(
|
||||
}
|
||||
|
||||
fill_pathname_join(new_path, new_basedir,
|
||||
path_basename(path), new_path_size);
|
||||
path_basename(path), sizeof(new_path));
|
||||
|
||||
/* TODO: This may fail on very large files...
|
||||
* but copying large files is not a good idea anyway */
|
||||
|
@ -250,60 +250,48 @@ error:
|
||||
|
||||
static int task_database_cue_get_serial(const char *name, char* serial)
|
||||
{
|
||||
char *track_path = (char*)malloc(PATH_MAX_LENGTH
|
||||
* sizeof(char));
|
||||
int ret = 0;
|
||||
char track_path[PATH_MAX_LENGTH];
|
||||
uint64_t offset = 0;
|
||||
uint64_t size = 0;
|
||||
int rv = 0;
|
||||
|
||||
track_path[0] = '\0';
|
||||
|
||||
rv = cue_find_track(name, true, &offset, &size, track_path, PATH_MAX_LENGTH);
|
||||
rv = cue_find_track(name, true, &offset, &size, track_path, sizeof(track_path));
|
||||
|
||||
if (rv < 0)
|
||||
{
|
||||
RARCH_LOG("%s: %s\n",
|
||||
msg_hash_to_str(MSG_COULD_NOT_FIND_VALID_DATA_TRACK),
|
||||
strerror(-rv));
|
||||
free(track_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
RARCH_LOG("%s\n", msg_hash_to_str(MSG_READING_FIRST_DATA_TRACK));
|
||||
|
||||
ret = intfstream_file_get_serial(track_path, offset, size, serial);
|
||||
free(track_path);
|
||||
|
||||
return ret;
|
||||
return intfstream_file_get_serial(track_path, offset, size, serial);
|
||||
}
|
||||
|
||||
static int task_database_gdi_get_serial(const char *name, char* serial)
|
||||
{
|
||||
char *track_path = (char*)malloc(PATH_MAX_LENGTH
|
||||
* sizeof(char));
|
||||
int ret = 0;
|
||||
char track_path[PATH_MAX_LENGTH];
|
||||
int rv = 0;
|
||||
|
||||
track_path[0] = '\0';
|
||||
|
||||
rv = gdi_find_track(name, true, track_path, PATH_MAX_LENGTH);
|
||||
rv = gdi_find_track(name, true, track_path, sizeof(track_path));
|
||||
|
||||
if (rv < 0)
|
||||
{
|
||||
RARCH_LOG("%s: %s\n",
|
||||
msg_hash_to_str(MSG_COULD_NOT_FIND_VALID_DATA_TRACK),
|
||||
strerror(-rv));
|
||||
free(track_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
RARCH_LOG("%s\n", msg_hash_to_str(MSG_READING_FIRST_DATA_TRACK));
|
||||
|
||||
ret = intfstream_file_get_serial(track_path, 0, SIZE_MAX, serial);
|
||||
free(track_path);
|
||||
|
||||
return ret;
|
||||
return intfstream_file_get_serial(track_path, 0, SIZE_MAX, serial);
|
||||
}
|
||||
|
||||
static int task_database_chd_get_serial(const char *name, char* serial)
|
||||
@ -384,7 +372,7 @@ error:
|
||||
|
||||
static int task_database_cue_get_crc(const char *name, uint32_t *crc)
|
||||
{
|
||||
char *track_path = (char *)malloc(PATH_MAX_LENGTH);
|
||||
char track_path[PATH_MAX_LENGTH];
|
||||
uint64_t offset = 0;
|
||||
uint64_t size = 0;
|
||||
int rv = 0;
|
||||
@ -392,14 +380,13 @@ static int task_database_cue_get_crc(const char *name, uint32_t *crc)
|
||||
track_path[0] = '\0';
|
||||
|
||||
rv = cue_find_track(name, false, &offset, &size,
|
||||
track_path, PATH_MAX_LENGTH);
|
||||
track_path, sizeof(track_path));
|
||||
|
||||
if (rv < 0)
|
||||
{
|
||||
RARCH_LOG("%s: %s\n",
|
||||
msg_hash_to_str(MSG_COULD_NOT_FIND_VALID_DATA_TRACK),
|
||||
strerror(-rv));
|
||||
free(track_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -412,24 +399,22 @@ static int task_database_cue_get_crc(const char *name, uint32_t *crc)
|
||||
{
|
||||
RARCH_LOG("CUE '%s' crc: %x\n", name, *crc);
|
||||
}
|
||||
free(track_path);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int task_database_gdi_get_crc(const char *name, uint32_t *crc)
|
||||
{
|
||||
char *track_path = (char *)malloc(PATH_MAX_LENGTH);
|
||||
char track_path[PATH_MAX_LENGTH];
|
||||
int rv = 0;
|
||||
|
||||
track_path[0] = '\0';
|
||||
|
||||
rv = gdi_find_track(name, true, track_path, PATH_MAX_LENGTH);
|
||||
rv = gdi_find_track(name, true, track_path, sizeof(track_path));
|
||||
|
||||
if (rv < 0)
|
||||
{
|
||||
RARCH_LOG("%s: %s\n", msg_hash_to_str(MSG_COULD_NOT_FIND_VALID_DATA_TRACK),
|
||||
strerror(-rv));
|
||||
free(track_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -442,7 +427,6 @@ static int task_database_gdi_get_crc(const char *name, uint32_t *crc)
|
||||
{
|
||||
RARCH_LOG("GDI '%s' crc: %x\n", name, *crc);
|
||||
}
|
||||
free(track_path);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -474,14 +458,16 @@ static void task_database_cue_prune(database_info_handle_t *db,
|
||||
const char *name)
|
||||
{
|
||||
size_t i;
|
||||
char *path = (char *)malloc(PATH_MAX_LENGTH + 1);
|
||||
char path[PATH_MAX_LENGTH];
|
||||
intfstream_t *fd = intfstream_open_file(name,
|
||||
RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
||||
if (!fd)
|
||||
goto end;
|
||||
return;
|
||||
|
||||
while (cue_next_file(fd, name, path, PATH_MAX_LENGTH))
|
||||
path[0] = '\0';
|
||||
|
||||
while (cue_next_file(fd, name, path, sizeof(path)))
|
||||
{
|
||||
for (i = db->list_ptr; i < db->list->size; ++i)
|
||||
{
|
||||
@ -495,26 +481,23 @@ static void task_database_cue_prune(database_info_handle_t *db,
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
if (fd)
|
||||
{
|
||||
intfstream_close(fd);
|
||||
free(fd);
|
||||
}
|
||||
free(path);
|
||||
intfstream_close(fd);
|
||||
free(fd);
|
||||
}
|
||||
|
||||
static void gdi_prune(database_info_handle_t *db, const char *name)
|
||||
{
|
||||
size_t i;
|
||||
char *path = (char *)malloc(PATH_MAX_LENGTH + 1);
|
||||
char path[PATH_MAX_LENGTH];
|
||||
intfstream_t *fd = intfstream_open_file(name,
|
||||
RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
|
||||
if (!fd)
|
||||
goto end;
|
||||
return;
|
||||
|
||||
while (gdi_next_file(fd, name, path, PATH_MAX_LENGTH))
|
||||
path[0] = '\0';
|
||||
|
||||
while (gdi_next_file(fd, name, path, sizeof(path)))
|
||||
{
|
||||
for (i = db->list_ptr; i < db->list->size; ++i)
|
||||
{
|
||||
@ -528,9 +511,7 @@ static void gdi_prune(database_info_handle_t *db, const char *name)
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
free(fd);
|
||||
free(path);
|
||||
}
|
||||
|
||||
static enum msg_file_type extension_to_file_type(const char *ext)
|
||||
@ -665,14 +646,12 @@ static int database_info_list_iterate_end_no_match(
|
||||
|
||||
for (i = 0; i < archive_list->size; i++)
|
||||
{
|
||||
char *new_path = (char*)malloc(
|
||||
PATH_MAX_LENGTH * sizeof(char));
|
||||
size_t path_size = PATH_MAX_LENGTH * sizeof(char);
|
||||
char new_path[PATH_MAX_LENGTH];
|
||||
size_t path_len = strlen(path);
|
||||
|
||||
new_path[0] = '\0';
|
||||
|
||||
strlcpy(new_path, path, path_size);
|
||||
strlcpy(new_path, path, sizeof(new_path));
|
||||
|
||||
if (path_len + strlen(archive_list->elems[i].data)
|
||||
+ 1 < PATH_MAX_LENGTH)
|
||||
@ -680,13 +659,11 @@ static int database_info_list_iterate_end_no_match(
|
||||
new_path[path_len] = '#';
|
||||
strlcpy(new_path + path_len + 1,
|
||||
archive_list->elems[i].data,
|
||||
path_size - path_len);
|
||||
sizeof(new_path) - path_len);
|
||||
}
|
||||
|
||||
string_list_append(db->list, new_path,
|
||||
archive_list->elems[i].attr);
|
||||
|
||||
free(new_path);
|
||||
}
|
||||
|
||||
string_list_free(archive_list);
|
||||
@ -731,10 +708,11 @@ static int database_info_list_iterate_found_match(
|
||||
const char *archive_name
|
||||
)
|
||||
{
|
||||
char *db_crc = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
char *db_playlist_base_str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
char *db_playlist_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
char *entry_path_str = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
char db_crc[PATH_MAX_LENGTH];
|
||||
char db_playlist_base_str[PATH_MAX_LENGTH];
|
||||
char db_playlist_path[PATH_MAX_LENGTH];
|
||||
char entry_path_str[PATH_MAX_LENGTH];
|
||||
char *hash = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
const char *db_path =
|
||||
database_info_get_current_name(db_state);
|
||||
@ -742,7 +720,6 @@ static int database_info_list_iterate_found_match(
|
||||
database_info_get_current_element_name(db);
|
||||
database_info_t *db_info_entry =
|
||||
&db_state->info->list[db_state->entry_index];
|
||||
char *hash;
|
||||
|
||||
db_crc[0] = '\0';
|
||||
db_playlist_path[0] = '\0';
|
||||
@ -750,29 +727,25 @@ static int database_info_list_iterate_found_match(
|
||||
entry_path_str[0] = '\0';
|
||||
|
||||
fill_short_pathname_representation_noext(db_playlist_base_str,
|
||||
db_path, PATH_MAX_LENGTH * sizeof(char));
|
||||
db_path, sizeof(db_playlist_base_str));
|
||||
|
||||
strlcat(db_playlist_base_str,
|
||||
".lpl",
|
||||
PATH_MAX_LENGTH * sizeof(char));
|
||||
strlcat(db_playlist_base_str, ".lpl", sizeof(db_playlist_base_str));
|
||||
|
||||
if (!string_is_empty(_db->playlist_directory))
|
||||
fill_pathname_join(db_playlist_path, _db->playlist_directory,
|
||||
db_playlist_base_str, PATH_MAX_LENGTH * sizeof(char));
|
||||
db_playlist_base_str, sizeof(db_playlist_path));
|
||||
|
||||
playlist_config_set_path(&_db->playlist_config, db_playlist_path);
|
||||
playlist = playlist_init(&_db->playlist_config);
|
||||
|
||||
snprintf(db_crc, PATH_MAX_LENGTH * sizeof(char),
|
||||
"%08X|crc", db_info_entry->crc32);
|
||||
snprintf(db_crc, sizeof(db_crc), "%08X|crc", db_info_entry->crc32);
|
||||
|
||||
if (entry_path)
|
||||
strlcpy(entry_path_str, entry_path, PATH_MAX_LENGTH * sizeof(char));
|
||||
strlcpy(entry_path_str, entry_path, sizeof(entry_path_str));
|
||||
|
||||
if (!string_is_empty(archive_name))
|
||||
fill_pathname_join_delim(entry_path_str,
|
||||
entry_path_str, archive_name,
|
||||
'#', PATH_MAX_LENGTH * sizeof(char));
|
||||
entry_path_str, archive_name, '#', sizeof(entry_path_str));
|
||||
|
||||
if (core_info_database_match_archive_member(
|
||||
db_state->list->elems[db_state->list_index].data) &&
|
||||
@ -841,11 +814,6 @@ static int database_info_list_iterate_found_match(
|
||||
db_state->crc = 0;
|
||||
db_state->archive_crc = 0;
|
||||
|
||||
free(entry_path_str);
|
||||
free(db_playlist_path);
|
||||
free(db_playlist_base_str);
|
||||
free(db_crc);
|
||||
|
||||
/* Move database to start since we are likely to match against it
|
||||
again */
|
||||
if (db_state->list_index != 0)
|
||||
@ -979,7 +947,7 @@ static int task_database_iterate_playlist_lutro(
|
||||
database_info_handle_t *db,
|
||||
const char *path)
|
||||
{
|
||||
char *db_playlist_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
char db_playlist_path[PATH_MAX_LENGTH];
|
||||
playlist_t *playlist = NULL;
|
||||
|
||||
db_playlist_path[0] = '\0';
|
||||
@ -987,24 +955,20 @@ static int task_database_iterate_playlist_lutro(
|
||||
if (!string_is_empty(_db->playlist_directory))
|
||||
fill_pathname_join(db_playlist_path,
|
||||
_db->playlist_directory,
|
||||
"Lutro.lpl",
|
||||
PATH_MAX_LENGTH * sizeof(char));
|
||||
"Lutro.lpl", sizeof(db_playlist_path));
|
||||
|
||||
playlist_config_set_path(&_db->playlist_config, db_playlist_path);
|
||||
playlist = playlist_init(&_db->playlist_config);
|
||||
|
||||
free(db_playlist_path);
|
||||
|
||||
if (!playlist_entry_exists(playlist, path))
|
||||
{
|
||||
struct playlist_entry entry;
|
||||
char *game_title = (char*)
|
||||
malloc(PATH_MAX_LENGTH * sizeof(char));
|
||||
char game_title[PATH_MAX_LENGTH];
|
||||
|
||||
game_title[0] = '\0';
|
||||
|
||||
fill_short_pathname_representation_noext(game_title,
|
||||
path, PATH_MAX_LENGTH * sizeof(char));
|
||||
path, sizeof(game_title));
|
||||
|
||||
/* the push function reads our entry as const,
|
||||
* so these casts are safe */
|
||||
@ -1028,8 +992,6 @@ static int task_database_iterate_playlist_lutro(
|
||||
entry.last_played_second = 0;
|
||||
|
||||
playlist_push(playlist, &entry);
|
||||
|
||||
free(game_title);
|
||||
}
|
||||
|
||||
playlist_write_file(playlist);
|
||||
|
Loading…
x
Reference in New Issue
Block a user