From 53ffcf455cf787dc80176adb5331561a8ef62448 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 26 Aug 2021 13:06:52 -0700 Subject: [PATCH] make several member functions const Signed-off-by: Rosen Penev --- src/Instance.hxx | 2 +- src/decoder/DecoderPlugin.hxx | 10 +++++----- src/input/cache/Manager.cxx | 2 +- src/input/cache/Manager.hxx | 2 +- src/output/SharedPipeConsumer.hxx | 2 +- src/playlist/PlaylistPlugin.hxx | 10 +++++----- src/util/OptionParser.hxx | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Instance.hxx b/src/Instance.hxx index cb85aa979..189aabab4 100644 --- a/src/Instance.hxx +++ b/src/Instance.hxx @@ -194,7 +194,7 @@ struct Instance final #endif #ifdef ENABLE_SQLITE - bool HasStickerDatabase() noexcept { + bool HasStickerDatabase() const noexcept { return sticker_database != nullptr; } #endif diff --git a/src/decoder/DecoderPlugin.hxx b/src/decoder/DecoderPlugin.hxx index 7e68ef7c1..d4887477c 100644 --- a/src/decoder/DecoderPlugin.hxx +++ b/src/decoder/DecoderPlugin.hxx @@ -143,34 +143,34 @@ struct DecoderPlugin { scan_stream(_scan_stream) {} constexpr auto WithInit(bool (*_init)(const ConfigBlock &block), - void (*_finish)() noexcept = nullptr) noexcept { + void (*_finish)() noexcept = nullptr) const noexcept { auto copy = *this; copy.init = _init; copy.finish = _finish; return copy; } - constexpr auto WithContainer(std::forward_list (*_container_scan)(Path path_fs)) noexcept { + constexpr auto WithContainer(std::forward_list (*_container_scan)(Path path_fs)) const noexcept { auto copy = *this; copy.container_scan = _container_scan; return copy; } constexpr auto WithProtocols(std::set (*_protocols)() noexcept, - void (*_uri_decode)(DecoderClient &client, const char *uri)) noexcept { + void (*_uri_decode)(DecoderClient &client, const char *uri)) const noexcept { auto copy = *this; copy.protocols = _protocols; copy.uri_decode = _uri_decode; return copy; } - constexpr auto WithSuffixes(const char *const*_suffixes) noexcept { + constexpr auto WithSuffixes(const char *const*_suffixes) const noexcept { auto copy = *this; copy.suffixes = _suffixes; return copy; } - constexpr auto WithMimeTypes(const char *const*_mime_types) noexcept { + constexpr auto WithMimeTypes(const char *const*_mime_types) const noexcept { auto copy = *this; copy.mime_types = _mime_types; return copy; diff --git a/src/input/cache/Manager.cxx b/src/input/cache/Manager.cxx index c5dd21283..d94a4912e 100644 --- a/src/input/cache/Manager.cxx +++ b/src/input/cache/Manager.cxx @@ -75,7 +75,7 @@ InputCacheManager::Flush() noexcept } bool -InputCacheManager::IsEligible(const InputStream &input) noexcept +InputCacheManager::IsEligible(const InputStream &input) const noexcept { assert(input.IsReady()); diff --git a/src/input/cache/Manager.hxx b/src/input/cache/Manager.hxx index b8dbb1e0b..81492a97a 100644 --- a/src/input/cache/Manager.hxx +++ b/src/input/cache/Manager.hxx @@ -98,7 +98,7 @@ private: * Check whether the given #InputStream can be stored in this * cache. */ - bool IsEligible(const InputStream &input) noexcept; + bool IsEligible(const InputStream &input) const noexcept; void Remove(InputCacheItem &item) noexcept; void Delete(InputCacheItem *item) noexcept; diff --git a/src/output/SharedPipeConsumer.hxx b/src/output/SharedPipeConsumer.hxx index a33d33c18..119b1e90c 100644 --- a/src/output/SharedPipeConsumer.hxx +++ b/src/output/SharedPipeConsumer.hxx @@ -66,7 +66,7 @@ public: return *pipe; } - bool IsInitial() { + bool IsInitial() const { return chunk == nullptr; } diff --git a/src/playlist/PlaylistPlugin.hxx b/src/playlist/PlaylistPlugin.hxx index c62ecd762..be3644caa 100644 --- a/src/playlist/PlaylistPlugin.hxx +++ b/src/playlist/PlaylistPlugin.hxx @@ -85,32 +85,32 @@ struct PlaylistPlugin { :name(_name), open_stream(_open_stream) {} constexpr auto WithInit(bool (*_init)(const ConfigBlock &block), - void (*_finish)() noexcept = nullptr) noexcept { + void (*_finish)() noexcept = nullptr) const noexcept { auto copy = *this; copy.init = _init; copy.finish = _finish; return copy; } - constexpr auto WithSchemes(const char *const*_schemes) noexcept { + constexpr auto WithSchemes(const char *const*_schemes) const noexcept { auto copy = *this; copy.schemes = _schemes; return copy; } - constexpr auto WithSuffixes(const char *const*_suffixes) noexcept { + constexpr auto WithSuffixes(const char *const*_suffixes) const noexcept { auto copy = *this; copy.suffixes = _suffixes; return copy; } - constexpr auto WithMimeTypes(const char *const*_mime_types) noexcept { + constexpr auto WithMimeTypes(const char *const*_mime_types) const noexcept { auto copy = *this; copy.mime_types = _mime_types; return copy; } - constexpr auto WithAsFolder(bool value=true) noexcept { + constexpr auto WithAsFolder(bool value=true) const noexcept { auto copy = *this; copy.as_folder = value; return copy; diff --git a/src/util/OptionParser.hxx b/src/util/OptionParser.hxx index 3625dedd4..8371fa76f 100644 --- a/src/util/OptionParser.hxx +++ b/src/util/OptionParser.hxx @@ -49,7 +49,7 @@ public: int index; const char *value; - constexpr operator bool() noexcept { + constexpr operator bool() const noexcept { return index >= 0; } };