strat: use m_ for member variables

This commit is contained in:
Michael Scire 2021-10-10 00:14:06 -07:00
parent ce28591ab2
commit a595c232b9
425 changed files with 8531 additions and 8484 deletions

View file

@ -20,20 +20,20 @@ namespace ams::fssystem {
SubDirectoryFileSystem::SubDirectoryFileSystem(std::shared_ptr<fs::fsa::IFileSystem> fs, const char *bp, bool unc)
: PathResolutionFileSystem(fs, unc)
{
this->base_path = nullptr;
m_base_path = nullptr;
R_ABORT_UNLESS(this->Initialize(bp));
}
SubDirectoryFileSystem::SubDirectoryFileSystem(std::unique_ptr<fs::fsa::IFileSystem> fs, const char *bp, bool unc)
: PathResolutionFileSystem(std::move(fs), unc)
{
this->base_path = nullptr;
m_base_path = nullptr;
R_ABORT_UNLESS(this->Initialize(bp));
}
SubDirectoryFileSystem::~SubDirectoryFileSystem() {
if (this->base_path != nullptr) {
fs::impl::Deallocate(this->base_path, this->base_path_len);
if (m_base_path != nullptr) {
fs::impl::Deallocate(m_base_path, m_base_path_len);
}
}
@ -56,25 +56,25 @@ namespace ams::fssystem {
}
/* Allocate new path. */
this->base_path_len = normalized_path_len + 1;
this->base_path = static_cast<char *>(fs::impl::Allocate(this->base_path_len));
R_UNLESS(this->base_path != nullptr, fs::ResultAllocationFailureInSubDirectoryFileSystem());
m_base_path_len = normalized_path_len + 1;
m_base_path = static_cast<char *>(fs::impl::Allocate(m_base_path_len));
R_UNLESS(m_base_path != nullptr, fs::ResultAllocationFailureInSubDirectoryFileSystem());
/* Copy path in. */
std::memcpy(this->base_path, normalized_path, normalized_path_len);
this->base_path[normalized_path_len] = fs::StringTraits::NullTerminator;
std::memcpy(m_base_path, normalized_path, normalized_path_len);
m_base_path[normalized_path_len] = fs::StringTraits::NullTerminator;
return ResultSuccess();
}
Result SubDirectoryFileSystem::ResolveFullPath(char *out, size_t out_size, const char *relative_path) {
/* Ensure path will fit. */
R_UNLESS(this->base_path_len + strnlen(relative_path, fs::EntryNameLengthMax + 1) <= out_size, fs::ResultTooLongPath());
R_UNLESS(m_base_path_len + strnlen(relative_path, fs::EntryNameLengthMax + 1) <= out_size, fs::ResultTooLongPath());
/* Copy base path. */
std::memcpy(out, this->base_path, this->base_path_len);
std::memcpy(out, m_base_path, m_base_path_len);
/* Normalize it. */
const size_t prefix_size = this->base_path_len - 2;
const size_t prefix_size = m_base_path_len - 2;
size_t normalized_len;
return fs::PathNormalizer::Normalize(out + prefix_size, std::addressof(normalized_len), relative_path, out_size - prefix_size, this->IsUncPreserved(), false);
}