Merge pull request #4304 from B3n30/std_optional

Replace boost::optional with std::optional where possible
This commit is contained in:
Weiyi Wang 2018-10-11 12:40:00 -04:00 committed by GitHub
commit 9adc407112
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 115 additions and 109 deletions

View file

@ -38,13 +38,13 @@ Loader::ResultStatus Ticket::Load(const std::vector<u8> file_data, std::size_t o
return Loader::ResultStatus::Success;
}
boost::optional<std::array<u8, 16>> Ticket::GetTitleKey() const {
std::optional<std::array<u8, 16>> Ticket::GetTitleKey() const {
HW::AES::InitKeys();
std::array<u8, 16> ctr{};
std::memcpy(ctr.data(), &ticket_body.title_id, sizeof(u64));
HW::AES::SelectCommonKeyIndex(ticket_body.common_key_index);
if (!HW::AES::IsNormalKeyAvailable(HW::AES::KeySlotID::TicketCommonKey)) {
return boost::none;
return {};
}
auto key = HW::AES::GetNormalKey(HW::AES::KeySlotID::TicketCommonKey);
auto title_key = ticket_body.title_key;

View file

@ -5,9 +5,9 @@
#pragma once
#include <array>
#include <optional>
#include <string>
#include <vector>
#include <boost/optional.hpp>
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/swap.h"
@ -48,7 +48,7 @@ public:
#pragma pack(pop)
Loader::ResultStatus Load(const std::vector<u8> file_data, std::size_t offset = 0);
boost::optional<std::array<u8, 16>> GetTitleKey() const;
std::optional<std::array<u8, 16>> GetTitleKey() const;
private:
Body ticket_body;