summaryrefslogtreecommitdiffstats
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-06-20 20:12:42 +0000
committerThomas Martitz <kugel@rockbox.org>2011-06-20 20:12:42 +0000
commitaf7aaae478b5c7382ae5505abab233a97aa3e658 (patch)
tree566d2e728aefb9f0e6b19edfd3519bf2826339e3 /apps/playlist.c
parent0b9c57d33e59a26b1f341632b990aff0dffd0fcb (diff)
downloadrockbox-af7aaae478b5c7382ae5505abab233a97aa3e658.tar.gz
rockbox-af7aaae478b5c7382ae5505abab233a97aa3e658.tar.bz2
rockbox-af7aaae478b5c7382ae5505abab233a97aa3e658.zip
Dircache: Don't expose struct dircache_entry and pointers into the cache, use IDs instead.
Only integer IDs are exposed from dircache with this. This way the cache is isolated from other modules. This is needed for my buflib gsoc project. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30038 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index dcf2fe1118..ea183d7552 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -575,7 +575,7 @@ static int add_indices_to_playlist(struct playlist_info* playlist,
playlist->indices[ playlist->amount ] = i+count;
#ifdef HAVE_DIRCACHE
if (playlist->filenames)
- playlist->filenames[ playlist->amount ] = NULL;
+ playlist->filenames[ playlist->amount ] = -1;
#endif
playlist->amount++;
}
@@ -816,7 +816,7 @@ static int add_track_to_playlist(struct playlist_info* playlist,
#ifdef HAVE_DIRCACHE
if (playlist->filenames)
- playlist->filenames[insert_position] = NULL;
+ playlist->filenames[insert_position] = -1;
#endif
playlist->amount++;
@@ -958,9 +958,9 @@ static int randomise_playlist(struct playlist_info* playlist,
#ifdef HAVE_DIRCACHE
if (playlist->filenames)
{
- store = (long)playlist->filenames[candidate];
+ store = playlist->filenames[candidate];
playlist->filenames[candidate] = playlist->filenames[count];
- playlist->filenames[count] = (struct dircache_entry *)store;
+ playlist->filenames[count] = store;
}
#endif
}
@@ -1298,7 +1298,7 @@ static void playlist_thread(void)
&& queue_empty(&playlist_queue); index++)
{
/* Process only pointers that are not already loaded. */
- if (playlist->filenames[index])
+ if (playlist->filenames[index] >= 0)
continue ;
control_file = playlist->indices[index] & PLAYLIST_INSERT_TYPE_MASK;
@@ -1310,7 +1310,7 @@ static void playlist_thread(void)
break ;
/* Set the dircache entry pointer. */
- playlist->filenames[index] = dircache_get_entry_ptr(tmp);
+ playlist->filenames[index] = dircache_get_entry_id(tmp);
/* And be on background so user doesn't notice any delays. */
yield();
@@ -1351,7 +1351,7 @@ static int get_filename(struct playlist_info* playlist, int index, int seek,
#ifdef HAVE_DIRCACHE
if (dircache_is_enabled() && playlist->filenames)
{
- if (playlist->filenames[index] != NULL)
+ if (playlist->filenames[index] >= 0)
{
max = dircache_copy_path(playlist->filenames[index],
tmp_buf, sizeof(tmp_buf)-1);
@@ -2389,7 +2389,7 @@ int playlist_add(const char *filename)
playlist->indices[playlist->amount] = playlist->buffer_end_pos;
#ifdef HAVE_DIRCACHE
- playlist->filenames[playlist->amount] = NULL;
+ playlist->filenames[playlist->amount] = -1;
#endif
playlist->amount++;
@@ -2713,8 +2713,7 @@ int playlist_create_ex(struct playlist_info* playlist,
playlist->max_playlist_size = num_indices;
playlist->indices = index_buffer;
#ifdef HAVE_DIRCACHE
- playlist->filenames = (const struct dircache_entry **)
- &playlist->indices[num_indices];
+ playlist->filenames = (int*)&playlist->indices[num_indices];
#endif
playlist->buffer_size = 0;