From 826e2bbf98ca5c6088c3d19968272b29fc335972 Mon Sep 17 00:00:00 2001 From: mitaclaw <140017135+mitaclaw@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:23:58 -0700 Subject: StringUtil: More Wrappers For `Common::IsLower(char)` was omitted as nothing needed it. --- Source/Core/DiscIO/DiscUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/DiscIO/DiscUtils.cpp') diff --git a/Source/Core/DiscIO/DiscUtils.cpp b/Source/Core/DiscIO/DiscUtils.cpp index afd22117c6..5d03a5aa7f 100644 --- a/Source/Core/DiscIO/DiscUtils.cpp +++ b/Source/Core/DiscIO/DiscUtils.cpp @@ -13,6 +13,7 @@ #include "Common/CommonTypes.h" #include "Common/MathUtil.h" +#include "Common/StringUtil.h" #include "DiscIO/Blob.h" #include "DiscIO/Filesystem.h" #include "DiscIO/Volume.h" @@ -39,8 +40,7 @@ std::string NameForPartitionType(u32 partition_type, bool include_prefix) static_cast((partition_type >> 16) & 0xFF), static_cast((partition_type >> 8) & 0xFF), static_cast(partition_type & 0xFF)}; - if (std::all_of(type_as_game_id.cbegin(), type_as_game_id.cend(), - [](char c) { return std::isalnum(c, std::locale::classic()); })) + if (std::all_of(type_as_game_id.cbegin(), type_as_game_id.cend(), Common::IsAlnum)) { return include_prefix ? "P-" + type_as_game_id : type_as_game_id; } -- cgit v1.2.3 From 860e6cf5cb7d96499aecf6f6067783bdb71c29ad Mon Sep 17 00:00:00 2001 From: mitaclaw <140017135+mitaclaw@users.noreply.github.com> Date: Sun, 29 Sep 2024 11:43:52 -0700 Subject: Modernize `std::all_of` with ranges In DITSpecification.cpp, MaterialAsset.cpp, and ShaderAsset.cpp, lambda predicates were replaced by pointers to member functions because ranges algorithms are able invoke those. In NetPlayClient.cpp, the non-trivial `NetPlay::Player` elements were being passed by value in `NetPlayClient::DoAllPlayersHaveGame()`. This has been fixed. In WIABlob.cpp, the second example's predicate was returning the `std::optional` by value instead of implicitly converting it to a bool. This has been fixed. --- Source/Core/DiscIO/DiscUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/DiscIO/DiscUtils.cpp') diff --git a/Source/Core/DiscIO/DiscUtils.cpp b/Source/Core/DiscIO/DiscUtils.cpp index 5d03a5aa7f..8564e8c017 100644 --- a/Source/Core/DiscIO/DiscUtils.cpp +++ b/Source/Core/DiscIO/DiscUtils.cpp @@ -40,7 +40,7 @@ std::string NameForPartitionType(u32 partition_type, bool include_prefix) static_cast((partition_type >> 16) & 0xFF), static_cast((partition_type >> 8) & 0xFF), static_cast(partition_type & 0xFF)}; - if (std::all_of(type_as_game_id.cbegin(), type_as_game_id.cend(), Common::IsAlnum)) + if (std::ranges::all_of(type_as_game_id, Common::IsAlnum)) { return include_prefix ? "P-" + type_as_game_id : type_as_game_id; } -- cgit v1.2.3