From bf557ea6e6f5ac10326a7a535d5cb59b68199af7 Mon Sep 17 00:00:00 2001 From: scribam Date: Sat, 1 Jun 2019 15:03:08 +0200 Subject: [PATCH] Use the more efficient character literal overload for find_first_of/find_last_of Recommendation from Clang-Tidy: https://clang.llvm.org/extra/clang-tidy/checks/performance-faster-string-find.html --- rpcs3/Emu/Cell/lv2/sys_tty.cpp | 2 +- rpcs3/Emu/RSX/Common/ShaderParam.h | 2 +- rpcs3/rpcs3qt/gs_frame.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_tty.cpp b/rpcs3/Emu/Cell/lv2/sys_tty.cpp index c82cb6aed6..9387b14ca5 100644 --- a/rpcs3/Emu/Cell/lv2/sys_tty.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_tty.cpp @@ -45,7 +45,7 @@ error_code sys_tty_read(s32 ch, vm::ptr buf, u32 len, vm::ptr preadle std::string& input = g_tty_input[ch].front(); // we have to stop reading at either a new line, the param len, or our input string size - size_t new_line_pos = input.find_first_of("\n"); + size_t new_line_pos = input.find_first_of('\n'); if (new_line_pos != input.npos) { diff --git a/rpcs3/Emu/RSX/Common/ShaderParam.h b/rpcs3/Emu/RSX/Common/ShaderParam.h index da7dd93a00..7ccb59e3fc 100644 --- a/rpcs3/Emu/RSX/Common/ShaderParam.h +++ b/rpcs3/Emu/RSX/Common/ShaderParam.h @@ -190,7 +190,7 @@ public: simple_var = var; } - const auto brace_pos = var.find_last_of(")"); + const auto brace_pos = var.find_last_of(')'); std::string prefix; if (brace_pos != std::string::npos) { diff --git a/rpcs3/rpcs3qt/gs_frame.cpp b/rpcs3/rpcs3qt/gs_frame.cpp index 6057a953ed..1f8a4a0396 100644 --- a/rpcs3/rpcs3qt/gs_frame.cpp +++ b/rpcs3/rpcs3qt/gs_frame.cpp @@ -186,12 +186,12 @@ gs_frame::gs_frame(const QString& title, const QRect& geometry, const QIcon& app //Get version by substringing VersionNumber-buildnumber-commithash to get just the part before the dash std::string version = rpcs3::version.to_string(); - version = version.substr(0 , version.find_last_of("-")); + version = version.substr(0 , version.find_last_of('-')); //Add branch and commit hash to version on frame , unless it's master. if ((rpcs3::get_branch().compare("master") != 0) && (rpcs3::get_branch().compare("HEAD") != 0)) { - version = version + "-" + rpcs3::version.to_string().substr((rpcs3::version.to_string().find_last_of("-") + 1), 8) + "-" + rpcs3::get_branch(); + version = version + "-" + rpcs3::version.to_string().substr((rpcs3::version.to_string().find_last_of('-') + 1), 8) + "-" + rpcs3::get_branch(); } m_windowTitle += qstr(" | " + version);