input/buffered: implement seeking to end of file

Previously, a seek to the end of the file would cause an assertion
failure in SparseMap::Check() because the given offset was invalid.

Closes #453
This commit is contained in:
Max Kellermann 2019-01-22 07:42:00 +01:00
parent 0126276e2f
commit ffc36d5255
2 changed files with 7 additions and 0 deletions

2
NEWS
View File

@ -1,6 +1,8 @@
ver 0.21.5 (not yet released)
* protocol
- fix deadlock in "albumart" command
* input
- buffer: fix crash bug when playing remote WAV file
* tags
- ape: map "Album Artist"
* output

View File

@ -66,6 +66,11 @@ BufferedInputStream::Check()
void
BufferedInputStream::Seek(offset_type new_offset)
{
if (new_offset >= size) {
offset = size;
return;
}
auto r = buffer.Read(new_offset);
if (r.HasData()) {
/* nice, we already have some data at the desired