changeset 4857:f3f94fb55398

Small bugfix with getting playlist last line. Thx Atmos
author albeu
date Mon, 25 Feb 2002 11:13:34 +0000
parents 7dfcfd1b9bf7
children 65730cea02e7
files playtreeparser.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/playtreeparser.c	Mon Feb 25 08:27:15 2002 +0000
+++ b/playtreeparser.c	Mon Feb 25 11:13:34 2002 +0000
@@ -73,7 +73,7 @@
     end = strchr(p->iter,'\n');
     if(!end) {
       if(p->stream->eof) {
-	end = p->buffer + p->buffer_end + 1;
+	end = p->buffer + p->buffer_end;
 	break;
       }
       resize = 1;
@@ -88,13 +88,13 @@
     return NULL;
   strncpy(p->line,p->iter,line_end - p->iter);
   p->line[line_end - p->iter] = '\0';
-  end++;
+  if(end != '\0')
+    end++;
 
   if(!p->keep) {
-    if(end[1] != '\0') {
-      p->buffer_end = strlen(end);
+    if(end[0] != '\0') {
+      p->buffer_end -= strlen(p->line)+1;
       memmove(p->buffer,end,p->buffer_end);
-      p->buffer[p->buffer_end] = '\0';
     } else
       p->buffer_end = 0;
     p->iter = p->buffer;