From c1f76abfafc3723b3b216d7985ec18d895699afc Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 4 Aug 2018 16:35:35 -0400 Subject: key_manager: Use regular std::string instead of std::string_view The benefit of std::string_view comes from the idea of avoiding copies (essentially acting as a non-owning view), however if we're just going to copy into a local variable immediately, there's not much benefit gained here. --- src/core/crypto/key_manager.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/core/crypto/key_manager.cpp') diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index 678ac5752..45e7e8545 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp @@ -66,8 +66,7 @@ KeyManager::KeyManager() { AttemptLoadKeyFile(yuzu_keys_dir, hactool_keys_dir, "title.keys", true); } -void KeyManager::LoadFromFile(std::string_view filename_, bool is_title_keys) { - const auto filename = std::string(filename_); +void KeyManager::LoadFromFile(const std::string& filename, bool is_title_keys) { std::ifstream file(filename); if (!file.is_open()) return; @@ -107,11 +106,8 @@ void KeyManager::LoadFromFile(std::string_view filename_, bool is_title_keys) { } } -void KeyManager::AttemptLoadKeyFile(std::string_view dir1_, std::string_view dir2_, - std::string_view filename_, bool title) { - const std::string dir1(dir1_); - const std::string dir2(dir2_); - const std::string filename(filename_); +void KeyManager::AttemptLoadKeyFile(const std::string& dir1, const std::string& dir2, + const std::string& filename, bool title) { if (FileUtil::Exists(dir1 + DIR_SEP + filename)) LoadFromFile(dir1 + DIR_SEP + filename, title); else if (FileUtil::Exists(dir2 + DIR_SEP + filename)) -- cgit v1.2.3 From 8da651ac4d25fbb48f77b8331b61f3cfa26e8f2c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 4 Aug 2018 16:41:17 -0400 Subject: core/crypto: Remove unnecessary includes --- src/core/crypto/key_manager.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/core/crypto/key_manager.cpp') diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index 45e7e8545..fc45e7ab5 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp @@ -2,19 +2,16 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include #include #include #include #include #include -#include -#include "common/assert.h" #include "common/common_paths.h" #include "common/file_util.h" -#include "common/logging/log.h" #include "core/crypto/key_manager.h" #include "core/settings.h" -#include "key_manager.h" namespace Core::Crypto { -- cgit v1.2.3