summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
1977 handle = core_alloc_ex("playlist buf", 1977 handle = core_alloc_ex("playlist buf",
1978 playlist->buffer_size, &ops); 1978 playlist->buffer_size, &ops);
1979 playlist->buffer = core_get_data(handle); 1979 playlist->buffer = core_get_data(handle);
1980 playlist->buffer_handle = handle;
1980 playlist->control_mutex = &current_playlist_mutex; 1981 playlist->control_mutex = &current_playlist_mutex;
1981 1982
1982 empty_playlist(playlist, true); 1983 empty_playlist(playlist, true);
@@ -3392,9 +3393,6 @@ int playlist_save(struct playlist_info* playlist, char *filename)
3392 char tmp_buf[MAX_PATH+1]; 3393 char tmp_buf[MAX_PATH+1];
3393 int result = 0; 3394 int result = 0;
3394 bool overwrite_current = false; 3395 bool overwrite_current = false;
3395 int old_handle = -1;
3396 char* old_buffer = NULL;
3397 size_t old_buffer_size = 0;
3398 3396
3399 if (!playlist) 3397 if (!playlist)
3400 playlist = &current_playlist; 3398 playlist = &current_playlist;
@@ -3407,6 +3405,10 @@ int playlist_save(struct playlist_info* playlist, char *filename)
3407 strlen(filename)+1, getcwd(NULL, -1)) < 0) 3405 strlen(filename)+1, getcwd(NULL, -1)) < 0)
3408 return -1; 3406 return -1;
3409 3407
3408 /* can ignore volatile here, because core_get_data() is called later */
3409 char* old_buffer = (char*)playlist->buffer;
3410 size_t old_buffer_size = playlist->buffer_size;
3411
3410 if (!strncmp(playlist->filename, path, strlen(path))) 3412 if (!strncmp(playlist->filename, path, strlen(path)))
3411 { 3413 {
3412 /* Attempting to overwrite current playlist file.*/ 3414 /* Attempting to overwrite current playlist file.*/
@@ -3415,10 +3417,6 @@ int playlist_save(struct playlist_info* playlist, char *filename)
3415 { 3417 {
3416 /* not enough buffer space to store updated indices */ 3418 /* not enough buffer space to store updated indices */
3417 /* Try to get a buffer */ 3419 /* Try to get a buffer */
3418 old_handle = playlist->buffer_handle;
3419 /* can ignore volatile here, because core_get_data() is called later */
3420 old_buffer = (char*)playlist->buffer;
3421 old_buffer_size = playlist->buffer_size;
3422 playlist->buffer = plugin_get_buffer((size_t*)&playlist->buffer_size); 3420 playlist->buffer = plugin_get_buffer((size_t*)&playlist->buffer_size);
3423 if (playlist->buffer_size < (int)(playlist->amount * sizeof(int))) 3421 if (playlist->buffer_size < (int)(playlist->amount * sizeof(int)))
3424 { 3422 {
@@ -3548,8 +3546,8 @@ int playlist_save(struct playlist_info* playlist, char *filename)
3548 cpu_boost(false); 3546 cpu_boost(false);
3549 3547
3550reset_old_buffer: 3548reset_old_buffer:
3551 if (old_handle > 0) 3549 if (playlist->buffer_handle > 0)
3552 old_buffer = core_get_data(old_handle); 3550 old_buffer = core_get_data(playlist->buffer_handle);
3553 playlist->buffer = old_buffer; 3551 playlist->buffer = old_buffer;
3554 playlist->buffer_size = old_buffer_size; 3552 playlist->buffer_size = old_buffer_size;
3555 3553