db,storage: pass std::string_view to PathTraits::Build()

This commit is contained in:
Max Kellermann 2020-04-03 16:25:08 +02:00
parent 7a58b8c3e8
commit 747436b17e
8 changed files with 9 additions and 10 deletions

View File

@ -41,7 +41,7 @@ Song::GetURI() const noexcept
return filename; return filename;
else { else {
const char *path = parent.GetPath(); const char *path = parent.GetPath();
return PathTraitsUTF8::Build(path, filename.c_str()); return PathTraitsUTF8::Build(path, filename);
} }
} }

View File

@ -397,8 +397,7 @@ UpnpDatabase::BuildPath(const ContentDirectoryService &server,
if (path.empty()) if (path.empty())
path = dirent.name; path = dirent.name;
else else
path = PathTraitsUTF8::Build(dirent.name.c_str(), path = PathTraitsUTF8::Build(dirent.name, path);
path.c_str());
} }
return PathTraitsUTF8::Build(server.getFriendlyName(), return PathTraitsUTF8::Build(server.getFriendlyName(),

View File

@ -322,7 +322,7 @@ UpdateWalk::UpdateDirectory(Directory &directory,
try { try {
Mutex mutex; Mutex mutex;
auto is = InputStream::OpenReady(PathTraitsUTF8::Build(storage.MapUTF8(directory.GetPath()).c_str(), auto is = InputStream::OpenReady(PathTraitsUTF8::Build(storage.MapUTF8(directory.GetPath()),
".mpdignore").c_str(), ".mpdignore").c_str(),
mutex); mutex);
child_exclude_list.Load(std::move(is)); child_exclude_list.Load(std::move(is));

View File

@ -75,7 +75,7 @@ CurlStorage::MapUTF8(const char *uri_utf8) const noexcept
return base; return base;
std::string path_esc = CurlEscapeUriPath(uri_utf8); std::string path_esc = CurlEscapeUriPath(uri_utf8);
return PathTraitsUTF8::Build(base.c_str(), path_esc.c_str()); return PathTraitsUTF8::Build(base, path_esc);
} }
const char * const char *

View File

@ -102,7 +102,7 @@ LocalStorage::MapUTF8(const char *uri_utf8) const noexcept
if (StringIsEmpty(uri_utf8)) if (StringIsEmpty(uri_utf8))
return base_utf8; return base_utf8;
return PathTraitsUTF8::Build(base_utf8.c_str(), uri_utf8); return PathTraitsUTF8::Build(base_utf8, uri_utf8);
} }
AllocatedPath AllocatedPath

View File

@ -240,7 +240,7 @@ NfsStorage::MapUTF8(const char *uri_utf8) const noexcept
if (StringIsEmpty(uri_utf8)) if (StringIsEmpty(uri_utf8))
return base; return base;
return PathTraitsUTF8::Build(base.c_str(), uri_utf8); return PathTraitsUTF8::Build(base, uri_utf8);
} }
const char * const char *

View File

@ -81,7 +81,7 @@ SmbclientStorage::MapUTF8(const char *uri_utf8) const noexcept
if (StringIsEmpty(uri_utf8)) if (StringIsEmpty(uri_utf8))
return base; return base;
return PathTraitsUTF8::Build(base.c_str(), uri_utf8); return PathTraitsUTF8::Build(base, uri_utf8);
} }
const char * const char *
@ -174,7 +174,7 @@ SmbclientDirectoryReader::Read() noexcept
StorageFileInfo StorageFileInfo
SmbclientDirectoryReader::GetInfo([[maybe_unused]] bool follow) SmbclientDirectoryReader::GetInfo([[maybe_unused]] bool follow)
{ {
const std::string path = PathTraitsUTF8::Build(base.c_str(), name); const std::string path = PathTraitsUTF8::Build(base, name);
return ::GetInfo(path.c_str()); return ::GetInfo(path.c_str());
} }

View File

@ -340,7 +340,7 @@ UdisksStorage::MapUTF8(const char *uri_utf8) const noexcept
return mounted_storage->MapUTF8(uri_utf8); return mounted_storage->MapUTF8(uri_utf8);
} catch (...) { } catch (...) {
/* fallback - not usable but the best we can do */ /* fallback - not usable but the best we can do */
return PathTraitsUTF8::Build(base_uri.c_str(), uri_utf8); return PathTraitsUTF8::Build(base_uri, uri_utf8);
} }
} }