From 82a79565de96aa3f2ca554397e26ed2877e49e16 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Dec 2017 11:32:36 +0100 Subject: [PATCH] input/InputStream: use C++11 initializers --- src/input/IcyInputStream.cxx | 3 +-- src/input/IcyInputStream.hxx | 2 +- src/input/InputStream.hxx | 12 +++++------- src/input/plugins/RewindInputPlugin.cxx | 5 ++--- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/input/IcyInputStream.cxx b/src/input/IcyInputStream.cxx index 23a971573..31db5f6d7 100644 --- a/src/input/IcyInputStream.cxx +++ b/src/input/IcyInputStream.cxx @@ -22,8 +22,7 @@ #include "tag/Tag.hxx" IcyInputStream::IcyInputStream(InputStream *_input) - :ProxyInputStream(_input), - override_offset(0) + :ProxyInputStream(_input) { } diff --git a/src/input/IcyInputStream.hxx b/src/input/IcyInputStream.hxx index 986abdca2..5c4701b96 100644 --- a/src/input/IcyInputStream.hxx +++ b/src/input/IcyInputStream.hxx @@ -44,7 +44,7 @@ class IcyInputStream final : public ProxyInputStream { */ std::unique_ptr icy_tag; - offset_type override_offset; + offset_type override_offset = 0; public: IcyInputStream(InputStream *_input); diff --git a/src/input/InputStream.hxx b/src/input/InputStream.hxx index 3d5b7542c..629848101 100644 --- a/src/input/InputStream.hxx +++ b/src/input/InputStream.hxx @@ -70,24 +70,24 @@ protected: * indicates whether the stream is ready for reading and * whether the other attributes in this struct are valid */ - bool ready; + bool ready = false; /** * if true, then the stream is fully seekable */ - bool seekable; + bool seekable = false; static constexpr offset_type UNKNOWN_SIZE = -1; /** * the size of the resource, or #UNKNOWN_SIZE if unknown */ - offset_type size; + offset_type size = UNKNOWN_SIZE; /** * the current offset within the stream */ - offset_type offset; + offset_type offset = 0; private: /** @@ -98,9 +98,7 @@ private: public: InputStream(const char *_uri, Mutex &_mutex, Cond &_cond) :uri(_uri), - mutex(_mutex), cond(_cond), - ready(false), seekable(false), - size(UNKNOWN_SIZE), offset(0) { + mutex(_mutex), cond(_cond) { assert(_uri != nullptr); } diff --git a/src/input/plugins/RewindInputPlugin.cxx b/src/input/plugins/RewindInputPlugin.cxx index 7ece4ad50..3d7bab029 100644 --- a/src/input/plugins/RewindInputPlugin.cxx +++ b/src/input/plugins/RewindInputPlugin.cxx @@ -34,7 +34,7 @@ class RewindInputStream final : public ProxyInputStream { /** * The write/append position within the buffer. */ - size_t tail; + size_t tail = 0; /** * The size of this buffer is the maximum number of bytes @@ -48,8 +48,7 @@ class RewindInputStream final : public ProxyInputStream { public: RewindInputStream(InputStream *_input) - :ProxyInputStream(_input), - tail(0) { + :ProxyInputStream(_input) { } /* virtual methods from InputStream */