input/InputStream: add "noexcept"

This commit is contained in:
Max Kellermann 2017-12-26 11:31:05 +01:00
parent 82a79565de
commit daeb7ae949
9 changed files with 34 additions and 33 deletions

View File

@ -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();

View File

@ -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;
};

View File

@ -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)

View File

@ -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

View File

@ -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();

View File

@ -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);

View File

@ -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();

View File

@ -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;

View File

@ -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();
}
};