diff options
author | Max Kellermann <max@musicpd.org> | 2017-12-26 11:31:05 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-12-26 11:39:34 +0100 |
commit | daeb7ae9490ccdb92cec41e769a64a6d5b30665e (patch) | |
tree | 5225c14bd1528eed7e2e9795830f601239f98cd2 /src | |
parent | 82a79565de96aa3f2ca554397e26ed2877e49e16 (diff) |
input/InputStream: add "noexcept"
Diffstat (limited to 'src')
-rw-r--r-- | src/input/IcyInputStream.cxx | 6 | ||||
-rw-r--r-- | src/input/IcyInputStream.hxx | 10 | ||||
-rw-r--r-- | src/input/Init.cxx | 3 | ||||
-rw-r--r-- | src/input/Init.hxx | 2 | ||||
-rw-r--r-- | src/input/InputStream.cxx | 10 | ||||
-rw-r--r-- | src/input/InputStream.hxx | 20 | ||||
-rw-r--r-- | src/input/ProxyInputStream.cxx | 6 | ||||
-rw-r--r-- | src/input/ProxyInputStream.hxx | 6 | ||||
-rw-r--r-- | src/input/plugins/RewindInputPlugin.cxx | 4 |
9 files changed, 34 insertions, 33 deletions
diff --git a/src/input/IcyInputStream.cxx b/src/input/IcyInputStream.cxx index 31db5f6d7..cbdafb404 100644 --- a/src/input/IcyInputStream.cxx +++ b/src/input/IcyInputStream.cxx @@ -21,15 +21,15 @@ #include "IcyInputStream.hxx" #include "tag/Tag.hxx" -IcyInputStream::IcyInputStream(InputStream *_input) +IcyInputStream::IcyInputStream(InputStream *_input) noexcept :ProxyInputStream(_input) { } -IcyInputStream::~IcyInputStream() = default; +IcyInputStream::~IcyInputStream() noexcept = default; void -IcyInputStream::Update() +IcyInputStream::Update() noexcept { ProxyInputStream::Update(); diff --git a/src/input/IcyInputStream.hxx b/src/input/IcyInputStream.hxx index 5c4701b96..fdbdd54f8 100644 --- a/src/input/IcyInputStream.hxx +++ b/src/input/IcyInputStream.hxx @@ -47,22 +47,22 @@ class IcyInputStream final : public ProxyInputStream { offset_type override_offset = 0; public: - IcyInputStream(InputStream *_input); - virtual ~IcyInputStream(); + IcyInputStream(InputStream *_input) noexcept; + virtual ~IcyInputStream() noexcept; IcyInputStream(const IcyInputStream &) = delete; IcyInputStream &operator=(const IcyInputStream &) = delete; - void Enable(size_t _data_size) { + void Enable(size_t _data_size) noexcept { parser.Start(_data_size); } - bool IsEnabled() const { + bool IsEnabled() const noexcept { return parser.IsDefined(); } /* virtual methods from InputStream */ - void Update() override; + void Update() noexcept override; std::unique_ptr<Tag> ReadTag() override; size_t Read(void *ptr, size_t size) override; }; diff --git a/src/input/Init.cxx b/src/input/Init.cxx index 6a40f5491..146f7db2e 100644 --- a/src/input/Init.cxx +++ b/src/input/Init.cxx @@ -69,7 +69,8 @@ input_stream_global_init(EventLoop &event_loop) } } -void input_stream_global_finish(void) +void +input_stream_global_finish() noexcept { input_plugins_for_each_enabled(plugin) if (plugin->finish != nullptr) diff --git a/src/input/Init.hxx b/src/input/Init.hxx index 982c4807f..0b73f8b0b 100644 --- a/src/input/Init.hxx +++ b/src/input/Init.hxx @@ -32,6 +32,6 @@ input_stream_global_init(EventLoop &event_loop); * Deinitializes this library and all #InputStream implementations. */ void -input_stream_global_finish(); +input_stream_global_finish() noexcept; #endif diff --git a/src/input/InputStream.cxx b/src/input/InputStream.cxx index 94db21dbc..7bf3272a1 100644 --- a/src/input/InputStream.cxx +++ b/src/input/InputStream.cxx @@ -27,7 +27,7 @@ #include <assert.h> -InputStream::~InputStream() +InputStream::~InputStream() noexcept { } @@ -37,12 +37,12 @@ InputStream::Check() } void -InputStream::Update() +InputStream::Update() noexcept { } void -InputStream::SetReady() +InputStream::SetReady() noexcept { assert(!ready); @@ -51,7 +51,7 @@ InputStream::SetReady() } void -InputStream::WaitReady() +InputStream::WaitReady() noexcept { while (true) { Update(); @@ -63,7 +63,7 @@ InputStream::WaitReady() } void -InputStream::LockWaitReady() +InputStream::LockWaitReady() noexcept { const std::lock_guard<Mutex> protect(mutex); WaitReady(); diff --git a/src/input/InputStream.hxx b/src/input/InputStream.hxx index 629848101..a5b9bbffa 100644 --- a/src/input/InputStream.hxx +++ b/src/input/InputStream.hxx @@ -107,7 +107,7 @@ public: * * The caller must not lock the mutex. */ - virtual ~InputStream(); + virtual ~InputStream() noexcept; /** * Opens a new input stream. You may not access it until the "ready" @@ -138,15 +138,15 @@ public: * * No lock necessary for this method. */ - const char *GetURI() const { + const char *GetURI() const noexcept { return uri.c_str(); } - void Lock() { + void Lock() noexcept { mutex.lock(); } - void Unlock() { + void Unlock() noexcept { mutex.unlock(); } @@ -160,9 +160,9 @@ public: * Update the public attributes. Call before accessing attributes * such as "ready" or "offset". */ - virtual void Update(); + virtual void Update() noexcept; - void SetReady(); + void SetReady() noexcept; /** * Return whether the stream is ready for reading and whether @@ -174,13 +174,13 @@ public: return ready; } - void WaitReady(); + void WaitReady() noexcept; /** * Wrapper for WaitReady() which locks and unlocks the mutex; * the caller must not be holding it already. */ - void LockWaitReady(); + void LockWaitReady() noexcept; gcc_pure bool HasMimeType() const noexcept { @@ -201,13 +201,13 @@ public: } gcc_nonnull_all - void SetMimeType(const char *_mime) { + void SetMimeType(const char *_mime) noexcept { assert(!ready); mime = _mime; } - void SetMimeType(std::string &&_mime) { + void SetMimeType(std::string &&_mime) noexcept { assert(!ready); mime = std::move(_mime); diff --git a/src/input/ProxyInputStream.cxx b/src/input/ProxyInputStream.cxx index 8a6d3a22b..95cb4ebd8 100644 --- a/src/input/ProxyInputStream.cxx +++ b/src/input/ProxyInputStream.cxx @@ -21,11 +21,11 @@ #include "ProxyInputStream.hxx" #include "tag/Tag.hxx" -ProxyInputStream::ProxyInputStream(InputStream *_input) +ProxyInputStream::ProxyInputStream(InputStream *_input) noexcept :InputStream(_input->GetURI(), _input->mutex, _input->cond), input(*_input) {} -ProxyInputStream::~ProxyInputStream() +ProxyInputStream::~ProxyInputStream() noexcept { delete &input; } @@ -57,7 +57,7 @@ ProxyInputStream::Check() } void -ProxyInputStream::Update() +ProxyInputStream::Update() noexcept { input.Update(); CopyAttributes(); diff --git a/src/input/ProxyInputStream.hxx b/src/input/ProxyInputStream.hxx index 075e3da5b..ee77f57a1 100644 --- a/src/input/ProxyInputStream.hxx +++ b/src/input/ProxyInputStream.hxx @@ -35,16 +35,16 @@ protected: public: gcc_nonnull_all - ProxyInputStream(InputStream *_input); + ProxyInputStream(InputStream *_input) noexcept; - virtual ~ProxyInputStream(); + virtual ~ProxyInputStream() noexcept; ProxyInputStream(const ProxyInputStream &) = delete; ProxyInputStream &operator=(const ProxyInputStream &) = delete; /* virtual methods from InputStream */ void Check() override; - void Update() override; + void Update() noexcept override; void Seek(offset_type new_offset) override; bool IsEOF() noexcept override; std::unique_ptr<Tag> ReadTag() override; diff --git a/src/input/plugins/RewindInputPlugin.cxx b/src/input/plugins/RewindInputPlugin.cxx index 3d7bab029..20df14047 100644 --- a/src/input/plugins/RewindInputPlugin.cxx +++ b/src/input/plugins/RewindInputPlugin.cxx @@ -53,7 +53,7 @@ public: /* virtual methods from InputStream */ - void Update() override { + void Update() noexcept override { if (!ReadingFromBuffer()) ProxyInputStream::Update(); } @@ -70,7 +70,7 @@ private: * Are we currently reading from the buffer, and does the * buffer contain more data for the next read operation? */ - bool ReadingFromBuffer() const { + bool ReadingFromBuffer() const noexcept { return tail > 0 && offset < input.GetOffset(); } }; |