summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/playlist.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 7cd264e821..2e28fc859d 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -542,7 +542,7 @@ static void update_playlist_filename(struct playlist_info* playlist,
542static int add_indices_to_playlist(struct playlist_info* playlist, 542static int add_indices_to_playlist(struct playlist_info* playlist,
543 char* buffer, size_t buflen) 543 char* buffer, size_t buflen)
544{ 544{
545 unsigned int nread; 545 ssize_t nread;
546 unsigned int i = 0; 546 unsigned int i = 0;
547 unsigned int count = 0; 547 unsigned int count = 0;
548 bool store_index; 548 bool store_index;
@@ -572,7 +572,7 @@ static int add_indices_to_playlist(struct playlist_info* playlist,
572 572
573 p = (unsigned char *)buffer; 573 p = (unsigned char *)buffer;
574 574
575 for(count=0; count < nread; count++,p++) { 575 for(count=0; count < (unsigned int)nread; count++,p++) {
576 576
577 /* Are we on a new line? */ 577 /* Are we on a new line? */
578 if((*p == '\n') || (*p == '\r')) 578 if((*p == '\n') || (*p == '\r'))
@@ -1493,8 +1493,8 @@ static int get_next_dir(char *dir, bool is_forward)
1493 if (fd >= 0) 1493 if (fd >= 0)
1494 { 1494 {
1495 int folder_count = 0; 1495 int folder_count = 0;
1496 read(fd,&folder_count,sizeof(int)); 1496 ssize_t nread = read(fd,&folder_count,sizeof(int));
1497 if (folder_count) 1497 if ((nread == sizeof(int)) && folder_count)
1498 { 1498 {
1499 char buffer[MAX_PATH]; 1499 char buffer[MAX_PATH];
1500 /* give up looking for a directory after we've had four 1500 /* give up looking for a directory after we've had four
@@ -2703,7 +2703,7 @@ int playlist_next(int steps)
2703 { 2703 {
2704 index = get_next_index(playlist, i, -1); 2704 index = get_next_index(playlist, i, -1);
2705 2705
2706 if (playlist->indices[index] & PLAYLIST_QUEUE_MASK) 2706 if (index >= 0 && playlist->indices[index] & PLAYLIST_QUEUE_MASK)
2707 { 2707 {
2708 remove_track_from_playlist(playlist, index, true); 2708 remove_track_from_playlist(playlist, index, true);
2709 steps--; /* one less track */ 2709 steps--; /* one less track */
@@ -3151,7 +3151,11 @@ int playlist_insert_playlist(struct playlist_info* playlist, const char *filenam
3151 { 3151 {
3152 if (playlist_remove_all_tracks(playlist) == 0) 3152 if (playlist_remove_all_tracks(playlist) == 0)
3153 position = PLAYLIST_INSERT_LAST; 3153 position = PLAYLIST_INSERT_LAST;
3154 else return -1; 3154 else
3155 {
3156 close(fd);
3157 return -1;
3158 }
3155 } 3159 }
3156 3160
3157 cpu_boost(true); 3161 cpu_boost(true);