fs.mitm: Replace more raw loops with algorithms

This commit is contained in:
Tony Wasserka 2018-06-16 19:49:48 +02:00
parent c950998c91
commit 5734c54188

View File

@ -40,10 +40,8 @@ void FsMitMService::postprocess(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_
} *resp = (decltype(resp))r.Raw; } *resp = (decltype(resp))r.Raw;
u64 *tls = (u64 *)armGetTls(); u64 *tls = (u64 *)armGetTls();
u64 backup_tls[0x100/sizeof(u64)]; std::array<u64, 0x100/sizeof(u64)> backup_tls;
for (unsigned int i = 0; i < sizeof(backup_tls)/sizeof(u64); i++) { std::copy(tls, tls + backup_tls.size(), backup_tls.begin());
backup_tls[i] = tls[i];
}
Result rc = (Result)resp->result; Result rc = (Result)resp->result;
switch (static_cast<FspSrvCmd>(cmd_id)) { switch (static_cast<FspSrvCmd>(cmd_id)) {
@ -56,9 +54,7 @@ void FsMitMService::postprocess(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_
if (R_FAILED(MitMQueryUtils::get_associated_tid_for_pid(this->process_id, &this->title_id))) { if (R_FAILED(MitMQueryUtils::get_associated_tid_for_pid(this->process_id, &this->title_id))) {
/* Log here, if desired. */ /* Log here, if desired. */
} }
for (unsigned int i = 0; i < sizeof(backup_tls)/sizeof(u64); i++) { std::copy(backup_tls.begin(), backup_tls.end(), tls);
tls[i] = backup_tls[i];
}
break; break;
default: default:
break; break;