Compare commits

..

1 Commits

Author SHA1 Message Date
heyimalaap 7f13392996
Merge 0d03ddfae9 into ac0d6cbaaa 2024-12-20 03:33:47 -06:00
7 changed files with 16 additions and 15 deletions

View File

@ -62,7 +62,7 @@ bool IsPathAndroidContent(std::string_view uri)
std::string OpenModeToAndroid(std::string mode)
{
// The 'b' specifier is not supported by Android. Since we're on POSIX, it's fine to just skip it.
std::erase(mode, 'b');
mode.erase(std::remove(mode.begin(), mode.end(), 'b'));
if (mode == "r")
return "r";

View File

@ -98,8 +98,7 @@ std::vector<std::string> DoFileSearch(const std::vector<std::string>& directorie
// not because std::filesystem returns duplicates). Also note that this pathname-based uniqueness
// isn't as thorough as std::filesystem::equivalent.
std::ranges::sort(result);
const auto unique_result = std::ranges::unique(result);
result.erase(unique_result.begin(), unique_result.end());
result.erase(std::unique(result.begin(), result.end()), result.end());
// Dolphin expects to be able to use "/" (DIR_SEP) everywhere.
// std::filesystem uses the OS separator.

View File

@ -1085,10 +1085,10 @@ void WiiSockMan::UpdatePollCommands()
std::vector<int> original_order(pfds.size());
std::iota(original_order.begin(), original_order.end(), 0);
// Select indices with valid fds
const auto partition_result = std::ranges::partition(original_order, [&](auto i) {
auto mid = std::partition(original_order.begin(), original_order.end(), [&](auto i) {
return GetHostSocket(memory.Read_U32(pcmd.buffer_out + 0xc * i)) >= 0;
});
const auto n_valid = std::distance(original_order.begin(), partition_result.begin());
const auto n_valid = std::distance(original_order.begin(), mid);
// Move all the valid pollfds to the front of the vector
for (auto i = 0; i < n_valid; ++i)

View File

@ -1081,11 +1081,11 @@ void MovieManager::LoadInput(const std::string& movie_path)
std::vector<u8> movInput(m_current_byte);
t_record.ReadArray(movInput.data(), movInput.size());
const auto mismatch_result = std::ranges::mismatch(movInput, m_temp_input);
const auto result = std::mismatch(movInput.begin(), movInput.end(), m_temp_input.begin());
if (mismatch_result.in1 != movInput.end())
if (result.first != movInput.end())
{
const ptrdiff_t mismatch_index = std::distance(movInput.begin(), mismatch_result.in1);
const ptrdiff_t mismatch_index = std::distance(movInput.begin(), result.first);
// this is a "you did something wrong" alert for the user's benefit.
// we'll try to say what's going on in excruciating detail, otherwise the user might not

View File

@ -240,9 +240,11 @@ bool NANDImporter::ExtractCertificates()
for (const PEMCertificate& certificate : certificates)
{
const auto search_result = std::ranges::search(content_bytes, certificate.search_bytes);
const auto search_result =
std::search(content_bytes.begin(), content_bytes.end(), certificate.search_bytes.begin(),
certificate.search_bytes.end());
if (search_result.empty())
if (search_result == content_bytes.end())
{
ERROR_LOG_FMT(DISCIO, "ExtractCertificates: Could not find offset for certficate '{}'",
certificate.filename);
@ -250,8 +252,7 @@ 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.begin());
const ptrdiff_t certificate_offset = std::distance(content_bytes.begin(), search_result);
constexpr int min_offset = 2;
if (certificate_offset < min_offset)
{

View File

@ -309,9 +309,11 @@ void Settings::RemovePath(const QString& qpath)
std::string path = qpath.toStdString();
std::vector<std::string> paths = Config::GetIsoPaths();
if (std::erase(paths, path) == 0)
auto new_end = std::remove(paths.begin(), paths.end(), path);
if (new_end == paths.end())
return;
paths.erase(new_end, paths.end());
Config::SetIsoPaths(paths);
emit PathRemoved(qpath);
}

View File

@ -129,8 +129,7 @@ BuildExpression(const std::vector<ciface::Core::DeviceContainer::InputDetection>
// Remove duplicates
std::ranges::sort(alternations);
const auto unique_result = std::ranges::unique(alternations);
alternations.erase(unique_result.begin(), unique_result.end());
alternations.erase(std::unique(alternations.begin(), alternations.end()), alternations.end());
return fmt::to_string(fmt::join(alternations, "|"));
}