diff options
author | Max Kellermann <max@musicpd.org> | 2017-06-03 21:33:44 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-06-04 12:46:48 +0200 |
commit | a057b4f6d88f7bfc1d9846e14de5617a4c281c0d (patch) | |
tree | 88c49e29042c500104827ac3d6e64bd447e1b4bf /src/decoder | |
parent | 62b03cfddf74c25d0b8187ce5e56d31ef49667b7 (diff) |
*: add lost of "noexcept" specifications
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/Bridge.cxx | 6 | ||||
-rw-r--r-- | src/decoder/Bridge.hxx | 6 | ||||
-rw-r--r-- | src/decoder/Client.hxx | 6 | ||||
-rw-r--r-- | src/decoder/DecoderBuffer.hxx | 10 | ||||
-rw-r--r-- | src/decoder/DecoderControl.hxx | 10 | ||||
-rw-r--r-- | src/decoder/plugins/FlacMetadata.hxx | 20 | ||||
-rw-r--r-- | src/decoder/plugins/OpusDecoderPlugin.cxx | 4 |
7 files changed, 32 insertions, 30 deletions
diff --git a/src/decoder/Bridge.cxx b/src/decoder/Bridge.cxx index c24c80768..37fcb2bf9 100644 --- a/src/decoder/Bridge.cxx +++ b/src/decoder/Bridge.cxx @@ -277,7 +277,7 @@ DecoderBridge::Ready(const AudioFormat audio_format, } DecoderCommand -DecoderBridge::GetCommand() +DecoderBridge::GetCommand() noexcept { return LockGetVirtualCommand(); } @@ -326,7 +326,7 @@ DecoderBridge::CommandFinished() } SongTime -DecoderBridge::GetSeekTime() +DecoderBridge::GetSeekTime() noexcept { assert(dc.pipe != nullptr); @@ -341,7 +341,7 @@ DecoderBridge::GetSeekTime() } uint64_t -DecoderBridge::GetSeekFrame() +DecoderBridge::GetSeekFrame() noexcept { return GetSeekTime().ToScale<uint64_t>(dc.in_audio_format.sample_rate); } diff --git a/src/decoder/Bridge.hxx b/src/decoder/Bridge.hxx index 8573d6a7f..3b354c063 100644 --- a/src/decoder/Bridge.hxx +++ b/src/decoder/Bridge.hxx @@ -134,10 +134,10 @@ public: /* virtual methods from DecoderClient */ void Ready(AudioFormat audio_format, bool seekable, SignedSongTime duration) override; - DecoderCommand GetCommand() override; + DecoderCommand GetCommand() noexcept override; void CommandFinished() override; - SongTime GetSeekTime() override; - uint64_t GetSeekFrame() override; + SongTime GetSeekTime() noexcept override; + uint64_t GetSeekFrame() noexcept override; void SeekError() override; InputStreamPtr OpenUri(const char *uri) override; size_t Read(InputStream &is, void *buffer, size_t length) override; diff --git a/src/decoder/Client.hxx b/src/decoder/Client.hxx index 8de82d155..87f19f5be 100644 --- a/src/decoder/Client.hxx +++ b/src/decoder/Client.hxx @@ -58,7 +58,7 @@ public: * command pending */ gcc_pure - virtual DecoderCommand GetCommand() = 0; + virtual DecoderCommand GetCommand() noexcept = 0; /** * Called by the decoder when it has performed the requested command @@ -73,7 +73,7 @@ public: * @return the destination position for the seek in milliseconds */ gcc_pure - virtual SongTime GetSeekTime() = 0; + virtual SongTime GetSeekTime() noexcept = 0; /** * Call this when you have received the DecoderCommand::SEEK command. @@ -81,7 +81,7 @@ public: * @return the destination position for the seek in frames */ gcc_pure - virtual uint64_t GetSeekFrame() = 0; + virtual uint64_t GetSeekFrame() noexcept = 0; /** * Call this instead of CommandFinished() when seeking has diff --git a/src/decoder/DecoderBuffer.hxx b/src/decoder/DecoderBuffer.hxx index c79f8d96c..a7ba2f85f 100644 --- a/src/decoder/DecoderBuffer.hxx +++ b/src/decoder/DecoderBuffer.hxx @@ -54,11 +54,11 @@ public: size_t _size) :client(_client), is(_is), buffer(_size) {} - const InputStream &GetStream() const { + const InputStream &GetStream() const noexcept { return is; } - void Clear() { + void Clear() noexcept { buffer.Clear(); } @@ -75,7 +75,7 @@ public: * How many bytes are stored in the buffer? */ gcc_pure - size_t GetAvailable() const { + size_t GetAvailable() const noexcept { return buffer.GetAvailable(); } @@ -84,7 +84,7 @@ public: * you have to call Consume() to do that. The returned buffer * becomes invalid after a Fill() or a Consume() call. */ - ConstBuffer<void> Read() const { + ConstBuffer<void> Read() const noexcept { auto r = buffer.Read(); return { r.data, r.size }; } @@ -102,7 +102,7 @@ public: * * @param nbytes the number of bytes to consume */ - void Consume(size_t nbytes) { + void Consume(size_t nbytes) noexcept { buffer.Consume(nbytes); } diff --git a/src/decoder/DecoderControl.hxx b/src/decoder/DecoderControl.hxx index fa8fdfd2b..cc858c9a5 100644 --- a/src/decoder/DecoderControl.hxx +++ b/src/decoder/DecoderControl.hxx @@ -227,29 +227,29 @@ struct DecoderControl { } gcc_pure - bool LockIsIdle() const { + bool LockIsIdle() const noexcept { const std::lock_guard<Mutex> protect(mutex); return IsIdle(); } - bool IsStarting() const { + bool IsStarting() const noexcept { return state == DecoderState::START; } gcc_pure - bool LockIsStarting() const { + bool LockIsStarting() const noexcept { const std::lock_guard<Mutex> protect(mutex); return IsStarting(); } - bool HasFailed() const { + bool HasFailed() const noexcept { assert(command == DecoderCommand::NONE); return state == DecoderState::ERROR; } gcc_pure - bool LockHasFailed() const { + bool LockHasFailed() const noexcept { const std::lock_guard<Mutex> protect(mutex); return HasFailed(); } diff --git a/src/decoder/plugins/FlacMetadata.hxx b/src/decoder/plugins/FlacMetadata.hxx index ede627aa1..d0ee8c824 100644 --- a/src/decoder/plugins/FlacMetadata.hxx +++ b/src/decoder/plugins/FlacMetadata.hxx @@ -42,25 +42,27 @@ public: return chain; } - bool Read(const char *path) { + bool Read(const char *path) noexcept { return ::FLAC__metadata_chain_read(chain, path); } - bool Read(FLAC__IOHandle handle, FLAC__IOCallbacks callbacks) { + bool Read(FLAC__IOHandle handle, + FLAC__IOCallbacks callbacks) noexcept { return ::FLAC__metadata_chain_read_with_callbacks(chain, handle, callbacks); } - bool Read(InputStream &is) { + bool Read(InputStream &is) noexcept { return Read(::ToFlacIOHandle(is), ::GetFlacIOCallbacks(is)); } - bool ReadOgg(const char *path) { + bool ReadOgg(const char *path) noexcept { return ::FLAC__metadata_chain_read_ogg(chain, path); } - bool ReadOgg(FLAC__IOHandle handle, FLAC__IOCallbacks callbacks) { + bool ReadOgg(FLAC__IOHandle handle, + FLAC__IOCallbacks callbacks) noexcept { return ::FLAC__metadata_chain_read_ogg_with_callbacks(chain, handle, callbacks); @@ -71,12 +73,12 @@ public: } gcc_pure - FLAC__Metadata_ChainStatus GetStatus() const { + FLAC__Metadata_ChainStatus GetStatus() const noexcept { return ::FLAC__metadata_chain_status(chain); } gcc_pure - const char *GetStatusString() const { + const char *GetStatusString() const noexcept { return FLAC__Metadata_ChainStatusString[GetStatus()]; } @@ -99,12 +101,12 @@ public: ::FLAC__metadata_iterator_delete(iterator); } - bool Next() { + bool Next() noexcept { return ::FLAC__metadata_iterator_next(iterator); } gcc_pure - FLAC__StreamMetadata *GetBlock() { + FLAC__StreamMetadata *GetBlock() noexcept { return ::FLAC__metadata_iterator_get_block(iterator); } }; diff --git a/src/decoder/plugins/OpusDecoderPlugin.cxx b/src/decoder/plugins/OpusDecoderPlugin.cxx index b526259ff..6c6d39845 100644 --- a/src/decoder/plugins/OpusDecoderPlugin.cxx +++ b/src/decoder/plugins/OpusDecoderPlugin.cxx @@ -52,14 +52,14 @@ static constexpr unsigned opus_output_buffer_frames = opus_sample_rate / 4; gcc_pure static bool -IsOpusHead(const ogg_packet &packet) +IsOpusHead(const ogg_packet &packet) noexcept { return packet.bytes >= 8 && memcmp(packet.packet, "OpusHead", 8) == 0; } gcc_pure static bool -IsOpusTags(const ogg_packet &packet) +IsOpusTags(const ogg_packet &packet) noexcept { return packet.bytes >= 8 && memcmp(packet.packet, "OpusTags", 8) == 0; } |