mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-08 15:20:45 +01:00
Modernize std::search
with ranges
The new return value is `std::ranges::subrange`.
This commit is contained in:
parent
0352f24a8e
commit
4fde0f2868
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user