lr: Eliminate unnecessary vars

This commit is contained in:
Adubbz 2019-08-15 20:43:37 +10:00
parent b52b5fe3a8
commit c7c5b9bfcf
4 changed files with 21 additions and 64 deletions

View File

@ -20,7 +20,6 @@
namespace sts::lr { namespace sts::lr {
Result AddOnContentLocationResolverInterface::ResolveAddOnContentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) { Result AddOnContentLocationResolverInterface::ResolveAddOnContentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
Path path;
ncm::StorageId storage_id = ncm::StorageId::None; ncm::StorageId storage_id = ncm::StorageId::None;
if (!this->registered_storages.Find(&storage_id, tid)) { if (!this->registered_storages.Find(&storage_id, tid)) {
@ -35,8 +34,7 @@ namespace sts::lr {
std::shared_ptr<ncm::IContentStorage> content_storage; std::shared_ptr<ncm::IContentStorage> content_storage;
R_TRY(ncm::impl::OpenContentStorage(&content_storage, storage_id)); R_TRY(ncm::impl::OpenContentStorage(&content_storage, storage_id));
R_ASSERT(content_storage->GetPath(&path, data_content_id)); R_ASSERT(content_storage->GetPath(out.pointer, data_content_id));
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }

View File

@ -28,10 +28,7 @@ namespace sts::lr {
} }
Result ContentLocationResolverInterface::ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) { Result ContentLocationResolverInterface::ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
Path path; if (this->program_redirector.FindRedirection(out.pointer, tid)) {
if (this->program_redirector.FindRedirection(&path, tid)) {
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }
@ -43,8 +40,7 @@ namespace sts::lr {
} }
} R_END_TRY_CATCH; } R_END_TRY_CATCH;
R_ASSERT(this->content_storage->GetPath(&path, program_content_id)); R_ASSERT(this->content_storage->GetPath(out.pointer, program_content_id));
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }
@ -54,10 +50,7 @@ namespace sts::lr {
} }
Result ContentLocationResolverInterface::ResolveApplicationControlPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) { Result ContentLocationResolverInterface::ResolveApplicationControlPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
Path path; if (this->app_control_redirector.FindRedirection(out.pointer, tid)) {
if (this->app_control_redirector.FindRedirection(&path, tid)) {
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }
@ -65,10 +58,7 @@ namespace sts::lr {
} }
Result ContentLocationResolverInterface::ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) { Result ContentLocationResolverInterface::ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
Path path; if (this->html_docs_redirector.FindRedirection(out.pointer, tid)) {
if (this->html_docs_redirector.FindRedirection(&path, tid)) {
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }
@ -76,12 +66,10 @@ namespace sts::lr {
} }
Result ContentLocationResolverInterface::ResolveDataPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) { Result ContentLocationResolverInterface::ResolveDataPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
Path path;
ncm::ContentId data_content_id; ncm::ContentId data_content_id;
R_TRY(this->content_meta_database->GetLatestData(&data_content_id, tid)); R_TRY(this->content_meta_database->GetLatestData(&data_content_id, tid));
R_ASSERT(this->content_storage->GetPath(&path, data_content_id)); R_ASSERT(this->content_storage->GetPath(out.pointer, data_content_id));
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }
@ -96,10 +84,7 @@ namespace sts::lr {
} }
Result ContentLocationResolverInterface::ResolveApplicationLegalInformationPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) { Result ContentLocationResolverInterface::ResolveApplicationLegalInformationPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
Path path; if (this->legal_info_redirector.FindRedirection(out.pointer, tid)) {
if (this->legal_info_redirector.FindRedirection(&path, tid)) {
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }
@ -163,20 +148,16 @@ namespace sts::lr {
} }
Result ContentLocationResolverInterface::ResolveProgramPathForDebug(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) { Result ContentLocationResolverInterface::ResolveProgramPathForDebug(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
Path path; if (this->debug_program_redirector.FindRedirection(out.pointer, tid)) {
if (this->debug_program_redirector.FindRedirection(&path, tid)) {
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }
R_TRY_CATCH(this->ResolveProgramPath(&path, tid)) { R_TRY_CATCH(this->ResolveProgramPath(out.pointer, tid)) {
R_CATCH(ResultLrProgramNotFound) { R_CATCH(ResultLrProgramNotFound) {
return ResultLrDebugProgramNotFound; return ResultLrDebugProgramNotFound;
} }
} R_END_TRY_CATCH; } R_END_TRY_CATCH;
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }

View File

@ -28,10 +28,7 @@ namespace sts::lr {
} }
Result RedirectOnlyLocationResolverInterface::ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) { Result RedirectOnlyLocationResolverInterface::ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
Path path; if (this->program_redirector.FindRedirection(out.pointer, tid)) {
if (this->program_redirector.FindRedirection(&path, tid)) {
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }
@ -44,10 +41,7 @@ namespace sts::lr {
} }
Result RedirectOnlyLocationResolverInterface::ResolveApplicationControlPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) { Result RedirectOnlyLocationResolverInterface::ResolveApplicationControlPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
Path path; if (this->app_control_redirector.FindRedirection(out.pointer, tid)) {
if (this->app_control_redirector.FindRedirection(&path, tid)) {
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }
@ -55,10 +49,7 @@ namespace sts::lr {
} }
Result RedirectOnlyLocationResolverInterface::ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) { Result RedirectOnlyLocationResolverInterface::ResolveApplicationHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
Path path; if (this->html_docs_redirector.FindRedirection(out.pointer, tid)) {
if (this->html_docs_redirector.FindRedirection(&path, tid)) {
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }
@ -80,10 +71,7 @@ namespace sts::lr {
} }
Result RedirectOnlyLocationResolverInterface::ResolveApplicationLegalInformationPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) { Result RedirectOnlyLocationResolverInterface::ResolveApplicationLegalInformationPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
Path path; if (this->legal_info_redirector.FindRedirection(out.pointer, tid)) {
if (this->legal_info_redirector.FindRedirection(&path, tid)) {
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }
@ -139,20 +127,16 @@ namespace sts::lr {
} }
Result RedirectOnlyLocationResolverInterface::ResolveProgramPathForDebug(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) { Result RedirectOnlyLocationResolverInterface::ResolveProgramPathForDebug(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
Path path; if (this->debug_program_redirector.FindRedirection(out.pointer, tid)) {
if (this->debug_program_redirector.FindRedirection(&path, tid)) {
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }
R_TRY_CATCH(this->ResolveProgramPath(&path, tid)) { R_TRY_CATCH(this->ResolveProgramPath(out.pointer, tid)) {
R_CATCH(ResultLrProgramNotFound) { R_CATCH(ResultLrProgramNotFound) {
return ResultLrDebugProgramNotFound; return ResultLrDebugProgramNotFound;
} }
} R_END_TRY_CATCH; } R_END_TRY_CATCH;
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }

View File

@ -25,20 +25,17 @@ namespace sts::lr {
} }
Result RegisteredLocationResolverInterface::ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) { Result RegisteredLocationResolverInterface::ResolveProgramPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
Path path; if (!this->program_redirector.FindRedirection(out.pointer, tid)) {
if (!this->registered_program_locations.Find(out.pointer, tid)) {
if (!this->program_redirector.FindRedirection(&path, tid)) {
if (!this->registered_program_locations.Find(&path, tid)) {
return ResultLrProgramNotFound; return ResultLrProgramNotFound;
} }
} }
*out.pointer = path;
return ResultSuccess; return ResultSuccess;
} }
Result RegisteredLocationResolverInterface::RegisterProgramPath(InPointer<const Path> path, ncm::TitleId tid) { Result RegisteredLocationResolverInterface::RegisterProgramPath(InPointer<const Path> path, ncm::TitleId tid) {
Path tmp_path = *path.pointer; const Path& tmp_path = *path.pointer;
if (!this->registered_program_locations.Register(tid, tmp_path)) { if (!this->registered_program_locations.Register(tid, tmp_path)) {
this->registered_program_locations.Clear(); this->registered_program_locations.Clear();
@ -60,20 +57,17 @@ namespace sts::lr {
} }
Result RegisteredLocationResolverInterface::ResolveHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) { Result RegisteredLocationResolverInterface::ResolveHtmlDocumentPath(OutPointerWithServerSize<Path, 0x1> out, ncm::TitleId tid) {
Path path; if (!this->html_docs_redirector.FindRedirection(out.pointer, tid)) {
if (!this->registered_html_docs_locations.Find(out.pointer, tid)) {
if (!this->html_docs_redirector.FindRedirection(&path, tid)) {
if (!this->registered_html_docs_locations.Find(&path, tid)) {
return ResultLrProgramNotFound; return ResultLrProgramNotFound;
} }
} }
*out.pointer = path;
return ResultLrHtmlDocumentNotFound; return ResultLrHtmlDocumentNotFound;
} }
Result RegisteredLocationResolverInterface::RegisterHtmlDocumentPath(InPointer<const Path> path, ncm::TitleId tid) { Result RegisteredLocationResolverInterface::RegisterHtmlDocumentPath(InPointer<const Path> path, ncm::TitleId tid) {
Path tmp_path = *path.pointer; const Path& tmp_path = *path.pointer;
if (!this->registered_html_docs_locations.Register(tid, tmp_path)) { if (!this->registered_html_docs_locations.Register(tid, tmp_path)) {
this->registered_html_docs_locations.Clear(); this->registered_html_docs_locations.Clear();