storage/Interface: pass std::string_view to MapChildFS()

This commit is contained in:
Max Kellermann 2020-04-02 20:10:36 +02:00
parent dadf054fbb
commit f0923231d0
7 changed files with 15 additions and 14 deletions

View File

@ -122,7 +122,7 @@ class UpdateArchiveVisitor final : public ArchiveVisitor {
* @param plugin the archive plugin which fits this archive type
*/
void
UpdateWalk::UpdateArchiveFile(Directory &parent, const char *name,
UpdateWalk::UpdateArchiveFile(Directory &parent, std::string_view name,
const StorageFileInfo &info,
const ArchivePlugin &plugin) noexcept
{
@ -157,7 +157,7 @@ UpdateWalk::UpdateArchiveFile(Directory &parent, const char *name,
bool
UpdateWalk::UpdateArchiveFile(Directory &directory,
const char *name, const char *suffix,
std::string_view name, const char *suffix,
const StorageFileInfo &info) noexcept
{
const ArchivePlugin *plugin = archive_plugin_from_suffix(suffix);

View File

@ -85,7 +85,7 @@ try {
bool
directory_child_access(Storage &storage, const Directory &directory,
const char *name, int mode) noexcept
std::string_view name, int mode) noexcept
{
#ifdef _WIN32
/* CheckAccess() is useless on WIN32 */

View File

@ -58,6 +58,6 @@ directory_child_is_regular(Storage &storage, const Directory &directory,
gcc_pure
bool
directory_child_access(Storage &storage, const Directory &directory,
const char *name, int mode) noexcept;
std::string_view name, int mode) noexcept;
#endif

View File

@ -229,7 +229,7 @@ skip_path(const char *name_utf8) noexcept
gcc_pure
bool
UpdateWalk::SkipSymlink(const Directory *directory,
const char *utf8_name) const noexcept
std::string_view utf8_name) const noexcept
{
#ifndef _WIN32
const auto path_fs = storage.MapChildFS(directory->GetPath(),
@ -369,7 +369,7 @@ UpdateWalk::UpdateDirectory(Directory &directory,
inline Directory *
UpdateWalk::DirectoryMakeChildChecked(Directory &parent,
const char *uri_utf8,
const char *name_utf8) noexcept
std::string_view name_utf8) noexcept
{
Directory *directory;
{

View File

@ -78,7 +78,7 @@ public:
private:
gcc_pure
bool SkipSymlink(const Directory *directory,
const char *utf8_name) const noexcept;
std::string_view utf8_name) const noexcept;
void RemoveExcludedFromDirectory(Directory &directory,
const ExcludeList &exclude_list) noexcept;
@ -103,10 +103,10 @@ private:
const char *name) noexcept;
bool UpdateArchiveFile(Directory &directory,
const char *name, const char *suffix,
std::string_view name, const char *suffix,
const StorageFileInfo &info) noexcept;
void UpdateArchiveFile(Directory &directory, const char *name,
void UpdateArchiveFile(Directory &directory, std::string_view name,
const StorageFileInfo &info,
const ArchivePlugin &plugin) noexcept;
@ -163,7 +163,7 @@ private:
Directory *DirectoryMakeChildChecked(Directory &parent,
const char *uri_utf8,
const char *name_utf8) noexcept;
std::string_view name_utf8) noexcept;
Directory *DirectoryMakeUriParentChecked(Directory &root,
const char *uri) noexcept;

View File

@ -28,8 +28,8 @@ Storage::MapFS([[maybe_unused]] const char *uri_utf8) const noexcept
}
AllocatedPath
Storage::MapChildFS(const char *uri_utf8,
const char *child_utf8) const noexcept
Storage::MapChildFS(std::string_view uri_utf8,
std::string_view child_utf8) const noexcept
{
const auto uri2 = PathTraitsUTF8::Build(uri_utf8, child_utf8);
return MapFS(uri2.c_str());

View File

@ -24,6 +24,7 @@
#include <memory>
#include <string>
#include <string_view>
struct StorageFileInfo;
class AllocatedPath;
@ -73,8 +74,8 @@ public:
virtual AllocatedPath MapFS(const char *uri_utf8) const noexcept;
gcc_pure
AllocatedPath MapChildFS(const char *uri_utf8,
const char *child_utf8) const noexcept;
AllocatedPath MapChildFS(std::string_view uri_utf8,
std::string_view child_utf8) const noexcept;
/**
* Check if the given URI points inside this storage. If yes,