From dcb91ca4a4a97d279d01ebe010e07298acca1ba9 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 26 Apr 2021 09:11:33 -0400 Subject: service: Eliminate cases of member shadowing Resolves a few localized instances of member variable shadowing. Brings us a little closer to turning shadowing warnings into errors. --- src/core/hle/service/vi/display/vi_display.cpp | 25 ++++++++++++------------- src/core/hle/service/vi/display/vi_display.h | 16 ++++++++-------- 2 files changed, 20 insertions(+), 21 deletions(-) (limited to 'src/core/hle/service/vi') diff --git a/src/core/hle/service/vi/display/vi_display.cpp b/src/core/hle/service/vi/display/vi_display.cpp index 7f42aa4a0..ac9e87338 100644 --- a/src/core/hle/service/vi/display/vi_display.cpp +++ b/src/core/hle/service/vi/display/vi_display.cpp @@ -41,24 +41,22 @@ void Display::SignalVSyncEvent() { vsync_event->GetWritableEvent()->Signal(); } -void Display::CreateLayer(u64 id, NVFlinger::BufferQueue& buffer_queue) { +void Display::CreateLayer(u64 layer_id, NVFlinger::BufferQueue& buffer_queue) { // TODO(Subv): Support more than 1 layer. ASSERT_MSG(layers.empty(), "Only one layer is supported per display at the moment"); - layers.emplace_back(std::make_shared(id, buffer_queue)); + layers.emplace_back(std::make_shared(layer_id, buffer_queue)); } -void Display::CloseLayer(u64 id) { - layers.erase( - std::remove_if(layers.begin(), layers.end(), - [id](const std::shared_ptr& layer) { return layer->GetID() == id; }), - layers.end()); +void Display::CloseLayer(u64 layer_id) { + std::erase_if(layers, [layer_id](const auto& layer) { return layer->GetID() == layer_id; }); } -Layer* Display::FindLayer(u64 id) { +Layer* Display::FindLayer(u64 layer_id) { const auto itr = - std::find_if(layers.begin(), layers.end(), - [id](const std::shared_ptr& layer) { return layer->GetID() == id; }); + std::find_if(layers.begin(), layers.end(), [layer_id](const std::shared_ptr& layer) { + return layer->GetID() == layer_id; + }); if (itr == layers.end()) { return nullptr; @@ -67,10 +65,11 @@ Layer* Display::FindLayer(u64 id) { return itr->get(); } -const Layer* Display::FindLayer(u64 id) const { +const Layer* Display::FindLayer(u64 layer_id) const { const auto itr = - std::find_if(layers.begin(), layers.end(), - [id](const std::shared_ptr& layer) { return layer->GetID() == id; }); + std::find_if(layers.begin(), layers.end(), [layer_id](const std::shared_ptr& layer) { + return layer->GetID() == layer_id; + }); if (itr == layers.end()) { return nullptr; diff --git a/src/core/hle/service/vi/display/vi_display.h b/src/core/hle/service/vi/display/vi_display.h index 931c898f6..8340059de 100644 --- a/src/core/hle/service/vi/display/vi_display.h +++ b/src/core/hle/service/vi/display/vi_display.h @@ -68,34 +68,34 @@ public: /// Creates and adds a layer to this display with the given ID. /// - /// @param id The ID to assign to the created layer. + /// @param layer_id The ID to assign to the created layer. /// @param buffer_queue The buffer queue for the layer instance to use. /// - void CreateLayer(u64 id, NVFlinger::BufferQueue& buffer_queue); + void CreateLayer(u64 layer_id, NVFlinger::BufferQueue& buffer_queue); /// Closes and removes a layer from this display with the given ID. /// - /// @param id The ID assigned to the layer to close. + /// @param layer_id The ID assigned to the layer to close. /// - void CloseLayer(u64 id); + void CloseLayer(u64 layer_id); /// Attempts to find a layer with the given ID. /// - /// @param id The layer ID. + /// @param layer_id The layer ID. /// /// @returns If found, the Layer instance with the given ID. /// If not found, then nullptr is returned. /// - Layer* FindLayer(u64 id); + Layer* FindLayer(u64 layer_id); /// Attempts to find a layer with the given ID. /// - /// @param id The layer ID. + /// @param layer_id The layer ID. /// /// @returns If found, the Layer instance with the given ID. /// If not found, then nullptr is returned. /// - const Layer* FindLayer(u64 id) const; + const Layer* FindLayer(u64 layer_id) const; private: u64 id; -- cgit v1.2.3