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.
This commit is contained in:
Max Kellermann 2019-05-31 17:45:45 +02:00
parent 81b2b4a85c
commit 9ed4fac341

View File

@ -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);
}
/**