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:
parent
81b2b4a85c
commit
9ed4fac341
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user