aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/directory.c2
-rw-r--r--src/playlist.c15
-rw-r--r--src/song.h4
3 files changed, 14 insertions, 7 deletions
diff --git a/src/directory.c b/src/directory.c
index ff07e6bd6..0666692ae 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -1229,7 +1229,7 @@ void initMp3Directory() {
Song * getSongDetails(char * file, char ** shortnameRet,
Directory ** directoryRet)
{
- void * song;
+ void * song = NULL;
Directory * directory;
char * dir = NULL;
char * dup = strdup(file);
diff --git a/src/playlist.c b/src/playlist.c
index ce7ac77df..60b40f4f9 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -138,6 +138,12 @@ void initPlaylist() {
}
void finishPlaylist() {
+ int i;
+ for(i=0;i<playlist.length;i++) {
+ if(playlist.songs[i]->type == SONG_TYPE_URL) {
+ /*freeJustSong(playlist.songs[i]);*/
+ }
+ }
free(playlist.songs);
playlist.songs = NULL;
free(playlist.order);
@@ -151,7 +157,7 @@ int clearPlaylist(FILE * fp) {
for(i=0;i<playlist.length;i++) {
if(playlist.songs[i]->type == SONG_TYPE_URL) {
- free(playlist.songs[i]);
+ /*freeJustSong(playlist.songs[i]);*/
}
playlist.songs[i] = NULL;
}
@@ -584,6 +590,10 @@ int deleteFromPlaylist(FILE * fp, int song) {
}
}
+ if(playlist.songs[song]->type == SONG_TYPE_URL) {
+ freeJustSong(playlist.songs[song]);
+ }
+
/* delete song from songs array */
for(i=song;i<playlist.length-1;i++) {
playlist.songs[i] = playlist.songs[i+1];
@@ -600,9 +610,6 @@ int deleteFromPlaylist(FILE * fp, int song) {
if(playlist.order[i]>song) playlist.order[i]--;
}
/* now take care of other misc stuff */
- if(playlist.songs[playlist.length-1]->type == SONG_TYPE_URL) {
- freeJustSong(playlist.songs[playlist.length-1]);
- }
playlist.songs[playlist.length-1] = NULL;
playlist.length--;
diff --git a/src/song.h b/src/song.h
index 48d1dcd7f..cc559c5b9 100644
--- a/src/song.h
+++ b/src/song.h
@@ -31,8 +31,8 @@
#include "list.h"
typedef enum {
- SONG_TYPE_FILE,
- SONG_TYPE_URL
+ SONG_TYPE_FILE = 1,
+ SONG_TYPE_URL = 2
} SONG_TYPE;
typedef struct _Song {