From 9ed4fac341839a03f69a717353102014f9695e63 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 31 May 2019 17:45:45 +0200 Subject: [PATCH] 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. --- src/input/InputStream.hxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/input/InputStream.hxx b/src/input/InputStream.hxx index 82609e14a..3086a21fc 100644 --- a/src/input/InputStream.hxx +++ b/src/input/InputStream.hxx @@ -287,11 +287,13 @@ public: * for Seek(0, error). */ void Rewind(std::unique_lock &lock) { - Seek(lock, 0); + if (offset > 0) + Seek(lock, 0); } void LockRewind() { - LockSeek(0); + std::unique_lock lock(mutex); + Rewind(lock); } /**