Commit 71f0ed8b authored by Max Kellermann's avatar Max Kellermann

*: add "noexcept" to many, many function prototypes

This eliminates some overhead, because the compiler doesn't need to consider these functions throwing.
parent ac2e4e59
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <stdio.h> #include <stdio.h>
void void
AudioFormat::ApplyMask(AudioFormat mask) AudioFormat::ApplyMask(AudioFormat mask) noexcept
{ {
assert(IsValid()); assert(IsValid());
assert(mask.IsMaskValid()); assert(mask.IsMaskValid());
...@@ -42,7 +42,7 @@ AudioFormat::ApplyMask(AudioFormat mask) ...@@ -42,7 +42,7 @@ AudioFormat::ApplyMask(AudioFormat mask)
} }
StringBuffer<24> StringBuffer<24>
ToString(const AudioFormat af) ToString(const AudioFormat af) noexcept
{ {
StringBuffer<24> buffer; StringBuffer<24> buffer;
......
...@@ -124,7 +124,7 @@ struct AudioFormat { ...@@ -124,7 +124,7 @@ struct AudioFormat {
return !(*this == other); return !(*this == other);
} }
void ApplyMask(AudioFormat mask); void ApplyMask(AudioFormat mask) noexcept;
gcc_pure gcc_pure
AudioFormat WithMask(AudioFormat mask) const { AudioFormat WithMask(AudioFormat mask) const {
...@@ -223,6 +223,6 @@ AudioFormat::GetTimeToSize() const ...@@ -223,6 +223,6 @@ AudioFormat::GetTimeToSize() const
*/ */
gcc_const gcc_const
StringBuffer<24> StringBuffer<24>
ToString(AudioFormat af); ToString(AudioFormat af) noexcept;
#endif #endif
...@@ -37,19 +37,19 @@ DetachedSong::~DetachedSong() ...@@ -37,19 +37,19 @@ DetachedSong::~DetachedSong()
} }
bool bool
DetachedSong::IsRemote() const DetachedSong::IsRemote() const noexcept
{ {
return uri_has_scheme(GetRealURI()); return uri_has_scheme(GetRealURI());
} }
bool bool
DetachedSong::IsAbsoluteFile() const DetachedSong::IsAbsoluteFile() const noexcept
{ {
return PathTraitsUTF8::IsAbsolute(GetRealURI()); return PathTraitsUTF8::IsAbsolute(GetRealURI());
} }
bool bool
DetachedSong::IsInDatabase() const DetachedSong::IsInDatabase() const noexcept
{ {
/* here, we use GetURI() and not GetRealURI() because /* here, we use GetURI() and not GetRealURI() because
GetRealURI() is never relative */ GetRealURI() is never relative */
...@@ -59,7 +59,7 @@ DetachedSong::IsInDatabase() const ...@@ -59,7 +59,7 @@ DetachedSong::IsInDatabase() const
} }
SignedSongTime SignedSongTime
DetachedSong::GetDuration() const DetachedSong::GetDuration() const noexcept
{ {
SongTime a = start_time, b = end_time; SongTime a = start_time, b = end_time;
if (!b.IsPositive()) { if (!b.IsPositive()) {
......
...@@ -100,7 +100,7 @@ public: ...@@ -100,7 +100,7 @@ public:
~DetachedSong(); ~DetachedSong();
gcc_pure gcc_pure
const char *GetURI() const { const char *GetURI() const noexcept {
return uri.c_str(); return uri.c_str();
} }
...@@ -114,7 +114,7 @@ public: ...@@ -114,7 +114,7 @@ public:
* displayed URI? * displayed URI?
*/ */
gcc_pure gcc_pure
bool HasRealURI() const { bool HasRealURI() const noexcept {
return !real_uri.empty(); return !real_uri.empty();
} }
...@@ -123,7 +123,7 @@ public: ...@@ -123,7 +123,7 @@ public:
* GetURI(). * GetURI().
*/ */
gcc_pure gcc_pure
const char *GetRealURI() const { const char *GetRealURI() const noexcept {
return (HasRealURI() ? real_uri : uri).c_str(); return (HasRealURI() ? real_uri : uri).c_str();
} }
...@@ -137,19 +137,19 @@ public: ...@@ -137,19 +137,19 @@ public:
* song. * song.
*/ */
gcc_pure gcc_pure
bool IsSame(const DetachedSong &other) const { bool IsSame(const DetachedSong &other) const noexcept {
return uri == other.uri && return uri == other.uri &&
start_time == other.start_time && start_time == other.start_time &&
end_time == other.end_time; end_time == other.end_time;
} }
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
bool IsURI(const char *other_uri) const { bool IsURI(const char *other_uri) const noexcept {
return uri == other_uri; return uri == other_uri;
} }
gcc_pure gcc_pure
bool IsRemote() const; bool IsRemote() const noexcept;
gcc_pure gcc_pure
bool IsFile() const { bool IsFile() const {
...@@ -157,10 +157,10 @@ public: ...@@ -157,10 +157,10 @@ public:
} }
gcc_pure gcc_pure
bool IsAbsoluteFile() const; bool IsAbsoluteFile() const noexcept;
gcc_pure gcc_pure
bool IsInDatabase() const; bool IsInDatabase() const noexcept;
const Tag &GetTag() const { const Tag &GetTag() const {
return tag; return tag;
...@@ -215,7 +215,7 @@ public: ...@@ -215,7 +215,7 @@ public:
} }
gcc_pure gcc_pure
SignedSongTime GetDuration() const; SignedSongTime GetDuration() const noexcept;
/** /**
* Update the #tag and #mtime. * Update the #tag and #mtime.
......
...@@ -96,7 +96,7 @@ io_thread_deinit(void) ...@@ -96,7 +96,7 @@ io_thread_deinit(void)
} }
EventLoop & EventLoop &
io_thread_get() io_thread_get() noexcept
{ {
assert(io.loop != nullptr); assert(io.loop != nullptr);
...@@ -104,7 +104,7 @@ io_thread_get() ...@@ -104,7 +104,7 @@ io_thread_get()
} }
bool bool
io_thread_inside(void) io_thread_inside() noexcept
{ {
return io.thread.IsInside(); return io.thread.IsInside();
} }
...@@ -51,13 +51,13 @@ io_thread_deinit(); ...@@ -51,13 +51,13 @@ io_thread_deinit();
gcc_const gcc_const
EventLoop & EventLoop &
io_thread_get(); io_thread_get() noexcept;
/** /**
* Is the current thread the I/O thread? * Is the current thread the I/O thread?
*/ */
gcc_pure gcc_pure
bool bool
io_thread_inside(); io_thread_inside() noexcept;
#endif #endif
...@@ -46,13 +46,13 @@ static const char *const idle_names[] = { ...@@ -46,13 +46,13 @@ static const char *const idle_names[] = {
}; };
const char*const* const char*const*
idle_get_names(void) idle_get_names() noexcept
{ {
return idle_names; return idle_names;
} }
unsigned unsigned
idle_parse_name(const char *name) idle_parse_name(const char *name) noexcept
{ {
#if !CLANG_CHECK_VERSION(3,6) #if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */ /* disabled on clang due to -Wtautological-pointer-compare */
......
...@@ -70,8 +70,9 @@ static constexpr unsigned IDLE_MOUNT = 0x1000; ...@@ -70,8 +70,9 @@ static constexpr unsigned IDLE_MOUNT = 0x1000;
/** /**
* Get idle names * Get idle names
*/ */
gcc_const
const char*const* const char*const*
idle_get_names(); idle_get_names() noexcept;
/** /**
* Parse an idle name and return its mask. Returns 0 if the given * Parse an idle name and return its mask. Returns 0 if the given
...@@ -79,6 +80,6 @@ idle_get_names(); ...@@ -79,6 +80,6 @@ idle_get_names();
*/ */
gcc_nonnull_all gcc_pure gcc_nonnull_all gcc_pure
unsigned unsigned
idle_parse_name(const char *name); idle_parse_name(const char *name) noexcept;
#endif #endif
...@@ -59,14 +59,14 @@ mapper_init(AllocatedPath &&_playlist_dir) ...@@ -59,14 +59,14 @@ mapper_init(AllocatedPath &&_playlist_dir)
} }
void void
mapper_finish() mapper_finish() noexcept
{ {
} }
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
AllocatedPath AllocatedPath
map_uri_fs(const char *uri) map_uri_fs(const char *uri) noexcept
{ {
assert(uri != nullptr); assert(uri != nullptr);
assert(*uri != '/'); assert(*uri != '/');
...@@ -86,7 +86,7 @@ map_uri_fs(const char *uri) ...@@ -86,7 +86,7 @@ map_uri_fs(const char *uri)
} }
std::string std::string
map_fs_to_utf8(Path path_fs) map_fs_to_utf8(Path path_fs) noexcept
{ {
if (path_fs.IsAbsolute()) { if (path_fs.IsAbsolute()) {
if (instance->storage == nullptr) if (instance->storage == nullptr)
...@@ -109,13 +109,13 @@ map_fs_to_utf8(Path path_fs) ...@@ -109,13 +109,13 @@ map_fs_to_utf8(Path path_fs)
#endif #endif
const AllocatedPath & const AllocatedPath &
map_spl_path() map_spl_path() noexcept
{ {
return playlist_dir_fs; return playlist_dir_fs;
} }
AllocatedPath AllocatedPath
map_spl_utf8_to_fs(const char *name) map_spl_utf8_to_fs(const char *name) noexcept
{ {
if (playlist_dir_fs.IsNull()) if (playlist_dir_fs.IsNull())
return AllocatedPath::Null(); return AllocatedPath::Null();
......
...@@ -37,7 +37,7 @@ void ...@@ -37,7 +37,7 @@ void
mapper_init(AllocatedPath &&playlist_dir); mapper_init(AllocatedPath &&playlist_dir);
void void
mapper_finish(); mapper_finish() noexcept;
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
...@@ -48,7 +48,7 @@ mapper_finish(); ...@@ -48,7 +48,7 @@ mapper_finish();
*/ */
gcc_pure gcc_pure
AllocatedPath AllocatedPath
map_uri_fs(const char *uri); map_uri_fs(const char *uri) noexcept;
/** /**
* Maps a file system path (relative to the music directory or * Maps a file system path (relative to the music directory or
...@@ -60,7 +60,7 @@ map_uri_fs(const char *uri); ...@@ -60,7 +60,7 @@ map_uri_fs(const char *uri);
*/ */
gcc_pure gcc_pure
std::string std::string
map_fs_to_utf8(Path path_fs); map_fs_to_utf8(Path path_fs) noexcept;
#endif #endif
...@@ -69,7 +69,7 @@ map_fs_to_utf8(Path path_fs); ...@@ -69,7 +69,7 @@ map_fs_to_utf8(Path path_fs);
*/ */
gcc_const gcc_const
const AllocatedPath & const AllocatedPath &
map_spl_path(); map_spl_path() noexcept;
/** /**
* Maps a playlist name (without the ".m3u" suffix) to a file system * Maps a playlist name (without the ".m3u" suffix) to a file system
...@@ -79,6 +79,6 @@ map_spl_path(); ...@@ -79,6 +79,6 @@ map_spl_path();
*/ */
gcc_pure gcc_pure
AllocatedPath AllocatedPath
map_spl_utf8_to_fs(const char *name); map_spl_utf8_to_fs(const char *name) noexcept;
#endif #endif
...@@ -23,19 +23,19 @@ ...@@ -23,19 +23,19 @@
#include <assert.h> #include <assert.h>
MusicBuffer::MusicBuffer(unsigned num_chunks) MusicBuffer::MusicBuffer(unsigned num_chunks) noexcept
:buffer(num_chunks) { :buffer(num_chunks) {
} }
MusicChunk * MusicChunk *
MusicBuffer::Allocate() MusicBuffer::Allocate() noexcept
{ {
const std::lock_guard<Mutex> protect(mutex); const std::lock_guard<Mutex> protect(mutex);
return buffer.Allocate(); return buffer.Allocate();
} }
void void
MusicBuffer::Return(MusicChunk *chunk) MusicBuffer::Return(MusicChunk *chunk) noexcept
{ {
assert(chunk != nullptr); assert(chunk != nullptr);
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
* @param num_chunks the number of #MusicChunk reserved in * @param num_chunks the number of #MusicChunk reserved in
* this buffer * this buffer
*/ */
MusicBuffer(unsigned num_chunks); MusicBuffer(unsigned num_chunks) noexcept;
#ifndef NDEBUG #ifndef NDEBUG
/** /**
...@@ -71,13 +71,13 @@ public: ...@@ -71,13 +71,13 @@ public:
* @return an empty chunk or nullptr if there are no chunks * @return an empty chunk or nullptr if there are no chunks
* available * available
*/ */
MusicChunk *Allocate(); MusicChunk *Allocate() noexcept;
/** /**
* Returns a chunk to the buffer. It can be reused by * Returns a chunk to the buffer. It can be reused by
* Allocate() then. * Allocate() then.
*/ */
void Return(MusicChunk *chunk); void Return(MusicChunk *chunk) noexcept;
}; };
#endif #endif
...@@ -31,7 +31,7 @@ MusicChunk::~MusicChunk() ...@@ -31,7 +31,7 @@ MusicChunk::~MusicChunk()
#ifndef NDEBUG #ifndef NDEBUG
bool bool
MusicChunk::CheckFormat(const AudioFormat other_format) const MusicChunk::CheckFormat(const AudioFormat other_format) const noexcept
{ {
assert(other_format.IsValid()); assert(other_format.IsValid());
...@@ -41,7 +41,7 @@ MusicChunk::CheckFormat(const AudioFormat other_format) const ...@@ -41,7 +41,7 @@ MusicChunk::CheckFormat(const AudioFormat other_format) const
WritableBuffer<void> WritableBuffer<void>
MusicChunk::Write(const AudioFormat af, MusicChunk::Write(const AudioFormat af,
SongTime data_time, uint16_t _bit_rate) SongTime data_time, uint16_t _bit_rate) noexcept
{ {
assert(CheckFormat(af)); assert(CheckFormat(af));
assert(length == 0 || audio_format.IsValid()); assert(length == 0 || audio_format.IsValid());
...@@ -64,7 +64,7 @@ MusicChunk::Write(const AudioFormat af, ...@@ -64,7 +64,7 @@ MusicChunk::Write(const AudioFormat af,
} }
bool bool
MusicChunk::Expand(const AudioFormat af, size_t _length) MusicChunk::Expand(const AudioFormat af, size_t _length) noexcept
{ {
const size_t frame_size = af.GetFrameSize(); const size_t frame_size = af.GetFrameSize();
......
...@@ -111,7 +111,7 @@ struct MusicChunk { ...@@ -111,7 +111,7 @@ struct MusicChunk {
* specified audio_format. * specified audio_format.
*/ */
gcc_pure gcc_pure
bool CheckFormat(AudioFormat audio_format) const; bool CheckFormat(AudioFormat audio_format) const noexcept;
#endif #endif
/** /**
...@@ -127,7 +127,7 @@ struct MusicChunk { ...@@ -127,7 +127,7 @@ struct MusicChunk {
*/ */
WritableBuffer<void> Write(AudioFormat af, WritableBuffer<void> Write(AudioFormat af,
SongTime data_time, SongTime data_time,
uint16_t bit_rate); uint16_t bit_rate) noexcept;
/** /**
* Increases the length of the chunk after the caller has written to * Increases the length of the chunk after the caller has written to
...@@ -138,7 +138,7 @@ struct MusicChunk { ...@@ -138,7 +138,7 @@ struct MusicChunk {
* @param length the number of bytes which were appended * @param length the number of bytes which were appended
* @return true if the chunk is full * @return true if the chunk is full
*/ */
bool Expand(AudioFormat af, size_t length); bool Expand(AudioFormat af, size_t length) noexcept;
}; };
#endif #endif
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifndef NDEBUG #ifndef NDEBUG
bool bool
MusicPipe::Contains(const MusicChunk *chunk) const MusicPipe::Contains(const MusicChunk *chunk) const noexcept
{ {
const std::lock_guard<Mutex> protect(mutex); const std::lock_guard<Mutex> protect(mutex);
......
...@@ -86,7 +86,7 @@ public: ...@@ -86,7 +86,7 @@ public:
* Checks if the specified chunk is enqueued in the music pipe. * Checks if the specified chunk is enqueued in the music pipe.
*/ */
gcc_pure gcc_pure
bool Contains(const MusicChunk *chunk) const; bool Contains(const MusicChunk *chunk) const noexcept;
#endif #endif
/** /**
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <math.h> #include <math.h>
float float
ReplayGainTuple::CalculateScale(const ReplayGainConfig &config) const ReplayGainTuple::CalculateScale(const ReplayGainConfig &config) const noexcept
{ {
float scale; float scale;
......
...@@ -40,23 +40,23 @@ struct ReplayGainTuple { ...@@ -40,23 +40,23 @@ struct ReplayGainTuple {
} }
gcc_pure gcc_pure
float CalculateScale(const ReplayGainConfig &config) const; float CalculateScale(const ReplayGainConfig &config) const noexcept;
}; };
struct ReplayGainInfo { struct ReplayGainInfo {
ReplayGainTuple track, album; ReplayGainTuple track, album;
constexpr bool IsDefined() const { constexpr bool IsDefined() const noexcept {
return track.IsDefined() || album.IsDefined(); return track.IsDefined() || album.IsDefined();
} }
const ReplayGainTuple &Get(ReplayGainMode mode) const { const ReplayGainTuple &Get(ReplayGainMode mode) const noexcept {
return mode == ReplayGainMode::ALBUM return mode == ReplayGainMode::ALBUM
? (album.IsDefined() ? album : track) ? (album.IsDefined() ? album : track)
: (track.IsDefined() ? track : album); : (track.IsDefined() ? track : album);
} }
void Clear() { void Clear() noexcept {
track.Clear(); track.Clear();
album.Clear(); album.Clear();
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <string.h> #include <string.h>
const char * const char *
ToString(ReplayGainMode mode) ToString(ReplayGainMode mode) noexcept
{ {
switch (mode) { switch (mode) {
case ReplayGainMode::AUTO: case ReplayGainMode::AUTO:
......
...@@ -36,7 +36,7 @@ enum class ReplayGainMode : uint8_t { ...@@ -36,7 +36,7 @@ enum class ReplayGainMode : uint8_t {
*/ */
gcc_pure gcc_pure
const char * const char *
ToString(ReplayGainMode mode); ToString(ReplayGainMode mode) noexcept;
/** /**
* Parse a string to a #ReplayGainMode. Throws std::runtime_error on * Parse a string to a #ReplayGainMode. Throws std::runtime_error on
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#define LOCATE_TAG_ANY_KEY "any" #define LOCATE_TAG_ANY_KEY "any"
unsigned unsigned
locate_parse_type(const char *str) locate_parse_type(const char *str) noexcept
{ {
if (StringEqualsCaseASCII(str, LOCATE_TAG_FILE_KEY) || if (StringEqualsCaseASCII(str, LOCATE_TAG_FILE_KEY) ||
StringEqualsCaseASCII(str, LOCATE_TAG_FILE_KEY_OLD)) StringEqualsCaseASCII(str, LOCATE_TAG_FILE_KEY_OLD))
...@@ -78,7 +78,7 @@ SongFilter::Item::Item(unsigned _tag, time_t _time) ...@@ -78,7 +78,7 @@ SongFilter::Item::Item(unsigned _tag, time_t _time)
} }
bool bool
SongFilter::Item::StringMatch(const char *s) const SongFilter::Item::StringMatch(const char *s) const noexcept
{ {
#if !CLANG_CHECK_VERSION(3,6) #if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */ /* disabled on clang due to -Wtautological-pointer-compare */
...@@ -97,14 +97,14 @@ SongFilter::Item::StringMatch(const char *s) const ...@@ -97,14 +97,14 @@ SongFilter::Item::StringMatch(const char *s) const
} }
bool bool
SongFilter::Item::Match(const TagItem &item) const SongFilter::Item::Match(const TagItem &item) const noexcept
{ {
return (tag == LOCATE_TAG_ANY_TYPE || (unsigned)item.type == tag) && return (tag == LOCATE_TAG_ANY_TYPE || (unsigned)item.type == tag) &&
StringMatch(item.value); StringMatch(item.value);
} }
bool bool
SongFilter::Item::Match(const Tag &_tag) const SongFilter::Item::Match(const Tag &_tag) const noexcept
{ {
bool visited_types[TAG_NUM_OF_ITEM_TYPES]; bool visited_types[TAG_NUM_OF_ITEM_TYPES];
std::fill_n(visited_types, size_t(TAG_NUM_OF_ITEM_TYPES), false); std::fill_n(visited_types, size_t(TAG_NUM_OF_ITEM_TYPES), false);
...@@ -140,7 +140,7 @@ SongFilter::Item::Match(const Tag &_tag) const ...@@ -140,7 +140,7 @@ SongFilter::Item::Match(const Tag &_tag) const
} }
bool bool
SongFilter::Item::Match(const DetachedSong &song) const SongFilter::Item::Match(const DetachedSong &song) const noexcept
{ {
if (tag == LOCATE_TAG_BASE_TYPE) if (tag == LOCATE_TAG_BASE_TYPE)
return uri_is_child_or_same(value.c_str(), song.GetURI()); return uri_is_child_or_same(value.c_str(), song.GetURI());
...@@ -155,7 +155,7 @@ SongFilter::Item::Match(const DetachedSong &song) const ...@@ -155,7 +155,7 @@ SongFilter::Item::Match(const DetachedSong &song) const
} }
bool bool
SongFilter::Item::Match(const LightSong &song) const SongFilter::Item::Match(const LightSong &song) const noexcept
{ {
if (tag == LOCATE_TAG_BASE_TYPE) { if (tag == LOCATE_TAG_BASE_TYPE) {
const auto uri = song.GetURI(); const auto uri = song.GetURI();
...@@ -185,7 +185,7 @@ SongFilter::~SongFilter() ...@@ -185,7 +185,7 @@ SongFilter::~SongFilter()
gcc_pure gcc_pure
static time_t static time_t
ParseTimeStamp(const char *s) ParseTimeStamp(const char *s) noexcept
{ {
assert(s != nullptr); assert(s != nullptr);
...@@ -246,7 +246,7 @@ SongFilter::Parse(ConstBuffer<const char *> args, bool fold_case) ...@@ -246,7 +246,7 @@ SongFilter::Parse(ConstBuffer<const char *> args, bool fold_case)
} }
bool bool
SongFilter::Match(const DetachedSong &song) const SongFilter::Match(const DetachedSong &song) const noexcept
{ {
for (const auto &i : items) for (const auto &i : items)
if (!i.Match(song)) if (!i.Match(song))
...@@ -256,7 +256,7 @@ SongFilter::Match(const DetachedSong &song) const ...@@ -256,7 +256,7 @@ SongFilter::Match(const DetachedSong &song) const
} }
bool bool
SongFilter::Match(const LightSong &song) const SongFilter::Match(const LightSong &song) const noexcept
{ {
for (const auto &i : items) for (const auto &i : items)
if (!i.Match(song)) if (!i.Match(song))
...@@ -266,7 +266,7 @@ SongFilter::Match(const LightSong &song) const ...@@ -266,7 +266,7 @@ SongFilter::Match(const LightSong &song) const
} }
bool bool
SongFilter::HasOtherThanBase() const SongFilter::HasOtherThanBase() const noexcept
{ {
for (const auto &i : items) for (const auto &i : items)
if (i.GetTag() != LOCATE_TAG_BASE_TYPE) if (i.GetTag() != LOCATE_TAG_BASE_TYPE)
...@@ -276,7 +276,7 @@ SongFilter::HasOtherThanBase() const ...@@ -276,7 +276,7 @@ SongFilter::HasOtherThanBase() const
} }
const char * const char *
SongFilter::GetBase() const SongFilter::GetBase() const noexcept
{ {
for (const auto &i : items) for (const auto &i : items)
if (i.GetTag() == LOCATE_TAG_BASE_TYPE) if (i.GetTag() == LOCATE_TAG_BASE_TYPE)
......
...@@ -80,19 +80,19 @@ public: ...@@ -80,19 +80,19 @@ public:
} }
gcc_pure gcc_nonnull(2) gcc_pure gcc_nonnull(2)
bool StringMatch(const char *s) const; bool StringMatch(const char *s) const noexcept;
gcc_pure gcc_pure
bool Match(const TagItem &tag_item) const; bool Match(const TagItem &tag_item) const noexcept;
gcc_pure gcc_pure
bool Match(const Tag &tag) const; bool Match(const Tag &tag) const noexcept;
gcc_pure gcc_pure
bool Match(const DetachedSong &song) const; bool Match(const DetachedSong &song) const noexcept;
gcc_pure gcc_pure
bool Match(const LightSong &song) const; bool Match(const LightSong &song) const noexcept;
}; };
private: private:
...@@ -112,20 +112,20 @@ public: ...@@ -112,20 +112,20 @@ public:
bool Parse(ConstBuffer<const char *> args, bool fold_case=false); bool Parse(ConstBuffer<const char *> args, bool fold_case=false);
gcc_pure gcc_pure
bool Match(const Tag &tag) const; bool Match(const Tag &tag) const noexcept;
gcc_pure gcc_pure
bool Match(const DetachedSong &song) const; bool Match(const DetachedSong &song) const noexcept;
gcc_pure gcc_pure
bool Match(const LightSong &song) const; bool Match(const LightSong &song) const noexcept;
const std::list<Item> &GetItems() const { const std::list<Item> &GetItems() const noexcept {
return items; return items;
} }
gcc_pure gcc_pure
bool IsEmpty() const { bool IsEmpty() const noexcept {
return items.empty(); return items.empty();
} }
...@@ -133,7 +133,7 @@ public: ...@@ -133,7 +133,7 @@ public:
* Is there at least one item with "fold case" enabled? * Is there at least one item with "fold case" enabled?
*/ */
gcc_pure gcc_pure
bool HasFoldCase() const { bool HasFoldCase() const noexcept {
for (const auto &i : items) for (const auto &i : items)
if (i.GetFoldCase()) if (i.GetFoldCase())
return true; return true;
...@@ -145,14 +145,14 @@ public: ...@@ -145,14 +145,14 @@ public:
* Does this filter contain constraints other than "base"? * Does this filter contain constraints other than "base"?
*/ */
gcc_pure gcc_pure
bool HasOtherThanBase() const; bool HasOtherThanBase() const noexcept;
/** /**
* Returns the "base" specification (if there is one) or * Returns the "base" specification (if there is one) or
* nullptr. * nullptr.
*/ */
gcc_pure gcc_pure
const char *GetBase() const; const char *GetBase() const noexcept;
}; };
/** /**
...@@ -160,6 +160,6 @@ public: ...@@ -160,6 +160,6 @@ public:
*/ */
gcc_pure gcc_pure
unsigned unsigned
locate_parse_type(const char *str); locate_parse_type(const char *str) noexcept;
#endif #endif
...@@ -50,7 +50,7 @@ StateFile::StateFile(AllocatedPath &&_path, ...@@ -50,7 +50,7 @@ StateFile::StateFile(AllocatedPath &&_path,
} }
void void
StateFile::RememberVersions() StateFile::RememberVersions() noexcept
{ {
prev_volume_version = sw_volume_state_get_hash(); prev_volume_version = sw_volume_state_get_hash();
prev_output_version = audio_output_state_get_version(); prev_output_version = audio_output_state_get_version();
...@@ -59,7 +59,7 @@ StateFile::RememberVersions() ...@@ -59,7 +59,7 @@ StateFile::RememberVersions()
} }
bool bool
StateFile::IsModified() const StateFile::IsModified() const noexcept
{ {
return prev_volume_version != sw_volume_state_get_hash() || return prev_volume_version != sw_volume_state_get_hash() ||
prev_output_version != audio_output_state_get_version() || prev_output_version != audio_output_state_get_version() ||
......
...@@ -67,14 +67,14 @@ private: ...@@ -67,14 +67,14 @@ private:
/** /**
* Save the current state versions for use with IsModified(). * Save the current state versions for use with IsModified().
*/ */
void RememberVersions(); void RememberVersions() noexcept;
/** /**
* Check if MPD's state was modified since the last * Check if MPD's state was modified since the last
* RememberVersions() call. * RememberVersions() call.
*/ */
gcc_pure gcc_pure
bool IsModified() const; bool IsModified() const noexcept;
/* virtual methods from TimeoutMonitor */ /* virtual methods from TimeoutMonitor */
void OnTimeout() override; void OnTimeout() override;
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
gcc_pure gcc_pure
static bool static bool
CheckDecoderPlugin(const DecoderPlugin &plugin, CheckDecoderPlugin(const DecoderPlugin &plugin,
const char *suffix, const char *mime) const char *suffix, const char *mime) noexcept
{ {
return (mime != nullptr && plugin.SupportsMimeType(mime)) || return (mime != nullptr && plugin.SupportsMimeType(mime)) ||
(suffix != nullptr && plugin.SupportsSuffix(suffix)); (suffix != nullptr && plugin.SupportsSuffix(suffix));
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
gcc_pure gcc_pure
static char * static char *
FindSlash(char *p, size_t i) FindSlash(char *p, size_t i) noexcept
{ {
for (; i > 0; --i) for (; i > 0; --i)
if (p[i] == '/') if (p[i] == '/')
...@@ -39,7 +39,7 @@ FindSlash(char *p, size_t i) ...@@ -39,7 +39,7 @@ FindSlash(char *p, size_t i)
gcc_pure gcc_pure
static const char * static const char *
FindSuffix(const char *p, const char *i) FindSuffix(const char *p, const char *i) noexcept
{ {
for (; i > p; --i) { for (; i > p; --i) {
if (*i == '.') if (*i == '.')
......
...@@ -93,7 +93,7 @@ public: ...@@ -93,7 +93,7 @@ public:
~Bzip2InputStream(); ~Bzip2InputStream();
/* virtual methods from InputStream */ /* virtual methods from InputStream */
bool IsEOF() override; bool IsEOF() noexcept override;
size_t Read(void *ptr, size_t size) override; size_t Read(void *ptr, size_t size) override;
private: private:
...@@ -205,7 +205,7 @@ Bzip2InputStream::Read(void *ptr, size_t length) ...@@ -205,7 +205,7 @@ Bzip2InputStream::Read(void *ptr, size_t length)
} }
bool bool
Bzip2InputStream::IsEOF() Bzip2InputStream::IsEOF() noexcept
{ {
return eof; return eof;
} }
......
...@@ -162,7 +162,7 @@ public: ...@@ -162,7 +162,7 @@ public:
} }
/* virtual methods from InputStream */ /* virtual methods from InputStream */
bool IsEOF() override; bool IsEOF() noexcept override;
size_t Read(void *ptr, size_t size) override; size_t Read(void *ptr, size_t size) override;
}; };
...@@ -213,7 +213,7 @@ Iso9660InputStream::Read(void *ptr, size_t read_size) ...@@ -213,7 +213,7 @@ Iso9660InputStream::Read(void *ptr, size_t read_size)
} }
bool bool
Iso9660InputStream::IsEOF() Iso9660InputStream::IsEOF() noexcept
{ {
return offset == size; return offset == size;
} }
......
...@@ -116,7 +116,7 @@ struct ZzipInputStream final : public InputStream { ...@@ -116,7 +116,7 @@ struct ZzipInputStream final : public InputStream {
} }
/* virtual methods from InputStream */ /* virtual methods from InputStream */
bool IsEOF() override; bool IsEOF() noexcept override;
size_t Read(void *ptr, size_t size) override; size_t Read(void *ptr, size_t size) override;
void Seek(offset_type offset) override; void Seek(offset_type offset) override;
}; };
...@@ -147,7 +147,7 @@ ZzipInputStream::Read(void *ptr, size_t read_size) ...@@ -147,7 +147,7 @@ ZzipInputStream::Read(void *ptr, size_t read_size)
} }
bool bool
ZzipInputStream::IsEOF() ZzipInputStream::IsEOF() noexcept
{ {
return offset_type(zzip_tell(file)) == size; return offset_type(zzip_tell(file)) == size;
} }
......
...@@ -28,7 +28,7 @@ const Domain client_domain("client"); ...@@ -28,7 +28,7 @@ const Domain client_domain("client");
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
const Database * const Database *
Client::GetDatabase() const Client::GetDatabase() const noexcept
{ {
return partition.instance.GetDatabase(); return partition.instance.GetDatabase();
} }
...@@ -40,7 +40,7 @@ Client::GetDatabaseOrThrow() const ...@@ -40,7 +40,7 @@ Client::GetDatabaseOrThrow() const
} }
const Storage * const Storage *
Client::GetStorage() const Client::GetStorage() const noexcept
{ {
return partition.instance.storage; return partition.instance.storage;
} }
......
...@@ -160,7 +160,7 @@ public: ...@@ -160,7 +160,7 @@ public:
}; };
gcc_pure gcc_pure
bool IsSubscribed(const char *channel_name) const { bool IsSubscribed(const char *channel_name) const noexcept {
return subscriptions.find(channel_name) != subscriptions.end(); return subscriptions.find(channel_name) != subscriptions.end();
} }
...@@ -186,7 +186,7 @@ public: ...@@ -186,7 +186,7 @@ public:
* Wrapper for Instance::GetDatabase(). * Wrapper for Instance::GetDatabase().
*/ */
gcc_pure gcc_pure
const Database *GetDatabase() const; const Database *GetDatabase() const noexcept;
/** /**
* Wrapper for Instance::GetDatabaseOrThrow(). * Wrapper for Instance::GetDatabaseOrThrow().
...@@ -195,7 +195,7 @@ public: ...@@ -195,7 +195,7 @@ public:
const Database &GetDatabaseOrThrow() const; const Database &GetDatabaseOrThrow() const;
gcc_pure gcc_pure
const Storage *GetStorage() const; const Storage *GetStorage() const noexcept;
private: private:
/* virtual methods from class BufferedSocket */ /* virtual methods from class BufferedSocket */
......
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
gcc_const gcc_const
static bool static bool
valid_channel_char(const char ch) valid_channel_char(const char ch) noexcept
{ {
return IsAlphaNumericASCII(ch) || return IsAlphaNumericASCII(ch) ||
ch == '_' || ch == '-' || ch == '.' || ch == ':'; ch == '_' || ch == '-' || ch == '.' || ch == ':';
} }
bool bool
client_message_valid_channel_name(const char *name) client_message_valid_channel_name(const char *name) noexcept
{ {
do { do {
if (!valid_channel_char(*name)) if (!valid_channel_char(*name))
......
...@@ -53,6 +53,6 @@ public: ...@@ -53,6 +53,6 @@ public:
gcc_pure gcc_pure
bool bool
client_message_valid_channel_name(const char *name); client_message_valid_channel_name(const char *name) noexcept;
#endif #endif
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
gcc_const gcc_const
static enum ack static enum ack
ToAck(PlaylistResult result) ToAck(PlaylistResult result) noexcept
{ {
switch (result) { switch (result) {
case PlaylistResult::SUCCESS: case PlaylistResult::SUCCESS:
...@@ -90,7 +90,7 @@ ToAck(PlaylistResult result) ...@@ -90,7 +90,7 @@ ToAck(PlaylistResult result)
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
gcc_const gcc_const
static enum ack static enum ack
ToAck(DatabaseErrorCode code) ToAck(DatabaseErrorCode code) noexcept
{ {
switch (code) { switch (code) {
case DatabaseErrorCode::DISABLED: case DatabaseErrorCode::DISABLED:
...@@ -107,7 +107,7 @@ ToAck(DatabaseErrorCode code) ...@@ -107,7 +107,7 @@ ToAck(DatabaseErrorCode code)
gcc_pure gcc_pure
static enum ack static enum ack
ToAck(std::exception_ptr ep) ToAck(std::exception_ptr ep) noexcept
{ {
try { try {
std::rethrow_exception(ep); std::rethrow_exception(ep);
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
gcc_pure gcc_pure
static bool static bool
SkipNameFS(PathTraitsFS::const_pointer_type name_fs) SkipNameFS(PathTraitsFS::const_pointer_type name_fs) noexcept
{ {
return name_fs[0] == '.' && return name_fs[0] == '.' &&
(name_fs[1] == 0 || (name_fs[1] == 0 ||
...@@ -53,7 +53,7 @@ SkipNameFS(PathTraitsFS::const_pointer_type name_fs) ...@@ -53,7 +53,7 @@ SkipNameFS(PathTraitsFS::const_pointer_type name_fs)
gcc_pure gcc_pure
static bool static bool
skip_path(Path name_fs) skip_path(Path name_fs) noexcept
{ {
return name_fs.HasNewline(); return name_fs.HasNewline();
} }
...@@ -107,7 +107,7 @@ handle_listfiles_local(Response &r, Path path_fs) ...@@ -107,7 +107,7 @@ handle_listfiles_local(Response &r, Path path_fs)
gcc_pure gcc_pure
static bool static bool
IsValidName(const char *p) IsValidName(const char *p) noexcept
{ {
if (!IsAlphaASCII(*p)) if (!IsAlphaASCII(*p))
return false; return false;
...@@ -123,7 +123,7 @@ IsValidName(const char *p) ...@@ -123,7 +123,7 @@ IsValidName(const char *p)
gcc_pure gcc_pure
static bool static bool
IsValidValue(const char *p) IsValidValue(const char *p) noexcept
{ {
while (*p) { while (*p) {
const char ch = *p++; const char ch = *p++;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <string> #include <string>
bool bool
neighbor_commands_available(const Instance &instance) neighbor_commands_available(const Instance &instance) noexcept
{ {
return instance.neighbors != nullptr; return instance.neighbors != nullptr;
} }
......
...@@ -30,7 +30,7 @@ class Response; ...@@ -30,7 +30,7 @@ class Response;
gcc_pure gcc_pure
bool bool
neighbor_commands_available(const Instance &instance); neighbor_commands_available(const Instance &instance) noexcept;
CommandResult CommandResult
handle_listneighbors(Client &client, Request request, Response &response); handle_listneighbors(Client &client, Request request, Response &response);
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "util/ConstBuffer.hxx" #include "util/ConstBuffer.hxx"
bool bool
playlist_commands_available() playlist_commands_available() noexcept
{ {
return !map_spl_path().IsNull(); return !map_spl_path().IsNull();
} }
......
...@@ -29,7 +29,7 @@ class Response; ...@@ -29,7 +29,7 @@ class Response;
gcc_const gcc_const
bool bool
playlist_commands_available(); playlist_commands_available() noexcept;
CommandResult CommandResult
handle_save(Client &client, Request request, Response &response); handle_save(Client &client, Request request, Response &response);
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
gcc_pure gcc_pure
static bool static bool
skip_path(const char *name_utf8) skip_path(const char *name_utf8) noexcept
{ {
return strchr(name_utf8, '\n') != nullptr; return strchr(name_utf8, '\n') != nullptr;
} }
......
...@@ -68,7 +68,7 @@ ConfigBlock::~ConfigBlock() ...@@ -68,7 +68,7 @@ ConfigBlock::~ConfigBlock()
} }
const BlockParam * const BlockParam *
ConfigBlock::GetBlockParam(const char *name) const ConfigBlock::GetBlockParam(const char *name) const noexcept
{ {
for (const auto &i : block_params) { for (const auto &i : block_params) {
if (i.name == name) { if (i.name == name) {
...@@ -81,7 +81,8 @@ ConfigBlock::GetBlockParam(const char *name) const ...@@ -81,7 +81,8 @@ ConfigBlock::GetBlockParam(const char *name) const
} }
const char * const char *
ConfigBlock::GetBlockValue(const char *name, const char *default_value) const ConfigBlock::GetBlockValue(const char *name,
const char *default_value) const noexcept
{ {
const BlockParam *bp = GetBlockParam(name); const BlockParam *bp = GetBlockParam(name);
if (bp == nullptr) if (bp == nullptr)
......
...@@ -101,11 +101,11 @@ struct ConfigBlock { ...@@ -101,11 +101,11 @@ struct ConfigBlock {
} }
gcc_nonnull_all gcc_pure gcc_nonnull_all gcc_pure
const BlockParam *GetBlockParam(const char *_name) const; const BlockParam *GetBlockParam(const char *_name) const noexcept;
gcc_pure gcc_pure
const char *GetBlockValue(const char *name, const char *GetBlockValue(const char *name,
const char *default_value=nullptr) const; const char *default_value=nullptr) const noexcept;
/** /**
* Same as config_get_path(), but looks up the setting in the * Same as config_get_path(), but looks up the setting in the
......
...@@ -75,7 +75,7 @@ void config_global_check(void) ...@@ -75,7 +75,7 @@ void config_global_check(void)
} }
const ConfigParam * const ConfigParam *
config_get_param(ConfigOption option) config_get_param(ConfigOption option) noexcept
{ {
auto *param = config_data.params[unsigned(option)]; auto *param = config_data.params[unsigned(option)];
if (param != nullptr) if (param != nullptr)
...@@ -84,7 +84,7 @@ config_get_param(ConfigOption option) ...@@ -84,7 +84,7 @@ config_get_param(ConfigOption option)
} }
const ConfigBlock * const ConfigBlock *
config_get_block(ConfigBlockOption option) config_get_block(ConfigBlockOption option) noexcept
{ {
ConfigBlock *block = config_data.blocks[unsigned(option)]; ConfigBlock *block = config_data.blocks[unsigned(option)];
if (block != nullptr) if (block != nullptr)
...@@ -110,7 +110,7 @@ config_find_block(ConfigBlockOption option, const char *key, const char *value) ...@@ -110,7 +110,7 @@ config_find_block(ConfigBlockOption option, const char *key, const char *value)
} }
const char * const char *
config_get_string(ConfigOption option, const char *default_value) config_get_string(ConfigOption option, const char *default_value) noexcept
{ {
const auto *param = config_get_param(option); const auto *param = config_get_param(option);
......
...@@ -48,11 +48,11 @@ ReadConfigFile(Path path); ...@@ -48,11 +48,11 @@ ReadConfigFile(Path path);
gcc_pure gcc_pure
const ConfigParam * const ConfigParam *
config_get_param(enum ConfigOption option); config_get_param(enum ConfigOption option) noexcept;
gcc_pure gcc_pure
const ConfigBlock * const ConfigBlock *
config_get_block(enum ConfigBlockOption option); config_get_block(enum ConfigBlockOption option) noexcept;
/** /**
* Find a block with a matching attribute. * Find a block with a matching attribute.
...@@ -74,7 +74,8 @@ config_find_block(ConfigBlockOption option, const char *key, const char *value); ...@@ -74,7 +74,8 @@ config_find_block(ConfigBlockOption option, const char *key, const char *value);
gcc_pure gcc_pure
const char * const char *
config_get_string(enum ConfigOption option, const char *default_value=nullptr); config_get_string(enum ConfigOption option,
const char *default_value=nullptr) noexcept;
/** /**
* Returns an optional configuration variable which contains an * Returns an optional configuration variable which contains an
......
...@@ -102,13 +102,13 @@ enum class ConfigBlockOption { ...@@ -102,13 +102,13 @@ enum class ConfigBlockOption {
*/ */
gcc_pure gcc_pure
enum ConfigOption enum ConfigOption
ParseConfigOptionName(const char *name); ParseConfigOptionName(const char *name) noexcept;
/** /**
* @return #ConfigOption::MAX if not found * @return #ConfigOption::MAX if not found
*/ */
gcc_pure gcc_pure
enum ConfigBlockOption enum ConfigBlockOption
ParseConfigBlockOptionName(const char *name); ParseConfigBlockOptionName(const char *name) noexcept;
#endif #endif
...@@ -101,7 +101,7 @@ static_assert(n_config_block_templates == unsigned(ConfigBlockOption::MAX), ...@@ -101,7 +101,7 @@ static_assert(n_config_block_templates == unsigned(ConfigBlockOption::MAX),
gcc_pure gcc_pure
static inline unsigned static inline unsigned
ParseConfigTemplateName(const ConfigTemplate templates[], unsigned count, ParseConfigTemplateName(const ConfigTemplate templates[], unsigned count,
const char *name) const char *name) noexcept
{ {
unsigned i = 0; unsigned i = 0;
for (; i < count; ++i) for (; i < count; ++i)
...@@ -112,7 +112,7 @@ ParseConfigTemplateName(const ConfigTemplate templates[], unsigned count, ...@@ -112,7 +112,7 @@ ParseConfigTemplateName(const ConfigTemplate templates[], unsigned count,
} }
ConfigOption ConfigOption
ParseConfigOptionName(const char *name) ParseConfigOptionName(const char *name) noexcept
{ {
return ConfigOption(ParseConfigTemplateName(config_param_templates, return ConfigOption(ParseConfigTemplateName(config_param_templates,
n_config_param_templates, n_config_param_templates,
...@@ -120,7 +120,7 @@ ParseConfigOptionName(const char *name) ...@@ -120,7 +120,7 @@ ParseConfigOptionName(const char *name)
} }
ConfigBlockOption ConfigBlockOption
ParseConfigBlockOptionName(const char *name) ParseConfigBlockOptionName(const char *name) noexcept
{ {
return ConfigBlockOption(ParseConfigTemplateName(config_block_templates, return ConfigBlockOption(ParseConfigTemplateName(config_block_templates,
n_config_block_templates, n_config_block_templates,
......
...@@ -45,7 +45,7 @@ extern ThreadId db_mutex_holder; ...@@ -45,7 +45,7 @@ extern ThreadId db_mutex_holder;
*/ */
gcc_pure gcc_pure
static inline bool static inline bool
holding_db_lock(void) holding_db_lock() noexcept
{ {
return db_mutex_holder.IsInside(); return db_mutex_holder.IsInside();
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "tag/Tag.hxx" #include "tag/Tag.hxx"
SignedSongTime SignedSongTime
LightSong::GetDuration() const LightSong::GetDuration() const noexcept
{ {
SongTime a = start_time, b = end_time; SongTime a = start_time, b = end_time;
if (!b.IsPositive()) { if (!b.IsPositive()) {
......
...@@ -76,7 +76,7 @@ struct LightSong { ...@@ -76,7 +76,7 @@ struct LightSong {
SongTime end_time; SongTime end_time;
gcc_pure gcc_pure
std::string GetURI() const { std::string GetURI() const noexcept {
if (directory == nullptr) if (directory == nullptr)
return std::string(uri); return std::string(uri);
...@@ -87,7 +87,7 @@ struct LightSong { ...@@ -87,7 +87,7 @@ struct LightSong {
} }
gcc_pure gcc_pure
SignedSongTime GetDuration() const; SignedSongTime GetDuration() const noexcept;
}; };
#endif #endif
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <assert.h> #include <assert.h>
PlaylistVector::iterator PlaylistVector::iterator
PlaylistVector::find(const char *name) PlaylistVector::find(const char *name) noexcept
{ {
assert(holding_db_lock()); assert(holding_db_lock());
assert(name != nullptr); assert(name != nullptr);
......
...@@ -31,7 +31,7 @@ protected: ...@@ -31,7 +31,7 @@ protected:
* Caller must lock the #db_mutex. * Caller must lock the #db_mutex.
*/ */
gcc_pure gcc_pure
iterator find(const char *name); iterator find(const char *name) noexcept;
public: public:
using std::list<PlaylistInfo>::empty; using std::list<PlaylistInfo>::empty;
......
...@@ -38,7 +38,7 @@ const DatabasePlugin *const database_plugins[] = { ...@@ -38,7 +38,7 @@ const DatabasePlugin *const database_plugins[] = {
}; };
const DatabasePlugin * const DatabasePlugin *
GetDatabasePluginByName(const char *name) GetDatabasePluginByName(const char *name) noexcept
{ {
for (auto i = database_plugins; *i != nullptr; ++i) for (auto i = database_plugins; *i != nullptr; ++i)
if (strcmp((*i)->name, name) == 0) if (strcmp((*i)->name, name) == 0)
......
...@@ -32,6 +32,6 @@ extern const DatabasePlugin *const database_plugins[]; ...@@ -32,6 +32,6 @@ extern const DatabasePlugin *const database_plugins[];
gcc_pure gcc_pure
const DatabasePlugin * const DatabasePlugin *
GetDatabasePluginByName(const char *name); GetDatabasePluginByName(const char *name) noexcept;
#endif #endif
...@@ -34,19 +34,19 @@ DatabaseSelection::DatabaseSelection(const char *_uri, bool _recursive, ...@@ -34,19 +34,19 @@ DatabaseSelection::DatabaseSelection(const char *_uri, bool _recursive,
} }
bool bool
DatabaseSelection::IsEmpty() const DatabaseSelection::IsEmpty() const noexcept
{ {
return uri.empty() && (filter == nullptr || filter->IsEmpty()); return uri.empty() && (filter == nullptr || filter->IsEmpty());
} }
bool bool
DatabaseSelection::HasOtherThanBase() const DatabaseSelection::HasOtherThanBase() const noexcept
{ {
return filter != nullptr && filter->HasOtherThanBase(); return filter != nullptr && filter->HasOtherThanBase();
} }
bool bool
DatabaseSelection::Match(const LightSong &song) const DatabaseSelection::Match(const LightSong &song) const noexcept
{ {
return filter == nullptr || filter->Match(song); return filter == nullptr || filter->Match(song);
} }
...@@ -45,16 +45,16 @@ struct DatabaseSelection { ...@@ -45,16 +45,16 @@ struct DatabaseSelection {
const SongFilter *_filter=nullptr); const SongFilter *_filter=nullptr);
gcc_pure gcc_pure
bool IsEmpty() const; bool IsEmpty() const noexcept;
/** /**
* Does this selection contain constraints other than "base"? * Does this selection contain constraints other than "base"?
*/ */
gcc_pure gcc_pure
bool HasOtherThanBase() const; bool HasOtherThanBase() const noexcept;
gcc_pure gcc_pure
bool Match(const LightSong &song) const; bool Match(const LightSong &song) const noexcept;
}; };
#endif #endif
...@@ -216,7 +216,7 @@ ProxySong::ProxySong(const mpd_song *song) ...@@ -216,7 +216,7 @@ ProxySong::ProxySong(const mpd_song *song)
gcc_const gcc_const
static enum mpd_tag_type static enum mpd_tag_type
Convert(TagType tag_type) Convert(TagType tag_type) noexcept
{ {
for (auto i = &tag_table[0]; i->d != TAG_NUM_OF_ITEM_TYPES; ++i) for (auto i = &tag_table[0]; i->d != TAG_NUM_OF_ITEM_TYPES; ++i)
if (i->d == tag_type) if (i->d == tag_type)
...@@ -574,7 +574,7 @@ Visit(struct mpd_connection *connection, ...@@ -574,7 +574,7 @@ Visit(struct mpd_connection *connection,
gcc_pure gcc_pure
static bool static bool
Match(const SongFilter *filter, const LightSong &song) Match(const SongFilter *filter, const LightSong &song) noexcept
{ {
return filter == nullptr || filter->Match(song); return filter == nullptr || filter->Match(song);
} }
...@@ -717,7 +717,7 @@ SearchSongs(struct mpd_connection *connection, ...@@ -717,7 +717,7 @@ SearchSongs(struct mpd_connection *connection,
*/ */
gcc_pure gcc_pure
static bool static bool
ServerSupportsSearchBase(const struct mpd_connection *connection) ServerSupportsSearchBase(const struct mpd_connection *connection) noexcept
{ {
#if LIBMPDCLIENT_CHECK_VERSION(2,9,0) #if LIBMPDCLIENT_CHECK_VERSION(2,9,0)
return mpd_connection_cmp_server_version(connection, 0, 18, 0) >= 0; return mpd_connection_cmp_server_version(connection, 0, 18, 0) >= 0;
......
...@@ -65,7 +65,7 @@ Directory::Delete() ...@@ -65,7 +65,7 @@ Directory::Delete()
} }
const char * const char *
Directory::GetName() const Directory::GetName() const noexcept
{ {
assert(!IsRoot()); assert(!IsRoot());
...@@ -89,7 +89,7 @@ Directory::CreateChild(const char *name_utf8) ...@@ -89,7 +89,7 @@ Directory::CreateChild(const char *name_utf8)
} }
const Directory * const Directory *
Directory::FindChild(const char *name) const Directory::FindChild(const char *name) const noexcept
{ {
assert(holding_db_lock()); assert(holding_db_lock());
...@@ -101,7 +101,7 @@ Directory::FindChild(const char *name) const ...@@ -101,7 +101,7 @@ Directory::FindChild(const char *name) const
} }
void void
Directory::PruneEmpty() Directory::PruneEmpty() noexcept
{ {
assert(holding_db_lock()); assert(holding_db_lock());
...@@ -118,7 +118,7 @@ Directory::PruneEmpty() ...@@ -118,7 +118,7 @@ Directory::PruneEmpty()
} }
Directory::LookupResult Directory::LookupResult
Directory::LookupDirectory(const char *uri) Directory::LookupDirectory(const char *uri) noexcept
{ {
assert(holding_db_lock()); assert(holding_db_lock());
assert(uri != nullptr); assert(uri != nullptr);
...@@ -173,7 +173,7 @@ Directory::AddSong(Song *song) ...@@ -173,7 +173,7 @@ Directory::AddSong(Song *song)
} }
void void
Directory::RemoveSong(Song *song) Directory::RemoveSong(Song *song) noexcept
{ {
assert(holding_db_lock()); assert(holding_db_lock());
assert(song != nullptr); assert(song != nullptr);
...@@ -183,7 +183,7 @@ Directory::RemoveSong(Song *song) ...@@ -183,7 +183,7 @@ Directory::RemoveSong(Song *song)
} }
const Song * const Song *
Directory::FindSong(const char *name_utf8) const Directory::FindSong(const char *name_utf8) const noexcept
{ {
assert(holding_db_lock()); assert(holding_db_lock());
assert(name_utf8 != nullptr); assert(name_utf8 != nullptr);
...@@ -200,13 +200,13 @@ Directory::FindSong(const char *name_utf8) const ...@@ -200,13 +200,13 @@ Directory::FindSong(const char *name_utf8) const
gcc_pure gcc_pure
static bool static bool
directory_cmp(const Directory &a, const Directory &b) directory_cmp(const Directory &a, const Directory &b) noexcept
{ {
return IcuCollate(a.path.c_str(), b.path.c_str()) < 0; return IcuCollate(a.path.c_str(), b.path.c_str()) < 0;
} }
void void
Directory::Sort() Directory::Sort() noexcept
{ {
assert(holding_db_lock()); assert(holding_db_lock());
...@@ -261,7 +261,7 @@ Directory::Walk(bool recursive, const SongFilter *filter, ...@@ -261,7 +261,7 @@ Directory::Walk(bool recursive, const SongFilter *filter,
} }
LightDirectory LightDirectory
Directory::Export() const Directory::Export() const noexcept
{ {
return LightDirectory(GetPath(), mtime); return LightDirectory(GetPath(), mtime);
} }
...@@ -134,10 +134,10 @@ public: ...@@ -134,10 +134,10 @@ public:
* Caller must lock the #db_mutex. * Caller must lock the #db_mutex.
*/ */
gcc_pure gcc_pure
const Directory *FindChild(const char *name) const; const Directory *FindChild(const char *name) const noexcept;
gcc_pure gcc_pure
Directory *FindChild(const char *name) { Directory *FindChild(const char *name) noexcept {
const Directory *cthis = this; const Directory *cthis = this;
return const_cast<Directory *>(cthis->FindChild(name)); return const_cast<Directory *>(cthis->FindChild(name));
} }
...@@ -177,10 +177,10 @@ public: ...@@ -177,10 +177,10 @@ public:
* @return the Directory, or nullptr if none was found * @return the Directory, or nullptr if none was found
*/ */
gcc_pure gcc_pure
LookupResult LookupDirectory(const char *uri); LookupResult LookupDirectory(const char *uri) noexcept;
gcc_pure gcc_pure
bool IsEmpty() const { bool IsEmpty() const noexcept {
return children.empty() && return children.empty() &&
songs.empty() && songs.empty() &&
playlists.empty(); playlists.empty();
...@@ -195,13 +195,13 @@ public: ...@@ -195,13 +195,13 @@ public:
* Returns the base name of the directory. * Returns the base name of the directory.
*/ */
gcc_pure gcc_pure
const char *GetName() const; const char *GetName() const noexcept;
/** /**
* Is this the root directory of the music database? * Is this the root directory of the music database?
*/ */
gcc_pure gcc_pure
bool IsRoot() const { bool IsRoot() const noexcept {
return parent == nullptr; return parent == nullptr;
} }
...@@ -229,10 +229,10 @@ public: ...@@ -229,10 +229,10 @@ public:
* Caller must lock the #db_mutex. * Caller must lock the #db_mutex.
*/ */
gcc_pure gcc_pure
const Song *FindSong(const char *name_utf8) const; const Song *FindSong(const char *name_utf8) const noexcept;
gcc_pure gcc_pure
Song *FindSong(const char *name_utf8) { Song *FindSong(const char *name_utf8) noexcept {
const Directory *cthis = this; const Directory *cthis = this;
return const_cast<Song *>(cthis->FindSong(name_utf8)); return const_cast<Song *>(cthis->FindSong(name_utf8));
} }
...@@ -248,19 +248,19 @@ public: ...@@ -248,19 +248,19 @@ public:
* invalidates the song object, because the "parent" attribute becomes * invalidates the song object, because the "parent" attribute becomes
* stale), but does not free it. * stale), but does not free it.
*/ */
void RemoveSong(Song *song); void RemoveSong(Song *song) noexcept;
/** /**
* Caller must lock the #db_mutex. * Caller must lock the #db_mutex.
*/ */
void PruneEmpty(); void PruneEmpty() noexcept;
/** /**
* Sort all directory entries recursively. * Sort all directory entries recursively.
* *
* Caller must lock the #db_mutex. * Caller must lock the #db_mutex.
*/ */
void Sort(); void Sort() noexcept;
/** /**
* Caller must lock #db_mutex. * Caller must lock #db_mutex.
...@@ -270,7 +270,7 @@ public: ...@@ -270,7 +270,7 @@ public:
VisitPlaylist visit_playlist) const; VisitPlaylist visit_playlist) const;
gcc_pure gcc_pure
LightDirectory Export() const; LightDirectory Export() const noexcept;
}; };
#endif #endif
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
gcc_const gcc_const
static const char * static const char *
DeviceToTypeString(unsigned device) DeviceToTypeString(unsigned device) noexcept
{ {
switch (device) { switch (device) {
case DEVICE_INARCHIVE: case DEVICE_INARCHIVE:
...@@ -56,7 +56,7 @@ DeviceToTypeString(unsigned device) ...@@ -56,7 +56,7 @@ DeviceToTypeString(unsigned device)
gcc_pure gcc_pure
static unsigned static unsigned
ParseTypeString(const char *type) ParseTypeString(const char *type) noexcept
{ {
if (strcmp(type, "archive") == 0) if (strcmp(type, "archive") == 0)
return DEVICE_INARCHIVE; return DEVICE_INARCHIVE;
......
...@@ -77,7 +77,7 @@ Song::Free() ...@@ -77,7 +77,7 @@ Song::Free()
} }
std::string std::string
Song::GetURI() const Song::GetURI() const noexcept
{ {
assert(*uri); assert(*uri);
...@@ -96,7 +96,7 @@ Song::GetURI() const ...@@ -96,7 +96,7 @@ Song::GetURI() const
} }
LightSong LightSong
Song::Export() const Song::Export() const noexcept
{ {
LightSong dest; LightSong dest;
dest.directory = parent->IsRoot() dest.directory = parent->IsRoot()
......
...@@ -123,10 +123,10 @@ struct Song { ...@@ -123,10 +123,10 @@ struct Song {
* location within the music directory. * location within the music directory.
*/ */
gcc_pure gcc_pure
std::string GetURI() const; std::string GetURI() const noexcept;
gcc_pure gcc_pure
LightSong Export() const; LightSong Export() const noexcept;
}; };
typedef boost::intrusive::list<Song, typedef boost::intrusive::list<Song,
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
static int static int
compare_utf8_string(const char *a, const char *b) compare_utf8_string(const char *a, const char *b) noexcept
{ {
if (a == nullptr) if (a == nullptr)
return b == nullptr ? 0 : -1; return b == nullptr ? 0 : -1;
...@@ -42,8 +42,7 @@ compare_utf8_string(const char *a, const char *b) ...@@ -42,8 +42,7 @@ compare_utf8_string(const char *a, const char *b)
* nullptr. * nullptr.
*/ */
static int static int
compare_string_tag_item(const Tag &a, const Tag &b, compare_string_tag_item(const Tag &a, const Tag &b, TagType type) noexcept
TagType type)
{ {
return compare_utf8_string(a.GetValue(type), return compare_utf8_string(a.GetValue(type),
b.GetValue(type)); b.GetValue(type));
...@@ -54,7 +53,7 @@ compare_string_tag_item(const Tag &a, const Tag &b, ...@@ -54,7 +53,7 @@ compare_string_tag_item(const Tag &a, const Tag &b,
* (e.g. disc or track number). Either one may be nullptr. * (e.g. disc or track number). Either one may be nullptr.
*/ */
static int static int
compare_number_string(const char *a, const char *b) compare_number_string(const char *a, const char *b) noexcept
{ {
long ai = a == nullptr ? 0 : strtol(a, nullptr, 10); long ai = a == nullptr ? 0 : strtol(a, nullptr, 10);
long bi = b == nullptr ? 0 : strtol(b, nullptr, 10); long bi = b == nullptr ? 0 : strtol(b, nullptr, 10);
...@@ -69,7 +68,7 @@ compare_number_string(const char *a, const char *b) ...@@ -69,7 +68,7 @@ compare_number_string(const char *a, const char *b)
} }
static int static int
compare_tag_item(const Tag &a, const Tag &b, TagType type) compare_tag_item(const Tag &a, const Tag &b, TagType type) noexcept
{ {
return compare_number_string(a.GetValue(type), return compare_number_string(a.GetValue(type),
b.GetValue(type)); b.GetValue(type));
...@@ -78,7 +77,7 @@ compare_tag_item(const Tag &a, const Tag &b, TagType type) ...@@ -78,7 +77,7 @@ compare_tag_item(const Tag &a, const Tag &b, TagType type)
/* Only used for sorting/searchin a songvec, not general purpose compares */ /* Only used for sorting/searchin a songvec, not general purpose compares */
gcc_pure gcc_pure
static bool static bool
song_cmp(const Song &a, const Song &b) song_cmp(const Song &a, const Song &b) noexcept
{ {
int ret; int ret;
...@@ -102,7 +101,7 @@ song_cmp(const Song &a, const Song &b) ...@@ -102,7 +101,7 @@ song_cmp(const Song &a, const Song &b)
} }
void void
song_list_sort(SongList &songs) song_list_sort(SongList &songs) noexcept
{ {
songs.sort(song_cmp); songs.sort(song_cmp);
} }
...@@ -23,6 +23,6 @@ ...@@ -23,6 +23,6 @@
#include "Song.hxx" #include "Song.hxx"
void void
song_list_sort(SongList &songs); song_list_sort(SongList &songs) noexcept;
#endif #endif
...@@ -39,7 +39,7 @@ UPnPDirContent::~UPnPDirContent() ...@@ -39,7 +39,7 @@ UPnPDirContent::~UPnPDirContent()
gcc_pure gcc_pure
static UPnPDirObject::ItemClass static UPnPDirObject::ItemClass
ParseItemClass(StringView name) ParseItemClass(StringView name) noexcept
{ {
if (name.EqualsLiteral("object.item.audioItem.musicTrack")) if (name.EqualsLiteral("object.item.audioItem.musicTrack"))
return UPnPDirObject::ItemClass::MUSIC; return UPnPDirObject::ItemClass::MUSIC;
...@@ -51,7 +51,7 @@ ParseItemClass(StringView name) ...@@ -51,7 +51,7 @@ ParseItemClass(StringView name)
gcc_pure gcc_pure
static SignedSongTime static SignedSongTime
ParseDuration(const char *duration) ParseDuration(const char *duration) noexcept
{ {
char *endptr; char *endptr;
...@@ -81,7 +81,7 @@ ParseDuration(const char *duration) ...@@ -81,7 +81,7 @@ ParseDuration(const char *duration)
*/ */
gcc_pure gcc_pure
static std::string && static std::string &&
TitleToPathSegment(std::string &&s) TitleToPathSegment(std::string &&s) noexcept
{ {
std::replace(s.begin(), s.end(), '/', '_'); std::replace(s.begin(), s.end(), '/', '_');
return std::move(s); return std::move(s);
......
...@@ -40,7 +40,7 @@ public: ...@@ -40,7 +40,7 @@ public:
~UPnPDirContent(); ~UPnPDirContent();
gcc_pure gcc_pure
UPnPDirObject *FindObject(const char *name) { UPnPDirObject *FindObject(const char *name) noexcept {
for (auto &o : objects) for (auto &o : objects)
if (o.name == name) if (o.name == name)
return &o; return &o;
......
...@@ -56,7 +56,7 @@ InotifyQueue::OnTimeout() ...@@ -56,7 +56,7 @@ InotifyQueue::OnTimeout()
gcc_pure gcc_pure
static bool static bool
path_in(const char *path, const char *possible_parent) path_in(const char *path, const char *possible_parent) noexcept
{ {
if (StringIsEmpty(path)) if (StringIsEmpty(path))
return true; return true;
......
...@@ -62,10 +62,10 @@ struct WatchDirectory { ...@@ -62,10 +62,10 @@ struct WatchDirectory {
WatchDirectory &operator=(const WatchDirectory &) = delete; WatchDirectory &operator=(const WatchDirectory &) = delete;
gcc_pure gcc_pure
unsigned GetDepth() const; unsigned GetDepth() const noexcept;
gcc_pure gcc_pure
AllocatedPath GetUriFS() const; AllocatedPath GetUriFS() const noexcept;
}; };
static InotifySource *inotify_source; static InotifySource *inotify_source;
...@@ -132,7 +132,7 @@ remove_watch_directory(WatchDirectory *directory) ...@@ -132,7 +132,7 @@ remove_watch_directory(WatchDirectory *directory)
} }
AllocatedPath AllocatedPath
WatchDirectory::GetUriFS() const WatchDirectory::GetUriFS() const noexcept
{ {
if (parent == nullptr) if (parent == nullptr)
return AllocatedPath::Null(); return AllocatedPath::Null();
...@@ -225,7 +225,7 @@ recursive_watch_subdirectories(WatchDirectory *directory, ...@@ -225,7 +225,7 @@ recursive_watch_subdirectories(WatchDirectory *directory,
gcc_pure gcc_pure
unsigned unsigned
WatchDirectory::GetDepth() const WatchDirectory::GetDepth() const noexcept
{ {
const WatchDirectory *d = this; const WatchDirectory *d = this;
unsigned depth = 0; unsigned depth = 0;
...@@ -331,7 +331,7 @@ mpd_inotify_init(EventLoop &loop, Storage &storage, UpdateService &update, ...@@ -331,7 +331,7 @@ mpd_inotify_init(EventLoop &loop, Storage &storage, UpdateService &update,
} }
void void
mpd_inotify_finish(void) mpd_inotify_finish(void) noexcept
{ {
if (inotify_source == nullptr) if (inotify_source == nullptr)
return; return;
......
...@@ -32,6 +32,6 @@ mpd_inotify_init(EventLoop &loop, Storage &storage, UpdateService &update, ...@@ -32,6 +32,6 @@ mpd_inotify_init(EventLoop &loop, Storage &storage, UpdateService &update,
unsigned max_depth); unsigned max_depth);
void void
mpd_inotify_finish(); mpd_inotify_finish() noexcept;
#endif #endif
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <errno.h> #include <errno.h>
bool bool
GetInfo(Storage &storage, const char *uri_utf8, StorageFileInfo &info) GetInfo(Storage &storage, const char *uri_utf8, StorageFileInfo &info) noexcept
try { try {
info = storage.GetInfo(uri_utf8, true); info = storage.GetInfo(uri_utf8, true);
return true; return true;
...@@ -42,7 +42,7 @@ try { ...@@ -42,7 +42,7 @@ try {
} }
bool bool
GetInfo(StorageDirectoryReader &reader, StorageFileInfo &info) GetInfo(StorageDirectoryReader &reader, StorageFileInfo &info) noexcept
try { try {
info = reader.GetInfo(true); info = reader.GetInfo(true);
return true; return true;
...@@ -52,7 +52,7 @@ try { ...@@ -52,7 +52,7 @@ try {
} }
bool bool
DirectoryExists(Storage &storage, const Directory &directory) DirectoryExists(Storage &storage, const Directory &directory) noexcept
{ {
StorageFileInfo info; StorageFileInfo info;
...@@ -79,7 +79,7 @@ GetDirectoryChildInfo(Storage &storage, const Directory &directory, ...@@ -79,7 +79,7 @@ GetDirectoryChildInfo(Storage &storage, const Directory &directory,
bool bool
directory_child_is_regular(Storage &storage, const Directory &directory, directory_child_is_regular(Storage &storage, const Directory &directory,
const char *name_utf8) const char *name_utf8) noexcept
try { try {
return GetDirectoryChildInfo(storage, directory, name_utf8) return GetDirectoryChildInfo(storage, directory, name_utf8)
.IsRegular(); .IsRegular();
...@@ -89,7 +89,7 @@ try { ...@@ -89,7 +89,7 @@ try {
bool bool
directory_child_access(Storage &storage, const Directory &directory, directory_child_access(Storage &storage, const Directory &directory,
const char *name, int mode) const char *name, int mode) noexcept
{ {
#ifdef WIN32 #ifdef WIN32
/* CheckAccess() is useless on WIN32 */ /* CheckAccess() is useless on WIN32 */
......
...@@ -33,23 +33,23 @@ class StorageDirectoryReader; ...@@ -33,23 +33,23 @@ class StorageDirectoryReader;
* returning them. * returning them.
*/ */
bool bool
GetInfo(Storage &storage, const char *uri_utf8, StorageFileInfo &info); GetInfo(Storage &storage, const char *uri_utf8, StorageFileInfo &info) noexcept;
/** /**
* Wrapper for LocalDirectoryReader::GetInfo() that logs errors * Wrapper for LocalDirectoryReader::GetInfo() that logs errors
* instead of returning them. * instead of returning them.
*/ */
bool bool
GetInfo(StorageDirectoryReader &reader, StorageFileInfo &info); GetInfo(StorageDirectoryReader &reader, StorageFileInfo &info) noexcept;
gcc_pure gcc_pure
bool bool
DirectoryExists(Storage &storage, const Directory &directory); DirectoryExists(Storage &storage, const Directory &directory) noexcept;
gcc_pure gcc_pure
bool bool
directory_child_is_regular(Storage &storage, const Directory &directory, directory_child_is_regular(Storage &storage, const Directory &directory,
const char *name_utf8); const char *name_utf8) noexcept;
/** /**
* Checks if the given permissions on the mapped file are given. * Checks if the given permissions on the mapped file are given.
...@@ -57,6 +57,6 @@ directory_child_is_regular(Storage &storage, const Directory &directory, ...@@ -57,6 +57,6 @@ directory_child_is_regular(Storage &storage, const Directory &directory,
gcc_pure gcc_pure
bool bool
directory_child_access(Storage &storage, const Directory &directory, directory_child_access(Storage &storage, const Directory &directory,
const char *name, int mode); const char *name, int mode) noexcept;
#endif #endif
...@@ -248,7 +248,7 @@ try { ...@@ -248,7 +248,7 @@ try {
/* we don't look at "." / ".." nor files with newlines in their name */ /* we don't look at "." / ".." nor files with newlines in their name */
gcc_pure gcc_pure
static bool static bool
skip_path(const char *name_utf8) skip_path(const char *name_utf8) noexcept
{ {
return strchr(name_utf8, '\n') != nullptr; return strchr(name_utf8, '\n') != nullptr;
} }
...@@ -256,7 +256,7 @@ skip_path(const char *name_utf8) ...@@ -256,7 +256,7 @@ skip_path(const char *name_utf8)
gcc_pure gcc_pure
bool bool
UpdateWalk::SkipSymlink(const Directory *directory, UpdateWalk::SkipSymlink(const Directory *directory,
const char *utf8_name) const const char *utf8_name) const noexcept
{ {
#ifndef WIN32 #ifndef WIN32
const auto path_fs = storage.MapChildFS(directory->GetPath(), const auto path_fs = storage.MapChildFS(directory->GetPath(),
......
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
private: private:
gcc_pure gcc_pure
bool SkipSymlink(const Directory *directory, bool SkipSymlink(const Directory *directory,
const char *utf8_name) const; const char *utf8_name) const noexcept;
void RemoveExcludedFromDirectory(Directory &directory, void RemoveExcludedFromDirectory(Directory &directory,
const ExcludeList &exclude_list); const ExcludeList &exclude_list);
......
...@@ -54,7 +54,7 @@ DecoderBridge::~DecoderBridge() ...@@ -54,7 +54,7 @@ DecoderBridge::~DecoderBridge()
} }
bool bool
DecoderBridge::CheckCancelRead() const DecoderBridge::CheckCancelRead() const noexcept
{ {
if (error) if (error)
/* this translates to DecoderCommand::STOP */ /* this translates to DecoderCommand::STOP */
...@@ -78,7 +78,7 @@ DecoderBridge::CheckCancelRead() const ...@@ -78,7 +78,7 @@ DecoderBridge::CheckCancelRead() const
* one. * one.
*/ */
static DecoderCommand static DecoderCommand
need_chunks(DecoderControl &dc) need_chunks(DecoderControl &dc) noexcept
{ {
if (dc.command == DecoderCommand::NONE) if (dc.command == DecoderCommand::NONE)
dc.Wait(); dc.Wait();
...@@ -87,14 +87,14 @@ need_chunks(DecoderControl &dc) ...@@ -87,14 +87,14 @@ need_chunks(DecoderControl &dc)
} }
static DecoderCommand static DecoderCommand
LockNeedChunks(DecoderControl &dc) LockNeedChunks(DecoderControl &dc) noexcept
{ {
const std::lock_guard<Mutex> protect(dc.mutex); const std::lock_guard<Mutex> protect(dc.mutex);
return need_chunks(dc); return need_chunks(dc);
} }
MusicChunk * MusicChunk *
DecoderBridge::GetChunk() DecoderBridge::GetChunk() noexcept
{ {
DecoderCommand cmd; DecoderCommand cmd;
...@@ -177,7 +177,7 @@ DecoderBridge::PrepareInitialSeek() ...@@ -177,7 +177,7 @@ DecoderBridge::PrepareInitialSeek()
} }
DecoderCommand DecoderCommand
DecoderBridge::GetVirtualCommand() DecoderBridge::GetVirtualCommand() noexcept
{ {
if (error) if (error)
/* an error has occurred: stop the decoder plugin */ /* an error has occurred: stop the decoder plugin */
...@@ -192,7 +192,7 @@ DecoderBridge::GetVirtualCommand() ...@@ -192,7 +192,7 @@ DecoderBridge::GetVirtualCommand()
} }
DecoderCommand DecoderCommand
DecoderBridge::LockGetVirtualCommand() DecoderBridge::LockGetVirtualCommand() noexcept
{ {
const std::lock_guard<Mutex> protect(dc.mutex); const std::lock_guard<Mutex> protect(dc.mutex);
return GetVirtualCommand(); return GetVirtualCommand();
......
...@@ -114,7 +114,7 @@ public: ...@@ -114,7 +114,7 @@ public:
* Caller must lock the #DecoderControl object. * Caller must lock the #DecoderControl object.
*/ */
gcc_pure gcc_pure
bool CheckCancelRead() const; bool CheckCancelRead() const noexcept;
/** /**
* Returns the current chunk the decoder writes to, or allocates a new * Returns the current chunk the decoder writes to, or allocates a new
...@@ -122,7 +122,7 @@ public: ...@@ -122,7 +122,7 @@ public:
* *
* @return the chunk, or NULL if we have received a decoder command * @return the chunk, or NULL if we have received a decoder command
*/ */
MusicChunk *GetChunk(); MusicChunk *GetChunk() noexcept;
/** /**
* Flushes the current chunk. * Flushes the current chunk.
...@@ -161,8 +161,8 @@ private: ...@@ -161,8 +161,8 @@ private:
* "virtual" synthesized command, e.g. to seek to the * "virtual" synthesized command, e.g. to seek to the
* beginning of the CUE track. * beginning of the CUE track.
*/ */
DecoderCommand GetVirtualCommand(); DecoderCommand GetVirtualCommand() noexcept;
DecoderCommand LockGetVirtualCommand(); DecoderCommand LockGetVirtualCommand() noexcept;
/** /**
* Sends a #Tag as-is to the #MusicPipe. Flushes the current * Sends a #Tag as-is to the #MusicPipe. Flushes the current
......
...@@ -74,7 +74,7 @@ DecoderControl::SetReady(const AudioFormat audio_format, ...@@ -74,7 +74,7 @@ DecoderControl::SetReady(const AudioFormat audio_format,
} }
bool bool
DecoderControl::IsCurrentSong(const DetachedSong &_song) const DecoderControl::IsCurrentSong(const DetachedSong &_song) const noexcept
{ {
switch (state) { switch (state) {
case DecoderState::STOP: case DecoderState::STOP:
......
...@@ -305,10 +305,10 @@ struct DecoderControl { ...@@ -305,10 +305,10 @@ struct DecoderControl {
* Caller must lock the object. * Caller must lock the object.
*/ */
gcc_pure gcc_pure
bool IsCurrentSong(const DetachedSong &_song) const; bool IsCurrentSong(const DetachedSong &_song) const noexcept;
gcc_pure gcc_pure
bool LockIsCurrentSong(const DetachedSong &_song) const { bool LockIsCurrentSong(const DetachedSong &_song) const noexcept {
const std::lock_guard<Mutex> protect(mutex); const std::lock_guard<Mutex> protect(mutex);
return IsCurrentSong(_song); return IsCurrentSong(_song);
} }
......
...@@ -118,7 +118,7 @@ static constexpr unsigned num_decoder_plugins = ...@@ -118,7 +118,7 @@ static constexpr unsigned num_decoder_plugins =
bool decoder_plugins_enabled[num_decoder_plugins]; bool decoder_plugins_enabled[num_decoder_plugins];
const struct DecoderPlugin * const struct DecoderPlugin *
decoder_plugin_from_name(const char *name) decoder_plugin_from_name(const char *name) noexcept
{ {
return decoder_plugins_find([=](const DecoderPlugin &plugin){ return decoder_plugins_find([=](const DecoderPlugin &plugin){
return strcmp(plugin.name, name) == 0; return strcmp(plugin.name, name) == 0;
...@@ -154,7 +154,7 @@ void decoder_plugin_deinit_all(void) ...@@ -154,7 +154,7 @@ void decoder_plugin_deinit_all(void)
} }
bool bool
decoder_plugins_supports_suffix(const char *suffix) decoder_plugins_supports_suffix(const char *suffix) noexcept
{ {
return decoder_plugins_try([suffix](const DecoderPlugin &plugin){ return decoder_plugins_try([suffix](const DecoderPlugin &plugin){
return plugin.SupportsSuffix(suffix); return plugin.SupportsSuffix(suffix);
......
...@@ -31,7 +31,7 @@ extern bool decoder_plugins_enabled[]; ...@@ -31,7 +31,7 @@ extern bool decoder_plugins_enabled[];
gcc_pure gcc_pure
const struct DecoderPlugin * const struct DecoderPlugin *
decoder_plugin_from_name(const char *name); decoder_plugin_from_name(const char *name) noexcept;
/* this is where we "load" all the "plugins" ;-) */ /* this is where we "load" all the "plugins" ;-) */
void void
...@@ -86,6 +86,6 @@ decoder_plugins_for_each_enabled(F f) ...@@ -86,6 +86,6 @@ decoder_plugins_for_each_enabled(F f)
*/ */
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
bool bool
decoder_plugins_supports_suffix(const char *suffix); decoder_plugins_supports_suffix(const char *suffix) noexcept;
#endif #endif
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <assert.h> #include <assert.h>
bool bool
DecoderPlugin::SupportsSuffix(const char *suffix) const DecoderPlugin::SupportsSuffix(const char *suffix) const noexcept
{ {
#if !CLANG_CHECK_VERSION(3,6) #if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */ /* disabled on clang due to -Wtautological-pointer-compare */
...@@ -36,7 +36,7 @@ DecoderPlugin::SupportsSuffix(const char *suffix) const ...@@ -36,7 +36,7 @@ DecoderPlugin::SupportsSuffix(const char *suffix) const
} }
bool bool
DecoderPlugin::SupportsMimeType(const char *mime_type) const DecoderPlugin::SupportsMimeType(const char *mime_type) const noexcept
{ {
#if !CLANG_CHECK_VERSION(3,6) #if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */ /* disabled on clang due to -Wtautological-pointer-compare */
......
...@@ -168,13 +168,13 @@ struct DecoderPlugin { ...@@ -168,13 +168,13 @@ struct DecoderPlugin {
* Does the plugin announce the specified file name suffix? * Does the plugin announce the specified file name suffix?
*/ */
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
bool SupportsSuffix(const char *suffix) const; bool SupportsSuffix(const char *suffix) const noexcept;
/** /**
* Does the plugin announce the specified MIME type? * Does the plugin announce the specified MIME type?
*/ */
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
bool SupportsMimeType(const char *mime_type) const; bool SupportsMimeType(const char *mime_type) const noexcept;
}; };
#endif #endif
...@@ -170,7 +170,8 @@ decoder_file_decode(const DecoderPlugin &plugin, ...@@ -170,7 +170,8 @@ decoder_file_decode(const DecoderPlugin &plugin,
gcc_pure gcc_pure
static bool static bool
decoder_check_plugin_mime(const DecoderPlugin &plugin, const InputStream &is) decoder_check_plugin_mime(const DecoderPlugin &plugin,
const InputStream &is) noexcept
{ {
assert(plugin.stream_decode != nullptr); assert(plugin.stream_decode != nullptr);
...@@ -181,7 +182,8 @@ decoder_check_plugin_mime(const DecoderPlugin &plugin, const InputStream &is) ...@@ -181,7 +182,8 @@ decoder_check_plugin_mime(const DecoderPlugin &plugin, const InputStream &is)
gcc_pure gcc_pure
static bool static bool
decoder_check_plugin_suffix(const DecoderPlugin &plugin, const char *suffix) decoder_check_plugin_suffix(const DecoderPlugin &plugin,
const char *suffix) noexcept
{ {
assert(plugin.stream_decode != nullptr); assert(plugin.stream_decode != nullptr);
...@@ -191,7 +193,7 @@ decoder_check_plugin_suffix(const DecoderPlugin &plugin, const char *suffix) ...@@ -191,7 +193,7 @@ decoder_check_plugin_suffix(const DecoderPlugin &plugin, const char *suffix)
gcc_pure gcc_pure
static bool static bool
decoder_check_plugin(const DecoderPlugin &plugin, const InputStream &is, decoder_check_plugin(const DecoderPlugin &plugin, const InputStream &is,
const char *suffix) const char *suffix) noexcept
{ {
return plugin.stream_decode != nullptr && return plugin.stream_decode != nullptr &&
(decoder_check_plugin_mime(plugin, is) || (decoder_check_plugin_mime(plugin, is) ||
......
...@@ -66,7 +66,7 @@ struct AudioFileInputStream { ...@@ -66,7 +66,7 @@ struct AudioFileInputStream {
gcc_pure gcc_pure
static SongTime static SongTime
audiofile_get_duration(AFfilehandle fh) audiofile_get_duration(AFfilehandle fh) noexcept
{ {
return SongTime::FromScale<uint64_t>(afGetFrameCount(fh, AF_DEFAULT_TRACK), return SongTime::FromScale<uint64_t>(afGetFrameCount(fh, AF_DEFAULT_TRACK),
afGetRate(fh, AF_DEFAULT_TRACK)); afGetRate(fh, AF_DEFAULT_TRACK));
...@@ -239,7 +239,7 @@ audiofile_stream_decode(DecoderClient &client, InputStream &is) ...@@ -239,7 +239,7 @@ audiofile_stream_decode(DecoderClient &client, InputStream &is)
gcc_pure gcc_pure
static SignedSongTime static SignedSongTime
audiofile_get_duration(InputStream &is) audiofile_get_duration(InputStream &is) noexcept
{ {
if (!is.IsSeekable() || !is.KnownSize()) if (!is.IsSeekable() || !is.KnownSize())
return SignedSongTime::Negative(); return SignedSongTime::Negative();
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include <stdlib.h> #include <stdlib.h>
bool bool
DsdId::Equals(const char *s) const DsdId::Equals(const char *s) const noexcept
{ {
assert(s != nullptr); assert(s != nullptr);
assert(strlen(s) == sizeof(value)); assert(strlen(s) == sizeof(value));
...@@ -95,7 +95,7 @@ dsdlib_skip(DecoderClient *client, InputStream &is, ...@@ -95,7 +95,7 @@ dsdlib_skip(DecoderClient *client, InputStream &is,
} }
bool bool
dsdlib_valid_freq(uint32_t samplefreq) dsdlib_valid_freq(uint32_t samplefreq) noexcept
{ {
switch (samplefreq) { switch (samplefreq) {
case 2822400: /* DSD64, 64xFs, Fs = 44.100kHz */ case 2822400: /* DSD64, 64xFs, Fs = 44.100kHz */
......
...@@ -34,7 +34,7 @@ struct DsdId { ...@@ -34,7 +34,7 @@ struct DsdId {
char value[4]; char value[4];
gcc_pure gcc_pure
bool Equals(const char *s) const; bool Equals(const char *s) const noexcept;
}; };
class DsdUint64 { class DsdUint64 {
...@@ -72,7 +72,7 @@ dsdlib_skip(DecoderClient *client, InputStream &is, ...@@ -72,7 +72,7 @@ dsdlib_skip(DecoderClient *client, InputStream &is,
**/ **/
gcc_const gcc_const
bool bool
dsdlib_valid_freq(uint32_t samplefreq); dsdlib_valid_freq(uint32_t samplefreq) noexcept;
/** /**
* Add tags from ID3 tag. All tags commonly found in the ID3 tags of * Add tags from ID3 tag. All tags commonly found in the ID3 tags of
......
...@@ -112,14 +112,14 @@ ffmpeg_finish() ...@@ -112,14 +112,14 @@ ffmpeg_finish()
gcc_pure gcc_pure
static const AVCodecParameters & static const AVCodecParameters &
GetCodecParameters(const AVStream &stream) GetCodecParameters(const AVStream &stream) noexcept
{ {
return *stream.codecpar; return *stream.codecpar;
} }
gcc_pure gcc_pure
static AVSampleFormat static AVSampleFormat
GetSampleFormat(const AVCodecParameters &codec_params) GetSampleFormat(const AVCodecParameters &codec_params) noexcept
{ {
return AVSampleFormat(codec_params.format); return AVSampleFormat(codec_params.format);
} }
...@@ -128,14 +128,14 @@ GetSampleFormat(const AVCodecParameters &codec_params) ...@@ -128,14 +128,14 @@ GetSampleFormat(const AVCodecParameters &codec_params)
gcc_pure gcc_pure
static const AVCodecContext & static const AVCodecContext &
GetCodecParameters(const AVStream &stream) GetCodecParameters(const AVStream &stream) noexcept
{ {
return *stream.codec; return *stream.codec;
} }
gcc_pure gcc_pure
static AVSampleFormat static AVSampleFormat
GetSampleFormat(const AVCodecContext &codec_context) GetSampleFormat(const AVCodecContext &codec_context) noexcept
{ {
return codec_context.sample_fmt; return codec_context.sample_fmt;
} }
...@@ -144,14 +144,14 @@ GetSampleFormat(const AVCodecContext &codec_context) ...@@ -144,14 +144,14 @@ GetSampleFormat(const AVCodecContext &codec_context)
gcc_pure gcc_pure
static bool static bool
IsAudio(const AVStream &stream) IsAudio(const AVStream &stream) noexcept
{ {
return GetCodecParameters(stream).codec_type == AVMEDIA_TYPE_AUDIO; return GetCodecParameters(stream).codec_type == AVMEDIA_TYPE_AUDIO;
} }
gcc_pure gcc_pure
static int static int
ffmpeg_find_audio_stream(const AVFormatContext &format_context) ffmpeg_find_audio_stream(const AVFormatContext &format_context) noexcept
{ {
for (unsigned i = 0; i < format_context.nb_streams; ++i) for (unsigned i = 0; i < format_context.nb_streams; ++i)
if (IsAudio(*format_context.streams[i])) if (IsAudio(*format_context.streams[i]))
...@@ -220,7 +220,7 @@ copy_interleave_frame(const AVCodecContext &codec_context, ...@@ -220,7 +220,7 @@ copy_interleave_frame(const AVCodecContext &codec_context,
*/ */
gcc_pure gcc_pure
static int64_t static int64_t
StreamRelativePts(const AVPacket &packet, const AVStream &stream) StreamRelativePts(const AVPacket &packet, const AVStream &stream) noexcept
{ {
auto pts = packet.pts; auto pts = packet.pts;
if (pts < 0 || pts == int64_t(AV_NOPTS_VALUE)) if (pts < 0 || pts == int64_t(AV_NOPTS_VALUE))
...@@ -237,7 +237,7 @@ StreamRelativePts(const AVPacket &packet, const AVStream &stream) ...@@ -237,7 +237,7 @@ StreamRelativePts(const AVPacket &packet, const AVStream &stream)
gcc_pure gcc_pure
static uint64_t static uint64_t
PtsToPcmFrame(uint64_t pts, const AVStream &stream, PtsToPcmFrame(uint64_t pts, const AVStream &stream,
const AVCodecContext &codec_context) const AVCodecContext &codec_context) noexcept
{ {
return av_rescale_q(pts, stream.time_base, codec_context.time_base); return av_rescale_q(pts, stream.time_base, codec_context.time_base);
} }
...@@ -437,7 +437,7 @@ ffmpeg_send_packet(DecoderClient &client, InputStream &is, ...@@ -437,7 +437,7 @@ ffmpeg_send_packet(DecoderClient &client, InputStream &is,
gcc_const gcc_const
static SampleFormat static SampleFormat
ffmpeg_sample_format(enum AVSampleFormat sample_fmt) ffmpeg_sample_format(enum AVSampleFormat sample_fmt) noexcept
{ {
switch (sample_fmt) { switch (sample_fmt) {
case AV_SAMPLE_FMT_S16: case AV_SAMPLE_FMT_S16:
......
...@@ -67,7 +67,7 @@ flac_parse_mixramp(const FLAC__StreamMetadata_VorbisComment &vc) ...@@ -67,7 +67,7 @@ flac_parse_mixramp(const FLAC__StreamMetadata_VorbisComment &vc)
*/ */
static const char * static const char *
flac_comment_value(const FLAC__StreamMetadata_VorbisComment_Entry *entry, flac_comment_value(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
const char *name) const char *name) noexcept
{ {
return vorbis_comment_value((const char *)entry->entry, name); return vorbis_comment_value((const char *)entry->entry, name);
} }
...@@ -126,7 +126,7 @@ flac_scan_comments(const FLAC__StreamMetadata_VorbisComment *comment, ...@@ -126,7 +126,7 @@ flac_scan_comments(const FLAC__StreamMetadata_VorbisComment *comment,
gcc_pure gcc_pure
static inline SongTime static inline SongTime
flac_duration(const FLAC__StreamMetadata_StreamInfo *stream_info) flac_duration(const FLAC__StreamMetadata_StreamInfo *stream_info) noexcept
{ {
assert(stream_info->sample_rate > 0); assert(stream_info->sample_rate > 0);
......
...@@ -74,7 +74,7 @@ gme_plugin_init(gcc_unused const ConfigBlock &block) ...@@ -74,7 +74,7 @@ gme_plugin_init(gcc_unused const ConfigBlock &block)
gcc_pure gcc_pure
static unsigned static unsigned
ParseSubtuneName(const char *base) ParseSubtuneName(const char *base) noexcept
{ {
if (memcmp(base, SUBTUNE_PREFIX, sizeof(SUBTUNE_PREFIX) - 1) != 0) if (memcmp(base, SUBTUNE_PREFIX, sizeof(SUBTUNE_PREFIX) - 1) != 0)
return 0; return 0;
......
...@@ -71,7 +71,7 @@ static bool gapless_playback; ...@@ -71,7 +71,7 @@ static bool gapless_playback;
gcc_const gcc_const
static SongTime static SongTime
ToSongTime(mad_timer_t t) ToSongTime(mad_timer_t t) noexcept
{ {
return SongTime::FromMS(mad_timer_count(t, MAD_UNITS_MILLISECONDS)); return SongTime::FromMS(mad_timer_count(t, MAD_UNITS_MILLISECONDS));
} }
...@@ -155,10 +155,10 @@ struct MadDecoder { ...@@ -155,10 +155,10 @@ struct MadDecoder {
enum mp3_action DecodeNextFrame(); enum mp3_action DecodeNextFrame();
gcc_pure gcc_pure
offset_type ThisFrameOffset() const; offset_type ThisFrameOffset() const noexcept;
gcc_pure gcc_pure
offset_type RestIncludingThisFrame() const; offset_type RestIncludingThisFrame() const noexcept;
/** /**
* Attempt to calulcate the length of the song from filesize * Attempt to calulcate the length of the song from filesize
...@@ -177,7 +177,7 @@ struct MadDecoder { ...@@ -177,7 +177,7 @@ struct MadDecoder {
} }
gcc_pure gcc_pure
long TimeToFrame(SongTime t) const; long TimeToFrame(SongTime t) const noexcept;
void UpdateTimerNextFrame(); void UpdateTimerNextFrame();
...@@ -291,7 +291,7 @@ parse_id3_replay_gain_info(ReplayGainInfo &rgi, ...@@ -291,7 +291,7 @@ parse_id3_replay_gain_info(ReplayGainInfo &rgi,
#ifdef ENABLE_ID3TAG #ifdef ENABLE_ID3TAG
gcc_pure gcc_pure
static MixRampInfo static MixRampInfo
parse_id3_mixramp(struct id3_tag *tag) parse_id3_mixramp(struct id3_tag *tag) noexcept
{ {
MixRampInfo result; MixRampInfo result;
...@@ -710,7 +710,7 @@ mp3_frame_duration(const struct mad_frame *frame) ...@@ -710,7 +710,7 @@ mp3_frame_duration(const struct mad_frame *frame)
} }
inline offset_type inline offset_type
MadDecoder::ThisFrameOffset() const MadDecoder::ThisFrameOffset() const noexcept
{ {
auto offset = input_stream.GetOffset(); auto offset = input_stream.GetOffset();
...@@ -723,7 +723,7 @@ MadDecoder::ThisFrameOffset() const ...@@ -723,7 +723,7 @@ MadDecoder::ThisFrameOffset() const
} }
inline offset_type inline offset_type
MadDecoder::RestIncludingThisFrame() const MadDecoder::RestIncludingThisFrame() const noexcept
{ {
return input_stream.GetSize() - ThisFrameOffset(); return input_stream.GetSize() - ThisFrameOffset();
} }
...@@ -846,7 +846,7 @@ mad_decoder_total_file_time(InputStream &is) ...@@ -846,7 +846,7 @@ mad_decoder_total_file_time(InputStream &is)
} }
long long
MadDecoder::TimeToFrame(SongTime t) const MadDecoder::TimeToFrame(SongTime t) const noexcept
{ {
unsigned long i; unsigned long i;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
gcc_pure gcc_pure
static TagType static TagType
ParseOpusTagName(const char *name) ParseOpusTagName(const char *name) noexcept
{ {
TagType type = tag_name_parse_i(name); TagType type = tag_name_parse_i(name);
if (type != TAG_NUM_OF_ITEM_TYPES) if (type != TAG_NUM_OF_ITEM_TYPES)
......
...@@ -116,7 +116,7 @@ struct SidplayContainerPath { ...@@ -116,7 +116,7 @@ struct SidplayContainerPath {
gcc_pure gcc_pure
static unsigned static unsigned
ParseSubtuneName(const char *base) ParseSubtuneName(const char *base) noexcept
{ {
if (memcmp(base, SUBTUNE_PREFIX, sizeof(SUBTUNE_PREFIX) - 1) != 0) if (memcmp(base, SUBTUNE_PREFIX, sizeof(SUBTUNE_PREFIX) - 1) != 0)
return 0; return 0;
...@@ -390,7 +390,7 @@ sidplay_file_decode(DecoderClient &client, Path path_fs) ...@@ -390,7 +390,7 @@ sidplay_file_decode(DecoderClient &client, Path path_fs)
gcc_pure gcc_pure
static const char * static const char *
GetInfoString(const SidTuneInfo &info, unsigned i) GetInfoString(const SidTuneInfo &info, unsigned i) noexcept
{ {
#ifdef HAVE_SIDPLAYFP #ifdef HAVE_SIDPLAYFP
return info.numberOfInfoStrings() > i return info.numberOfInfoStrings() > i
......
...@@ -148,7 +148,7 @@ sndfile_duration(const SF_INFO &info) ...@@ -148,7 +148,7 @@ sndfile_duration(const SF_INFO &info)
gcc_pure gcc_pure
static SampleFormat static SampleFormat
sndfile_sample_format(const SF_INFO &info) sndfile_sample_format(const SF_INFO &info) noexcept
{ {
switch (info.format & SF_FORMAT_SUBMASK) { switch (info.format & SF_FORMAT_SUBMASK) {
case SF_FORMAT_PCM_S8: case SF_FORMAT_PCM_S8:
......
...@@ -101,7 +101,7 @@ WavpackOpenInput(WavpackStreamReader *reader, void *wv_id, void *wvc_id, ...@@ -101,7 +101,7 @@ WavpackOpenInput(WavpackStreamReader *reader, void *wv_id, void *wvc_id,
gcc_pure gcc_pure
static SignedSongTime static SignedSongTime
GetDuration(WavpackContext *wpc) GetDuration(WavpackContext *wpc) noexcept
{ {
#ifdef OPEN_DSD_AS_PCM #ifdef OPEN_DSD_AS_PCM
/* libWavPack 5 */ /* libWavPack 5 */
......
...@@ -103,16 +103,16 @@ public: ...@@ -103,16 +103,16 @@ public:
using SocketMonitor::Close; using SocketMonitor::Close;
gcc_pure gcc_pure
std::string ToString() const { std::string ToString() const noexcept {
return ::ToString(address); return ::ToString(address);
} }
void SetFD(int _fd) { void SetFD(int _fd) noexcept {
SocketMonitor::Open(_fd); SocketMonitor::Open(_fd);
SocketMonitor::ScheduleRead(); SocketMonitor::ScheduleRead();
} }
void Accept(); void Accept() noexcept;
private: private:
virtual bool OnSocketReady(unsigned flags) override; virtual bool OnSocketReady(unsigned flags) override;
...@@ -146,7 +146,7 @@ get_remote_uid(int fd) ...@@ -146,7 +146,7 @@ get_remote_uid(int fd)
} }
inline void inline void
OneServerSocket::Accept() OneServerSocket::Accept() noexcept
{ {
StaticSocketAddress peer_address; StaticSocketAddress peer_address;
size_t peer_address_length = sizeof(peer_address); size_t peer_address_length = sizeof(peer_address);
...@@ -343,7 +343,7 @@ ServerSocket::AddPortIPv6(unsigned port) ...@@ -343,7 +343,7 @@ ServerSocket::AddPortIPv6(unsigned port)
*/ */
gcc_pure gcc_pure
static bool static bool
SupportsIPv6() SupportsIPv6() noexcept
{ {
int fd = socket(AF_INET6, SOCK_STREAM, 0); int fd = socket(AF_INET6, SOCK_STREAM, 0);
if (fd < 0) if (fd < 0)
......
...@@ -32,7 +32,7 @@ static const FilterPlugin *const filter_plugins[] = { ...@@ -32,7 +32,7 @@ static const FilterPlugin *const filter_plugins[] = {
}; };
const FilterPlugin * const FilterPlugin *
filter_plugin_by_name(const char *name) filter_plugin_by_name(const char *name) noexcept
{ {
for (unsigned i = 0; filter_plugins[i] != nullptr; ++i) for (unsigned i = 0; filter_plugins[i] != nullptr; ++i)
if (strcmp(filter_plugins[i]->name, name) == 0) if (strcmp(filter_plugins[i]->name, name) == 0)
......
...@@ -39,6 +39,6 @@ extern const FilterPlugin volume_filter_plugin; ...@@ -39,6 +39,6 @@ extern const FilterPlugin volume_filter_plugin;
gcc_pure gcc_pure
const FilterPlugin * const FilterPlugin *
filter_plugin_by_name(const char *name); filter_plugin_by_name(const char *name) noexcept;
#endif #endif
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
AllocatedPath::~AllocatedPath() {} AllocatedPath::~AllocatedPath() {}
AllocatedPath AllocatedPath
AllocatedPath::FromUTF8(const char *path_utf8) AllocatedPath::FromUTF8(const char *path_utf8) noexcept
{ {
#if defined(HAVE_FS_CHARSET) || defined(WIN32) #if defined(HAVE_FS_CHARSET) || defined(WIN32)
try { try {
...@@ -53,13 +53,13 @@ AllocatedPath::FromUTF8Throw(const char *path_utf8) ...@@ -53,13 +53,13 @@ AllocatedPath::FromUTF8Throw(const char *path_utf8)
} }
AllocatedPath AllocatedPath
AllocatedPath::GetDirectoryName() const AllocatedPath::GetDirectoryName() const noexcept
{ {
return FromFS(PathTraitsFS::GetParent(c_str())); return FromFS(PathTraitsFS::GetParent(c_str()));
} }
std::string std::string
AllocatedPath::ToUTF8() const AllocatedPath::ToUTF8() const noexcept
{ {
try { try {
return ::PathToUTF8(c_str()); return ::PathToUTF8(c_str());
...@@ -69,7 +69,7 @@ AllocatedPath::ToUTF8() const ...@@ -69,7 +69,7 @@ AllocatedPath::ToUTF8() const
} }
void void
AllocatedPath::ChopSeparators() AllocatedPath::ChopSeparators() noexcept
{ {
size_t l = length(); size_t l = length();
const auto *p = data(); const auto *p = data();
......
...@@ -153,7 +153,7 @@ public: ...@@ -153,7 +153,7 @@ public:
* Returns return a "nulled" instance on error. * Returns return a "nulled" instance on error.
*/ */
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
static AllocatedPath FromUTF8(const char *path_utf8); static AllocatedPath FromUTF8(const char *path_utf8) noexcept;
/** /**
* Convert a UTF-8 C string to an #AllocatedPath instance. * Convert a UTF-8 C string to an #AllocatedPath instance.
...@@ -244,14 +244,14 @@ public: ...@@ -244,14 +244,14 @@ public:
* (#IsNull returns true). * (#IsNull returns true).
*/ */
gcc_pure gcc_pure
std::string ToUTF8() const; std::string ToUTF8() const noexcept;
/** /**
* Gets directory name of this path. * Gets directory name of this path.
* Returns a "nulled" instance on error. * Returns a "nulled" instance on error.
*/ */
gcc_pure gcc_pure
AllocatedPath GetDirectoryName() const; AllocatedPath GetDirectoryName() const noexcept;
/** /**
* Determine the relative part of the given path to this * Determine the relative part of the given path to this
...@@ -260,17 +260,17 @@ public: ...@@ -260,17 +260,17 @@ public:
* nullptr on mismatch. * nullptr on mismatch.
*/ */
gcc_pure gcc_pure
const_pointer_type Relative(Path other_fs) const { const_pointer_type Relative(Path other_fs) const noexcept {
return PathTraitsFS::Relative(c_str(), other_fs.c_str()); return PathTraitsFS::Relative(c_str(), other_fs.c_str());
} }
/** /**
* Chop trailing directory separators. * Chop trailing directory separators.
*/ */
void ChopSeparators(); void ChopSeparators() noexcept;
gcc_pure gcc_pure
bool IsAbsolute() const { bool IsAbsolute() const noexcept {
return PathTraitsFS::IsAbsolute(c_str()); return PathTraitsFS::IsAbsolute(c_str());
} }
}; };
......
...@@ -57,7 +57,7 @@ SetFSCharset(const char *charset) ...@@ -57,7 +57,7 @@ SetFSCharset(const char *charset)
#endif #endif
void void
DeinitFSCharset() DeinitFSCharset() noexcept
{ {
#ifdef HAVE_ICU_CONVERTER #ifdef HAVE_ICU_CONVERTER
delete fs_converter; delete fs_converter;
...@@ -66,7 +66,7 @@ DeinitFSCharset() ...@@ -66,7 +66,7 @@ DeinitFSCharset()
} }
const char * const char *
GetFSCharset() GetFSCharset() noexcept
{ {
#ifdef HAVE_FS_CHARSET #ifdef HAVE_FS_CHARSET
return fs_charset.empty() ? "UTF-8" : fs_charset.c_str(); return fs_charset.empty() ? "UTF-8" : fs_charset.c_str();
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
*/ */
gcc_const gcc_const
const char * const char *
GetFSCharset(); GetFSCharset() noexcept;
/** /**
* Throws std::runtime_error on error. * Throws std::runtime_error on error.
...@@ -42,7 +42,7 @@ void ...@@ -42,7 +42,7 @@ void
SetFSCharset(const char *charset); SetFSCharset(const char *charset);
void void
DeinitFSCharset(); DeinitFSCharset() noexcept;
/** /**
* Convert the path to UTF-8. * Convert the path to UTF-8.
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <stdexcept> #include <stdexcept>
std::string std::string
Path::ToUTF8() const Path::ToUTF8() const noexcept
{ {
try { try {
return ::PathToUTF8(c_str()); return ::PathToUTF8(c_str());
...@@ -34,7 +34,7 @@ Path::ToUTF8() const ...@@ -34,7 +34,7 @@ Path::ToUTF8() const
} }
Path::const_pointer_type Path::const_pointer_type
Path::GetSuffix() const Path::GetSuffix() const noexcept
{ {
const auto base = GetBase().c_str(); const auto base = GetBase().c_str();
const auto *dot = StringFindLast(base, '.'); const auto *dot = StringFindLast(base, '.');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment