summaryrefslogtreecommitdiffstats
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-07-17 13:30:48 +0000
committerThomas Martitz <kugel@rockbox.org>2011-07-17 13:30:48 +0000
commit5eb2f60afb38617633da4b7d6130e30960918a27 (patch)
treec8d9db8a9f2df50c55082cf18e52496d5360fa16 /apps/playlist.c
parent6f392693b8f1d00513c48dc6e797e174dafb2448 (diff)
downloadrockbox-5eb2f60afb38617633da4b7d6130e30960918a27.tar.gz
rockbox-5eb2f60afb38617633da4b7d6130e30960918a27.tar.bz2
rockbox-5eb2f60afb38617633da4b7d6130e30960918a27.zip
Revert r30030 "Remove unused code path from playlist_create_ex()."
It breaks playlist viewing when playback is stopped (the code path wasn't so unused). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30150 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index f645d662db..ae6ea900d2 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -2693,10 +2693,8 @@ void playlist_set_last_shuffled_start(void)
/*
* Create a new playlist If playlist is not NULL then we're loading a
* playlist off disk for viewing/editing. The index_buffer is used to store
- * playlist indices (required for and only used if playlist != NULL). The
- * temp_buffer is used as a scratchpad when loading indices.
- *
- * returns <0 on failure
+ * playlist indices (required for and only used if !current playlist). The
+ * temp_buffer (if not NULL) is used as a scratchpad when loading indices.
*/
int playlist_create_ex(struct playlist_info* playlist,
const char* dir, const char* file,
@@ -2707,8 +2705,6 @@ int playlist_create_ex(struct playlist_info* playlist,
playlist = &current_playlist;
else
{
- if (!index_buffer)
- return -1;
/* Initialize playlist structure */
int r = rand() % 10;
playlist->current = false;
@@ -2719,19 +2715,30 @@ int playlist_create_ex(struct playlist_info* playlist,
playlist->fd = -1;
playlist->control_fd = -1;
- int num_indices = index_buffer_size / sizeof(int);
+ if (index_buffer)
+ {
+ int num_indices = index_buffer_size / sizeof(int);
#ifdef HAVE_DIRCACHE
- num_indices /= 2;
+ num_indices /= 2;
#endif
- if (num_indices > global_settings.max_files_in_playlist)
- num_indices = global_settings.max_files_in_playlist;
+ if (num_indices > global_settings.max_files_in_playlist)
+ num_indices = global_settings.max_files_in_playlist;
- playlist->max_playlist_size = num_indices;
- playlist->indices = index_buffer;
+ playlist->max_playlist_size = num_indices;
+ playlist->indices = index_buffer;
#ifdef HAVE_DIRCACHE
playlist->filenames = (int*)&playlist->indices[num_indices];
#endif
+ }
+ else
+ {
+ playlist->max_playlist_size = current_playlist.max_playlist_size;
+ playlist->indices = current_playlist.indices;
+#ifdef HAVE_DIRCACHE
+ playlist->filenames = current_playlist.filenames;
+#endif
+ }
playlist->buffer_size = 0;
playlist->buffer = NULL;