From f564c9ac9a2abd77b49940d29e1230c3024570ff Mon Sep 17 00:00:00 2001 From: Robert Hak Date: Tue, 11 Jun 2002 07:33:51 +0000 Subject: we now handle playlists in a block of 255 bytes instead of a single byte at a time git-svn-id: svn://svn.rockbox.org/rockbox/trunk@947 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) (limited to 'apps') diff --git a/apps/playlist.c b/apps/playlist.c index 12749dba67..5e22c86d8c 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -58,8 +58,7 @@ char* playlist_next(int type) (now_playing[seek] != '\r') && (seek < max)) seek++; -/* if(seek == max) - seek = max-1;*/ + now_playing[seek]=0; return now_playing; @@ -100,47 +99,20 @@ void empty_playlist( playlist_info_t *playlist ) */ void add_indices_to_playlist( playlist_info_t *playlist ) { -/* - char *p; - int i = 0; - unsigned char byte; - unsigned char lastbyte='\n'; -*/ int nread; - int fd; - int i = 0; - unsigned char *p; - unsigned char buf[255]; int store_index = 0; int count = 0; + unsigned char *p; + unsigned char buf[255]; + + fd = open(playlist->filename, O_RDONLY); if(-1 == fd) return; /* failure */ -#ifdef ROBHAK - p = &byte; /* Not being used? */ - - /* loop thru buffer, store index whenever we get a new line */ - - while((nread = read(fd, &byte, 1)) == 1) - { - /* move thru (any) newlines */ - - if(( byte != '\n' ) && ( byte != '\r' ) && - ((lastbyte == '\n') || (lastbyte == '\r'))) { - /* we're now at the start of a new track filename. store index */ - - DEBUGF("tune %d at position %d\n", playlist->amount, i); - playlist->indices [ playlist->amount ] = i; - playlist->amount++; - } - i++; - lastbyte = byte; - } -#endif store_index = 1; while((nread = read(fd, &buf, sizeof(buf))) != 0) -- cgit v1.2.3