util/UriExtract: uri_get_suffix() returns std::string_view
No need to copy it to a buffer.
This commit is contained in:
@@ -157,7 +157,7 @@ UpdateWalk::UpdateArchiveFile(Directory &parent, std::string_view name,
|
||||
|
||||
bool
|
||||
UpdateWalk::UpdateArchiveFile(Directory &directory,
|
||||
std::string_view name, const char *suffix,
|
||||
std::string_view name, std::string_view suffix,
|
||||
const StorageFileInfo &info) noexcept
|
||||
{
|
||||
const ArchivePlugin *plugin = archive_plugin_from_suffix(suffix);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
bool
|
||||
UpdateWalk::UpdateContainerFile(Directory &directory,
|
||||
std::string_view name, const char *suffix,
|
||||
std::string_view name, std::string_view suffix,
|
||||
const StorageFileInfo &info) noexcept
|
||||
{
|
||||
const DecoderPlugin *_plugin = decoder_plugins_find([suffix](const DecoderPlugin &plugin){
|
||||
|
||||
@@ -88,7 +88,7 @@ UpdateWalk::UpdatePlaylistFile(Directory &parent, std::string_view name,
|
||||
|
||||
bool
|
||||
UpdateWalk::UpdatePlaylistFile(Directory &directory,
|
||||
std::string_view name, const char *suffix,
|
||||
std::string_view name, std::string_view suffix,
|
||||
const StorageFileInfo &info) noexcept
|
||||
{
|
||||
const auto *const plugin = FindPlaylistPluginBySuffix(suffix);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
inline void
|
||||
UpdateWalk::UpdateSongFile2(Directory &directory,
|
||||
const char *name, const char *suffix,
|
||||
const char *name, std::string_view suffix,
|
||||
const StorageFileInfo &info) noexcept
|
||||
try {
|
||||
Song *song;
|
||||
@@ -98,7 +98,7 @@ try {
|
||||
|
||||
bool
|
||||
UpdateWalk::UpdateSongFile(Directory &directory,
|
||||
const char *name, const char *suffix,
|
||||
const char *name, std::string_view suffix,
|
||||
const StorageFileInfo &info) noexcept
|
||||
{
|
||||
if (!decoder_plugins_supports_suffix(suffix))
|
||||
|
||||
@@ -189,8 +189,8 @@ UpdateWalk::UpdateRegularFile(Directory &directory,
|
||||
const char *name,
|
||||
const StorageFileInfo &info) noexcept
|
||||
{
|
||||
const char *suffix = uri_get_suffix(name);
|
||||
if (suffix == nullptr)
|
||||
const auto suffix = uri_get_suffix(name);
|
||||
if (suffix.empty())
|
||||
return false;
|
||||
|
||||
return UpdateSongFile(directory, name, suffix, info) ||
|
||||
|
||||
@@ -86,15 +86,15 @@ private:
|
||||
void PurgeDeletedFromDirectory(Directory &directory) noexcept;
|
||||
|
||||
void UpdateSongFile2(Directory &directory,
|
||||
const char *name, const char *suffix,
|
||||
const char *name, std::string_view suffix,
|
||||
const StorageFileInfo &info) noexcept;
|
||||
|
||||
bool UpdateSongFile(Directory &directory,
|
||||
const char *name, const char *suffix,
|
||||
const char *name, std::string_view suffix,
|
||||
const StorageFileInfo &info) noexcept;
|
||||
|
||||
bool UpdateContainerFile(Directory &directory,
|
||||
std::string_view name, const char *suffix,
|
||||
std::string_view name, std::string_view suffix,
|
||||
const StorageFileInfo &info) noexcept;
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ private:
|
||||
const char *name) noexcept;
|
||||
|
||||
bool UpdateArchiveFile(Directory &directory,
|
||||
std::string_view name, const char *suffix,
|
||||
std::string_view name, std::string_view suffix,
|
||||
const StorageFileInfo &info) noexcept;
|
||||
|
||||
void UpdateArchiveFile(Directory &directory, std::string_view name,
|
||||
@@ -114,7 +114,7 @@ private:
|
||||
#else
|
||||
bool UpdateArchiveFile([[maybe_unused]] Directory &directory,
|
||||
[[maybe_unused]] const char *name,
|
||||
[[maybe_unused]] const char *suffix,
|
||||
[[maybe_unused]] std::string_view suffix,
|
||||
[[maybe_unused]] const StorageFileInfo &info) noexcept {
|
||||
return false;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ private:
|
||||
const PlaylistPlugin &plugin) noexcept;
|
||||
|
||||
bool UpdatePlaylistFile(Directory &directory,
|
||||
std::string_view name, const char *suffix,
|
||||
std::string_view name, std::string_view suffix,
|
||||
const StorageFileInfo &info) noexcept;
|
||||
|
||||
bool UpdateRegularFile(Directory &directory,
|
||||
|
||||
Reference in New Issue
Block a user