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:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user