summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2024-12-26 16:51:53 -0500
committerGitHub <noreply@github.com>2024-12-26 16:51:53 -0500
commit532a8621daa5c0d8a3a55f64ffba9cb20209d455 (patch)
tree21837ec63b1fe4a45a162a1f1bf4167efcd4d177 /Source/Core/DiscIO
parentf9ce2b9d764014ab59cf2c19e49c2c848604e6fc (diff)
parent2b0cd16c8c266bc1e298e49d4009eab8c9c23f99 (diff)
Merge pull request #13116 from mitaclaw/ranges-modernization-8-trivial-of
Ranges Algorithms Modernization - Of
Diffstat (limited to 'Source/Core/DiscIO')
-rw-r--r--Source/Core/DiscIO/DiscUtils.cpp4
-rw-r--r--Source/Core/DiscIO/RiivolutionPatcher.cpp2
-rw-r--r--Source/Core/DiscIO/VolumeVerifier.cpp9
-rw-r--r--Source/Core/DiscIO/VolumeWad.cpp2
-rw-r--r--Source/Core/DiscIO/WIABlob.cpp6
5 files changed, 11 insertions, 12 deletions
diff --git a/Source/Core/DiscIO/DiscUtils.cpp b/Source/Core/DiscIO/DiscUtils.cpp
index afd22117c6..8564e8c017 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<char>((partition_type >> 16) & 0xFF),
static_cast<char>((partition_type >> 8) & 0xFF),
static_cast<char>(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::ranges::all_of(type_as_game_id, Common::IsAlnum))
{
return include_prefix ? "P-" + type_as_game_id : type_as_game_id;
}
diff --git a/Source/Core/DiscIO/RiivolutionPatcher.cpp b/Source/Core/DiscIO/RiivolutionPatcher.cpp
index eff36077f9..9dce9e9a8f 100644
--- a/Source/Core/DiscIO/RiivolutionPatcher.cpp
+++ b/Source/Core/DiscIO/RiivolutionPatcher.cpp
@@ -104,7 +104,7 @@ FileDataLoaderHostFS::MakeAbsoluteFromRelative(std::string_view external_relativ
result.pop_back();
result.pop_back();
}
- else if (std::all_of(element.begin(), element.end(), [](char c) { return c == '.'; }))
+ else if (std::ranges::all_of(element, [](char c) { return c == '.'; }))
{
// This is a triple, quadruple, etc. dot.
// Some file systems treat this as several 'up' path traversals, but Riivolution does not.
diff --git a/Source/Core/DiscIO/VolumeVerifier.cpp b/Source/Core/DiscIO/VolumeVerifier.cpp
index d510aa3266..552b20cfb4 100644
--- a/Source/Core/DiscIO/VolumeVerifier.cpp
+++ b/Source/Core/DiscIO/VolumeVerifier.cpp
@@ -729,16 +729,15 @@ bool VolumeVerifier::ShouldHaveInstallPartition() const
static constexpr std::array<std::string_view, 4> dragon_quest_x = {"S4MJGD", "S4SJGD", "S6TJGD",
"SDQJGD"};
const std::string& game_id = m_volume.GetGameID();
- return std::any_of(dragon_quest_x.cbegin(), dragon_quest_x.cend(),
- [&game_id](std::string_view x) { return x == game_id; });
+ return std::ranges::any_of(dragon_quest_x,
+ [&game_id](std::string_view x) { return x == game_id; });
}
bool VolumeVerifier::ShouldHaveMasterpiecePartitions() const
{
static constexpr std::array<std::string_view, 4> ssbb = {"RSBE01", "RSBJ01", "RSBK01", "RSBP01"};
const std::string& game_id = m_volume.GetGameID();
- return std::any_of(ssbb.cbegin(), ssbb.cend(),
- [&game_id](std::string_view x) { return x == game_id; });
+ return std::ranges::any_of(ssbb, [&game_id](std::string_view x) { return x == game_id; });
}
bool VolumeVerifier::ShouldBeDualLayer() const
@@ -1039,7 +1038,7 @@ void VolumeVerifier::CheckSuperPaperMario()
if (!m_volume.Read(offset, length, data.data(), partition))
return;
- if (std::any_of(data.cbegin(), data.cend(), [](u8 x) { return x != 0; }))
+ if (std::ranges::any_of(data, [](u8 x) { return x != 0; }))
{
AddProblem(Severity::High,
Common::GetStringT("Some padding data that should be zero is not zero. "
diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp
index bc75e71b88..61848a4218 100644
--- a/Source/Core/DiscIO/VolumeWad.cpp
+++ b/Source/Core/DiscIO/VolumeWad.cpp
@@ -176,7 +176,7 @@ IOS::ES::TicketReader VolumeWAD::GetTicketWithFixedCommonKey() const
return m_ticket;
const std::vector<u8> sig = m_ticket.GetSignatureData();
- if (!std::all_of(sig.cbegin(), sig.cend(), [](u8 a) { return a == 0; }))
+ if (!std::ranges::all_of(sig, [](u8 a) { return a == 0; }))
{
// This does not look like a typical "invalid common key index" ticket, so let's assume
// the index is correct. This saves some time when reading properly signed titles.
diff --git a/Source/Core/DiscIO/WIABlob.cpp b/Source/Core/DiscIO/WIABlob.cpp
index c0f3930899..ec39245884 100644
--- a/Source/Core/DiscIO/WIABlob.cpp
+++ b/Source/Core/DiscIO/WIABlob.cpp
@@ -1126,7 +1126,7 @@ bool WIARVZFileReader<RVZ>::TryReuse(std::map<ReuseID, GroupEntry>* reusable_gro
static bool AllAre(const std::vector<u8>& data, u8 x)
{
- return std::all_of(data.begin(), data.end(), [x](u8 y) { return x == y; });
+ return std::ranges::all_of(data, [x](u8 y) { return x == y; });
}
static bool AllAre(const u8* begin, const u8* end, u8 x)
@@ -1379,8 +1379,8 @@ WIARVZFileReader<RVZ>::ProcessAndCompress(CompressThreadState* state, CompressPa
}
}
- if (!std::all_of(output_entries.begin(), output_entries.end(),
- [](const OutputParametersEntry& entry) { return entry.reused_group; }))
+ if (!std::ranges::all_of(output_entries,
+ [](const auto& entry) { return entry.reused_group.has_value(); }))
{
const u64 number_of_exception_lists =
chunks_per_wii_group == 1 ? exception_lists_per_chunk : chunks;