Commit ffc36d52 authored by Max Kellermann's avatar Max Kellermann

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
parent 0126276e
ver 0.21.5 (not yet released) ver 0.21.5 (not yet released)
* protocol * protocol
- fix deadlock in "albumart" command - fix deadlock in "albumart" command
* input
- buffer: fix crash bug when playing remote WAV file
* tags * tags
- ape: map "Album Artist" - ape: map "Album Artist"
* output * output
......
...@@ -66,6 +66,11 @@ BufferedInputStream::Check() ...@@ -66,6 +66,11 @@ BufferedInputStream::Check()
void void
BufferedInputStream::Seek(offset_type new_offset) BufferedInputStream::Seek(offset_type new_offset)
{ {
if (new_offset >= size) {
offset = size;
return;
}
auto r = buffer.Read(new_offset); auto r = buffer.Read(new_offset);
if (r.HasData()) { if (r.HasData()) {
/* nice, we already have some data at the desired /* nice, we already have some data at the desired
......
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