code: Use std::span where appropriate (#6658)

* code: Use std::span when possible

* code: Prefix memcpy and memcmp with std::
This commit is contained in:
GPUCode
2023-07-07 01:52:40 +03:00
committed by GitHub
parent 4ccd9f24fb
commit cf9bb90ae3
106 changed files with 362 additions and 329 deletions

View File

@ -13,7 +13,7 @@
namespace FileSys {
Loader::ResultStatus Ticket::Load(const std::vector<u8> file_data, std::size_t offset) {
Loader::ResultStatus Ticket::Load(std::span<const u8> file_data, std::size_t offset) {
std::size_t total_size = static_cast<std::size_t>(file_data.size() - offset);
if (total_size < sizeof(u32))
return Loader::ResultStatus::Error;
@ -35,8 +35,8 @@ Loader::ResultStatus Ticket::Load(const std::vector<u8> file_data, std::size_t o
// Read signature + ticket body
ticket_signature.resize(signature_size);
memcpy(ticket_signature.data(), &file_data[offset + sizeof(u32)], signature_size);
memcpy(&ticket_body, &file_data[offset + body_start], sizeof(Body));
std::memcpy(ticket_signature.data(), &file_data[offset + sizeof(u32)], signature_size);
std::memcpy(&ticket_body, &file_data[offset + body_start], sizeof(Body));
return Loader::ResultStatus::Success;
}