db/update: pass filenames as std::string_view
This commit is contained in:
parent
434bcb08ee
commit
f2a4ae15aa
@ -14,7 +14,7 @@
|
||||
#include "archive/ArchivePlugin.hxx"
|
||||
#include "archive/ArchiveFile.hxx"
|
||||
#include "archive/ArchiveVisitor.hxx"
|
||||
#include "util/StringCompare.hxx"
|
||||
#include "util/StringSplit.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <exception>
|
||||
@ -37,19 +37,18 @@ LockFindSong(Directory &directory, std::string_view name) noexcept
|
||||
|
||||
void
|
||||
UpdateWalk::UpdateArchiveTree(ArchiveFile &archive, Directory &directory,
|
||||
const char *name) noexcept
|
||||
std::string_view name) noexcept
|
||||
{
|
||||
const char *tmp = std::strchr(name, '/');
|
||||
if (tmp) {
|
||||
const std::string_view child_name(name, tmp - name);
|
||||
const auto [child_name, rest] = Split(name, '/');
|
||||
if (rest.data() != nullptr) {
|
||||
//add dir is not there already
|
||||
Directory *subdir = LockMakeChild(directory, child_name);
|
||||
subdir->device = DEVICE_INARCHIVE;
|
||||
|
||||
//create directories first
|
||||
UpdateArchiveTree(archive, *subdir, tmp + 1);
|
||||
UpdateArchiveTree(archive, *subdir, rest);
|
||||
} else {
|
||||
if (StringIsEmpty(name)) {
|
||||
if (name.empty()) {
|
||||
LogWarning(update_domain,
|
||||
"archive returned directory only");
|
||||
return;
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
inline void
|
||||
UpdateWalk::UpdateSongFile2(Directory &directory,
|
||||
const char *name, std::string_view suffix,
|
||||
std::string_view name, std::string_view suffix,
|
||||
const StorageFileInfo &info) noexcept
|
||||
try {
|
||||
Song *song;
|
||||
@ -83,7 +83,7 @@ try {
|
||||
|
||||
bool
|
||||
UpdateWalk::UpdateSongFile(Directory &directory,
|
||||
const char *name, std::string_view suffix,
|
||||
std::string_view name, std::string_view suffix,
|
||||
const StorageFileInfo &info) noexcept
|
||||
{
|
||||
if (!decoder_plugins_supports_suffix(suffix))
|
||||
|
@ -79,11 +79,11 @@ private:
|
||||
void PurgeDanglingFromPlaylists(Directory &directory) noexcept;
|
||||
|
||||
void UpdateSongFile2(Directory &directory,
|
||||
const char *name, std::string_view suffix,
|
||||
std::string_view name, std::string_view suffix,
|
||||
const StorageFileInfo &info) noexcept;
|
||||
|
||||
bool UpdateSongFile(Directory &directory,
|
||||
const char *name, std::string_view suffix,
|
||||
std::string_view name, std::string_view suffix,
|
||||
const StorageFileInfo &info) noexcept;
|
||||
|
||||
bool UpdateContainerFile(Directory &directory,
|
||||
@ -93,7 +93,7 @@ private:
|
||||
|
||||
#ifdef ENABLE_ARCHIVE
|
||||
void UpdateArchiveTree(ArchiveFile &archive, Directory &parent,
|
||||
const char *name) noexcept;
|
||||
std::string_view name) noexcept;
|
||||
|
||||
bool UpdateArchiveFile(Directory &directory,
|
||||
std::string_view name, std::string_view suffix,
|
||||
@ -106,7 +106,7 @@ private:
|
||||
|
||||
#else
|
||||
bool UpdateArchiveFile([[maybe_unused]] Directory &directory,
|
||||
[[maybe_unused]] const char *name,
|
||||
[[maybe_unused]] std::string_view name,
|
||||
[[maybe_unused]] std::string_view suffix,
|
||||
[[maybe_unused]] const StorageFileInfo &info) noexcept {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user