storage/Interface: pass std::string_view to MapChildFS()
This commit is contained in:
parent
dadf054fbb
commit
f0923231d0
|
@ -122,7 +122,7 @@ class UpdateArchiveVisitor final : public ArchiveVisitor {
|
||||||
* @param plugin the archive plugin which fits this archive type
|
* @param plugin the archive plugin which fits this archive type
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
UpdateWalk::UpdateArchiveFile(Directory &parent, const char *name,
|
UpdateWalk::UpdateArchiveFile(Directory &parent, std::string_view name,
|
||||||
const StorageFileInfo &info,
|
const StorageFileInfo &info,
|
||||||
const ArchivePlugin &plugin) noexcept
|
const ArchivePlugin &plugin) noexcept
|
||||||
{
|
{
|
||||||
|
@ -157,7 +157,7 @@ UpdateWalk::UpdateArchiveFile(Directory &parent, const char *name,
|
||||||
|
|
||||||
bool
|
bool
|
||||||
UpdateWalk::UpdateArchiveFile(Directory &directory,
|
UpdateWalk::UpdateArchiveFile(Directory &directory,
|
||||||
const char *name, const char *suffix,
|
std::string_view name, const char *suffix,
|
||||||
const StorageFileInfo &info) noexcept
|
const StorageFileInfo &info) noexcept
|
||||||
{
|
{
|
||||||
const ArchivePlugin *plugin = archive_plugin_from_suffix(suffix);
|
const ArchivePlugin *plugin = archive_plugin_from_suffix(suffix);
|
||||||
|
|
|
@ -85,7 +85,7 @@ try {
|
||||||
|
|
||||||
bool
|
bool
|
||||||
directory_child_access(Storage &storage, const Directory &directory,
|
directory_child_access(Storage &storage, const Directory &directory,
|
||||||
const char *name, int mode) noexcept
|
std::string_view name, int mode) noexcept
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* CheckAccess() is useless on WIN32 */
|
/* CheckAccess() is useless on WIN32 */
|
||||||
|
|
|
@ -58,6 +58,6 @@ directory_child_is_regular(Storage &storage, const Directory &directory,
|
||||||
gcc_pure
|
gcc_pure
|
||||||
bool
|
bool
|
||||||
directory_child_access(Storage &storage, const Directory &directory,
|
directory_child_access(Storage &storage, const Directory &directory,
|
||||||
const char *name, int mode) noexcept;
|
std::string_view name, int mode) noexcept;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -229,7 +229,7 @@ skip_path(const char *name_utf8) noexcept
|
||||||
gcc_pure
|
gcc_pure
|
||||||
bool
|
bool
|
||||||
UpdateWalk::SkipSymlink(const Directory *directory,
|
UpdateWalk::SkipSymlink(const Directory *directory,
|
||||||
const char *utf8_name) const noexcept
|
std::string_view utf8_name) const noexcept
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
const auto path_fs = storage.MapChildFS(directory->GetPath(),
|
const auto path_fs = storage.MapChildFS(directory->GetPath(),
|
||||||
|
@ -369,7 +369,7 @@ UpdateWalk::UpdateDirectory(Directory &directory,
|
||||||
inline Directory *
|
inline Directory *
|
||||||
UpdateWalk::DirectoryMakeChildChecked(Directory &parent,
|
UpdateWalk::DirectoryMakeChildChecked(Directory &parent,
|
||||||
const char *uri_utf8,
|
const char *uri_utf8,
|
||||||
const char *name_utf8) noexcept
|
std::string_view name_utf8) noexcept
|
||||||
{
|
{
|
||||||
Directory *directory;
|
Directory *directory;
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
private:
|
private:
|
||||||
gcc_pure
|
gcc_pure
|
||||||
bool SkipSymlink(const Directory *directory,
|
bool SkipSymlink(const Directory *directory,
|
||||||
const char *utf8_name) const noexcept;
|
std::string_view utf8_name) const noexcept;
|
||||||
|
|
||||||
void RemoveExcludedFromDirectory(Directory &directory,
|
void RemoveExcludedFromDirectory(Directory &directory,
|
||||||
const ExcludeList &exclude_list) noexcept;
|
const ExcludeList &exclude_list) noexcept;
|
||||||
|
@ -103,10 +103,10 @@ private:
|
||||||
const char *name) noexcept;
|
const char *name) noexcept;
|
||||||
|
|
||||||
bool UpdateArchiveFile(Directory &directory,
|
bool UpdateArchiveFile(Directory &directory,
|
||||||
const char *name, const char *suffix,
|
std::string_view name, const char *suffix,
|
||||||
const StorageFileInfo &info) noexcept;
|
const StorageFileInfo &info) noexcept;
|
||||||
|
|
||||||
void UpdateArchiveFile(Directory &directory, const char *name,
|
void UpdateArchiveFile(Directory &directory, std::string_view name,
|
||||||
const StorageFileInfo &info,
|
const StorageFileInfo &info,
|
||||||
const ArchivePlugin &plugin) noexcept;
|
const ArchivePlugin &plugin) noexcept;
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ private:
|
||||||
|
|
||||||
Directory *DirectoryMakeChildChecked(Directory &parent,
|
Directory *DirectoryMakeChildChecked(Directory &parent,
|
||||||
const char *uri_utf8,
|
const char *uri_utf8,
|
||||||
const char *name_utf8) noexcept;
|
std::string_view name_utf8) noexcept;
|
||||||
|
|
||||||
Directory *DirectoryMakeUriParentChecked(Directory &root,
|
Directory *DirectoryMakeUriParentChecked(Directory &root,
|
||||||
const char *uri) noexcept;
|
const char *uri) noexcept;
|
||||||
|
|
|
@ -28,8 +28,8 @@ Storage::MapFS([[maybe_unused]] const char *uri_utf8) const noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
AllocatedPath
|
AllocatedPath
|
||||||
Storage::MapChildFS(const char *uri_utf8,
|
Storage::MapChildFS(std::string_view uri_utf8,
|
||||||
const char *child_utf8) const noexcept
|
std::string_view child_utf8) const noexcept
|
||||||
{
|
{
|
||||||
const auto uri2 = PathTraitsUTF8::Build(uri_utf8, child_utf8);
|
const auto uri2 = PathTraitsUTF8::Build(uri_utf8, child_utf8);
|
||||||
return MapFS(uri2.c_str());
|
return MapFS(uri2.c_str());
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
struct StorageFileInfo;
|
struct StorageFileInfo;
|
||||||
class AllocatedPath;
|
class AllocatedPath;
|
||||||
|
@ -73,8 +74,8 @@ public:
|
||||||
virtual AllocatedPath MapFS(const char *uri_utf8) const noexcept;
|
virtual AllocatedPath MapFS(const char *uri_utf8) const noexcept;
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
AllocatedPath MapChildFS(const char *uri_utf8,
|
AllocatedPath MapChildFS(std::string_view uri_utf8,
|
||||||
const char *child_utf8) const noexcept;
|
std::string_view child_utf8) const noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the given URI points inside this storage. If yes,
|
* Check if the given URI points inside this storage. If yes,
|
||||||
|
|
Loading…
Reference in New Issue