From 09a188bfd9987587112e239a06740ca0ca1c9914 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 22 Feb 2016 13:14:19 +0100 Subject: [PATCH] input/InputStream: add method Skip() --- src/input/InputStream.cxx | 7 +++++++ src/input/InputStream.hxx | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/src/input/InputStream.cxx b/src/input/InputStream.cxx index bd593bc29..8ea3ef560 100644 --- a/src/input/InputStream.cxx +++ b/src/input/InputStream.cxx @@ -100,6 +100,13 @@ InputStream::LockSeek(offset_type _offset, Error &error) return Seek(_offset, error); } +bool +InputStream::LockSkip(offset_type _offset, Error &error) +{ + const ScopeLock protect(mutex); + return Skip(_offset, error); +} + Tag * InputStream::ReadTag() { diff --git a/src/input/InputStream.hxx b/src/input/InputStream.hxx index 458947eb4..af010e2e1 100644 --- a/src/input/InputStream.hxx +++ b/src/input/InputStream.hxx @@ -294,6 +294,15 @@ public: return LockSeek(0, error); } + /** + * Skip input bytes. + */ + bool Skip(offset_type _offset, Error &error) { + return Seek(GetOffset() + _offset, error); + } + + bool LockSkip(offset_type _offset, Error &error); + /** * Returns true if the stream has reached end-of-file. *