summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/NANDImporter.cpp
diff options
context:
space:
mode:
authormitaclaw <140017135+mitaclaw@users.noreply.github.com>2024-09-22 00:00:41 -0700
committermitaclaw <140017135+mitaclaw@users.noreply.github.com>2024-10-17 18:38:34 -0700
commit4fde0f2868212afc216cd9324af8d5efcc282887 (patch)
treefaba92788faa14c1e7578380ae410d89d71e292b /Source/Core/DiscIO/NANDImporter.cpp
parent0352f24a8ee0b8c079df065b5155ea576727db3d (diff)
Modernize `std::search` with ranges
The new return value is `std::ranges::subrange`.
Diffstat (limited to 'Source/Core/DiscIO/NANDImporter.cpp')
-rw-r--r--Source/Core/DiscIO/NANDImporter.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/Source/Core/DiscIO/NANDImporter.cpp b/Source/Core/DiscIO/NANDImporter.cpp
index 8ab09da8b3..80b52951b0 100644
--- a/Source/Core/DiscIO/NANDImporter.cpp
+++ b/Source/Core/DiscIO/NANDImporter.cpp
@@ -240,11 +240,9 @@ bool NANDImporter::ExtractCertificates()
for (const PEMCertificate& certificate : certificates)
{
- const auto search_result =
- std::search(content_bytes.begin(), content_bytes.end(), certificate.search_bytes.begin(),
- certificate.search_bytes.end());
+ const auto search_result = std::ranges::search(content_bytes, certificate.search_bytes);
- if (search_result == content_bytes.end())
+ if (search_result.empty())
{
ERROR_LOG_FMT(DISCIO, "ExtractCertificates: Could not find offset for certficate '{}'",
certificate.filename);
@@ -252,7 +250,8 @@ bool NANDImporter::ExtractCertificates()
}
const std::string pem_file_path = m_nand_root + std::string(certificate.filename);
- const ptrdiff_t certificate_offset = std::distance(content_bytes.begin(), search_result);
+ const ptrdiff_t certificate_offset =
+ std::distance(content_bytes.begin(), search_result.begin());
constexpr int min_offset = 2;
if (certificate_offset < min_offset)
{