summaryrefslogtreecommitdiff
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-06-20 19:33:03 +0000
committerThomas Martitz <kugel@rockbox.org>2011-06-20 19:33:03 +0000
commit1a86aab1a26b6efddd843cad8a68cb49c30e36ec (patch)
tree33c45e94f9cb3e920cab29eb27334e9593ec90d3 /apps/playlist.c
parent316f9a0238794d5219db5b60bf28f79aa77c8966 (diff)
downloadrockbox-1a86aab1a26b6efddd843cad8a68cb49c30e36ec.tar.gz
rockbox-1a86aab1a26b6efddd843cad8a68cb49c30e36ec.zip
Remove unused code path from playlist_create_ex().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30030 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index d17bf230a5..62f85eab40 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -2676,8 +2676,10 @@ void playlist_set_last_shuffled_start(void)
2676/* 2676/*
2677 * Create a new playlist If playlist is not NULL then we're loading a 2677 * Create a new playlist If playlist is not NULL then we're loading a
2678 * playlist off disk for viewing/editing. The index_buffer is used to store 2678 * playlist off disk for viewing/editing. The index_buffer is used to store
2679 * playlist indices (required for and only used if !current playlist). The 2679 * playlist indices (required for and only used if playlist != NULL). The
2680 * temp_buffer (if not NULL) is used as a scratchpad when loading indices. 2680 * temp_buffer is used as a scratchpad when loading indices.
2681 *
2682 * returns <0 on failure
2681 */ 2683 */
2682int playlist_create_ex(struct playlist_info* playlist, 2684int playlist_create_ex(struct playlist_info* playlist,
2683 const char* dir, const char* file, 2685 const char* dir, const char* file,
@@ -2688,6 +2690,8 @@ int playlist_create_ex(struct playlist_info* playlist,
2688 playlist = &current_playlist; 2690 playlist = &current_playlist;
2689 else 2691 else
2690 { 2692 {
2693 if (!index_buffer)
2694 return -1;
2691 /* Initialize playlist structure */ 2695 /* Initialize playlist structure */
2692 int r = rand() % 10; 2696 int r = rand() % 10;
2693 playlist->current = false; 2697 playlist->current = false;
@@ -2698,31 +2702,20 @@ int playlist_create_ex(struct playlist_info* playlist,
2698 playlist->fd = -1; 2702 playlist->fd = -1;
2699 playlist->control_fd = -1; 2703 playlist->control_fd = -1;
2700 2704
2701 if (index_buffer) 2705 int num_indices = index_buffer_size / sizeof(int);
2702 {
2703 int num_indices = index_buffer_size / sizeof(int);
2704 2706
2705#ifdef HAVE_DIRCACHE 2707#ifdef HAVE_DIRCACHE
2706 num_indices /= 2; 2708 num_indices /= 2;
2707#endif 2709#endif
2708 if (num_indices > global_settings.max_files_in_playlist) 2710 if (num_indices > global_settings.max_files_in_playlist)
2709 num_indices = global_settings.max_files_in_playlist; 2711 num_indices = global_settings.max_files_in_playlist;
2710 2712
2711 playlist->max_playlist_size = num_indices; 2713 playlist->max_playlist_size = num_indices;
2712 playlist->indices = index_buffer; 2714 playlist->indices = index_buffer;
2713#ifdef HAVE_DIRCACHE 2715#ifdef HAVE_DIRCACHE
2714 playlist->filenames = (const struct dircache_entry **) 2716 playlist->filenames = (const struct dircache_entry **)
2715 &playlist->indices[num_indices]; 2717 &playlist->indices[num_indices];
2716#endif 2718#endif
2717 }
2718 else
2719 {
2720 playlist->max_playlist_size = current_playlist.max_playlist_size;
2721 playlist->indices = current_playlist.indices;
2722#ifdef HAVE_DIRCACHE
2723 playlist->filenames = current_playlist.filenames;
2724#endif
2725 }
2726 2719
2727 playlist->buffer_size = 0; 2720 playlist->buffer_size = 0;
2728 playlist->buffer = NULL; 2721 playlist->buffer = NULL;