summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Hak <adiamas@rockbox.org>2002-06-11 07:33:51 +0000
committerRobert Hak <adiamas@rockbox.org>2002-06-11 07:33:51 +0000
commitf564c9ac9a2abd77b49940d29e1230c3024570ff (patch)
treef1f096af5fc5dd8294f158d31f33e5ebc811e030
parent06b4e7f8bc943efb9de47e25f582f276f7afadf9 (diff)
downloadrockbox-f564c9ac9a2abd77b49940d29e1230c3024570ff.zip
rockbox-f564c9ac9a2abd77b49940d29e1230c3024570ff.tar.gz
rockbox-f564c9ac9a2abd77b49940d29e1230c3024570ff.tar.bz2
rockbox-f564c9ac9a2abd77b49940d29e1230c3024570ff.tar.xz
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
-rw-r--r--apps/playlist.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 12749db..5e22c86 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)