summaryrefslogtreecommitdiffstats
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorBoris Gjenero <dreamlayers@rockbox.org>2011-12-31 16:47:58 +0000
committerBoris Gjenero <dreamlayers@rockbox.org>2011-12-31 16:47:58 +0000
commit9c720393b2e371d8ef3cad31f7e3cd14362ecb48 (patch)
tree126c4501c173c08b1de37789e7793603e0653b24 /apps/playlist.c
parent3a9aa8e51be9f5ec29d6f95795c16a876db966c5 (diff)
downloadrockbox-9c720393b2e371d8ef3cad31f7e3cd14362ecb48.tar.gz
rockbox-9c720393b2e371d8ef3cad31f7e3cd14362ecb48.tar.bz2
rockbox-9c720393b2e371d8ef3cad31f7e3cd14362ecb48.zip
Fix FS#12499 - Directory playback fails after saving playlist
This makes playlist_save() properly restore playlist buffer values, so the buffer can be used afterwards. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31481 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 117d657ed1..bf55671bf1 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -1977,6 +1977,7 @@ void playlist_init(void)
handle = core_alloc_ex("playlist buf",
playlist->buffer_size, &ops);
playlist->buffer = core_get_data(handle);
+ playlist->buffer_handle = handle;
playlist->control_mutex = &current_playlist_mutex;
empty_playlist(playlist, true);
@@ -3392,9 +3393,6 @@ int playlist_save(struct playlist_info* playlist, char *filename)
char tmp_buf[MAX_PATH+1];
int result = 0;
bool overwrite_current = false;
- int old_handle = -1;
- char* old_buffer = NULL;
- size_t old_buffer_size = 0;
if (!playlist)
playlist = &current_playlist;
@@ -3407,6 +3405,10 @@ int playlist_save(struct playlist_info* playlist, char *filename)
strlen(filename)+1, getcwd(NULL, -1)) < 0)
return -1;
+ /* can ignore volatile here, because core_get_data() is called later */
+ char* old_buffer = (char*)playlist->buffer;
+ size_t old_buffer_size = playlist->buffer_size;
+
if (!strncmp(playlist->filename, path, strlen(path)))
{
/* Attempting to overwrite current playlist file.*/
@@ -3415,10 +3417,6 @@ int playlist_save(struct playlist_info* playlist, char *filename)
{
/* not enough buffer space to store updated indices */
/* Try to get a buffer */
- old_handle = playlist->buffer_handle;
- /* can ignore volatile here, because core_get_data() is called later */
- old_buffer = (char*)playlist->buffer;
- old_buffer_size = playlist->buffer_size;
playlist->buffer = plugin_get_buffer((size_t*)&playlist->buffer_size);
if (playlist->buffer_size < (int)(playlist->amount * sizeof(int)))
{
@@ -3548,8 +3546,8 @@ int playlist_save(struct playlist_info* playlist, char *filename)
cpu_boost(false);
reset_old_buffer:
- if (old_handle > 0)
- old_buffer = core_get_data(old_handle);
+ if (playlist->buffer_handle > 0)
+ old_buffer = core_get_data(playlist->buffer_handle);
playlist->buffer = old_buffer;
playlist->buffer_size = old_buffer_size;