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
30 changed files with 115 additions and 109 deletions

View File

@@ -208,7 +208,7 @@ ResultVal<MessageParameter> AppletManager::GlanceParameter(AppletId app_id) {
// Note: The NS module always clears the DSPSleep and DSPWakeup signals even in GlanceParameter.
if (next_parameter->signal == SignalType::DspSleep ||
next_parameter->signal == SignalType::DspWakeup)
next_parameter = boost::none;
next_parameter = {};
return MakeResult<MessageParameter>(parameter);
}
@@ -217,7 +217,7 @@ ResultVal<MessageParameter> AppletManager::ReceiveParameter(AppletId app_id) {
auto result = GlanceParameter(app_id);
if (result.Succeeded()) {
// Clear the parameter
next_parameter = boost::none;
next_parameter = {};
}
return result;
}
@@ -237,7 +237,7 @@ bool AppletManager::CancelParameter(bool check_sender, AppletId sender_appid, bo
}
if (cancellation_success)
next_parameter = boost::none;
next_parameter = {};
return cancellation_success;
}

View File

@@ -5,8 +5,8 @@
#pragma once
#include <array>
#include <optional>
#include <vector>
#include <boost/optional.hpp>
#include "core/hle/kernel/event.h"
#include "core/hle/result.h"
#include "core/hle/service/fs/archive.h"
@@ -168,8 +168,7 @@ public:
private:
/// Parameter data to be returned in the next call to Glance/ReceiveParameter.
/// TODO(Subv): Use std::optional once we migrate to C++17.
boost::optional<MessageParameter> next_parameter;
std::optional<MessageParameter> next_parameter;
static constexpr std::size_t NumAppletSlot = 4;

View File

@@ -205,8 +205,10 @@ void Module::Interface::GetSharedFont(Kernel::HLERequestContext& ctx) {
// The shared font has to be relocated to the new address before being passed to the
// application.
VAddr target_address =
Memory::PhysicalToVirtualAddress(apt->shared_font_mem->linear_heap_phys_address).value();
auto maybe_vaddr =
Memory::PhysicalToVirtualAddress(apt->shared_font_mem->linear_heap_phys_address);
ASSERT(maybe_vaddr);
VAddr target_address = *maybe_vaddr;
if (!apt->shared_font_relocated) {
BCFNT::RelocateSharedFont(apt->shared_font_mem, target_address);
apt->shared_font_relocated = true;