Commit 217d88f2 authored by Max Kellermann's avatar Max Kellermann

TextInputStream: don't ignore unterminated last line

parent 394e3be4
ver 0.19.2 (not yet released)
* playlist
- m3u: don't ignore unterminated last line
- m3u: recognize the file suffix ".m3u8"
* decoder
- faad: remove workaround for ancient libfaad2 ABI bug
......
......@@ -38,8 +38,8 @@ TextInputStream::ReadLine()
while (true) {
auto dest = buffer.Write();
if (dest.size < 2) {
/* end of file (or line too long): terminate
the current line */
/* line too long: terminate the current
line */
assert(!dest.IsEmpty());
dest[0] = 0;
......@@ -66,7 +66,19 @@ TextInputStream::ReadLine()
if (line != nullptr)
return line;
if (nbytes == 0)
return nullptr;
if (nbytes == 0) {
/* end of file: see if there's an unterminated
line */
dest = buffer.Write();
assert(!dest.IsEmpty());
dest[0] = 0;
auto r = buffer.Read();
buffer.Clear();
return r.IsEmpty()
? nullptr
: r.data;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment