summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2024-11-16 08:08:20 +0100
committerChristian Soffke <christian.soffke@gmail.com>2024-11-16 12:18:03 -0500
commit78bea2a7ac5e31a1a9b83173d48109f8d6015a19 (patch)
treed12d27120620382dfb7f208d38c87d2e760415c9
parent953fcef05e5868ca9f66351c6152a3c3c1274107 (diff)
downloadrockbox-78bea2a7ac.tar.gz
rockbox-78bea2a7ac.zip
playlist: Remove playlist_get_required_bufsz
Change-Id: I00cf26a2502f1b31cab8d896bf8eb1ae2626020a
-rw-r--r--apps/playlist.c20
-rw-r--r--apps/playlist.h2
-rw-r--r--apps/playlist_viewer.c10
3 files changed, 6 insertions, 26 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index f1edfe7323..fe22335210 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -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 = &current_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)
diff --git a/apps/playlist.h b/apps/playlist.h
index 2fb1ce100e..9b8c1da424 100644
--- a/apps/playlist.h
+++ b/apps/playlist.h
@@ -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);
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index d556f3b557..69fd4eac69 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -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);