demux_playlist: fix previous commit

This just froze, due to obvious stupidity (I forgot to deal with all
semantic changes done to the the former stream_skip()).

Fixes: ac7f67b3f2
This commit is contained in:
wm4 2019-11-15 12:10:01 +01:00
parent 9efdb0368e
commit 8d4e012bfa
1 changed files with 2 additions and 3 deletions

View File

@ -99,7 +99,7 @@ static int read_characters(stream_t *s, uint8_t *dst, int dstsize, int utf16)
if (len > dstsize)
return -1; // line too long
memcpy(dst, buf, len);
stream_seek_skip(s, len);
stream_seek_skip(s, stream_tell(s) + len);
return len;
}
}
@ -119,7 +119,6 @@ static char *read_line(stream_t *s, char *mem, int max, int utf16)
int l = read_characters(s, &mem[read], max - read - 1, utf16);
if (l < 0 || memchr(&mem[read], '\0', l)) {
MP_WARN(s, "error reading line\n");
s->eof = false;
return NULL;
}
read += l;
@ -127,7 +126,7 @@ static char *read_line(stream_t *s, char *mem, int max, int utf16)
break;
}
mem[read] = '\0';
if (s->eof && read == 0) // legitimate EOF
if (!stream_read_peek(s, &(char){0}, 1) && read == 0) // legitimate EOF
return NULL;
return mem;
}