From 99bf50cd4e3a6f0984baf37bc7ffcbb3284a86cc Mon Sep 17 00:00:00 2001 From: Vladislav Belov Date: Thu, 16 Oct 2025 09:17:05 +0200 Subject: [PATCH] Reduces boost usage for strings --- source/graphics/ColladaManager.cpp | 3 +-- source/i18n/L10n.cpp | 3 +-- source/ps/ArchiveBuilder.cpp | 13 +++++-------- source/ps/ConfigDB.cpp | 5 ++--- source/ps/ModIo.cpp | 5 ++--- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/source/graphics/ColladaManager.cpp b/source/graphics/ColladaManager.cpp index e4788dd07b..7854e20c27 100644 --- a/source/graphics/ColladaManager.cpp +++ b/source/graphics/ColladaManager.cpp @@ -35,7 +35,6 @@ #include "ps/Filesystem.h" #include -#include #include #include #include @@ -93,7 +92,7 @@ public: Status ReloadChangedFile(const VfsPath& path) { // Ignore files that aren't in the right path - if (!boost::algorithm::starts_with(path.string(), L"art/skeletons/")) + if (!path.string().starts_with(L"art/skeletons/")) return INFO::OK; if (path.Extension() != L".xml") diff --git a/source/i18n/L10n.cpp b/source/i18n/L10n.cpp index 2032459a6d..af2313ee47 100644 --- a/source/i18n/L10n.cpp +++ b/source/i18n/L10n.cpp @@ -39,7 +39,6 @@ #include "scriptinterface/ScriptInterface.h" #include -#include #include #include #include @@ -518,7 +517,7 @@ VfsPath L10n::LocalizePath(const VfsPath& sourcePath) const Status L10n::ReloadChangedFile(const VfsPath& path) { - if (!boost::algorithm::starts_with(path.string(), L"l10n/")) + if (!path.string().starts_with(L"l10n/")) return INFO::OK; if (path.Extension() != L".po") diff --git a/source/ps/ArchiveBuilder.cpp b/source/ps/ArchiveBuilder.cpp index 978eff2ff8..138ea59b25 100644 --- a/source/ps/ArchiveBuilder.cpp +++ b/source/ps/ArchiveBuilder.cpp @@ -32,7 +32,6 @@ #include "ps/XML/Xeromyces.h" #include "renderer/backend/dummy/Device.h" -#include #include CArchiveBuilder::CArchiveBuilder(const OsPath& mod, const OsPath& tempdir) : @@ -98,13 +97,11 @@ void CArchiveBuilder::Build(const OsPath& archive, bool compress) ENSURE(ret == INFO::OK); // Compress textures and store the new cached version instead of the original - if ((boost::algorithm::starts_with(path.string(), L"art/textures/") || - boost::algorithm::starts_with(path.string(), L"fonts/") - ) && + if ((path.string().starts_with(L"art/textures/") || path.string().starts_with(L"fonts/")) && tex_is_known_extension(path) && // Skip some subdirectories where the engine doesn't use CTextureManager yet: - !boost::algorithm::starts_with(path.string(), L"art/textures/cursors/") && - !boost::algorithm::starts_with(path.string(), L"art/textures/terrain/alphamaps/") + !path.string().starts_with(L"art/textures/cursors/") && + !path.string().starts_with(L"art/textures/terrain/alphamaps/") ) { VfsPath cachedPath; @@ -128,9 +125,9 @@ void CArchiveBuilder::Build(const OsPath& archive, bool compress) { CColladaManager::FileType type; - if (boost::algorithm::starts_with(path.string(), L"art/meshes/")) + if (path.string().starts_with(L"art/meshes/")) type = CColladaManager::PMD; - else if (boost::algorithm::starts_with(path.string(), L"art/animation/")) + else if (path.string().starts_with(L"art/animation/")) type = CColladaManager::PSA; else { diff --git a/source/ps/ConfigDB.cpp b/source/ps/ConfigDB.cpp index 95ac817358..512cf42ed7 100644 --- a/source/ps/ConfigDB.cpp +++ b/source/ps/ConfigDB.cpp @@ -33,7 +33,6 @@ #include "ps/Profiler2.h" #include -#include #include #include #include @@ -239,11 +238,11 @@ std::map CConfigDB::GetValuesWithPrefix(EConfigNamespace // values in earlier namespaces for (int search_ns = 0; search_ns <= ns; ++search_ns) for (const std::pair& p : m_Map[search_ns]) - if (boost::algorithm::starts_with(p.first, prefix)) + if (p.first.starts_with(prefix)) ret[p.first] = p.second; for (const std::pair& p : m_Map[CFG_COMMAND]) - if (boost::algorithm::starts_with(p.first, prefix)) + if (p.first.starts_with(prefix)) ret[p.first] = p.second; return ret; diff --git a/source/ps/ModIo.cpp b/source/ps/ModIo.cpp index f372c6af4e..950727bc8e 100644 --- a/source/ps/ModIo.cpp +++ b/source/ps/ModIo.cpp @@ -46,7 +46,6 @@ #include #include -#include #include #include #include @@ -826,9 +825,9 @@ bool ModIo::ParseSignature(const std::vector& minisigs, SigStruct& // because that is easy. const std::string untrusted_comment_prefix = "untrusted comment: "; const std::string trusted_comment_prefix = "trusted comment: "; - if (!boost::algorithm::starts_with(sig_lines[0], untrusted_comment_prefix)) + if (!sig_lines[0].starts_with(untrusted_comment_prefix)) FAIL("Malformed untrusted comment."); - if (!boost::algorithm::starts_with(sig_lines[2], trusted_comment_prefix)) + if (!sig_lines[2].starts_with(trusted_comment_prefix)) FAIL("Malformed trusted comment."); // We only _really_ care about the second line which is the signature of the file (b64-encoded)