From 618b41a4593032a5c374069b37369e91ecf5db9e Mon Sep 17 00:00:00 2001 From: "Dr. Dystopia" Date: Fri, 19 Jul 2024 22:49:15 +0200 Subject: [PATCH] Use 'contains' method --- Source/Core/Common/IniFile.cpp | 2 +- Source/Core/Core/Boot/Boot.cpp | 2 +- Source/Core/Core/HW/DVD/FileMonitor.cpp | 2 +- Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp | 2 +- Source/Core/Core/IOS/ES/ES.cpp | 2 +- Source/Core/Core/IOS/ES/NandUtils.cpp | 2 +- Source/Core/Core/IOS/Network/Socket.cpp | 4 ++-- Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp | 4 ++-- Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.cpp | 2 +- Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.h | 2 +- .../IOS/USB/Emulated/Skylanders/SkylanderFigure.cpp | 2 +- Source/Core/Core/IOS/USB/Host.cpp | 6 +++--- Source/Core/Core/IOS/USB/OH0/OH0.cpp | 5 ++--- Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp | 5 ++--- Source/Core/Core/NetPlayClient.cpp | 2 +- Source/Core/Core/NetPlayServer.cpp | 10 +++++----- Source/Core/Core/PowerPC/Jit64/Jit.cpp | 8 +++----- Source/Core/Core/PowerPC/JitArm64/Jit.cpp | 3 +-- Source/Core/Core/PowerPC/JitInterface.cpp | 3 +-- Source/Core/Core/PowerPC/PPCSymbolDB.cpp | 2 +- Source/Core/Core/State.cpp | 2 +- Source/Core/Core/WiiUtils.cpp | 2 +- Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp | 2 +- .../Core/DolphinQt/NetPlay/ChunkedProgressDialog.cpp | 2 +- Source/Core/DolphinQt/NetPlay/GameDigestDialog.cpp | 4 ++-- Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp | 2 +- .../Settings/USBDeviceAddToWhitelistDialog.cpp | 2 +- .../ControllerInterface/DInput/DInputJoystick.cpp | 4 ++-- Source/Core/UpdaterCommon/UpdaterCommon.cpp | 2 +- .../GraphicsModSystem/Runtime/GraphicsModManager.cpp | 2 +- Source/Core/VideoCommon/TextureCacheBase.cpp | 4 ++-- 31 files changed, 46 insertions(+), 52 deletions(-) diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp index 2aed1b805f..ab20ff58fd 100644 --- a/Source/Core/Common/IniFile.cpp +++ b/Source/Core/Common/IniFile.cpp @@ -75,7 +75,7 @@ bool IniFile::Section::Get(std::string_view key, std::string* value, bool IniFile::Section::Exists(std::string_view key) const { - return values.find(key) != values.end(); + return values.contains(key); } bool IniFile::Section::Delete(std::string_view key) diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index 7e866604ed..1fd77d2c30 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -235,7 +235,7 @@ std::unique_ptr BootParameters::GenerateFromFile(std::vector disc_image_extensions = { {".gcm", ".iso", ".tgc", ".wbfs", ".ciso", ".gcz", ".wia", ".rvz", ".nfs", ".dol", ".elf"}}; - if (disc_image_extensions.find(extension) != disc_image_extensions.end()) + if (disc_image_extensions.contains(extension)) { std::unique_ptr disc = DiscIO::CreateDisc(path); if (disc) diff --git a/Source/Core/Core/HW/DVD/FileMonitor.cpp b/Source/Core/Core/HW/DVD/FileMonitor.cpp index f4bc53a097..b469b42570 100644 --- a/Source/Core/Core/HW/DVD/FileMonitor.cpp +++ b/Source/Core/Core/HW/DVD/FileMonitor.cpp @@ -43,7 +43,7 @@ static bool IsSoundFile(const std::string& filename) ".str", // Harry Potter & the Sorcerer's Stone }; - return extensions.find(extension) != extensions.end(); + return extensions.contains(extension); } FileLogger::FileLogger() = default; diff --git a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp index 9b6db2acfd..18cc6e4a37 100644 --- a/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/HW/WiimoteReal/WiimoteReal.cpp @@ -1000,7 +1000,7 @@ bool IsBalanceBoardName(const std::string& name) bool IsNewWiimote(const std::string& identifier) { std::lock_guard lk(s_known_ids_mutex); - return s_known_ids.count(identifier) == 0; + return !s_known_ids.contains(identifier); } void HandleWiimoteSourceChange(unsigned int index) diff --git a/Source/Core/Core/IOS/ES/ES.cpp b/Source/Core/Core/IOS/ES/ES.cpp index d04a3ef889..3634518f6f 100644 --- a/Source/Core/Core/IOS/ES/ES.cpp +++ b/Source/Core/Core/IOS/ES/ES.cpp @@ -1049,7 +1049,7 @@ ReturnCode ESCore::WriteNewCertToStore(const ES::CertReader& cert) { const std::map certs = ES::ParseCertChain(current_store); // The cert is already present in the store. Nothing to do. - if (certs.find(cert.GetName()) != certs.end()) + if (certs.contains(cert.GetName())) return IPC_SUCCESS; } diff --git a/Source/Core/Core/IOS/ES/NandUtils.cpp b/Source/Core/Core/IOS/ES/NandUtils.cpp index 89af3f140f..7198049462 100644 --- a/Source/Core/Core/IOS/ES/NandUtils.cpp +++ b/Source/Core/Core/IOS/ES/NandUtils.cpp @@ -340,7 +340,7 @@ bool ESCore::FinishImport(const ES::TMDReader& tmd) // There should not be any directory in there. Remove it. if (fs->ReadDirectory(PID_KERNEL, PID_KERNEL, absolute_path)) fs->Delete(PID_KERNEL, PID_KERNEL, absolute_path); - else if (expected_entries.find(name) == expected_entries.end()) + else if (!expected_entries.contains(name)) fs->Delete(PID_KERNEL, PID_KERNEL, absolute_path); } diff --git a/Source/Core/Core/IOS/Network/Socket.cpp b/Source/Core/Core/IOS/Network/Socket.cpp index 59f8e31814..b5ab5ffc4e 100644 --- a/Source/Core/Core/IOS/Network/Socket.cpp +++ b/Source/Core/Core/IOS/Network/Socket.cpp @@ -876,7 +876,7 @@ s32 WiiSockMan::AddSocket(s32 fd, bool is_rw) for (wii_fd = 0; wii_fd < WII_SOCKET_FD_MAX; ++wii_fd) { // Find an available socket fd - if (WiiSockets.count(wii_fd) == 0) + if (!WiiSockets.contains(wii_fd)) break; } @@ -964,7 +964,7 @@ s32 WiiSockMan::NewSocket(s32 af, s32 type, s32 protocol) s32 WiiSockMan::GetHostSocket(s32 wii_fd) const { - if (WiiSockets.count(wii_fd) > 0) + if (WiiSockets.contains(wii_fd)) return WiiSockets.at(wii_fd).fd; return -EBADF; } diff --git a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp index 9d853d1f48..1a43a647c5 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp +++ b/Source/Core/Core/IOS/USB/Bluetooth/BTReal.cpp @@ -678,7 +678,7 @@ bool BluetoothRealDevice::OpenDevice(libusb_device* device) void BluetoothRealDevice::HandleCtrlTransfer(libusb_transfer* tr) { std::lock_guard lk(m_transfers_mutex); - if (!m_current_transfers.count(tr)) + if (!m_current_transfers.contains(tr)) return; if (tr->status != LIBUSB_TRANSFER_COMPLETED && tr->status != LIBUSB_TRANSFER_NO_DEVICE) @@ -706,7 +706,7 @@ void BluetoothRealDevice::HandleCtrlTransfer(libusb_transfer* tr) void BluetoothRealDevice::HandleBulkOrIntrTransfer(libusb_transfer* tr) { std::lock_guard lk(m_transfers_mutex); - if (!m_current_transfers.count(tr)) + if (!m_current_transfers.contains(tr)) return; if (tr->status != LIBUSB_TRANSFER_COMPLETED && tr->status != LIBUSB_TRANSFER_TIMED_OUT && diff --git a/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.cpp b/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.cpp index 950e20404f..a48be51173 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.cpp +++ b/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.cpp @@ -188,7 +188,7 @@ u16 WiimoteDevice::GenerateChannelID() const u16 cid = starting_id; - while (m_channels.count(cid) != 0) + while (m_channels.contains(cid)) ++cid; return cid; diff --git a/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.h b/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.h index 99ac995f78..f74bb4717e 100644 --- a/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.h +++ b/Source/Core/Core/IOS/USB/Bluetooth/WiimoteDevice.h @@ -149,7 +149,7 @@ private: bool LinkChannel(u16 psm); u16 GenerateChannelID() const; - bool DoesChannelExist(u16 scid) const { return m_channels.count(scid) != 0; } + bool DoesChannelExist(u16 scid) const { return m_channels.contains(scid); } void SendCommandToACL(u8 ident, u8 code, u8 command_length, u8* command_data); void SignalChannel(u8* data, u32 size); diff --git a/Source/Core/Core/IOS/USB/Emulated/Skylanders/SkylanderFigure.cpp b/Source/Core/Core/IOS/USB/Emulated/Skylanders/SkylanderFigure.cpp index 56535f9c6b..f4483ba359 100644 --- a/Source/Core/Core/IOS/USB/Emulated/Skylanders/SkylanderFigure.cpp +++ b/Source/Core/Core/IOS/USB/Emulated/Skylanders/SkylanderFigure.cpp @@ -186,7 +186,7 @@ FigureData SkylanderFigure::GetData() const auto filter = std::make_pair(figure_data.figure_id, figure_data.variant_id); Type type = Type::Item; - if (IOS::HLE::USB::list_skylanders.count(filter) != 0) + if (IOS::HLE::USB::list_skylanders.contains(filter)) { auto found = IOS::HLE::USB::list_skylanders.at(filter); type = found.type; diff --git a/Source/Core/Core/IOS/USB/Host.cpp b/Source/Core/Core/IOS/USB/Host.cpp index c2641932ac..bc1eace025 100644 --- a/Source/Core/Core/IOS/USB/Host.cpp +++ b/Source/Core/Core/IOS/USB/Host.cpp @@ -72,7 +72,7 @@ void USBHost::DoState(PointerWrap& p) bool USBHost::AddDevice(std::unique_ptr device) { std::lock_guard lk(m_devices_mutex); - if (m_devices.find(device->GetId()) != m_devices.end()) + if (m_devices.contains(device->GetId())) return false; m_devices[device->GetId()] = std::move(device); @@ -136,7 +136,7 @@ bool USBHost::AddNewDevices(std::set& new_devices, DeviceChangeHooks& hooks const int ret = m_context.GetDeviceList([&](libusb_device* device) { libusb_device_descriptor descriptor; libusb_get_device_descriptor(device, &descriptor); - if (whitelist.count({descriptor.idVendor, descriptor.idProduct}) == 0) + if (!whitelist.contains({descriptor.idVendor, descriptor.idProduct})) return true; auto usb_device = @@ -157,7 +157,7 @@ void USBHost::DetectRemovedDevices(const std::set& plugged_devices, DeviceC std::lock_guard lk(m_devices_mutex); for (auto it = m_devices.begin(); it != m_devices.end();) { - if (plugged_devices.find(it->second->GetId()) == plugged_devices.end()) + if (!plugged_devices.contains(it->second->GetId())) { hooks.emplace(it->second, ChangeEvent::Removed); it = m_devices.erase(it); diff --git a/Source/Core/Core/IOS/USB/OH0/OH0.cpp b/Source/Core/Core/IOS/USB/OH0/OH0.cpp index 3685c9d8f5..fdd6b40d9c 100644 --- a/Source/Core/Core/IOS/USB/OH0/OH0.cpp +++ b/Source/Core/Core/IOS/USB/OH0/OH0.cpp @@ -176,7 +176,7 @@ std::optional OH0::RegisterRemovalHook(const u64 device_id, const IOCt { std::lock_guard lock{m_hooks_mutex}; // IOS only allows a single device removal hook. - if (m_removal_hooks.find(device_id) != m_removal_hooks.end()) + if (m_removal_hooks.contains(device_id)) return IPCReply(IPC_EEXIST); m_removal_hooks.insert({device_id, request.address}); return std::nullopt; @@ -271,8 +271,7 @@ std::pair OH0::DeviceOpen(const u16 vid, const u16 pid) continue; has_device_with_vid_pid = true; - if (m_opened_devices.find(device.second->GetId()) != m_opened_devices.cend() || - !device.second->Attach()) + if (m_opened_devices.contains(device.second->GetId()) || !device.second->Attach()) { continue; } diff --git a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp index 288c4490fc..b60339a8f1 100644 --- a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp +++ b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp @@ -173,13 +173,12 @@ void USB_HIDv4::OnDeviceChange(ChangeEvent event, std::shared_ptr d if (event == ChangeEvent::Inserted) { s32 new_id = 0; - while (m_ios_ids.find(new_id) != m_ios_ids.cend()) + while (m_ios_ids.contains(new_id)) ++new_id; m_ios_ids[new_id] = device->GetId(); m_device_ids[device->GetId()] = new_id; } - else if (event == ChangeEvent::Removed && - m_device_ids.find(device->GetId()) != m_device_ids.cend()) + else if (event == ChangeEvent::Removed && m_device_ids.contains(device->GetId())) { m_ios_ids.erase(m_device_ids.at(device->GetId())); m_device_ids.erase(device->GetId()); diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index c40b122a70..96203a67d7 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -2388,7 +2388,7 @@ void NetPlayClient::RequestGolfControl() std::string NetPlayClient::GetCurrentGolfer() { std::lock_guard lkp(m_crit.players); - if (m_players.count(m_current_golfer)) + if (m_players.contains(m_current_golfer)) return m_players[m_current_golfer].name; return ""; } diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index 0705e4d2a7..617608741c 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -283,7 +283,7 @@ void NetPlayServer::ThreadFunc() auto& e = m_async_queue.Front(); if (e.target_mode == TargetMode::Only) { - if (m_players.find(e.target_pid) != m_players.end()) + if (m_players.contains(e.target_pid)) Send(m_players.at(e.target_pid).socket, e.packet, e.channel_id); } else @@ -787,7 +787,7 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player) u32 cid; packet >> cid; - if (m_chunked_data_complete_count.find(cid) != m_chunked_data_complete_count.end()) + if (m_chunked_data_complete_count.contains(cid)) { m_chunked_data_complete_count[cid]++; m_chunked_data_complete_event.Set(); @@ -832,7 +832,7 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player) if (m_host_input_authority) { // Prevent crash before game stop if the golfer disconnects - if (m_current_golfer != 0 && m_players.find(m_current_golfer) != m_players.end()) + if (m_current_golfer != 0 && m_players.contains(m_current_golfer)) Send(m_players.at(m_current_golfer).socket, spac); } else @@ -917,7 +917,7 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player) packet >> pid; // Check if player ID is valid and sender isn't a spectator - if (!m_players.count(pid) || !PlayerHasControllerMapped(player.pid)) + if (!m_players.contains(pid) || !PlayerHasControllerMapped(player.pid)) break; if (m_host_input_authority && m_settings.golf_mode && m_pending_golfer == 0 && @@ -2426,7 +2426,7 @@ void NetPlayServer::ChunkedDataThreadFunc() } if (e.target_mode == TargetMode::Only) { - if (m_players.find(e.target_pid) == m_players.end()) + if (!m_players.contains(e.target_pid)) { skip_wait = true; break; diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index fe46aa90a6..4594f7d6d5 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -909,7 +909,7 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) // Assume that GQR values don't change often at runtime. Many paired-heavy games use largely float // loads and stores, which are significantly faster when inlined (especially in MMU mode, where // this lets them use fastmem). - if (js.pairedQuantizeAddresses.find(js.blockStart) == js.pairedQuantizeAddresses.end()) + if (!js.pairedQuantizeAddresses.contains(js.blockStart)) { // If there are GQRs used but not set, we'll treat those as constant and optimize them BitSet8 gqr_static = ComputeStaticGQRs(code_block); @@ -938,8 +938,7 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) } } - if (js.noSpeculativeConstantsAddresses.find(js.blockStart) == - js.noSpeculativeConstantsAddresses.end()) + if (!js.noSpeculativeConstantsAddresses.contains(js.blockStart)) { IntializeSpeculativeConstants(); } @@ -967,8 +966,7 @@ bool Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) { // Gather pipe writes using a non-immediate address are discovered by profiling. const u32 prev_address = m_code_buffer[i - 1].address; - bool gatherPipeIntCheck = - js.fifoWriteAddresses.find(prev_address) != js.fifoWriteAddresses.end(); + bool gatherPipeIntCheck = js.fifoWriteAddresses.contains(prev_address); // Gather pipe writes using an immediate address are explicitly tracked. if (jo.optimizeGatherPipe && diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp index 4f0bd71c31..049f9f6892 100644 --- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp +++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp @@ -1158,8 +1158,7 @@ bool JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC) { // Gather pipe writes using a non-immediate address are discovered by profiling. const u32 prev_address = m_code_buffer[i - 1].address; - bool gatherPipeIntCheck = - js.fifoWriteAddresses.find(prev_address) != js.fifoWriteAddresses.end(); + bool gatherPipeIntCheck = js.fifoWriteAddresses.contains(prev_address); if (jo.optimizeGatherPipe && (js.fifoBytesSinceCheck >= GPFifo::GATHER_PIPE_SIZE || js.mustCheckFifo)) diff --git a/Source/Core/Core/PowerPC/JitInterface.cpp b/Source/Core/Core/PowerPC/JitInterface.cpp index bd31893035..7e0e281998 100644 --- a/Source/Core/Core/PowerPC/JitInterface.cpp +++ b/Source/Core/Core/PowerPC/JitInterface.cpp @@ -316,8 +316,7 @@ void JitInterface::CompileExceptionCheck(ExceptionType type) } auto& ppc_state = m_system.GetPPCState(); - if (ppc_state.pc != 0 && - (exception_addresses->find(ppc_state.pc)) == (exception_addresses->end())) + if (ppc_state.pc != 0 && !exception_addresses->contains(ppc_state.pc)) { if (type == ExceptionType::FIFOWrite) { diff --git a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp index 4bbf5ca7db..cccf98a629 100644 --- a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp +++ b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp @@ -34,7 +34,7 @@ PPCSymbolDB::~PPCSymbolDB() = default; Common::Symbol* PPCSymbolDB::AddFunction(const Core::CPUThreadGuard& guard, u32 start_addr) { // It's already in the list - if (m_functions.find(start_addr) != m_functions.end()) + if (m_functions.contains(start_addr)) return nullptr; Common::Symbol symbol; diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp index 11c8e9660e..fe20d74ea4 100644 --- a/Source/Core/Core/State.cpp +++ b/Source/Core/Core/State.cpp @@ -742,7 +742,7 @@ static bool ValidateHeaders(const StateHeader& header) std::string loaded_str = header.version_string; const u32 loaded_version = header.version_header.version_cookie - COOKIE_BASE; - if (s_old_versions.count(loaded_version)) + if (s_old_versions.contains(loaded_version)) { // This is a REALLY old version, before we started writing the version string to file success = false; diff --git a/Source/Core/Core/WiiUtils.cpp b/Source/Core/Core/WiiUtils.cpp index 2803844ac6..2d5a8e4ac3 100644 --- a/Source/Core/Core/WiiUtils.cpp +++ b/Source/Core/Core/WiiUtils.cpp @@ -532,7 +532,7 @@ UpdateResult OnlineSystemUpdater::InstallTitleFromNUS(const std::string& prefix_ if (title.id == Titles::BOOT2) return UpdateResult::Succeeded; - if (!ShouldInstallTitle(title) || updated_titles->find(title.id) != updated_titles->end()) + if (!ShouldInstallTitle(title) || updated_titles->contains(title.id)) return UpdateResult::Succeeded; NOTICE_LOG_FMT(CORE, "Updating title {:016x}", title.id); diff --git a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp index c6ca41d64c..be1eb0a4b9 100644 --- a/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/CodeViewWidget.cpp @@ -728,7 +728,7 @@ void CodeViewWidget::AutoStep(CodeTrace::AutoStop option) for (u32 i = 1; i <= 3; i++) { - if (results.mem_tracked.count(address + i)) + if (results.mem_tracked.contains(address + i)) iter++; else break; diff --git a/Source/Core/DolphinQt/NetPlay/ChunkedProgressDialog.cpp b/Source/Core/DolphinQt/NetPlay/ChunkedProgressDialog.cpp index 8e28c9983f..18ba1a2d3c 100644 --- a/Source/Core/DolphinQt/NetPlay/ChunkedProgressDialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/ChunkedProgressDialog.cpp @@ -125,7 +125,7 @@ void ChunkedProgressDialog::SetProgress(const int pid, const u64 progress) { QString player_name = GetPlayerNameFromPID(pid); - if (!m_status_labels.count(pid)) + if (!m_status_labels.contains(pid)) return; const float acquired = progress / 1024.0f / 1024.0f; diff --git a/Source/Core/DolphinQt/NetPlay/GameDigestDialog.cpp b/Source/Core/DolphinQt/NetPlay/GameDigestDialog.cpp index 6a91e4bbde..6ca4ec378d 100644 --- a/Source/Core/DolphinQt/NetPlay/GameDigestDialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/GameDigestDialog.cpp @@ -122,7 +122,7 @@ void GameDigestDialog::SetProgress(int pid, int progress) { QString player_name = GetPlayerNameFromPID(pid); - if (!m_status_labels.count(pid)) + if (!m_status_labels.contains(pid)) return; m_status_labels[pid]->setText( @@ -134,7 +134,7 @@ void GameDigestDialog::SetResult(int pid, const std::string& result) { QString player_name = GetPlayerNameFromPID(pid); - if (!m_status_labels.count(pid)) + if (!m_status_labels.contains(pid)) return; m_status_labels[pid]->setText( diff --git a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp index 4ae4b5f315..c02946d48f 100644 --- a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp @@ -659,7 +659,7 @@ void NetPlayDialog::UpdateGUI() auto* name_item = new QTableWidgetItem(QString::fromStdString(p->name)); name_item->setToolTip(name_item->text()); - const auto& status_info = player_status.count(p->game_status) ? + const auto& status_info = player_status.contains(p->game_status) ? player_status.at(p->game_status) : std::make_pair(QStringLiteral("?"), QStringLiteral("?")); auto* status_item = new QTableWidgetItem(status_info.first); diff --git a/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp b/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp index fd2b26e511..d6add823d3 100644 --- a/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp +++ b/Source/Core/DolphinQt/Settings/USBDeviceAddToWhitelistDialog.cpp @@ -113,7 +113,7 @@ void USBDeviceAddToWhitelistDialog::RefreshDeviceList() auto whitelist = Config::GetUSBDeviceWhitelist(); for (const auto& device : current_devices) { - if (whitelist.count({device.first.first, device.first.second}) != 0) + if (whitelist.contains({device.first.first, device.first.second})) continue; usb_inserted_devices_list->addItem(QString::fromStdString(device.second)); } diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp index f095818287..577bd761d4 100644 --- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp @@ -44,7 +44,7 @@ void InitJoystick(IDirectInput8* const idi8, HWND hwnd) for (DIDEVICEINSTANCE& joystick : joysticks) { // Skip XInput Devices - if (xinput_guids.count(joystick.guidProduct.Data1)) + if (xinput_guids.contains(joystick.guidProduct.Data1)) { continue; } @@ -52,7 +52,7 @@ void InitJoystick(IDirectInput8* const idi8, HWND hwnd) // Skip devices we are already using. { std::lock_guard lk(s_guids_mutex); - if (s_guids_in_use.count(joystick.guidInstance)) + if (s_guids_in_use.contains(joystick.guidInstance)) { continue; } diff --git a/Source/Core/UpdaterCommon/UpdaterCommon.cpp b/Source/Core/UpdaterCommon/UpdaterCommon.cpp index bba12b8f48..9dd470e067 100644 --- a/Source/Core/UpdaterCommon/UpdaterCommon.cpp +++ b/Source/Core/UpdaterCommon/UpdaterCommon.cpp @@ -279,7 +279,7 @@ TodoList ComputeActionsToDo(Manifest this_manifest, Manifest next_manifest) // Delete if present in this manifest but not in next manifest. for (const auto& entry : this_manifest.entries) { - if (next_manifest.entries.find(entry.first) == next_manifest.entries.end()) + if (!next_manifest.entries.contains(entry.first)) { TodoList::DeleteOp del; del.filename = entry.first; diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp index 4ddd2d1d72..0d070a4310 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp +++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp @@ -197,7 +197,7 @@ void GraphicsModManager::Load(const GraphicsModGroupConfig& config) { for (const GraphicsTargetGroupConfig& group : mod.m_groups) { - if (m_groups.find(group.m_name) != m_groups.end()) + if (m_groups.contains(group.m_name)) { WARN_LOG_FMT( VIDEO, diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 5ef7d3fc98..b99533eb02 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -665,7 +665,7 @@ void TextureCacheBase::DoSaveState(PointerWrap& p) auto refpair1 = std::make_pair(*id1, *id2); auto refpair2 = std::make_pair(*id2, *id1); - if (reference_pairs.count(refpair1) == 0 && reference_pairs.count(refpair2) == 0) + if (!reference_pairs.contains(refpair1) && !reference_pairs.contains(refpair2)) reference_pairs.insert(refpair1); } } @@ -854,7 +854,7 @@ RcTcacheEntry TextureCacheBase::DoPartialTextureUpdates(RcTcacheEntry& entry_to_ { auto& entry = iter.first->second; if (entry != entry_to_update && entry->IsCopy() && - entry->references.count(entry_to_update.get()) == 0 && + !entry->references.contains(entry_to_update.get()) && entry->OverlapsMemoryRange(entry_to_update->addr, entry_to_update->size_in_bytes) && entry->memory_stride == numBlocksX * block_size) {