From 5071b27bb155efc4c67fb0be600c7276407bd627 Mon Sep 17 00:00:00 2001 From: phosit Date: Sun, 23 Aug 2026 17:07:27 +0200 Subject: [PATCH] Remove CStr::Find(char) It was only a wrapper around `std::string::find`. It is only used once. --- source/ps/CStr.cpp | 12 ------------ source/ps/CStr.h | 18 ------------------ source/ps/GameSetup/Config.cpp | 2 +- 3 files changed, 1 insertion(+), 31 deletions(-) diff --git a/source/ps/CStr.cpp b/source/ps/CStr.cpp index 16368933e3..0658a5ada1 100644 --- a/source/ps/CStr.cpp +++ b/source/ps/CStr.cpp @@ -264,17 +264,6 @@ double CStr::ToDouble() const return ret; } -// Search the string for another string -long CStr::Find(const Char chr) const -{ - size_t pos = find(chr, 0); - - if (pos != npos) - return static_cast(pos); - - return -1; -} - // Search the string for another string long CStr::Find(const int start, const Char chr) const { @@ -287,7 +276,6 @@ long CStr::Find(const int start, const Char chr) const } long CStr::FindInsensitive(const int start, const Char chr) const { return LowerCase().Find(start, totlower(chr)); } -long CStr::FindInsensitive(const Char chr) const { return LowerCase().Find(totlower(chr)); } long CStr::ReverseFind(const CStr& str) const { diff --git a/source/ps/CStr.h b/source/ps/CStr.h index 64874153a1..f912bc2b4c 100644 --- a/source/ps/CStr.h +++ b/source/ps/CStr.h @@ -138,15 +138,6 @@ public: **/ double ToDouble() const; - /** - * Search the CStr for another string. - * The search is case-sensitive. - * - * @param const {t|w}char_t & chr reference to the search string - * @return long offset into the CStr of the first occurrence of the search string - * -1 if the search string is not found - **/ - long Find(const Char chr) const; /** * Search the CStr for another string with starting offset. * The search is case-sensitive. @@ -158,15 +149,6 @@ public: **/ long Find(const int start, const Char chr) const; - /** - * Search the CStr for another string. - * The search is case-insensitive. - * - * @param const {t|w}char_t & chr reference to the search string - * @return long offset into the CStr of the first occurrence of the search string - * -1 if the search string is not found - **/ - long FindInsensitive(const Char chr) const; /** * Search the CStr for another string with starting offset. * The search is case-insensitive. diff --git a/source/ps/GameSetup/Config.cpp b/source/ps/GameSetup/Config.cpp index 6fde072a5e..0d582c6970 100644 --- a/source/ps/GameSetup/Config.cpp +++ b/source/ps/GameSetup/Config.cpp @@ -53,7 +53,7 @@ static void ProcessCommandLineArgs(const CmdLineArgs& args) for (size_t i = 0; i < conf.size(); ++i) { CStr name_value = conf[i]; - if (name_value.Find(':') != -1) + if (name_value.find(':') != std::string::npos) { CStr name = name_value.BeforeFirst(":"); CStr value = name_value.AfterFirst(":");