Merge pull request #6296 from lioncash/shadow-error

core: Make variable shadowing a compile-time error
This commit is contained in:
bunnei 2021-05-16 01:35:46 -07:00 committed by GitHub
commit ad6e20cfde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
99 changed files with 304 additions and 279 deletions

View file

@ -833,7 +833,7 @@ IStorageImpl::~IStorageImpl() = default;
class StorageDataImpl final : public IStorageImpl {
public:
explicit StorageDataImpl(std::vector<u8>&& buffer) : buffer{std::move(buffer)} {}
explicit StorageDataImpl(std::vector<u8>&& buffer_) : buffer{std::move(buffer_)} {}
std::vector<u8>& GetData() override {
return buffer;
@ -1513,9 +1513,9 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
system.GetContentProvider()};
auto res = pm.GetControlMetadata();
if (res.first != nullptr) {
return res;
auto metadata = pm.GetControlMetadata();
if (metadata.first != nullptr) {
return metadata;
}
const FileSys::PatchManager pm_update{FileSys::GetUpdateTitleID(title_id),
@ -1550,9 +1550,9 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) {
const FileSys::PatchManager pm{title_id, system.GetFileSystemController(),
system.GetContentProvider()};
auto res = pm.GetControlMetadata();
if (res.first != nullptr) {
return res;
auto metadata = pm.GetControlMetadata();
if (metadata.first != nullptr) {
return metadata;
}
const FileSys::PatchManager pm_update{FileSys::GetUpdateTitleID(title_id),

View file

@ -15,11 +15,11 @@ namespace Service::APM {
constexpr auto DEFAULT_PERFORMANCE_CONFIGURATION = PerformanceConfiguration::Config7;
Controller::Controller(Core::Timing::CoreTiming& core_timing)
: core_timing{core_timing}, configs{
{PerformanceMode::Handheld, DEFAULT_PERFORMANCE_CONFIGURATION},
{PerformanceMode::Docked, DEFAULT_PERFORMANCE_CONFIGURATION},
} {}
Controller::Controller(Core::Timing::CoreTiming& core_timing_)
: core_timing{core_timing_}, configs{
{PerformanceMode::Handheld, DEFAULT_PERFORMANCE_CONFIGURATION},
{PerformanceMode::Docked, DEFAULT_PERFORMANCE_CONFIGURATION},
} {}
Controller::~Controller() = default;

View file

@ -50,7 +50,7 @@ enum class PerformanceMode : u8 {
// system during times of high load -- this simply maps to different PerformanceConfigs to use.
class Controller {
public:
explicit Controller(Core::Timing::CoreTiming& core_timing);
explicit Controller(Core::Timing::CoreTiming& core_timing_);
~Controller();
void SetPerformanceConfiguration(PerformanceMode mode, PerformanceConfiguration config);

View file

@ -362,7 +362,7 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) {
static constexpr u64 max_perf_detail_entries = 100;
// Size of the data structure representing the bulk of the voice-related state.
static constexpr u64 voice_state_size = 0x100;
static constexpr u64 voice_state_size_bytes = 0x100;
// Size of the upsampler manager data structure
constexpr u64 upsampler_manager_size = 0x48;
@ -449,7 +449,8 @@ void AudRenU::GetAudioRendererWorkBufferSize(Kernel::HLERequestContext& ctx) {
size += Common::AlignUp(voice_info_size * params.voice_count, info_field_alignment_size);
size +=
Common::AlignUp(voice_resource_size * params.voice_count, info_field_alignment_size);
size += Common::AlignUp(voice_state_size * params.voice_count, info_field_alignment_size);
size +=
Common::AlignUp(voice_state_size_bytes * params.voice_count, info_field_alignment_size);
return size;
};

View file

@ -50,8 +50,8 @@ public:
Enabled,
};
explicit OpusDecoderState(OpusDecoderPtr decoder, u32 sample_rate, u32 channel_count)
: decoder{std::move(decoder)}, sample_rate{sample_rate}, channel_count{channel_count} {}
explicit OpusDecoderState(OpusDecoderPtr decoder_, u32 sample_rate_, u32 channel_count_)
: decoder{std::move(decoder_)}, sample_rate{sample_rate_}, channel_count{channel_count_} {}
// Decodes interleaved Opus packets. Optionally allows reporting time taken to
// perform the decoding, as well as any relevant extra behavior.
@ -160,9 +160,9 @@ private:
class IHardwareOpusDecoderManager final : public ServiceFramework<IHardwareOpusDecoderManager> {
public:
explicit IHardwareOpusDecoderManager(Core::System& system_, OpusDecoderState decoder_state)
explicit IHardwareOpusDecoderManager(Core::System& system_, OpusDecoderState decoder_state_)
: ServiceFramework{system_, "IHardwareOpusDecoderManager"}, decoder_state{
std::move(decoder_state)} {
std::move(decoder_state_)} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &IHardwareOpusDecoderManager::DecodeInterleavedOld, "DecodeInterleavedOld"},

View file

@ -3,9 +3,18 @@
// Refer to the license.txt file included.
#include <fmt/ostream.h>
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#endif
#include <httplib.h>
#include <mbedtls/sha256.h>
#include <nlohmann/json.hpp>
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#include "common/hex_util.h"
#include "common/logging/backend.h"
#include "common/logging/log.h"
@ -178,8 +187,8 @@ bool VfsRawCopyDProgress(FileSys::VirtualDir src, FileSys::VirtualDir dest,
class Boxcat::Client {
public:
Client(std::string path, u64 title_id, u64 build_id)
: path(std::move(path)), title_id(title_id), build_id(build_id) {}
Client(std::string path_, u64 title_id_, u64 build_id_)
: path(std::move(path_)), title_id(title_id_), build_id(build_id_) {}
DownloadResult DownloadDataZip() {
return DownloadInternal(fmt::format(BOXCAT_PATHNAME_DATA, title_id), TIMEOUT_SECONDS,

View file

@ -6,7 +6,7 @@
namespace Service::HID {
ControllerBase::ControllerBase(Core::System& system) : system(system) {}
ControllerBase::ControllerBase(Core::System& system_) : system(system_) {}
ControllerBase::~ControllerBase() = default;
void ControllerBase::ActivateController() {

View file

@ -18,7 +18,7 @@ class System;
namespace Service::HID {
class ControllerBase {
public:
explicit ControllerBase(Core::System& system);
explicit ControllerBase(Core::System& system_);
virtual ~ControllerBase();
// Called when the controller is initialized

View file

@ -23,7 +23,7 @@ constexpr f32 Square(s32 num) {
return static_cast<f32>(num * num);
}
Controller_Gesture::Controller_Gesture(Core::System& system) : ControllerBase(system) {}
Controller_Gesture::Controller_Gesture(Core::System& system_) : ControllerBase(system_) {}
Controller_Gesture::~Controller_Gesture() = default;
void Controller_Gesture::OnInit() {
@ -211,15 +211,16 @@ void Controller_Gesture::UpdateExistingGesture(GestureProperties& gesture, Touch
}
}
void Controller_Gesture::EndGesture(GestureProperties& gesture, GestureProperties& last_gesture,
TouchType& type, Attribute& attributes, f32 time_difference) {
void Controller_Gesture::EndGesture(GestureProperties& gesture,
GestureProperties& last_gesture_props, TouchType& type,
Attribute& attributes, f32 time_difference) {
const auto& last_entry =
shared_memory.gesture_states[(shared_memory.header.last_entry_index + 16) % 17];
if (last_gesture.active_points != 0) {
if (last_gesture_props.active_points != 0) {
switch (last_entry.type) {
case TouchType::Touch:
if (enable_press_and_tap) {
SetTapEvent(gesture, last_gesture, type, attributes);
SetTapEvent(gesture, last_gesture_props, type, attributes);
return;
}
type = TouchType::Cancel;
@ -234,7 +235,7 @@ void Controller_Gesture::EndGesture(GestureProperties& gesture, GesturePropertie
force_update = true;
break;
case TouchType::Pan:
EndPanEvent(gesture, last_gesture, type, time_difference);
EndPanEvent(gesture, last_gesture_props, type, time_difference);
break;
default:
break;
@ -246,10 +247,11 @@ void Controller_Gesture::EndGesture(GestureProperties& gesture, GesturePropertie
}
}
void Controller_Gesture::SetTapEvent(GestureProperties& gesture, GestureProperties& last_gesture,
TouchType& type, Attribute& attributes) {
void Controller_Gesture::SetTapEvent(GestureProperties& gesture,
GestureProperties& last_gesture_props, TouchType& type,
Attribute& attributes) {
type = TouchType::Tap;
gesture = last_gesture;
gesture = last_gesture_props;
force_update = true;
f32 tap_time_difference =
static_cast<f32>(last_update_timestamp - last_tap_timestamp) / (1000 * 1000 * 1000);
@ -259,8 +261,9 @@ void Controller_Gesture::SetTapEvent(GestureProperties& gesture, GestureProperti
}
}
void Controller_Gesture::UpdatePanEvent(GestureProperties& gesture, GestureProperties& last_gesture,
TouchType& type, f32 time_difference) {
void Controller_Gesture::UpdatePanEvent(GestureProperties& gesture,
GestureProperties& last_gesture_props, TouchType& type,
f32 time_difference) {
auto& cur_entry = shared_memory.gesture_states[shared_memory.header.last_entry_index];
const auto& last_entry =
shared_memory.gesture_states[(shared_memory.header.last_entry_index + 16) % 17];
@ -272,13 +275,14 @@ void Controller_Gesture::UpdatePanEvent(GestureProperties& gesture, GesturePrope
last_pan_time_difference = time_difference;
// Promote to pinch type
if (std::abs(gesture.average_distance - last_gesture.average_distance) > pinch_threshold) {
if (std::abs(gesture.average_distance - last_gesture_props.average_distance) >
pinch_threshold) {
type = TouchType::Pinch;
cur_entry.scale = gesture.average_distance / last_gesture.average_distance;
cur_entry.scale = gesture.average_distance / last_gesture_props.average_distance;
}
const f32 angle_between_two_lines = std::atan((gesture.angle - last_gesture.angle) /
(1 + (gesture.angle * last_gesture.angle)));
const f32 angle_between_two_lines = std::atan((gesture.angle - last_gesture_props.angle) /
(1 + (gesture.angle * last_gesture_props.angle)));
// Promote to rotate type
if (std::abs(angle_between_two_lines) > angle_threshold) {
type = TouchType::Rotate;
@ -287,8 +291,9 @@ void Controller_Gesture::UpdatePanEvent(GestureProperties& gesture, GesturePrope
}
}
void Controller_Gesture::EndPanEvent(GestureProperties& gesture, GestureProperties& last_gesture,
TouchType& type, f32 time_difference) {
void Controller_Gesture::EndPanEvent(GestureProperties& gesture,
GestureProperties& last_gesture_props, TouchType& type,
f32 time_difference) {
auto& cur_entry = shared_memory.gesture_states[shared_memory.header.last_entry_index];
const auto& last_entry =
shared_memory.gesture_states[(shared_memory.header.last_entry_index + 16) % 17];
@ -301,7 +306,7 @@ void Controller_Gesture::EndPanEvent(GestureProperties& gesture, GestureProperti
// Set swipe event with parameters
if (curr_vel > swipe_threshold) {
SetSwipeEvent(gesture, last_gesture, type);
SetSwipeEvent(gesture, last_gesture_props, type);
return;
}
@ -312,13 +317,13 @@ void Controller_Gesture::EndPanEvent(GestureProperties& gesture, GestureProperti
force_update = true;
}
void Controller_Gesture::SetSwipeEvent(GestureProperties& gesture, GestureProperties& last_gesture,
TouchType& type) {
void Controller_Gesture::SetSwipeEvent(GestureProperties& gesture,
GestureProperties& last_gesture_props, TouchType& type) {
auto& cur_entry = shared_memory.gesture_states[shared_memory.header.last_entry_index];
const auto& last_entry =
shared_memory.gesture_states[(shared_memory.header.last_entry_index + 16) % 17];
type = TouchType::Swipe;
gesture = last_gesture;
gesture = last_gesture_props;
force_update = true;
cur_entry.delta_x = last_entry.delta_x;
cur_entry.delta_y = last_entry.delta_y;

View file

@ -128,32 +128,34 @@ private:
void UpdateExistingGesture(GestureProperties& gesture, TouchType& type, f32 time_difference);
// Terminates exiting gesture
void EndGesture(GestureProperties& gesture, GestureProperties& last_gesture, TouchType& type,
Attribute& attributes, f32 time_difference);
void EndGesture(GestureProperties& gesture, GestureProperties& last_gesture_props,
TouchType& type, Attribute& attributes, f32 time_difference);
// Set current event to a tap event
void SetTapEvent(GestureProperties& gesture, GestureProperties& last_gesture, TouchType& type,
Attribute& attributes);
void SetTapEvent(GestureProperties& gesture, GestureProperties& last_gesture_props,
TouchType& type, Attribute& attributes);
// Calculates and set the extra parameters related to a pan event
void UpdatePanEvent(GestureProperties& gesture, GestureProperties& last_gesture,
void UpdatePanEvent(GestureProperties& gesture, GestureProperties& last_gesture_props,
TouchType& type, f32 time_difference);
// Terminates the pan event
void EndPanEvent(GestureProperties& gesture, GestureProperties& last_gesture, TouchType& type,
f32 time_difference);
void EndPanEvent(GestureProperties& gesture, GestureProperties& last_gesture_props,
TouchType& type, f32 time_difference);
// Set current event to a swipe event
void SetSwipeEvent(GestureProperties& gesture, GestureProperties& last_gesture,
void SetSwipeEvent(GestureProperties& gesture, GestureProperties& last_gesture_props,
TouchType& type);
// Returns an unused finger id, if there is no fingers avaliable MAX_FINGERS will be returned
// Returns an unused finger id, if there is no fingers available std::nullopt is returned.
std::optional<size_t> GetUnusedFingerID() const;
/** If the touch is new it tries to assing a new finger id, if there is no fingers avaliable no
/**
* If the touch is new it tries to assign a new finger id, if there is no fingers available no
* changes will be made. Updates the coordinates if the finger id it's already set. If the touch
* ends delays the output by one frame to set the end_touch flag before finally freeing the
* finger id */
* finger id
*/
size_t UpdateTouchInputEvent(const std::tuple<float, float, bool>& touch_input,
size_t finger_id);

View file

@ -89,7 +89,7 @@ static_assert(std::has_unique_object_representations_v<MiiInfo>,
#pragma pack(push, 4)
struct MiiInfoElement {
MiiInfoElement(const MiiInfo& info, Source source) : info{info}, source{source} {}
MiiInfoElement(const MiiInfo& info_, Source source_) : info{info_}, source{source_} {}
MiiInfo info{};
Source source{};

View file

@ -253,8 +253,8 @@ private:
class MiiDBModule final : public ServiceFramework<MiiDBModule> {
public:
explicit MiiDBModule(Core::System& system_, const char* name)
: ServiceFramework{system_, name} {
explicit MiiDBModule(Core::System& system_, const char* name_)
: ServiceFramework{system_, name_} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &MiiDBModule::GetDatabaseService, "GetDatabaseService"},

View file

@ -21,7 +21,7 @@ namespace Service::Nvidia::Devices {
/// implement the ioctl interface.
class nvdevice {
public:
explicit nvdevice(Core::System& system) : system{system} {}
explicit nvdevice(Core::System& system_) : system{system_} {}
virtual ~nvdevice() = default;
/**

View file

@ -48,13 +48,13 @@ private:
public:
constexpr BufferMap() = default;
constexpr BufferMap(GPUVAddr start_addr, std::size_t size)
: start_addr{start_addr}, end_addr{start_addr + size} {}
constexpr BufferMap(GPUVAddr start_addr_, std::size_t size_)
: start_addr{start_addr_}, end_addr{start_addr_ + size_} {}
constexpr BufferMap(GPUVAddr start_addr, std::size_t size, VAddr cpu_addr,
bool is_allocated)
: start_addr{start_addr}, end_addr{start_addr + size}, cpu_addr{cpu_addr},
is_allocated{is_allocated} {}
constexpr BufferMap(GPUVAddr start_addr_, std::size_t size_, VAddr cpu_addr_,
bool is_allocated_)
: start_addr{start_addr_}, end_addr{start_addr_ + size_}, cpu_addr{cpu_addr_},
is_allocated{is_allocated_} {}
constexpr VAddr StartAddr() const {
return start_addr;

View file

@ -27,13 +27,13 @@ protected:
public:
constexpr BufferMap() = default;
constexpr BufferMap(GPUVAddr start_addr, std::size_t size)
: start_addr{start_addr}, end_addr{start_addr + size} {}
constexpr BufferMap(GPUVAddr start_addr_, std::size_t size_)
: start_addr{start_addr_}, end_addr{start_addr_ + size_} {}
constexpr BufferMap(GPUVAddr start_addr, std::size_t size, VAddr cpu_addr,
bool is_allocated)
: start_addr{start_addr}, end_addr{start_addr + size}, cpu_addr{cpu_addr},
is_allocated{is_allocated} {}
constexpr BufferMap(GPUVAddr start_addr_, std::size_t size_, VAddr cpu_addr_,
bool is_allocated_)
: start_addr{start_addr_}, end_addr{start_addr_ + size_}, cpu_addr{cpu_addr_},
is_allocated{is_allocated_} {}
constexpr VAddr StartAddr() const {
return start_addr;

View file

@ -8,7 +8,7 @@
namespace Service::Nvidia {
SyncpointManager::SyncpointManager(Tegra::GPU& gpu) : gpu{gpu} {}
SyncpointManager::SyncpointManager(Tegra::GPU& gpu_) : gpu{gpu_} {}
SyncpointManager::~SyncpointManager() = default;

View file

@ -18,7 +18,7 @@ namespace Service::Nvidia {
class SyncpointManager final {
public:
explicit SyncpointManager(Tegra::GPU& gpu);
explicit SyncpointManager(Tegra::GPU& gpu_);
~SyncpointManager();
/**

View file

@ -13,8 +13,8 @@
namespace Service::NVFlinger {
BufferQueue::BufferQueue(Kernel::KernelCore& kernel, u32 id, u64 layer_id)
: id(id), layer_id(layer_id), buffer_wait_event{kernel} {
BufferQueue::BufferQueue(Kernel::KernelCore& kernel, u32 id_, u64 layer_id_)
: id(id_), layer_id(layer_id_), buffer_wait_event{kernel} {
Kernel::KAutoObject::Create(std::addressof(buffer_wait_event));
buffer_wait_event.Initialize("BufferQueue:WaitEvent");
}

View file

@ -54,7 +54,7 @@ public:
NativeWindowFormat = 2,
};
explicit BufferQueue(Kernel::KernelCore& kernel, u32 id, u64 layer_id);
explicit BufferQueue(Kernel::KernelCore& kernel, u32 id_, u64 layer_id_);
~BufferQueue();
enum class BufferTransformFlags : u32 {

View file

@ -61,7 +61,7 @@ void NVFlinger::SplitVSync() {
}
}
NVFlinger::NVFlinger(Core::System& system) : system(system) {
NVFlinger::NVFlinger(Core::System& system_) : system(system_) {
displays.emplace_back(0, "Default", system);
displays.emplace_back(1, "External", system);
displays.emplace_back(2, "Edid", system);

View file

@ -45,7 +45,7 @@ class BufferQueue;
class NVFlinger final {
public:
explicit NVFlinger(Core::System& system);
explicit NVFlinger(Core::System& system_);
~NVFlinger();
/// Sets the NVDrv module instance to use to send buffers to the GPU.

View file

@ -7,8 +7,8 @@
namespace Service::PCTL {
PCTL::PCTL(Core::System& system_, std::shared_ptr<Module> module_, const char* name,
Capability capability)
: Interface{system_, std::move(module_), name, capability} {
Capability capability_)
: Interface{system_, std::move(module_), name, capability_} {
static const FunctionInfo functions[] = {
{0, &PCTL::CreateService, "CreateService"},
{1, &PCTL::CreateServiceWithoutInitialize, "CreateServiceWithoutInitialize"},

View file

@ -15,7 +15,7 @@ namespace Service::PCTL {
class PCTL final : public Module::Interface {
public:
explicit PCTL(Core::System& system_, std::shared_ptr<Module> module_, const char* name,
Capability capability);
Capability capability_);
~PCTL() override;
};

View file

@ -31,8 +31,8 @@ std::optional<Kernel::KProcess*> SearchProcessList(
void GetApplicationPidGeneric(Kernel::HLERequestContext& ctx,
const std::vector<Kernel::KProcess*>& process_list) {
const auto process = SearchProcessList(process_list, [](const auto& process) {
return process->GetProcessID() == Kernel::KProcess::ProcessIDMin;
const auto process = SearchProcessList(process_list, [](const auto& proc) {
return proc->GetProcessID() == Kernel::KProcess::ProcessIDMin;
});
IPC::ResponseBuilder rb{ctx, 4};
@ -100,8 +100,8 @@ private:
LOG_DEBUG(Service_PM, "called, title_id={:016X}", title_id);
const auto process =
SearchProcessList(kernel.GetProcessList(), [title_id](const auto& process) {
return process->GetTitleID() == title_id;
SearchProcessList(kernel.GetProcessList(), [title_id](const auto& proc) {
return proc->GetTitleID() == title_id;
});
if (!process.has_value()) {
@ -140,8 +140,8 @@ private:
LOG_DEBUG(Service_PM, "called, process_id={:016X}", process_id);
const auto process = SearchProcessList(process_list, [process_id](const auto& process) {
return process->GetProcessID() == process_id;
const auto process = SearchProcessList(process_list, [process_id](const auto& proc) {
return proc->GetProcessID() == process_id;
});
if (!process.has_value()) {

View file

@ -155,17 +155,17 @@ protected:
/**
* Constructs a FunctionInfo for a function.
*
* @param expected_header request header in the command buffer which will trigger dispatch
* @param expected_header_ request header in the command buffer which will trigger dispatch
* to this handler
* @param handler_callback member function in this service which will be called to handle
* @param handler_callback_ member function in this service which will be called to handle
* the request
* @param name human-friendly name for the request. Used mostly for logging purposes.
* @param name_ human-friendly name for the request. Used mostly for logging purposes.
*/
FunctionInfo(u32 expected_header, HandlerFnP<Self> handler_callback, const char* name)
FunctionInfo(u32 expected_header_, HandlerFnP<Self> handler_callback_, const char* name_)
: FunctionInfoBase{
expected_header,
expected_header_,
// Type-erase member function pointer by casting it down to the base class.
static_cast<HandlerFnP<ServiceFrameworkBase>>(handler_callback), name} {}
static_cast<HandlerFnP<ServiceFrameworkBase>>(handler_callback_), name_} {}
};
/**

View file

@ -10,8 +10,8 @@ namespace Service::Time::Clock {
class EphemeralNetworkSystemClockCore final : public SystemClockCore {
public:
explicit EphemeralNetworkSystemClockCore(SteadyClockCore& steady_clock_core)
: SystemClockCore{steady_clock_core} {}
explicit EphemeralNetworkSystemClockCore(SteadyClockCore& steady_clock_core_)
: SystemClockCore{steady_clock_core_} {}
};
} // namespace Service::Time::Clock

View file

@ -12,8 +12,8 @@ namespace Service::Time::Clock {
class LocalSystemClockContextWriter final : public SystemClockContextUpdateCallback {
public:
explicit LocalSystemClockContextWriter(SharedMemory& shared_memory)
: SystemClockContextUpdateCallback{}, shared_memory{shared_memory} {}
explicit LocalSystemClockContextWriter(SharedMemory& shared_memory_)
: SystemClockContextUpdateCallback{}, shared_memory{shared_memory_} {}
protected:
ResultCode Update() override {

View file

@ -12,8 +12,8 @@ namespace Service::Time::Clock {
class NetworkSystemClockContextWriter final : public SystemClockContextUpdateCallback {
public:
explicit NetworkSystemClockContextWriter(SharedMemory& shared_memory)
: SystemClockContextUpdateCallback{}, shared_memory{shared_memory} {}
explicit NetworkSystemClockContextWriter(SharedMemory& shared_memory_)
: SystemClockContextUpdateCallback{}, shared_memory{shared_memory_} {}
protected:
ResultCode Update() override {

View file

@ -10,8 +10,8 @@ namespace Service::Time::Clock {
class StandardLocalSystemClockCore final : public SystemClockCore {
public:
explicit StandardLocalSystemClockCore(SteadyClockCore& steady_clock_core)
: SystemClockCore{steady_clock_core} {}
explicit StandardLocalSystemClockCore(SteadyClockCore& steady_clock_core_)
: SystemClockCore{steady_clock_core_} {}
};
} // namespace Service::Time::Clock

View file

@ -16,21 +16,21 @@ namespace Service::Time::Clock {
class StandardNetworkSystemClockCore final : public SystemClockCore {
public:
explicit StandardNetworkSystemClockCore(SteadyClockCore& steady_clock_core)
: SystemClockCore{steady_clock_core} {}
explicit StandardNetworkSystemClockCore(SteadyClockCore& steady_clock_core_)
: SystemClockCore{steady_clock_core_} {}
void SetStandardNetworkClockSufficientAccuracy(TimeSpanType value) {
standard_network_clock_sufficient_accuracy = value;
}
bool IsStandardNetworkSystemClockAccuracySufficient(Core::System& system) const {
SystemClockContext context{};
if (GetClockContext(system, context) != RESULT_SUCCESS) {
SystemClockContext clock_ctx{};
if (GetClockContext(system, clock_ctx) != RESULT_SUCCESS) {
return {};
}
s64 span{};
if (context.steady_time_point.GetSpanBetween(
if (clock_ctx.steady_time_point.GetSpanBetween(
GetSteadyClockCore().GetCurrentTimePoint(system), span) != RESULT_SUCCESS) {
return {};
}

View file

@ -11,13 +11,13 @@
namespace Service::Time::Clock {
StandardUserSystemClockCore::StandardUserSystemClockCore(
StandardLocalSystemClockCore& local_system_clock_core,
StandardNetworkSystemClockCore& network_system_clock_core, Core::System& system)
: SystemClockCore(local_system_clock_core.GetSteadyClockCore()),
local_system_clock_core{local_system_clock_core},
network_system_clock_core{network_system_clock_core}, auto_correction_enabled{},
StandardLocalSystemClockCore& local_system_clock_core_,
StandardNetworkSystemClockCore& network_system_clock_core_, Core::System& system_)
: SystemClockCore(local_system_clock_core_.GetSteadyClockCore()),
local_system_clock_core{local_system_clock_core_},
network_system_clock_core{network_system_clock_core_},
auto_correction_time{SteadyClockTimePoint::GetRandom()}, auto_correction_event{
system.Kernel()} {
system_.Kernel()} {
Kernel::KAutoObject::Create(std::addressof(auto_correction_event));
auto_correction_event.Initialize("StandardUserSystemClockCore:AutoCorrectionEvent");
}
@ -35,13 +35,13 @@ ResultCode StandardUserSystemClockCore::SetAutomaticCorrectionEnabled(Core::Syst
}
ResultCode StandardUserSystemClockCore::GetClockContext(Core::System& system,
SystemClockContext& context) const {
SystemClockContext& ctx) const {
if (const ResultCode result{ApplyAutomaticCorrection(system, false)};
result != RESULT_SUCCESS) {
return result;
}
return local_system_clock_core.GetClockContext(system, context);
return local_system_clock_core.GetClockContext(system, ctx);
}
ResultCode StandardUserSystemClockCore::Flush(const SystemClockContext&) {
@ -64,13 +64,13 @@ ResultCode StandardUserSystemClockCore::ApplyAutomaticCorrection(Core::System& s
return ERROR_UNINITIALIZED_CLOCK;
}
SystemClockContext context{};
if (const ResultCode result{network_system_clock_core.GetClockContext(system, context)};
SystemClockContext ctx{};
if (const ResultCode result{network_system_clock_core.GetClockContext(system, ctx)};
result != RESULT_SUCCESS) {
return result;
}
local_system_clock_core.SetClockContext(context);
local_system_clock_core.SetClockContext(ctx);
return RESULT_SUCCESS;
}

View file

@ -23,13 +23,13 @@ class StandardNetworkSystemClockCore;
class StandardUserSystemClockCore final : public SystemClockCore {
public:
StandardUserSystemClockCore(StandardLocalSystemClockCore& local_system_clock_core,
StandardNetworkSystemClockCore& network_system_clock_core,
Core::System& system);
StandardUserSystemClockCore(StandardLocalSystemClockCore& local_system_clock_core_,
StandardNetworkSystemClockCore& network_system_clock_core_,
Core::System& system_);
ResultCode SetAutomaticCorrectionEnabled(Core::System& system, bool value);
ResultCode GetClockContext(Core::System& system, SystemClockContext& context) const override;
ResultCode GetClockContext(Core::System& system, SystemClockContext& ctx) const override;
bool IsAutomaticCorrectionEnabled() const {
return auto_correction_enabled;

View file

@ -8,8 +8,8 @@
namespace Service::Time::Clock {
SystemClockCore::SystemClockCore(SteadyClockCore& steady_clock_core)
: steady_clock_core{steady_clock_core} {
SystemClockCore::SystemClockCore(SteadyClockCore& steady_clock_core_)
: steady_clock_core{steady_clock_core_} {
context.steady_time_point.clock_source_id = steady_clock_core.GetClockSourceId();
}

View file

@ -21,7 +21,7 @@ class SystemClockContextUpdateCallback;
class SystemClockCore {
public:
explicit SystemClockCore(SteadyClockCore& steady_clock_core);
explicit SystemClockCore(SteadyClockCore& steady_clock_core_);
virtual ~SystemClockCore();
SteadyClockCore& GetSteadyClockCore() const {

View file

@ -223,7 +223,7 @@ struct TimeManager::Impl final {
TimeZone::TimeZoneContentManager time_zone_content_manager;
};
TimeManager::TimeManager(Core::System& system) : system{system} {}
TimeManager::TimeManager(Core::System& system_) : system{system_} {}
TimeManager::~TimeManager() = default;

View file

@ -30,7 +30,7 @@ class NetworkSystemClockContextWriter;
class TimeManager final {
public:
explicit TimeManager(Core::System& system);
explicit TimeManager(Core::System& system_);
~TimeManager();
void Initialize();

View file

@ -15,7 +15,7 @@ namespace Service::Time {
static constexpr std::size_t SHARED_MEMORY_SIZE{0x1000};
SharedMemory::SharedMemory(Core::System& system) : system(system) {
SharedMemory::SharedMemory(Core::System& system_) : system(system_) {
std::memset(system.Kernel().GetTimeSharedMem().GetPointer(), 0, SHARED_MEMORY_SIZE);
}

View file

@ -14,7 +14,7 @@ namespace Service::Time {
class SharedMemory final {
public:
explicit SharedMemory(Core::System& system);
explicit SharedMemory(Core::System& system_);
~SharedMemory();
// TODO(ogniK): We have to properly simulate memory barriers, how are we going to do this?

View file

@ -68,8 +68,8 @@ static std::vector<std::string> BuildLocationNameCache(Core::System& system) {
return location_name_cache;
}
TimeZoneContentManager::TimeZoneContentManager(Core::System& system)
: system{system}, location_name_cache{BuildLocationNameCache(system)} {}
TimeZoneContentManager::TimeZoneContentManager(Core::System& system_)
: system{system_}, location_name_cache{BuildLocationNameCache(system)} {}
void TimeZoneContentManager::Initialize(TimeManager& time_manager) {
std::string location_name;

View file

@ -21,7 +21,7 @@ namespace Service::Time::TimeZone {
class TimeZoneContentManager final {
public:
explicit TimeZoneContentManager(Core::System& system);
explicit TimeZoneContentManager(Core::System& system_);
void Initialize(TimeManager& time_manager);

View file

@ -17,8 +17,8 @@
namespace Service::VI {
Display::Display(u64 id, std::string name, Core::System& system)
: id{id}, name{std::move(name)}, vsync_event{system.Kernel()} {
Display::Display(u64 id, std::string name_, Core::System& system)
: display_id{id}, name{std::move(name_)}, vsync_event{system.Kernel()} {
Kernel::KAutoObject::Create(std::addressof(vsync_event));
vsync_event.Initialize(fmt::format("Display VSync Event {}", id));
}

View file

@ -32,14 +32,14 @@ public:
/// Constructs a display with a given unique ID and name.
///
/// @param id The unique ID for this display.
/// @param name The name for this display.
/// @param name_ The name for this display.
///
Display(u64 id, std::string name, Core::System& system);
Display(u64 id, std::string name_, Core::System& system);
~Display();
/// Gets the unique ID assigned to this display.
u64 GetID() const {
return id;
return display_id;
}
/// Gets the name of this display
@ -96,7 +96,7 @@ public:
const Layer* FindLayer(u64 layer_id) const;
private:
u64 id;
u64 display_id;
std::string name;
std::vector<std::shared_ptr<Layer>> layers;

View file

@ -6,7 +6,7 @@
namespace Service::VI {
Layer::Layer(u64 id, NVFlinger::BufferQueue& queue) : id{id}, buffer_queue{queue} {}
Layer::Layer(u64 id, NVFlinger::BufferQueue& queue) : layer_id{id}, buffer_queue{queue} {}
Layer::~Layer() = default;

View file

@ -31,7 +31,7 @@ public:
/// Gets the ID for this layer.
u64 GetID() const {
return id;
return layer_id;
}
/// Gets a reference to the buffer queue this layer is using.
@ -45,7 +45,7 @@ public:
}
private:
u64 id;
u64 layer_id;
NVFlinger::BufferQueue& buffer_queue;
};

View file

@ -212,7 +212,7 @@ private:
class IGBPConnectRequestParcel : public Parcel {
public:
explicit IGBPConnectRequestParcel(std::vector<u8> buffer) : Parcel(std::move(buffer)) {
explicit IGBPConnectRequestParcel(std::vector<u8> buffer_) : Parcel(std::move(buffer_)) {
Deserialize();
}
@ -274,8 +274,8 @@ private:
class IGBPSetPreallocatedBufferRequestParcel : public Parcel {
public:
explicit IGBPSetPreallocatedBufferRequestParcel(std::vector<u8> buffer)
: Parcel(std::move(buffer)) {
explicit IGBPSetPreallocatedBufferRequestParcel(std::vector<u8> buffer_)
: Parcel(std::move(buffer_)) {
Deserialize();
}
@ -312,7 +312,7 @@ protected:
class IGBPCancelBufferRequestParcel : public Parcel {
public:
explicit IGBPCancelBufferRequestParcel(std::vector<u8> buffer) : Parcel(std::move(buffer)) {
explicit IGBPCancelBufferRequestParcel(std::vector<u8> buffer_) : Parcel(std::move(buffer_)) {
Deserialize();
}
@ -338,7 +338,7 @@ protected:
class IGBPDequeueBufferRequestParcel : public Parcel {
public:
explicit IGBPDequeueBufferRequestParcel(std::vector<u8> buffer) : Parcel(std::move(buffer)) {
explicit IGBPDequeueBufferRequestParcel(std::vector<u8> buffer_) : Parcel(std::move(buffer_)) {
Deserialize();
}
@ -360,8 +360,8 @@ public:
class IGBPDequeueBufferResponseParcel : public Parcel {
public:
explicit IGBPDequeueBufferResponseParcel(u32 slot, Service::Nvidia::MultiFence& multi_fence)
: slot(slot), multi_fence(multi_fence) {}
explicit IGBPDequeueBufferResponseParcel(u32 slot_, Nvidia::MultiFence& multi_fence_)
: slot(slot_), multi_fence(multi_fence_) {}
protected:
void SerializeData() override {
@ -377,7 +377,7 @@ protected:
class IGBPRequestBufferRequestParcel : public Parcel {
public:
explicit IGBPRequestBufferRequestParcel(std::vector<u8> buffer) : Parcel(std::move(buffer)) {
explicit IGBPRequestBufferRequestParcel(std::vector<u8> buffer_) : Parcel(std::move(buffer_)) {
Deserialize();
}
@ -391,7 +391,7 @@ public:
class IGBPRequestBufferResponseParcel : public Parcel {
public:
explicit IGBPRequestBufferResponseParcel(NVFlinger::IGBPBuffer buffer) : buffer(buffer) {}
explicit IGBPRequestBufferResponseParcel(NVFlinger::IGBPBuffer buffer_) : buffer(buffer_) {}
~IGBPRequestBufferResponseParcel() override = default;
protected:
@ -408,7 +408,7 @@ protected:
class IGBPQueueBufferRequestParcel : public Parcel {
public:
explicit IGBPQueueBufferRequestParcel(std::vector<u8> buffer) : Parcel(std::move(buffer)) {
explicit IGBPQueueBufferRequestParcel(std::vector<u8> buffer_) : Parcel(std::move(buffer_)) {
Deserialize();
}
@ -470,7 +470,7 @@ private:
class IGBPQueryRequestParcel : public Parcel {
public:
explicit IGBPQueryRequestParcel(std::vector<u8> buffer) : Parcel(std::move(buffer)) {
explicit IGBPQueryRequestParcel(std::vector<u8> buffer_) : Parcel(std::move(buffer_)) {
Deserialize();
}
@ -484,7 +484,7 @@ public:
class IGBPQueryResponseParcel : public Parcel {
public:
explicit IGBPQueryResponseParcel(u32 value) : value(value) {}
explicit IGBPQueryResponseParcel(u32 value_) : value{value_} {}
~IGBPQueryResponseParcel() override = default;
protected: