strat: use m_ for member variables
This commit is contained in:
@@ -50,18 +50,18 @@ namespace ams::fs {
|
||||
Result HierarchicalRomFileTable::Initialize(SubStorage dir_bucket, SubStorage dir_entry, SubStorage file_bucket, SubStorage file_entry) {
|
||||
s64 dir_bucket_size;
|
||||
R_TRY(dir_bucket.GetSize(std::addressof(dir_bucket_size)));
|
||||
R_TRY(this->dir_table.Initialize(dir_bucket, DirectoryEntryMapTable::QueryBucketCount(dir_bucket_size), dir_entry));
|
||||
R_TRY(m_dir_table.Initialize(dir_bucket, DirectoryEntryMapTable::QueryBucketCount(dir_bucket_size), dir_entry));
|
||||
|
||||
s64 file_bucket_size;
|
||||
R_TRY(file_bucket.GetSize(std::addressof(file_bucket_size)));
|
||||
R_TRY(this->file_table.Initialize(file_bucket, FileEntryMapTable::QueryBucketCount(file_bucket_size), file_entry));
|
||||
R_TRY(m_file_table.Initialize(file_bucket, FileEntryMapTable::QueryBucketCount(file_bucket_size), file_entry));
|
||||
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
void HierarchicalRomFileTable::Finalize() {
|
||||
this->dir_table.Finalize();
|
||||
this->file_table.Finalize();
|
||||
m_dir_table.Finalize();
|
||||
m_file_table.Finalize();
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::CreateRootDirectory() {
|
||||
@@ -74,7 +74,7 @@ namespace ams::fs {
|
||||
.dir = InvalidPosition,
|
||||
.file = InvalidPosition,
|
||||
};
|
||||
return this->dir_table.Add(std::addressof(root_pos), root_key, root_entry);
|
||||
return m_dir_table.Add(std::addressof(root_pos), root_key, root_entry);
|
||||
}
|
||||
|
||||
Result HierarchicalRomFileTable::CreateDirectory(RomDirectoryId *out, const RomPathChar *path, const DirectoryInfo &info) {
|
||||
@@ -95,7 +95,7 @@ namespace ams::fs {
|
||||
AMS_UNUSED(info);
|
||||
|
||||
Position new_pos = 0;
|
||||
R_TRY_CATCH(this->dir_table.Add(std::addressof(new_pos), new_key, new_entry)) {
|
||||
R_TRY_CATCH(m_dir_table.Add(std::addressof(new_pos), new_key, new_entry)) {
|
||||
R_CONVERT(fs::ResultDbmKeyFull, fs::ResultDbmDirectoryEntryFull())
|
||||
} R_END_TRY_CATCH;
|
||||
|
||||
@@ -104,18 +104,18 @@ namespace ams::fs {
|
||||
if (parent_entry.dir == InvalidPosition) {
|
||||
parent_entry.dir = new_pos;
|
||||
|
||||
R_TRY(this->dir_table.SetByPosition(new_key.key.parent, parent_entry));
|
||||
R_TRY(m_dir_table.SetByPosition(new_key.key.parent, parent_entry));
|
||||
} else {
|
||||
Position cur_pos = parent_entry.dir;
|
||||
while (true) {
|
||||
RomEntryKey cur_key = {};
|
||||
RomDirectoryEntry cur_entry = {};
|
||||
R_TRY(this->dir_table.GetByPosition(std::addressof(cur_key), std::addressof(cur_entry), cur_pos));
|
||||
R_TRY(m_dir_table.GetByPosition(std::addressof(cur_key), std::addressof(cur_entry), cur_pos));
|
||||
|
||||
if (cur_entry.next == InvalidPosition) {
|
||||
cur_entry.next = new_pos;
|
||||
|
||||
R_TRY(this->dir_table.SetByPosition(cur_pos, cur_entry));
|
||||
R_TRY(m_dir_table.SetByPosition(cur_pos, cur_entry));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace ams::fs {
|
||||
};
|
||||
|
||||
Position new_pos = 0;
|
||||
R_TRY_CATCH(this->file_table.Add(std::addressof(new_pos), new_key, new_entry)) {
|
||||
R_TRY_CATCH(m_file_table.Add(std::addressof(new_pos), new_key, new_entry)) {
|
||||
R_CONVERT(fs::ResultDbmKeyFull, fs::ResultDbmFileEntryFull())
|
||||
} R_END_TRY_CATCH;
|
||||
|
||||
@@ -151,18 +151,18 @@ namespace ams::fs {
|
||||
if (parent_entry.file == InvalidPosition) {
|
||||
parent_entry.file = new_pos;
|
||||
|
||||
R_TRY(this->dir_table.SetByPosition(new_key.key.parent, parent_entry));
|
||||
R_TRY(m_dir_table.SetByPosition(new_key.key.parent, parent_entry));
|
||||
} else {
|
||||
Position cur_pos = parent_entry.file;
|
||||
while (true) {
|
||||
RomEntryKey cur_key = {};
|
||||
RomFileEntry cur_entry = {};
|
||||
R_TRY(this->file_table.GetByPosition(std::addressof(cur_key), std::addressof(cur_entry), cur_pos));
|
||||
R_TRY(m_file_table.GetByPosition(std::addressof(cur_key), std::addressof(cur_entry), cur_pos));
|
||||
|
||||
if (cur_entry.next == InvalidPosition) {
|
||||
cur_entry.next = new_pos;
|
||||
|
||||
R_TRY(this->file_table.SetByPosition(cur_pos, cur_entry));
|
||||
R_TRY(m_file_table.SetByPosition(cur_pos, cur_entry));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ namespace ams::fs {
|
||||
RomEntryKey key = {};
|
||||
RomDirectoryEntry entry = {};
|
||||
size_t aux_size = 0;
|
||||
R_TRY(this->dir_table.GetByPosition(std::addressof(key), std::addressof(entry), out, std::addressof(aux_size), find->next_dir));
|
||||
R_TRY(m_dir_table.GetByPosition(std::addressof(key), std::addressof(entry), out, std::addressof(aux_size), find->next_dir));
|
||||
AMS_ASSERT(aux_size / sizeof(RomPathChar) <= RomPathTool::MaxPathLength);
|
||||
|
||||
out[aux_size / sizeof(RomPathChar)] = RomStringTraits::NullTerminator;
|
||||
@@ -305,7 +305,7 @@ namespace ams::fs {
|
||||
RomEntryKey key = {};
|
||||
RomFileEntry entry = {};
|
||||
size_t aux_size = 0;
|
||||
R_TRY(this->file_table.GetByPosition(std::addressof(key), std::addressof(entry), out, std::addressof(aux_size), find->next_file));
|
||||
R_TRY(m_file_table.GetByPosition(std::addressof(key), std::addressof(entry), out, std::addressof(aux_size), find->next_file));
|
||||
AMS_ASSERT(aux_size / sizeof(RomPathChar) <= RomPathTool::MaxPathLength);
|
||||
|
||||
out[aux_size / sizeof(RomPathChar)] = RomStringTraits::NullTerminator;
|
||||
@@ -318,8 +318,8 @@ namespace ams::fs {
|
||||
AMS_ASSERT(out_dir_entry_size != nullptr);
|
||||
AMS_ASSERT(out_file_entry_size != nullptr);
|
||||
|
||||
*out_dir_entry_size = this->dir_table.GetTotalEntrySize();
|
||||
*out_file_entry_size = this->file_table.GetTotalEntrySize();
|
||||
*out_dir_entry_size = m_dir_table.GetTotalEntrySize();
|
||||
*out_file_entry_size = m_file_table.GetTotalEntrySize();
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ namespace ams::fs {
|
||||
|
||||
RomEntryKey gp_key = {};
|
||||
RomDirectoryEntry gp_entry = {};
|
||||
R_TRY(this->dir_table.GetByPosition(std::addressof(gp_key), std::addressof(gp_entry), pos));
|
||||
R_TRY(m_dir_table.GetByPosition(std::addressof(gp_key), std::addressof(gp_entry), pos));
|
||||
out_dir_key->key.parent = gp_key.parent;
|
||||
|
||||
R_TRY(RomPathTool::GetParentDirectoryName(std::addressof(out_dir_key->name), name, path));
|
||||
@@ -458,7 +458,7 @@ namespace ams::fs {
|
||||
{
|
||||
Position pos = InvalidPosition;
|
||||
RomDirectoryEntry entry = {};
|
||||
const Result get_res = this->dir_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
const Result get_res = m_dir_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
if (!fs::ResultDbmKeyNotFound::Includes(get_res)) {
|
||||
R_TRY(get_res);
|
||||
return if_exists;
|
||||
@@ -469,7 +469,7 @@ namespace ams::fs {
|
||||
{
|
||||
Position pos = InvalidPosition;
|
||||
RomFileEntry entry = {};
|
||||
const Result get_res = this->file_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
const Result get_res = m_file_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
if (!fs::ResultDbmKeyNotFound::Includes(get_res)) {
|
||||
R_TRY(get_res);
|
||||
return if_exists;
|
||||
@@ -482,13 +482,13 @@ namespace ams::fs {
|
||||
AMS_ASSERT(out_pos != nullptr);
|
||||
AMS_ASSERT(out_entry != nullptr);
|
||||
|
||||
const Result dir_res = this->dir_table.Get(out_pos, out_entry, key);
|
||||
const Result dir_res = m_dir_table.Get(out_pos, out_entry, key);
|
||||
R_UNLESS(R_FAILED(dir_res), dir_res);
|
||||
R_UNLESS(fs::ResultDbmKeyNotFound::Includes(dir_res), dir_res);
|
||||
|
||||
Position pos = 0;
|
||||
RomFileEntry entry = {};
|
||||
const Result file_res = this->file_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
const Result file_res = m_file_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
R_UNLESS(R_FAILED(file_res), fs::ResultDbmInvalidOperation());
|
||||
R_UNLESS(!fs::ResultDbmKeyNotFound::Includes(file_res), fs::ResultDbmDirectoryNotFound());
|
||||
return file_res;
|
||||
@@ -499,12 +499,12 @@ namespace ams::fs {
|
||||
Position pos = DirectoryIdToPosition(id);
|
||||
|
||||
RomEntryKey key = {};
|
||||
const Result dir_res = this->dir_table.GetByPosition(std::addressof(key), out_entry, pos);
|
||||
const Result dir_res = m_dir_table.GetByPosition(std::addressof(key), out_entry, pos);
|
||||
R_UNLESS(R_FAILED(dir_res), dir_res);
|
||||
R_UNLESS(fs::ResultDbmKeyNotFound::Includes(dir_res), dir_res);
|
||||
|
||||
RomFileEntry entry = {};
|
||||
const Result file_res = this->file_table.GetByPosition(std::addressof(key), std::addressof(entry), pos);
|
||||
const Result file_res = m_file_table.GetByPosition(std::addressof(key), std::addressof(entry), pos);
|
||||
R_UNLESS(R_FAILED(file_res), fs::ResultDbmInvalidOperation());
|
||||
R_UNLESS(!fs::ResultDbmKeyNotFound::Includes(file_res), fs::ResultDbmDirectoryNotFound());
|
||||
return file_res;
|
||||
@@ -514,13 +514,13 @@ namespace ams::fs {
|
||||
AMS_ASSERT(out_pos != nullptr);
|
||||
AMS_ASSERT(out_entry != nullptr);
|
||||
|
||||
const Result file_res = this->file_table.Get(out_pos, out_entry, key);
|
||||
const Result file_res = m_file_table.Get(out_pos, out_entry, key);
|
||||
R_UNLESS(R_FAILED(file_res), file_res);
|
||||
R_UNLESS(fs::ResultDbmKeyNotFound::Includes(file_res), file_res);
|
||||
|
||||
Position pos = 0;
|
||||
RomDirectoryEntry entry = {};
|
||||
const Result dir_res = this->dir_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
const Result dir_res = m_dir_table.Get(std::addressof(pos), std::addressof(entry), key);
|
||||
R_UNLESS(R_FAILED(dir_res), fs::ResultDbmInvalidOperation());
|
||||
R_UNLESS(!fs::ResultDbmKeyNotFound::Includes(dir_res), fs::ResultDbmFileNotFound());
|
||||
return dir_res;
|
||||
@@ -531,12 +531,12 @@ namespace ams::fs {
|
||||
Position pos = FileIdToPosition(id);
|
||||
|
||||
RomEntryKey key = {};
|
||||
const Result file_res = this->file_table.GetByPosition(std::addressof(key), out_entry, pos);
|
||||
const Result file_res = m_file_table.GetByPosition(std::addressof(key), out_entry, pos);
|
||||
R_UNLESS(R_FAILED(file_res), file_res);
|
||||
R_UNLESS(fs::ResultDbmKeyNotFound::Includes(file_res), file_res);
|
||||
|
||||
RomDirectoryEntry entry = {};
|
||||
const Result dir_res = this->dir_table.GetByPosition(std::addressof(key), std::addressof(entry), pos);
|
||||
const Result dir_res = m_dir_table.GetByPosition(std::addressof(key), std::addressof(entry), pos);
|
||||
R_UNLESS(R_FAILED(dir_res), fs::ResultDbmInvalidOperation());
|
||||
R_UNLESS(!fs::ResultDbmKeyNotFound::Includes(dir_res), fs::ResultDbmFileNotFound());
|
||||
return dir_res;
|
||||
|
||||
@@ -26,9 +26,9 @@ namespace ams::fs::RomPathTool {
|
||||
path++;
|
||||
}
|
||||
|
||||
this->prev_path_start = path;
|
||||
this->prev_path_end = path;
|
||||
for (this->next_path = path + 1; IsSeparator(this->next_path[0]); ++this->next_path) {
|
||||
m_prev_path_start = path;
|
||||
m_prev_path_end = path;
|
||||
for (m_next_path = path + 1; IsSeparator(m_next_path[0]); ++m_next_path) {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
@@ -36,63 +36,63 @@ namespace ams::fs::RomPathTool {
|
||||
}
|
||||
|
||||
void PathParser::Finalize() {
|
||||
this->prev_path_start = nullptr;
|
||||
this->prev_path_end = nullptr;
|
||||
this->next_path = nullptr;
|
||||
this->finished = false;
|
||||
m_prev_path_start = nullptr;
|
||||
m_prev_path_end = nullptr;
|
||||
m_next_path = nullptr;
|
||||
m_finished = false;
|
||||
}
|
||||
|
||||
bool PathParser::IsParseFinished() const {
|
||||
return this->finished;
|
||||
return m_finished;
|
||||
}
|
||||
|
||||
bool PathParser::IsDirectoryPath() const {
|
||||
AMS_ASSERT(this->next_path != nullptr);
|
||||
AMS_ASSERT(m_next_path != nullptr);
|
||||
|
||||
if (IsNullTerminator(this->next_path[0]) && IsSeparator(this->next_path[-1])) {
|
||||
if (IsNullTerminator(m_next_path[0]) && IsSeparator(m_next_path[-1])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IsCurrentDirectory(this->next_path)) {
|
||||
if (IsCurrentDirectory(m_next_path)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return IsParentDirectory(this->next_path);
|
||||
return IsParentDirectory(m_next_path);
|
||||
}
|
||||
|
||||
Result PathParser::GetNextDirectoryName(RomEntryName *out) {
|
||||
AMS_ASSERT(out != nullptr);
|
||||
AMS_ASSERT(this->prev_path_start != nullptr);
|
||||
AMS_ASSERT(this->prev_path_end != nullptr);
|
||||
AMS_ASSERT(this->next_path != nullptr);
|
||||
AMS_ASSERT(m_prev_path_start != nullptr);
|
||||
AMS_ASSERT(m_prev_path_end != nullptr);
|
||||
AMS_ASSERT(m_next_path != nullptr);
|
||||
|
||||
/* Set the current path to output. */
|
||||
out->length = this->prev_path_end - this->prev_path_start;
|
||||
out->path = this->prev_path_start;
|
||||
out->length = m_prev_path_end - m_prev_path_start;
|
||||
out->path = m_prev_path_start;
|
||||
|
||||
/* Parse the next path. */
|
||||
this->prev_path_start = this->next_path;
|
||||
const RomPathChar *cur = this->next_path;
|
||||
m_prev_path_start = m_next_path;
|
||||
const RomPathChar *cur = m_next_path;
|
||||
for (size_t name_len = 0; true; name_len++) {
|
||||
if (IsSeparator(cur[name_len])) {
|
||||
R_UNLESS(name_len < MaxPathLength, fs::ResultDbmDirectoryNameTooLong());
|
||||
|
||||
this->prev_path_end = cur + name_len;
|
||||
this->next_path = this->prev_path_end + 1;
|
||||
m_prev_path_end = cur + name_len;
|
||||
m_next_path = m_prev_path_end + 1;
|
||||
|
||||
while (IsSeparator(this->next_path[0])) {
|
||||
++this->next_path;
|
||||
while (IsSeparator(m_next_path[0])) {
|
||||
++m_next_path;
|
||||
}
|
||||
if (IsNullTerminator(this->next_path[0])) {
|
||||
this->finished = true;
|
||||
if (IsNullTerminator(m_next_path[0])) {
|
||||
m_finished = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (IsNullTerminator(cur[name_len])) {
|
||||
this->finished = true;
|
||||
this->next_path = cur + name_len;
|
||||
this->prev_path_end = cur + name_len;
|
||||
m_finished = true;
|
||||
m_next_path = cur + name_len;
|
||||
m_prev_path_end = cur + name_len;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -102,29 +102,29 @@ namespace ams::fs::RomPathTool {
|
||||
|
||||
Result PathParser::GetAsDirectoryName(RomEntryName *out) const {
|
||||
AMS_ASSERT(out != nullptr);
|
||||
AMS_ASSERT(this->prev_path_start != nullptr);
|
||||
AMS_ASSERT(this->prev_path_end != nullptr);
|
||||
AMS_ASSERT(this->next_path != nullptr);
|
||||
AMS_ASSERT(m_prev_path_start != nullptr);
|
||||
AMS_ASSERT(m_prev_path_end != nullptr);
|
||||
AMS_ASSERT(m_next_path != nullptr);
|
||||
|
||||
const size_t len = this->prev_path_end - this->prev_path_start;
|
||||
const size_t len = m_prev_path_end - m_prev_path_start;
|
||||
R_UNLESS(len <= MaxPathLength, fs::ResultDbmDirectoryNameTooLong());
|
||||
|
||||
out->length = len;
|
||||
out->path = this->prev_path_start;
|
||||
out->path = m_prev_path_start;
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result PathParser::GetAsFileName(RomEntryName *out) const {
|
||||
AMS_ASSERT(out != nullptr);
|
||||
AMS_ASSERT(this->prev_path_start != nullptr);
|
||||
AMS_ASSERT(this->prev_path_end != nullptr);
|
||||
AMS_ASSERT(this->next_path != nullptr);
|
||||
AMS_ASSERT(m_prev_path_start != nullptr);
|
||||
AMS_ASSERT(m_prev_path_end != nullptr);
|
||||
AMS_ASSERT(m_next_path != nullptr);
|
||||
|
||||
const size_t len = this->prev_path_end - this->prev_path_start;
|
||||
const size_t len = m_prev_path_end - m_prev_path_start;
|
||||
R_UNLESS(len <= MaxPathLength, fs::ResultDbmFileNameTooLong());
|
||||
|
||||
out->length = len;
|
||||
out->path = this->prev_path_start;
|
||||
out->path = m_prev_path_start;
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
namespace ams::fs {
|
||||
|
||||
Result FileStorage::UpdateSize() {
|
||||
R_SUCCEED_IF(this->size != InvalidSize);
|
||||
return this->base_file->GetSize(std::addressof(this->size));
|
||||
R_SUCCEED_IF(m_size != InvalidSize);
|
||||
return m_base_file->GetSize(std::addressof(m_size));
|
||||
}
|
||||
|
||||
Result FileStorage::Read(s64 offset, void *buffer, size_t size) {
|
||||
@@ -33,10 +33,10 @@ namespace ams::fs {
|
||||
R_TRY(this->UpdateSize());
|
||||
|
||||
/* Ensure our access is valid. */
|
||||
R_UNLESS(IStorage::CheckAccessRange(offset, size, this->size), fs::ResultOutOfRange());
|
||||
R_UNLESS(IStorage::CheckAccessRange(offset, size, m_size), fs::ResultOutOfRange());
|
||||
|
||||
size_t read_size;
|
||||
return this->base_file->Read(std::addressof(read_size), offset, buffer, size);
|
||||
return m_base_file->Read(std::addressof(read_size), offset, buffer, size);
|
||||
}
|
||||
|
||||
Result FileStorage::Write(s64 offset, const void *buffer, size_t size) {
|
||||
@@ -50,24 +50,24 @@ namespace ams::fs {
|
||||
R_TRY(this->UpdateSize());
|
||||
|
||||
/* Ensure our access is valid. */
|
||||
R_UNLESS(IStorage::CheckAccessRange(offset, size, this->size), fs::ResultOutOfRange());
|
||||
R_UNLESS(IStorage::CheckAccessRange(offset, size, m_size), fs::ResultOutOfRange());
|
||||
|
||||
return this->base_file->Write(offset, buffer, size, fs::WriteOption());
|
||||
return m_base_file->Write(offset, buffer, size, fs::WriteOption());
|
||||
}
|
||||
|
||||
Result FileStorage::Flush() {
|
||||
return this->base_file->Flush();
|
||||
return m_base_file->Flush();
|
||||
}
|
||||
|
||||
Result FileStorage::GetSize(s64 *out_size) {
|
||||
R_TRY(this->UpdateSize());
|
||||
*out_size = this->size;
|
||||
*out_size = m_size;
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result FileStorage::SetSize(s64 size) {
|
||||
this->size = InvalidSize;
|
||||
return this->base_file->SetSize(size);
|
||||
m_size = InvalidSize;
|
||||
return m_base_file->SetSize(size);
|
||||
}
|
||||
|
||||
Result FileStorage::OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
|
||||
@@ -84,7 +84,7 @@ namespace ams::fs {
|
||||
}
|
||||
R_TRY(this->UpdateSize());
|
||||
R_UNLESS(IStorage::CheckOffsetAndSize(offset, size), fs::ResultOutOfRange());
|
||||
return this->base_file->OperateRange(dst, dst_size, op_id, offset, size, src, src_size);
|
||||
return m_base_file->OperateRange(dst, dst_size, op_id, offset, size, src, src_size);
|
||||
default:
|
||||
return fs::ResultUnsupportedOperationInFileStorageA();
|
||||
}
|
||||
@@ -97,19 +97,19 @@ namespace ams::fs {
|
||||
|
||||
/* Set the file. */
|
||||
this->SetFile(std::move(base_file));
|
||||
this->base_file_system = std::move(base_file_system);
|
||||
m_base_file_system = std::move(base_file_system);
|
||||
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result FileHandleStorage::UpdateSize() {
|
||||
R_SUCCEED_IF(this->size != InvalidSize);
|
||||
return GetFileSize(std::addressof(this->size), this->handle);
|
||||
R_SUCCEED_IF(m_size != InvalidSize);
|
||||
return GetFileSize(std::addressof(m_size), m_handle);
|
||||
}
|
||||
|
||||
Result FileHandleStorage::Read(s64 offset, void *buffer, size_t size) {
|
||||
/* Lock the mutex. */
|
||||
std::scoped_lock lk(this->mutex);
|
||||
std::scoped_lock lk(m_mutex);
|
||||
|
||||
/* Immediately succeed if there's nothing to read. */
|
||||
R_SUCCEED_IF(size == 0);
|
||||
@@ -121,14 +121,14 @@ namespace ams::fs {
|
||||
R_TRY(this->UpdateSize());
|
||||
|
||||
/* Ensure our access is valid. */
|
||||
R_UNLESS(IStorage::CheckAccessRange(offset, size, this->size), fs::ResultOutOfRange());
|
||||
R_UNLESS(IStorage::CheckAccessRange(offset, size, m_size), fs::ResultOutOfRange());
|
||||
|
||||
return ReadFile(this->handle, offset, buffer, size, fs::ReadOption());
|
||||
return ReadFile(m_handle, offset, buffer, size, fs::ReadOption());
|
||||
}
|
||||
|
||||
Result FileHandleStorage::Write(s64 offset, const void *buffer, size_t size) {
|
||||
/* Lock the mutex. */
|
||||
std::scoped_lock lk(this->mutex);
|
||||
std::scoped_lock lk(m_mutex);
|
||||
|
||||
/* Immediately succeed if there's nothing to write. */
|
||||
R_SUCCEED_IF(size == 0);
|
||||
@@ -140,24 +140,24 @@ namespace ams::fs {
|
||||
R_TRY(this->UpdateSize());
|
||||
|
||||
/* Ensure our access is valid. */
|
||||
R_UNLESS(IStorage::CheckAccessRange(offset, size, this->size), fs::ResultOutOfRange());
|
||||
R_UNLESS(IStorage::CheckAccessRange(offset, size, m_size), fs::ResultOutOfRange());
|
||||
|
||||
return WriteFile(this->handle, offset, buffer, size, fs::WriteOption());
|
||||
return WriteFile(m_handle, offset, buffer, size, fs::WriteOption());
|
||||
}
|
||||
|
||||
Result FileHandleStorage::Flush() {
|
||||
return FlushFile(this->handle);
|
||||
return FlushFile(m_handle);
|
||||
}
|
||||
|
||||
Result FileHandleStorage::GetSize(s64 *out_size) {
|
||||
R_TRY(this->UpdateSize());
|
||||
*out_size = this->size;
|
||||
*out_size = m_size;
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
Result FileHandleStorage::SetSize(s64 size) {
|
||||
this->size = InvalidSize;
|
||||
return SetFileSize(this->handle, size);
|
||||
m_size = InvalidSize;
|
||||
return SetFileSize(m_handle, size);
|
||||
}
|
||||
|
||||
Result FileHandleStorage::OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
|
||||
@@ -169,7 +169,7 @@ namespace ams::fs {
|
||||
R_UNLESS(dst != nullptr, fs::ResultNullptrArgument());
|
||||
R_UNLESS(dst_size == sizeof(QueryRangeInfo), fs::ResultInvalidSize());
|
||||
|
||||
return QueryRange(static_cast<QueryRangeInfo *>(dst), this->handle, offset, size);
|
||||
return QueryRange(static_cast<QueryRangeInfo *>(dst), m_handle, offset, size);
|
||||
default:
|
||||
return fs::ResultUnsupportedOperationInFileStorageB();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user