mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Use 'contains' method
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -235,7 +235,7 @@ std::unique_ptr<BootParameters> BootParameters::GenerateFromFile(std::vector<std
|
||||
|
||||
static const std::unordered_set<std::string> 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<DiscIO::VolumeDisc> disc = DiscIO::CreateDisc(path);
|
||||
if (disc)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1049,7 +1049,7 @@ ReturnCode ESCore::WriteNewCertToStore(const ES::CertReader& cert)
|
||||
{
|
||||
const std::map<std::string, ES::CertReader> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -72,7 +72,7 @@ void USBHost::DoState(PointerWrap& p)
|
||||
bool USBHost::AddDevice(std::unique_ptr<USB::Device> 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<u64>& 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<u64>& 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);
|
||||
|
||||
@@ -176,7 +176,7 @@ std::optional<IPCReply> 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<ReturnCode, u64> 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;
|
||||
}
|
||||
|
||||
@@ -173,13 +173,12 @@ void USB_HIDv4::OnDeviceChange(ChangeEvent event, std::shared_ptr<USB::Device> 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());
|
||||
|
||||
@@ -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 "";
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user