ams: globally prefer R_RETURN to return for ams::Result

This commit is contained in:
Michael Scire 2022-03-26 14:48:33 -07:00
parent dd78ede99f
commit bbf22b4c60
325 changed files with 1955 additions and 1993 deletions

View file

@ -29,11 +29,11 @@ namespace ams::fs::impl {
}
Result DirectoryAccessor::Read(s64 *out_count, DirectoryEntry *out_entries, s64 max_entries) {
return m_impl->Read(out_count, out_entries, max_entries);
R_RETURN(m_impl->Read(out_count, out_entries, max_entries));
}
Result DirectoryAccessor::GetEntryCount(s64 *out) {
return m_impl->GetEntryCount(out);
R_RETURN(m_impl->GetEntryCount(out));
}
}

View file

@ -46,7 +46,7 @@ namespace ams::fs::impl {
}
Result FileAccessor::ReadWithoutCacheAccessLog(size_t *out, s64 offset, void *buf, size_t size, const ReadOption &option) {
return m_impl->Read(out, offset, buf, size, option);
R_RETURN(m_impl->Read(out, offset, buf, size, option));
}
Result FileAccessor::Read(size_t *out, s64 offset, void *buf, size_t size, const ReadOption &option) {
@ -62,9 +62,9 @@ namespace ams::fs::impl {
if (use_path_cache && use_data_cache && false) {
/* TODO */
return this->ReadWithCacheAccessLog(out, offset, buf, size, option, use_path_cache, use_data_cache);
R_RETURN(this->ReadWithCacheAccessLog(out, offset, buf, size, option, use_path_cache, use_data_cache));
} else {
return AMS_FS_IMPL_ACCESS_LOG_WITH_NAME(this->ReadWithoutCacheAccessLog(out, offset, buf, size, option), handle, "ReadFile", AMS_FS_IMPL_ACCESS_LOG_FORMAT_READ_FILE(out, offset, size));
R_RETURN(AMS_FS_IMPL_ACCESS_LOG_WITH_NAME(this->ReadWithoutCacheAccessLog(out, offset, buf, size, option), handle, "ReadFile", AMS_FS_IMPL_ACCESS_LOG_FORMAT_READ_FILE(out, offset, size)));
}
}
@ -117,11 +117,11 @@ namespace ams::fs::impl {
/* Fail after a write fails. */
R_TRY(m_write_result);
return m_impl->GetSize(out);
R_RETURN(m_impl->GetSize(out));
}
Result FileAccessor::OperateRange(void *dst, size_t dst_size, OperationId operation, s64 offset, s64 size, const void *src, size_t src_size) {
return m_impl->OperateRange(dst, dst_size, operation, offset, size, src, src_size);
R_RETURN(m_impl->OperateRange(dst, dst_size, operation, offset, size, src, src_size));
}
}

View file

@ -61,7 +61,7 @@ namespace ams::fs::impl {
if (!fs::ResultNotEnoughFreeSpace::Includes(r)) {
m_write_result = r;
}
return r;
R_RETURN(r);
}
};

View file

@ -125,7 +125,7 @@ namespace ams::fs::impl {
MountName mount_name;
R_TRY(GetMountNameAndSubPath(std::addressof(mount_name), out_sub_path, path));
return impl::Find(out_accessor, mount_name.str);
R_RETURN(impl::Find(out_accessor, mount_name.str));
}
Result Unmount(const char *name) {

View file

@ -23,14 +23,14 @@ namespace ams::fs::fsa {
auto accessor = std::make_unique<impl::FileSystemAccessor>(name, std::move(fs));
R_UNLESS(accessor != nullptr, fs::ResultAllocationMemoryFailedInRegisterA());
return impl::Register(std::move(accessor));
R_RETURN(impl::Register(std::move(accessor)));
}
Result Register(const char *name, std::unique_ptr<IFileSystem> &&fs, std::unique_ptr<ICommonMountNameGenerator> &&generator) {
auto accessor = std::make_unique<impl::FileSystemAccessor>(name, std::move(fs), std::move(generator));
R_UNLESS(accessor != nullptr, fs::ResultAllocationMemoryFailedInRegisterB());
return impl::Register(std::move(accessor));
R_RETURN(impl::Register(std::move(accessor)));
}
Result Register(const char *name, std::unique_ptr<IFileSystem> &&fs, std::unique_ptr<ICommonMountNameGenerator> &&generator, bool use_data_cache, bool use_path_cache, bool support_multi_commit) {
@ -41,7 +41,7 @@ namespace ams::fs::fsa {
accessor->SetPathBasedFileDataCacheAttachable(use_path_cache);
accessor->SetMultiCommitSupported(support_multi_commit);
return impl::Register(std::move(accessor));
R_RETURN(impl::Register(std::move(accessor)));
}
void Unregister(const char *name) {

View file

@ -23,7 +23,7 @@
namespace ams::fs {
Result CreateFile(const char *path, s64 size) {
return CreateFile(path, size, 0);
R_RETURN(CreateFile(path, size, 0));
}
Result CreateFile(const char* path, s64 size, int option) {
@ -220,11 +220,11 @@ namespace ams::fs {
}
Result Commit(const char *mount_name) {
return CommitImpl(mount_name, AMS_CURRENT_FUNCTION_NAME);
R_RETURN(CommitImpl(mount_name, AMS_CURRENT_FUNCTION_NAME));
}
Result CommitSaveData(const char *mount_name) {
return CommitImpl(mount_name, AMS_CURRENT_FUNCTION_NAME);
R_RETURN(CommitImpl(mount_name, AMS_CURRENT_FUNCTION_NAME));
}
}

View file

@ -27,11 +27,11 @@ namespace ams::fs::impl {
}
Result Register(std::unique_ptr<FileSystemAccessor> &&fs) {
return g_mount_table.Mount(std::move(fs));
R_RETURN(g_mount_table.Mount(std::move(fs)));
}
Result Find(FileSystemAccessor **out, const char *name) {
return g_mount_table.Find(out, name);
R_RETURN(g_mount_table.Find(out, name));
}
void Unregister(const char *name) {