Commit 9ed4fac3 authored by Max Kellermann's avatar Max Kellermann

input/InputStream: check offset in Rewind()

Don't call Seek() if the stream is already at the beginning. This avoids unnecessary exceptions if seeking is not implemented by an Inputstream implementation.
parent 81b2b4a8
......@@ -287,11 +287,13 @@ public:
* for Seek(0, error).
*/
void Rewind(std::unique_lock<Mutex> &lock) {
Seek(lock, 0);
if (offset > 0)
Seek(lock, 0);
}
void LockRewind() {
LockSeek(0);
std::unique_lock<Mutex> lock(mutex);
Rewind(lock);
}
/**
......
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