From 2c4ef4460ff242b1e5eead0e55ef66c2ee9cedbf Mon Sep 17 00:00:00 2001 From: Max Kellermann <max.kellermann@gmail.com> Date: Wed, 6 Sep 2023 14:51:35 +0200 Subject: [PATCH] db/update/SpecialDirectory: more std::string_view migration --- src/db/update/SpecialDirectory.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/db/update/SpecialDirectory.cxx b/src/db/update/SpecialDirectory.cxx index bcd2f2999..7cc5277d1 100644 --- a/src/db/update/SpecialDirectory.cxx +++ b/src/db/update/SpecialDirectory.cxx @@ -9,11 +9,11 @@ [[gnu::pure]] static bool -HaveArchivePluginForFilename(const char *filename) noexcept +HaveArchivePluginForFilename(std::string_view filename) noexcept { #ifdef ENABLE_ARCHIVE - const char *suffix = PathTraitsUTF8::GetFilenameSuffix(filename); - return suffix != nullptr && + const auto suffix = PathTraitsUTF8::GetFilenameSuffix(filename); + return !suffix.empty() && archive_plugin_from_suffix(suffix) != nullptr; #else (void)filename; @@ -23,20 +23,20 @@ HaveArchivePluginForFilename(const char *filename) noexcept [[gnu::pure]] static bool -HaveContainerPluginForFilename(const char *filename) noexcept +HaveContainerPluginForFilename(std::string_view filename) noexcept { - const char *suffix = PathTraitsUTF8::GetFilenameSuffix(filename); - return suffix != nullptr && + const auto suffix = PathTraitsUTF8::GetFilenameSuffix(filename); + return !suffix.empty() && // TODO: check if this plugin really supports containers decoder_plugins_supports_suffix(suffix); } [[gnu::pure]] static bool -HavePlaylistPluginForFilename(const char *filename) noexcept +HavePlaylistPluginForFilename(std::string_view filename) noexcept { - const char *suffix = PathTraitsUTF8::GetFilenameSuffix(filename); - if (suffix == nullptr) + const auto suffix = PathTraitsUTF8::GetFilenameSuffix(filename); + if (suffix.empty()) return false; const auto plugin = FindPlaylistPluginBySuffix(suffix);