input/Plugin: add noexcept

This commit is contained in:
Max Kellermann 2020-09-21 11:42:07 +02:00
parent 2c05752071
commit 07e524509f
6 changed files with 12 additions and 8 deletions

View File

@ -63,7 +63,8 @@ constexpr static const char *whitelist[] = {
}; };
bool bool
protocol_is_whitelisted(const char *proto) { protocol_is_whitelisted(const char *proto) noexcept
{
auto begin = std::begin(whitelist); auto begin = std::begin(whitelist);
auto end = std::end(whitelist); auto end = std::end(whitelist);
return std::binary_search(begin, end, proto, [](const char* a, const char* b) { return std::binary_search(begin, end, proto, [](const char* a, const char* b) {

View File

@ -56,7 +56,7 @@ struct InputPlugin {
* Global deinitialization. Called once before MPD shuts * Global deinitialization. Called once before MPD shuts
* down (only if init() has returned true). * down (only if init() has returned true).
*/ */
void (*finish)(); void (*finish)() noexcept;
/** /**
* Attempt to open the given URI. Returns nullptr if the * Attempt to open the given URI. Returns nullptr if the
@ -69,7 +69,7 @@ struct InputPlugin {
/** /**
* return a set of supported protocols * return a set of supported protocols
*/ */
std::set<std::string> (*protocols)(); std::set<std::string> (*protocols)() noexcept;
/** /**
* Prepare a #RemoteTagScanner. The operation must be started * Prepare a #RemoteTagScanner. The operation must be started
@ -103,7 +103,8 @@ struct InputPlugin {
} }
}; };
gcc_pure
bool bool
protocol_is_whitelisted(const char *proto); protocol_is_whitelisted(const char *proto) noexcept;
#endif #endif

View File

@ -516,7 +516,8 @@ input_curl_open(const char *url, Mutex &mutex)
} }
static std::set<std::string> static std::set<std::string>
input_curl_protocols() { input_curl_protocols() noexcept
{
std::set<std::string> protocols; std::set<std::string> protocols;
auto version_info = curl_version_info(CURLVERSION_FIRST); auto version_info = curl_version_info(CURLVERSION_FIRST);
for (auto proto_ptr = version_info->protocols; *proto_ptr != nullptr; proto_ptr++) { for (auto proto_ptr = version_info->protocols; *proto_ptr != nullptr; proto_ptr++) {

View File

@ -73,7 +73,8 @@ input_ffmpeg_init(EventLoop &, const ConfigBlock &)
} }
static std::set<std::string> static std::set<std::string>
input_ffmpeg_protocols() { input_ffmpeg_protocols() noexcept
{
void *opaque = nullptr; void *opaque = nullptr;
const char* protocol; const char* protocol;
std::set<std::string> protocols; std::set<std::string> protocols;

View File

@ -158,7 +158,7 @@ InitQobuzInput(EventLoop &event_loop, const ConfigBlock &block)
} }
static void static void
FinishQobuzInput() FinishQobuzInput() noexcept
{ {
delete qobuz_client; delete qobuz_client;
} }

View File

@ -189,7 +189,7 @@ InitTidalInput(EventLoop &event_loop, const ConfigBlock &block)
} }
static void static void
FinishTidalInput() FinishTidalInput() noexcept
{ {
delete tidal_session; delete tidal_session;
} }