forked from len0rd/rockbox
playlist: Remove playlist_get_required_bufsz
Change-Id: I00cf26a2502f1b31cab8d896bf8eb1ae2626020a
This commit is contained in:
parent
953fcef05e
commit
78bea2a7ac
3 changed files with 6 additions and 26 deletions
|
@ -2030,8 +2030,7 @@ int playlist_create_ex(struct playlist_info* playlist,
|
|||
|
||||
if (index_buffer)
|
||||
{
|
||||
int num_indices = index_buffer_size /
|
||||
playlist_get_required_bufsz(playlist, false, 1);
|
||||
int num_indices = index_buffer_size / sizeof(*playlist->indices);
|
||||
|
||||
if (num_indices > global_settings.max_files_in_playlist)
|
||||
num_indices = global_settings.max_files_in_playlist;
|
||||
|
@ -2342,23 +2341,6 @@ char *playlist_get_name(const struct playlist_info* playlist, char *buf,
|
|||
return buf;
|
||||
}
|
||||
|
||||
/* return size of buffer needed for playlist to initialize num_indices entries */
|
||||
size_t playlist_get_required_bufsz(struct playlist_info* playlist,
|
||||
bool include_namebuf,
|
||||
int num_indices)
|
||||
{
|
||||
size_t namebuf = 0;
|
||||
|
||||
if (!playlist)
|
||||
playlist = ¤t_playlist;
|
||||
|
||||
size_t unit_size = sizeof (*playlist->indices);
|
||||
if (include_namebuf)
|
||||
namebuf = AVERAGE_FILENAME_LENGTH * global_settings.max_files_in_dir;
|
||||
|
||||
return (num_indices * unit_size) + namebuf;
|
||||
}
|
||||
|
||||
/* Get resume info for current playing song. If return value is -1 then
|
||||
settings shouldn't be saved. */
|
||||
int playlist_get_resume_info(int *resume_index)
|
||||
|
|
|
@ -180,8 +180,6 @@ char *playlist_name(const struct playlist_info* playlist, char *buf,
|
|||
int buf_size);
|
||||
char *playlist_get_name(const struct playlist_info* playlist, char *buf,
|
||||
int buf_size);
|
||||
size_t playlist_get_required_bufsz(struct playlist_info* playlist,
|
||||
bool include_namebuf, int num_indices);
|
||||
int playlist_get_track_info(struct playlist_info* playlist, int index,
|
||||
struct playlist_track_info* info);
|
||||
int playlist_save(struct playlist_info* playlist, char *filename);
|
||||
|
|
|
@ -424,8 +424,8 @@ static bool playlist_viewer_init(struct playlist_viewer * viewer,
|
|||
{
|
||||
/* Something is playing, try to accommodate
|
||||
* global_settings.max_files_in_playlist entries */
|
||||
index_buffer_size = playlist_get_required_bufsz(viewer->playlist,
|
||||
false, global_settings.max_files_in_playlist);
|
||||
index_buffer_size = (global_settings.max_files_in_playlist *
|
||||
sizeof(*viewer->playlist->indices));
|
||||
|
||||
if ((unsigned)index_buffer_size >= buffer_size - MAX_PATH)
|
||||
index_buffer_size = buffer_size - (MAX_PATH + 1);
|
||||
|
@ -551,12 +551,12 @@ static void format_line(struct playlist_entry* track, char* str,
|
|||
)
|
||||
track->attr |= PLAYLIST_ATTR_RETRIEVE_ID3_SUCCEEDED;
|
||||
}
|
||||
/* Yield to reduce as much as possible the perceived UI lag,
|
||||
/* Yield to reduce as much as possible the perceived UI lag,
|
||||
because retrieving id3 tags is an expensive operation */
|
||||
yield();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!(track->attr & PLAYLIST_ATTR_RETRIEVE_ID3_SUCCEEDED))
|
||||
{
|
||||
/* Simply use a formatted file name */
|
||||
|
@ -1316,7 +1316,7 @@ bool search_playlist(void)
|
|||
return ret;
|
||||
}
|
||||
backlight_on();
|
||||
struct playlist_search_data s_data = {.track = &track, .found_indicies = found_indicies};
|
||||
struct playlist_search_data s_data = {.track = &track, .found_indicies = found_indicies};
|
||||
gui_synclist_init(&playlist_lists, playlist_search_callback_name,
|
||||
&s_data, false, 1, NULL);
|
||||
gui_synclist_set_title(&playlist_lists, str(LANG_SEARCH_RESULTS), NOICON);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue