From d37db2ba07990c2e8120d916d2626cc5a61455e2 Mon Sep 17 00:00:00 2001 From: phosit Date: Mon, 24 Aug 2026 13:34:37 +0200 Subject: [PATCH] Remove CStr::ReverseFind It was only used once. In this case a normal `std::string::find` can be used. --- source/gui/GUIRenderer.cpp | 2 +- source/ps/CStr.cpp | 10 ---------- source/ps/CStr.h | 10 ---------- 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/source/gui/GUIRenderer.cpp b/source/gui/GUIRenderer.cpp index 04cdd39b1a..9316c13284 100644 --- a/source/gui/GUIRenderer.cpp +++ b/source/gui/GUIRenderer.cpp @@ -90,7 +90,7 @@ void GUIRenderer::UpdateDrawCallCache(const CGUI& pGUI, DrawCalls& Calls, const * "grayscale:color:255 255 255 100:stretched:filename.ext" */ // Check that this can be a special sprite. - if (SpriteName.ReverseFind(":") == -1 && SpriteName.find("color(") == std::string::npos) + if (SpriteName.find(":") == std::string::npos && SpriteName.find("color(") == std::string::npos) { LOGERROR("Trying to use a sprite that doesn't exist (\"%s\").", SpriteName.c_str()); return; diff --git a/source/ps/CStr.cpp b/source/ps/CStr.cpp index 9a961002d8..8c5f02a915 100644 --- a/source/ps/CStr.cpp +++ b/source/ps/CStr.cpp @@ -264,16 +264,6 @@ double CStr::ToDouble() const return ret; } -long CStr::ReverseFind(const CStr& str) const -{ - size_t pos = rfind(str, length() ); - - if (pos != npos) - return static_cast(pos); - - return -1; -} - // Lowercase and uppercase CStr CStr::LowerCase() const { diff --git a/source/ps/CStr.h b/source/ps/CStr.h index 5291b8efac..4dd7347a7b 100644 --- a/source/ps/CStr.h +++ b/source/ps/CStr.h @@ -131,16 +131,6 @@ public: **/ double ToDouble() const; - /** - * Search the CStr for another string. - * The search is case-sensitive. - * - * @param const CStr & str reference to the search string - * @return long offset into the CStr of the last occurrence of the search string - * -1 if the search string is not found - **/ - long ReverseFind(const CStr& str) const; - /** * Make a copy of the CStr in lower-case. *