From 6dd728cdea3e506c5b404bc3c2dc7d8e4aaadb42 Mon Sep 17 00:00:00 2001 From: Hardeep Sidhu Date: Mon, 3 Apr 2006 14:25:47 +0000 Subject: Fixed problems with playlist buffer full handling git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9454 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'apps/playlist.c') diff --git a/apps/playlist.c b/apps/playlist.c index 23dfa40c9f..7652e2924d 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -457,6 +457,7 @@ static int add_indices_to_playlist(struct playlist_info* playlist, unsigned int count = 0; bool store_index; unsigned char *p; + int result = 0; if(-1 == playlist->fd) playlist->fd = open(playlist->filename, O_RDONLY); @@ -506,16 +507,18 @@ static int add_indices_to_playlist(struct playlist_info* playlist, if(*p != '#') { + if ( playlist->amount >= playlist->max_playlist_size ) { + display_buffer_full(); + result = -1; + goto exit; + } + /* Store a new entry */ playlist->indices[ playlist->amount ] = i+count; #ifdef HAVE_DIRCACHE if (playlist->filenames) playlist->filenames[ playlist->amount ] = NULL; #endif - if ( playlist->amount >= playlist->max_playlist_size ) { - display_buffer_full(); - return -1; - } playlist->amount++; } } @@ -524,11 +527,12 @@ static int add_indices_to_playlist(struct playlist_info* playlist, i+= count; } +exit: #ifdef HAVE_DIRCACHE queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0); #endif - return 0; + return result; } /* -- cgit v1.2.3