(view as text)
diff --git a/Source/Core/Common/ArmEmitter.cpp b/Source/Core/Common/ArmEmitter.cpp
index 6178d2c..f20ef73 100644
--- a/Source/Core/Common/ArmEmitter.cpp
+++ b/Source/Core/Common/ArmEmitter.cpp
@@ -206,23 +206,23 @@ void ARMXEmitter::ORI2R(ARMReg rd, ARMReg rs, u32 val, ARMReg scratch)
void ARMXEmitter::FlushLitPool()
{
- for(std::vector<LiteralPool>::iterator it = currentLitPool.begin(); it != currentLitPool.end(); ++it) {
+ for(auto& pool : currentLitPool) {
// Search for duplicates
- for(std::vector<LiteralPool>::iterator old_it = currentLitPool.begin(); old_it != it; ++old_it) {
- if ((*old_it).val == (*it).val)
- (*it).loc = (*old_it).loc;
+ for(auto& old_pool : currentLitPool) {
+ if (old_pool.val == pool.val)
+ pool.loc = old_pool.loc;
}
// Write the constant to Literal Pool
- if (!(*it).loc)
+ if (!pool.loc)
{
- (*it).loc = (s32)code;
- Write32((*it).val);
+ pool.loc = (s32)code;
+ Write32(pool.val);
}
- s32 offset = (*it).loc - (s32)(*it).ldr_address - 8;
+ s32 offset = pool.loc - (s32)pool.ldr_address - 8;
// Backpatch the LDR
- *(u32*)(*it).ldr_address |= (offset >= 0) << 23 | abs(offset);
+ *(u32*)pool.ldr_address |= (offset >= 0) << 23 | abs(offset);
}
// TODO: Save a copy of previous pools in case they are still in range.
currentLitPool.clear();
diff --git a/Source/Core/Common/BreakPoints.cpp b/Source/Core/Common/BreakPoints.cpp
index e4b2337..bfcb12a 100644
--- a/Source/Core/Common/BreakPoints.cpp
+++ b/Source/Core/Common/BreakPoints.cpp
@@ -8,11 +8,10 @@
#include "../Core/PowerPC/JitCommon/JitBase.h"
#include <sstream>
-#include <algorithm>
bool BreakPoints::IsAddressBreakPoint(u32 _iAddress)
{
- for (auto& bp : m_BreakPoints)
+ for (const auto& bp : m_BreakPoints)
if (bp.iAddress == _iAddress)
return true;
return false;
@@ -20,7 +19,7 @@ bool BreakPoints::IsAddressBreakPoint(u32 _iAddress)
bool BreakPoints::IsTempBreakPoint(u32 _iAddress)
{
- for (auto& bp : m_BreakPoints)
+ for (const auto& bp : m_BreakPoints)
if (bp.iAddress == _iAddress && bp.bTemporary)
return true;
return false;
@@ -84,7 +83,7 @@ void BreakPoints::Add(u32 em_address, bool temp)
void BreakPoints::Remove(u32 em_address)
{
- for (TBreakPoints::iterator i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i)
+ for (auto i = m_BreakPoints.begin(); i != m_BreakPoints.end(); ++i)
{
if (i->iAddress == em_address)
{
@@ -100,12 +99,10 @@ void BreakPoints::Clear()
{
if (jit)
{
- std::for_each(m_BreakPoints.begin(), m_BreakPoints.end(),
- [](const TBreakPoint& bp)
- {
- jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4);
- }
- );
+ for (const auto& bp : m_BreakPoints)
+ {
+ jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4);
+ }
}
m_BreakPoints.clear();
@@ -156,7 +153,7 @@ void MemChecks::Add(const TMemCheck& _rMemoryCheck)
void MemChecks::Remove(u32 _Address)
{
- for (TMemChecks::iterator i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i)
+ for (auto i = m_MemChecks.begin(); i != m_MemChecks.end(); ++i)
{
if (i->StartAddress == _Address)
{
diff --git a/Source/Core/Common/CDUtils.cpp b/Source/Core/Common/CDUtils.cpp
index 763fbf7..cd9d881 100644
--- a/Source/Core/Common/CDUtils.cpp
+++ b/Source/Core/Common/CDUtils.cpp
@@ -192,7 +192,7 @@ std::vector<std::string> cdio_get_devices ()
for (unsigned int j = checklist[i].num_min; j <= checklist[i].num_max; ++j)
{
std::string drive = StringFromFormat(checklist[i].format, j);
- if ( (is_cdrom(drive.c_str(), NULL)) > 0 )
+ if ( (is_cdrom(drive, NULL)) > 0 )
{
drives.push_back(std::move(drive));
}
diff --git a/Source/Core/Common/ChunkFile.h b/Source/Core/Common/ChunkFile.h
index acacca4..14a73f5 100644
--- a/Source/Core/Common/ChunkFile.h
+++ b/Source/Core/Common/ChunkFile.h
@@ -117,9 +117,9 @@ public:
case MODE_WRITE:
case MODE_MEASURE:
case MODE_VERIFY:
- for (auto itr = x.begin(); itr != x.end(); ++itr)
+ for (auto& itr : x)
{
- Do(*itr);
+ Do(itr);
}
break;
}
diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp
index a1a10ab..6a0f177 100644
--- a/Source/Core/Common/IniFile.cpp
+++ b/Source/Core/Common/IniFile.cpp
@@ -85,10 +85,9 @@ void IniFile::Section::Set(const char* key, const std::vector<std::string>& newV
{
std::string temp;
// Join the strings with ,
- std::vector<std::string>::const_iterator it;
- for (it = newValues.begin(); it != newValues.end(); ++it)
+ for (const auto& value : newValues)
{
- temp = (*it) + ",";
+ temp = value + ",";
}
// remove last ,
temp.resize(temp.length() - 1);
@@ -238,7 +237,7 @@ bool IniFile::DeleteSection(const char* sectionName)
Section* s = GetSection(sectionName);
if (!s)
return false;
- for (std::vector<Section>::iterator iter = sections.begin(); iter != sections.end(); ++iter)
+ for (auto iter = sections.begin(); iter != sections.end(); ++iter)
{
if (&(*iter) == s)
{
@@ -397,21 +396,21 @@ bool IniFile::Save(const char* filename)
return false;
}
- for (auto& section : sections)
+ for (const auto& section : sections)
{
if (section.keys_order.size() != 0 || section.lines.size() != 0)
out << "[" << section.name << "]" << std::endl;
if (section.keys_order.size() == 0)
{
- for (auto s : section.lines)
+ for (const auto& s : section.lines)
out << s << std::endl;
}
else
{
- for (auto kvit = section.keys_order.begin(); kvit != section.keys_order.end(); ++kvit)
+ for (const auto& kvit : section.keys_order)
{
- auto pair = section.values.find(*kvit);
+ auto pair = section.values.find(kvit);
out << pair->first << " = " << pair->second << std::endl;
}
}
diff --git a/Source/Core/Common/LogManager.cpp b/Source/Core/Common/LogManager.cpp
index 5fe218b..0f4d919 100644
--- a/Source/Core/Common/LogManager.cpp
+++ b/Source/Core/Common/LogManager.cpp
@@ -168,10 +168,9 @@ void LogContainer::Trigger(LogTypes::LOG_LEVELS level, const char *msg)
{
std::lock_guard<std::mutex> lk(m_listeners_lock);
- std::set<LogListener*>::const_iterator i;
- for (i = m_listeners.begin(); i != m_listeners.end(); ++i)
+ for (const auto& listener : m_listeners)
{
- (*i)->Log(level, msg);
+ listener->Log(level, msg);
}
}
diff --git a/Source/Core/Common/SymbolDB.h b/Source/Core/Common/SymbolDB.h
index e0272d4..348bdb5 100644
--- a/Source/Core/Common/SymbolDB.h
+++ b/Source/Core/Common/SymbolDB.h
@@ -95,11 +95,6 @@ public:
const XFuncMap &Symbols() const {return functions;}
XFuncMap &AccessSymbols() {return functions;}
- // deprecated
- XFuncMap::iterator GetIterator() { return functions.begin(); }
- XFuncMap::const_iterator GetConstIterator() { return functions.begin(); }
- XFuncMap::iterator End() { return functions.end(); }
-
void Clear(const char *prefix = "");
void List();
void Index();
diff --git a/Source/Core/Common/SysConf.cpp b/Source/Core/Common/SysConf.cpp
index acfb11b..460ad16 100644
--- a/Source/Core/Common/SysConf.cpp
+++ b/Source/Core/Common/SysConf.cpp
@@ -25,8 +25,7 @@ SysConf::~SysConf()
void SysConf::Clear()
{
- for (std::vector<SSysConfEntry>::const_iterator i = m_Entries.begin();
- i < m_Entries.end() - 1; i++)
+ for (auto i = m_Entries.begin(); i < m_Entries.end() - 1; ++i)
delete [] i->data;
m_Entries.clear();
}
@@ -85,8 +84,7 @@ bool SysConf::LoadFromFileInternal(FILE *fh)
}
// Last offset is an invalid entry. We ignore it throughout this class
- for (std::vector<SSysConfEntry>::iterator i = m_Entries.begin();
- i < m_Entries.end() - 1; i++)
+ for (auto i = m_Entries.begin(); i < m_Entries.end() - 1; ++i)
{
SSysConfEntry& curEntry = *i;
f.Seek(curEntry.offset, SEEK_SET);
@@ -362,8 +360,7 @@ bool SysConf::SaveToFile(const char *filename)
{
File::IOFile f(filename, "r+b");
- for (std::vector<SSysConfEntry>::iterator i = m_Entries.begin();
- i < m_Entries.end() - 1; i++)
+ for (auto i = m_Entries.begin(); i < m_Entries.end() - 1; ++i)
{
// Seek to after the name of this entry
f.Seek(i->offset + i->nameLength + 1, SEEK_SET);
diff --git a/Source/Core/Common/SysConf.h b/Source/Core/Common/SysConf.h
index f8f6ca3..1b4706e 100644
--- a/Source/Core/Common/SysConf.h
+++ b/Source/Core/Common/SysConf.h
@@ -79,7 +79,7 @@ public:
}
std::vector<SSysConfEntry>::iterator index = m_Entries.begin();
- for (; index < m_Entries.end() - 1; index++)
+ for (; index < m_Entries.end() - 1; ++index)
{
if (strcmp(index->name, sectionName) == 0)
break;
@@ -102,7 +102,7 @@ public:
}
std::vector<SSysConfEntry>::iterator index = m_Entries.begin();
- for (; index < m_Entries.end() - 1; index++)
+ for (; index < m_Entries.end() - 1; ++index)
{
if (strcmp(index->name, sectionName) == 0)
break;
@@ -122,7 +122,7 @@ public:
return false;
std::vector<SSysConfEntry>::iterator index = m_Entries.begin();
- for (; index < m_Entries.end() - 1; index++)
+ for (; index < m_Entries.end() - 1; ++index)
{
if (strcmp(index->name, sectionName) == 0)
break;
@@ -143,7 +143,7 @@ public:
return false;
std::vector<SSysConfEntry>::iterator index = m_Entries.begin();
- for (; index < m_Entries.end() - 1; index++)
+ for (; index < m_Entries.end() - 1; ++index)
{
if (strcmp(index->name, sectionName) == 0)
break;
diff --git a/Source/Core/Core/DSP/disassemble.cpp b/Source/Core/Core/DSP/disassemble.cpp
index 99bd281..33fc28e 100644
--- a/Source/Core/Core/DSP/disassemble.cpp
+++ b/Source/Core/Core/DSP/disassemble.cpp
@@ -55,18 +55,17 @@ DSPDisassembler::~DSPDisassembler()
return;
int count = 0;
- for (std::map<u16, int>::const_iterator iter = unk_opcodes.begin();
- iter != unk_opcodes.end(); ++iter)
+ for (const auto& entry : unk_opcodes)
{
- if (iter->second > 0)
+ if (entry.second > 0)
{
count++;
- fprintf(uo.GetHandle(), "OP%04x\t%d", iter->first, iter->second);
+ fprintf(uo.GetHandle(), "OP%04x\t%d", entry.first, entry.second);
for (int j = 15; j >= 0; j--) // print op bits
{
if ((j & 0x3) == 3)
fprintf(uo.GetHandle(), "\tb");
- fprintf(uo.GetHandle(), "%d", (iter->first >> j) & 0x1);
+ fprintf(uo.GetHandle(), "%d", (entry.first >> j) & 0x1);
}
fprintf(uo.GetHandle(), "\n");
}
diff --git a/Source/Core/Core/HW/DSPHLE/MailHandler.h b/Source/Core/Core/HW/DSPHLE/MailHandler.h
index b54c163..94a98f8 100644
--- a/Source/Core/Core/HW/DSPHLE/MailHandler.h
+++ b/Source/Core/Core/HW/DSPHLE/MailHandler.h
@@ -26,7 +26,7 @@ public:
u32 GetNextMail()
{
- if (m_Mails.size())
+ if (!m_Mails.empty())
{
return m_Mails.front();
}
diff --git a/Source/Core/Core/HW/EXI_DeviceGecko.cpp b/Source/Core/Core/HW/EXI_DeviceGecko.cpp
index 0bb84c4..b8ac071 100644
--- a/Source/Core/Core/HW/EXI_DeviceGecko.cpp
+++ b/Source/Core/Core/HW/EXI_DeviceGecko.cpp
@@ -77,7 +77,7 @@ bool GeckoSockServer::GetAvailableSock(sf::SocketTCP &sock_to_fill)
std::lock_guard<std::mutex> lk(connection_lock);
- if (waiting_socks.size())
+ if (!waiting_socks.empty())
{
sock_to_fill = waiting_socks.front();
if (clientThread.joinable())
diff --git a/Source/Core/Core/HW/SI_DeviceGBA.cpp b/Source/Core/Core/HW/SI_DeviceGBA.cpp
index 6a59ecd..754c17d 100644
--- a/Source/Core/Core/HW/SI_DeviceGBA.cpp
+++ b/Source/Core/Core/HW/SI_DeviceGBA.cpp
@@ -56,7 +56,7 @@ bool GetAvailableSock(sf::SocketTCP& sock_to_fill)
std::lock_guard<std::mutex> lk(cs_gba);
- if (waiting_socks.size())
+ if (!waiting_socks.empty())
{
sock_to_fill = waiting_socks.front();
waiting_socks.pop();
diff --git a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp
index ebb3ff6..f30d812 100644
--- a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp
@@ -1257,7 +1257,7 @@ void Wiimote::DoState(PointerWrap& p)
if (p.mode == PointerWrap::MODE_READ)
{
//clear
- while (m_read_requests.size())
+ while (!m_read_requests.empty())
m_read_requests.pop();
p.Do(size);
diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp
index b259334..edebc2f 100644
--- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp
@@ -252,7 +252,7 @@ void Wiimote::Reset()
memset(m_shake_step, 0, sizeof(m_shake_step));
// clear read request queue
- while (m_read_requests.size())
+ while (!m_read_requests.empty())
{
delete[] m_read_requests.front().data;
m_read_requests.pop();
@@ -351,7 +351,7 @@ bool Wiimote::Step()
}
// check if there is a read data request
- if (m_read_requests.size())
+ if (!m_read_requests.empty())
{
ReadRequest& rr = m_read_requests.front();
// send up to 16 bytes to the wii
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp
index 3bd37ba..ba6cf79 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE.cpp
@@ -606,9 +606,9 @@ void Update()
void UpdateDevices()
{
// Check if a hardware device must be updated
- for (TDeviceMap::const_iterator itr = g_DeviceMap.begin(); itr != g_DeviceMap.end(); ++itr)
+ for (const auto& entry : g_DeviceMap)
{
- if (itr->second->IsOpened() && itr->second->Update())
+ if (entry.second->IsOpened() && entry.second->Update())
{
break;
}
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp
index 4de7af8..9f8ae8e 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_fs.cpp
@@ -146,10 +146,10 @@ bool CWII_IPC_HLE_Device_fs::IOCtlV(u32 _CommandAddress)
// Decode entities of invalid file system characters so that
// games (such as HP:HBP) will be able to find what they expect.
- for (Common::replace_v::const_iterator it = replacements.begin(); it != replacements.end(); ++it)
+ for (const auto& r : replacements)
{
- for (size_t j = 0; (j = FileName.find(it->second, j)) != FileName.npos; ++j)
- FileName.replace(j, it->second.length(), 1, it->first);
+ for (size_t j = 0; (j = FileName.find(r.second, j)) != FileName.npos; ++j)
+ FileName.replace(j, r.second.length(), 1, r.first);
}
strcpy(pFilename, FileName.c_str());
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp
index c1b82e4..636c883 100644
--- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_hid.cpp
@@ -94,9 +94,9 @@ CWII_IPC_HLE_Device_hid::~CWII_IPC_HLE_Device_hid()
deinit_libusb = true;
}
- for ( std::map<u32,libusb_device_handle*>::const_iterator iter = open_devices.begin(); iter != open_devices.end(); ++iter )
+ for (const auto& device : open_devices)
{
- libusb_close(iter->second);
+ libusb_close(device.second);
}
open_devices.clear();
diff --git a/Source/Core/Core/IPC_HLE/WII_Socket.cpp b/Source/Core/Core/IPC_HLE/WII_Socket.cpp
index 32e6cbe..3565577 100644
--- a/Source/Core/Core/IPC_HLE/WII_Socket.cpp
+++ b/Source/Core/Core/IPC_HLE/WII_Socket.cpp
@@ -582,9 +582,9 @@ void WiiSockMan::Update()
FD_ZERO(&read_fds);
FD_ZERO(&write_fds);
FD_ZERO(&except_fds);
- for (auto it = WiiSockets.begin(); it != WiiSockets.end(); ++it)
+ for (auto& entry : WiiSockets)
{
- WiiSocket& sock = it->second;
+ WiiSocket& sock = entry.second;
if (sock.valid())
{
FD_SET(sock.fd, &read_fds);
diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp
index 3209f6a..9a841d5 100644
--- a/Source/Core/Core/NetPlayServer.cpp
+++ b/Source/Core/Core/NetPlayServer.cpp
@@ -196,14 +196,11 @@ unsigned int NetPlayServer::OnConnect(sf::SocketTCP& socket)
socket.Send(spac);
// sync values with new client
- std::map<sf::SocketTCP, Client>::const_iterator
- i,
- e = m_players.end();
- for (i = m_players.begin(); i!=e; ++i)
+ for (const auto& p : m_players)
{
spac.Clear();
spac << (MessageId)NP_MSG_PLAYER_JOIN;
- spac << i->second.pid << i->second.name << i->second.revision;
+ spac << p.second.pid << p.second.name << p.second.revision;
socket.Send(spac);
}
@@ -650,10 +647,8 @@ bool NetPlayServer::initUPnP()
dev = dev->pNext;
}
- std::vector<UPNPDev *>::iterator i;
- for (i = igds.begin(); i != igds.end(); i++)
+ for (auto& dev : igds)
{
- dev = *i;
descXML = (char *) miniwget(dev->descURL, &descXMLsize, 0);
if (descXML)
{
diff --git a/Source/Core/Core/PatchEngine.cpp b/Source/Core/Core/PatchEngine.cpp
index f4386ad..5ac4ac8 100644
--- a/Source/Core/Core/PatchEngine.cpp
+++ b/Source/Core/Core/PatchEngine.cpp
@@ -124,10 +124,9 @@ static void LoadDiscList(const char *section, std::vector<std::string> &_discLis
if (!ini.GetLines(section, lines))
return;
- for (std::vector<std::string>::const_iterator iter = lines.begin(); iter != lines.end(); ++iter)
+ for (const auto& line : lines)
{
- std::string line = *iter;
- if (line.size())
+ if (!line.empty())
_discList.push_back(line);
}
}
@@ -136,9 +135,8 @@ static void LoadSpeedhacks(const char *section, std::map<u32, int> &hacks, IniFi
{
std::vector<std::string> keys;
ini.GetKeys(section, keys);
- for (std::vector<std::string>::const_iterator iter = keys.begin(); iter != keys.end(); ++iter)
+ for (const auto& key : keys)
{
- std::string key = *iter;
std::string value;
ini.Get(section, key.c_str(), &value, "BOGUS");
if (value != "BOGUS")
@@ -188,11 +186,11 @@ void ApplyPatches(const std::vector<Patch> &patches)
{
if (patch.active)
{
- for (std::vector<PatchEntry>::const_iterator iter2 = patch.entries.begin(); iter2 != patch.entries.end(); ++iter2)
+ for (const auto& entry : patch.entries)
{
- u32 addr = iter2->address;
- u32 value = iter2->value;
- switch (iter2->type)
+ u32 addr = entry.address;
+ u32 value = entry.value;
+ switch (entry.type)
{
case PATCH_8BIT:
Memory::Write_U8((u8)value, addr);
diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp
index d7c78d9..a7efa3d 100644
--- a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp
+++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp
@@ -374,7 +374,7 @@ using namespace Gen;
JitBlock &b = blocks[it2->second];
*GetICachePtr(b.originalAddress) = JIT_ICACHE_INVALID_WORD;
DestroyBlock(it2->second, true);
- it2++;
+ ++it2;
}
if (it1 != it2)
{
diff --git a/Source/Core/Core/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/PowerPC/PPCAnalyst.cpp
index 462d950..86b34c6 100644
--- a/Source/Core/Core/PowerPC/PPCAnalyst.cpp
+++ b/Source/Core/Core/PowerPC/PPCAnalyst.cpp
@@ -196,7 +196,7 @@ void AnalyzeFunction2(Symbol *func)
u32 flags = func->flags;
bool nonleafcall = false;
- for (auto c : func->calls)
+ for (const auto& c : func->calls)
{
Symbol *called_func = g_symbolDB.GetSymbolFromAddr(c.function);
if (called_func && (called_func->flags & FFLAG_LEAF) == 0)
@@ -603,10 +603,10 @@ void FindFunctionsAfterBLR(PPCSymbolDB *func_db)
{
vector<u32> funcAddrs;
- for (PPCSymbolDB::XFuncMap::iterator iter = func_db->GetIterator(); iter != func_db->End(); ++iter)
- funcAddrs.push_back(iter->second.address + iter->second.size);
+ for (const auto& func : func_db->Symbols())
+ funcAddrs.push_back(func.second.address + func.second.size);
- for (auto location : funcAddrs)
+ for (auto& location : funcAddrs)
{
while (true)
{
@@ -637,15 +637,15 @@ void FindFunctions(u32 startAddr, u32 endAddr, PPCSymbolDB *func_db)
int numLeafs = 0, numNice = 0, numUnNice = 0;
int numTimer = 0, numRFI = 0, numStraightLeaf = 0;
int leafSize = 0, niceSize = 0, unniceSize = 0;
- for (PPCSymbolDB::XFuncMap::iterator iter = func_db->GetIterator(); iter != func_db->End(); ++iter)
+ for (auto& func : func_db->AccessSymbols())
{
- if (iter->second.address == 4)
+ if (func.second.address == 4)
{
WARN_LOG(OSHLE, "Weird function");
continue;
}
- AnalyzeFunction2(&(iter->second));
- Symbol &f = iter->second;
+ AnalyzeFunction2(&(func.second));
+ Symbol &f = func.second;
if (f.name.substr(0, 3) == "zzz")
{
if (f.flags & FFLAG_LEAF)
diff --git a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp
index 3762138..8bfea6e 100644
--- a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp
+++ b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp
@@ -119,12 +119,12 @@ void PPCSymbolDB::FillInCallers()
p.second.callers.clear();
}
- for (XFuncMap::iterator iter = functions.begin(); iter != functions.end(); ++iter)
+ for (auto& entry : functions)
{
- Symbol &f = iter->second;
+ Symbol &f = entry.second;
for (auto& call : f.calls)
{
- SCall NewCall(iter->first, call.callAddress);
+ SCall NewCall(entry.first, call.callAddress);
u32 FunctionAddress = call.function;
XFuncMap::iterator FuncIterator = functions.find(FunctionAddress);
@@ -149,12 +149,12 @@ void PPCSymbolDB::PrintCalls(u32 funcAddr) const
{
const Symbol &f = iter->second;
INFO_LOG(OSHLE, "The function %s at %08x calls:", f.name.c_str(), f.address);
- for (std::vector<SCall>::const_iterator fiter = f.calls.begin(); fiter!=f.calls.end(); ++fiter)
+ for (const auto& call : f.calls)
{
- XFuncMap::const_iterator n = functions.find(fiter->function);
+ XFuncMap::const_iterator n = functions.find(call.function);
if (n != functions.end())
{
- INFO_LOG(CONSOLE,"* %08x : %s", fiter->callAddress, n->second.name.c_str());
+ INFO_LOG(CONSOLE,"* %08x : %s", call.callAddress, n->second.name.c_str());
}
}
}
@@ -171,12 +171,12 @@ void PPCSymbolDB::PrintCallers(u32 funcAddr) const
{
const Symbol &f = iter->second;
INFO_LOG(CONSOLE,"The function %s at %08x is called by:",f.name.c_str(),f.address);
- for (std::vector<SCall>::const_iterator fiter = f.callers.begin(); fiter != f.callers.end(); ++fiter)
+ for (const auto& caller : f.callers)
{
- XFuncMap::const_iterator n = functions.find(fiter->function);
+ XFuncMap::const_iterator n = functions.find(caller.function);
if (n != functions.end())
{
- INFO_LOG(CONSOLE,"* %08x : %s", fiter->callAddress, n->second.name.c_str());
+ INFO_LOG(CONSOLE,"* %08x : %s", caller.callAddress, n->second.name.c_str());
}
}
}
diff --git a/Source/Core/Core/PowerPC/SignatureDB.cpp b/Source/Core/Core/PowerPC/SignatureDB.cpp
index 4e91499..82474fc 100644
--- a/Source/Core/Core/PowerPC/SignatureDB.cpp
+++ b/Source/Core/Core/PowerPC/SignatureDB.cpp
@@ -56,13 +56,13 @@ bool SignatureDB::Save(const char *filename)
}
u32 fcount = (u32)database.size();
f.WriteArray(&fcount, 1);
- for (FuncDB::const_iterator iter = database.begin(); iter != database.end(); ++iter)
+ for (const auto& entry : database)
{
FuncDesc temp;
memset(&temp, 0, sizeof(temp));
- temp.checkSum = iter->first;
- temp.size = iter->second.size;
- strncpy(temp.name, iter->second.name.c_str(), 127);
+ temp.checkSum = entry.first;
+ temp.size = entry.second.size;
+ strncpy(temp.name, entry.second.name.c_str(), 127);
f.WriteArray(&temp, 1);
}
@@ -87,9 +87,9 @@ u32 SignatureDB::Add(u32 startAddr, u32 size, const char *name)
void SignatureDB::List()
{
- for (FuncDB::iterator iter = database.begin(); iter != database.end(); ++iter)
+ for (const auto& entry : database)
{
- INFO_LOG(OSHLE, "%s : %i bytes, hash = %08x", iter->second.name.c_str(), iter->second.size, iter->first);
+ INFO_LOG(OSHLE, "%s : %i bytes, hash = %08x", entry.second.name.c_str(), entry.second.size, entry.first);
}
INFO_LOG(OSHLE, "%lu functions known in current database.",
(unsigned long)database.size());
@@ -102,22 +102,23 @@ void SignatureDB::Clear()
void SignatureDB::Apply(PPCSymbolDB *symbol_db)
{
- for (FuncDB::const_iterator iter = database.begin(); iter != database.end(); ++iter)
+ for (const auto& entry : database)
{
- u32 hash = iter->first;
+ u32 hash = entry.first;
Symbol *function = symbol_db->GetSymbolFromHash(hash);
if (function)
{
// Found the function. Let's rename it according to the symbol file.
- if (iter->second.size == (unsigned int)function->size)
+ if (entry.second.size == (unsigned int)function->size)
{
- function->name = iter->second.name;
- INFO_LOG(OSHLE, "Found %s at %08x (size: %08x)!", iter->second.name.c_str(), function->address, function->size);
+ function->name = entry.second.name;
+ INFO_LOG(OSHLE, "Found %s at %08x (size: %08x)!", entry.second.name.c_str(), function->address, function->size);
}
else
{
- function->name = iter->second.name;
- ERROR_LOG(OSHLE, "Wrong size! Found %s at %08x (size: %08x instead of %08x)!", iter->second.name.c_str(), function->address, function->size, iter->second.size);
+ function->name = entry.second.name;
+ ERROR_LOG(OSHLE, "Wrong size! Found %s at %08x (size: %08x instead of %08x)!",
+ entry.second.name.c_str(), function->address, function->size, entry.second.size);
}
}
}
@@ -127,14 +128,14 @@ void SignatureDB::Apply(PPCSymbolDB *symbol_db)
void SignatureDB::Initialize(PPCSymbolDB *symbol_db, const char *prefix)
{
std::string prefix_str(prefix);
- for (PPCSymbolDB::XFuncMap::const_iterator iter = symbol_db->GetConstIterator(); iter != symbol_db->End(); ++iter)
+ for (const auto& symbol : symbol_db->Symbols())
{
- if ((iter->second.name.substr(0, prefix_str.size()) == prefix_str) || prefix_str.empty())
+ if ((symbol.second.name.substr(0, prefix_str.size()) == prefix_str) || prefix_str.empty())
{
DBFunc temp_dbfunc;
- temp_dbfunc.name = iter->second.name;
- temp_dbfunc.size = iter->second.size;
- database[iter->second.hash] = temp_dbfunc;
+ temp_dbfunc.name = symbol.second.name;
+ temp_dbfunc.size = symbol.second.size;
+ database[symbol.second.hash] = temp_dbfunc;
}
}
}
diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp
index c801ea3..ac3050f 100644
--- a/Source/Core/DiscIO/CompressedBlob.cpp
+++ b/Source/Core/DiscIO/CompressedBlob.cpp
@@ -21,9 +21,8 @@
namespace DiscIO
{
-CompressedBlobReader::CompressedBlobReader(const char *filename)
+CompressedBlobReader::CompressedBlobReader(const char *filename) : file_name(filename)
{
- file_name = filename;
m_file.Open(filename, "rb");
file_size = File::GetSize(filename);
m_file.ReadArray(&header, 1);
diff --git a/Source/Core/DiscIO/DiscScrubber.cpp b/Source/Core/DiscIO/DiscScrubber.cpp
index 9283835..445f25b 100644
--- a/Source/Core/DiscIO/DiscScrubber.cpp
+++ b/Source/Core/DiscIO/DiscScrubber.cpp
@@ -267,7 +267,7 @@ bool ParsePartitionData(SPartition& _rPartition)
IVolume *OldVolume = m_Disc;
// Ready some stuff
- m_Disc = CreateVolumeFromFilename(m_Filename.c_str(), _rPartition.GroupNumber, _rPartition.Number);
+ m_Disc = CreateVolumeFromFilename(m_Filename, _rPartition.GroupNumber, _rPartition.Number);
IFileSystem *FileSystem = CreateFileSystem(m_Disc);
if (!FileSystem)
diff --git a/Source/Core/DiscIO/VolumeDirectory.cpp b/Source/Core/DiscIO/VolumeDirectory.cpp
index f9f8f00..a501a9c 100644
--- a/Source/Core/DiscIO/VolumeDirectory.cpp
+++ b/Source/Core/DiscIO/VolumeDirectory.cpp
@@ -106,7 +106,7 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer) const
WriteToBuffer(FST_ADDRESS, m_fstSize, m_FSTData, _Offset, _Length, _pBuffer);
}
- if(m_virtualDisk.size() == 0)
+ if(m_virtualDisk.empty())
return true;
// Determine which file the offset refers to
diff --git a/Source/Core/DolphinWX/Android/ButtonManager.cpp b/Source/Core/DolphinWX/Android/ButtonManager.cpp
index f451d64..04e0905 100644
--- a/Source/Core/DolphinWX/Android/ButtonManager.cpp
+++ b/Source/Core/DolphinWX/Android/ButtonManager.cpp
@@ -127,7 +127,7 @@ namespace ButtonManager
bool pressed = false;
pressed = m_buttons[std::make_pair(padID, button)]->Pressed();
- for (auto it = m_controllers.begin(); it != m_controllers.end(); ++it)
+ for (const auto& controller : m_controllers)
pressed |= it->second->ButtonValue(padID, button);
return pressed;
@@ -172,10 +172,10 @@ namespace ButtonManager
}
void Shutdown()
{
- for(auto it = m_buttons.begin(); it != m_buttons.end(); ++it)
- delete it->second;
- for (auto it = m_controllers.begin(); it != m_controllers.end(); ++it)
- delete it->second;
+ for (const auto& button : m_buttons)
+ delete button.second;
+ for (const auto& controller : m_controllers)
+ delete controller.second;
m_controllers.clear();
m_buttons.clear();
}
diff --git a/Source/Core/DolphinWX/Android/ButtonManager.h b/Source/Core/DolphinWX/Android/ButtonManager.h
index ff3b7f6..07b3bff 100644
--- a/Source/Core/DolphinWX/Android/ButtonManager.h
+++ b/Source/Core/DolphinWX/Android/ButtonManager.h
@@ -108,8 +108,8 @@ namespace ButtonManager
: _dev(dev) {}
~InputDevice()
{
- for (auto it = _binds.begin(); it != _binds.end(); ++it)
- delete it->second;
+ for (const auto& bind : _binds)
+ delete bind.second;
}
void AddBind(sBind *bind) { _binds[bind->_buttontype] = bind; _inputbinds[bind->_bind] = bind; }
void PressEvent(int button, int action);
diff --git a/Source/Core/DolphinWX/ConfigMain.cpp b/Source/Core/DolphinWX/ConfigMain.cpp
index 90525d8..7f2365e 100644
--- a/Source/Core/DolphinWX/ConfigMain.cpp
+++ b/Source/Core/DolphinWX/ConfigMain.cpp
@@ -184,7 +184,7 @@ CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title,
CreateGUIControls();
// Update selected ISO paths
- for(auto& folder : SConfig::GetInstance().m_ISOFolder)
+ for(const auto& folder : SConfig::GetInstance().m_ISOFolder)
{
ISOPaths->Append(StrToWxStr(folder));
}
@@ -250,7 +250,7 @@ void CConfigMain::InitializeGUILists()
arrayStringFor_Framelimit.Add(wxString::Format(wxT("%i"), i));
// Emulator Engine
- for (auto& CPUCores_a : CPUCores)
+ for (const auto& CPUCores_a : CPUCores)
arrayStringFor_CPUEngine.Add(wxGetTranslation(CPUCores_a.name));
// DSP Engine
@@ -979,12 +979,9 @@ void CConfigMain::AudioSettingsChanged(wxCommandEvent& event)
void CConfigMain::AddAudioBackends()
{
- std::vector<std::string> backends = AudioCommon::GetSoundBackends();
- // I'm sure Billiard will change this into an auto sometimes soon :P
- for (std::vector<std::string>::const_iterator iter = backends.begin();
- iter != backends.end(); ++iter)
+ for (const auto& backend : AudioCommon::GetSoundBackends())
{
- BackendSelection->Append(wxGetTranslation(StrToWxStr(*iter)));
+ BackendSelection->Append(wxGetTranslation(StrToWxStr(backend)));
int num = BackendSelection->
FindString(StrToWxStr(SConfig::GetInstance().sBackend));
BackendSelection->SetSelection(num);
diff --git a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
index 3582866..93ede5c 100644
--- a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
+++ b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
@@ -354,10 +354,10 @@ void CCodeWindow::NotifyMapLoaded()
//symbols->Show(false); // hide it for faster filling
symbols->Freeze(); // HyperIris: wx style fast filling
symbols->Clear();
- for (PPCSymbolDB::XFuncMap::iterator iter = g_symbolDB.GetIterator(); iter != g_symbolDB.End(); ++iter)
+ for (const auto& symbol : g_symbolDB.Symbols())
{
- int idx = symbols->Append(StrToWxStr(iter->second.name));
- symbols->SetClientData(idx, (void*)&iter->second);
+ int idx = symbols->Append(StrToWxStr(symbol.second.name));
+ symbols->SetClientData(idx, (void*)&symbol.second);
}
symbols->Thaw();
//symbols->Show(true);
diff --git a/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp b/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp
index 3be7432..48435c7 100644
--- a/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp
+++ b/Source/Core/DolphinWX/Debugger/DSPDebugWindow.cpp
@@ -205,11 +205,10 @@ void DSPDebuggerLLE::UpdateSymbolMap()
m_SymbolList->Freeze(); // HyperIris: wx style fast filling
m_SymbolList->Clear();
- for (SymbolDB::XFuncMap::iterator iter = DSPSymbols::g_dsp_symbol_db.GetIterator();
- iter != DSPSymbols::g_dsp_symbol_db.End(); ++iter)
+ for (const auto& symbol : DSPSymbols::g_dsp_symbol_db.Symbols())
{
- int idx = m_SymbolList->Append(StrToWxStr(iter->second.name));
- m_SymbolList->SetClientData(idx, (void*)&iter->second);
+ int idx = m_SymbolList->Append(StrToWxStr(symbol.second.name));
+ m_SymbolList->SetClientData(idx, (void*)&symbol.second);
}
m_SymbolList->Thaw();
}
diff --git a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp
index bff2462..e49512a 100644
--- a/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp
+++ b/Source/Core/DolphinWX/Debugger/MemoryWindow.cpp
@@ -337,7 +337,7 @@ void CMemoryWindow::onSearch(wxCommandEvent& event)
tmpstr = new char[newsize + 1];
memset(tmpstr, 0, newsize + 1);
}
- sprintf(tmpstr, "%s%s", tmpstr, WxStrToStr(rawData).c_str());
+ strcat(tmpstr, WxStrToStr(rawData).c_str());
tmp2 = &Dest.front();
count = 0;
for(i = 0; i < strlen(tmpstr); i++)
diff --git a/Source/Core/DolphinWX/FifoPlayerDlg.cpp b/Source/Core/DolphinWX/FifoPlayerDlg.cpp
index 0a957c7..5e3c7b0 100644
--- a/Source/Core/DolphinWX/FifoPlayerDlg.cpp
+++ b/Source/Core/DolphinWX/FifoPlayerDlg.cpp
@@ -515,7 +515,7 @@ void FifoPlayerDlg::OnFindNextClick(wxCommandEvent& event)
return;
}
- for (std::vector<SearchResult>::iterator it = search_results.begin(); it != search_results.end(); ++it)
+ for (auto it = search_results.begin(); it != search_results.end(); ++it)
{
if (it->cmd_idx > cur_cmd_index)
{
@@ -534,7 +534,7 @@ void FifoPlayerDlg::OnFindPreviousClick(wxCommandEvent& event)
return;
}
- for (std::vector<SearchResult>::reverse_iterator it = search_results.rbegin(); it != search_results.rend(); ++it)
+ for (auto it = search_results.rbegin(); it != search_results.rend(); ++it)
{
if (it->cmd_idx < cur_cmd_index)
{
diff --git a/Source/Core/DolphinWX/ISOProperties.cpp b/Source/Core/DolphinWX/ISOProperties.cpp
index d2bf7ca..12ca892 100644
--- a/Source/Core/DolphinWX/ISOProperties.cpp
+++ b/Source/Core/DolphinWX/ISOProperties.cpp
@@ -1242,9 +1242,9 @@ void CISOProperties::PatchList_Save()
if (DefaultPatches.find(p.name) == DefaultPatches.end())
{
lines.push_back("$" + p.name);
- for (auto iter2 = p.entries.begin(); iter2 != p.entries.end(); ++iter2)
+ for (const auto& entry : p.entries)
{
- std::string temp = StringFromFormat("0x%08X:%s:0x%08X", iter2->address, PatchEngine::PatchTypeStrings[iter2->type], iter2->value);
+ std::string temp = StringFromFormat("0x%08X:%s:0x%08X", entry.address, PatchEngine::PatchTypeStrings[entry.type], entry.value);
lines.push_back(temp);
}
}
@@ -1308,9 +1308,8 @@ void CISOProperties::ActionReplayList_Load()
ActionReplay::LoadCodes(arCodes, GameIniDefault, GameIniLocal);
u32 index = 0;
- for (std::vector<ActionReplay::ARCode>::const_iterator it = arCodes.begin(); it != arCodes.end(); ++it)
+ for (const auto& arCode : arCodes)
{
- ActionReplay::ARCode arCode = *it;
Cheats->Append(StrToWxStr(arCode.name));
Cheats->Check(index, arCode.active);
if (!arCode.user_defined)
@@ -1324,7 +1323,7 @@ void CISOProperties::ActionReplayList_Save()
std::vector<std::string> lines;
std::vector<std::string> enabledLines;
u32 index = 0;
- for (auto code : arCodes)
+ for (const auto& code : arCodes)
{
if (Cheats->IsChecked(index))
enabledLines.push_back("$" + code.name);
@@ -1333,7 +1332,7 @@ void CISOProperties::ActionReplayList_Save()
if (DefaultCheats.find(code.name) == DefaultCheats.end())
{
lines.push_back("$" + code.name);
- for (auto& op : code.ops)
+ for (const auto& op : code.ops)
{
lines.push_back(WxStrToStr(wxString::Format(wxT("%08X %08X"), op.cmd_addr, op.value)));
}
diff --git a/Source/Core/DolphinWX/LogWindow.cpp b/Source/Core/DolphinWX/LogWindow.cpp
index 6579a88..5d6b526 100644
--- a/Source/Core/DolphinWX/LogWindow.cpp
+++ b/Source/Core/DolphinWX/LogWindow.cpp
@@ -277,7 +277,7 @@ void CLogWindow::OnLogTimer(wxTimerEvent& WXUNUSED(event))
UpdateLog();
// Scroll to the last line
- if (msgQueue.size() > 0)
+ if (!msgQueue.empty())
{
m_Log->ScrollLines(1);
m_Log->ShowPosition( m_Log->GetLastPosition() );
diff --git a/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.cpp b/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.cpp
index 2ccc236..431efa7 100644
--- a/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.cpp
+++ b/Source/Core/DolphinWX/MemoryCards/WiiSaveCrypted.cpp
@@ -47,7 +47,7 @@ void CWiiSaveCrypted::ExportAllSaves()
std::string folder = StringFromFormat("%s/%08x/", titleFolder.c_str(), pathMask | i);
File::ScanDirectoryTree(folder, FST_Temp);
- for (auto& entry : FST_Temp.children)
+ for (const auto& entry : FST_Temp.children)
{
if (entry.isDirectory)
{
@@ -65,7 +65,7 @@ void CWiiSaveCrypted::ExportAllSaves()
}
}
SuccessAlertT("Found %x save files", (unsigned int) titles.size());
- for (auto& title : titles)
+ for (const auto& title : titles)
{
CWiiSaveCrypted* exportSave = new CWiiSaveCrypted("", title);
delete exportSave;
@@ -377,21 +377,21 @@ void CWiiSaveCrypted::ExportWiiSaveFiles()
__name = FilesList[i].substr(WiiTitlePath.length()+1);
- for (Common::replace_v::const_iterator iter = replacements.begin(); iter != replacements.end(); ++iter)
+ for (const auto& repl : replacements)
{
- for (size_t j = 0; (j = __name.find(iter->second, j)) != __name.npos; ++j)
+ for (size_t j = 0; (j = __name.find(repl.second, j)) != __name.npos; ++j)
{
- __name.replace(j, iter->second.length(), 1, iter->first);
+ __name.replace(j, repl.second.length(), 1, repl.first);
}
}
if (__name.length() > 0x44)
{
- PanicAlertT("%s is too long for the filename, max chars is 45", __name.c_str());
+ PanicAlertT("\"%s\" is too long for the filename, max length is 0x44 + \\0", __name.c_str());
b_valid = false;
return;
}
- strncpy((char *)tmpFileHDR.name, __name.c_str(), __name.length());
+ strncpy((char *)tmpFileHDR.name, __name.c_str(), sizeof(tmpFileHDR.name));
{
File::IOFile fpData_bin(encryptedSavePath, "ab");
@@ -583,7 +583,7 @@ void CWiiSaveCrypted::ScanForFiles(std::string savDir, std::vector<std::string>&
File::FSTEntry FST_Temp;
File::ScanDirectoryTree(Directories[i], FST_Temp);
- for (auto& elem : FST_Temp.children)
+ for (const auto& elem : FST_Temp.children)
{
if (strncmp(elem.virtualName.c_str(), "banner.bin", 10) != 0)
{
diff --git a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp
index 7f7954d..802d1b8 100644
--- a/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/ExpressionParser.cpp
@@ -102,7 +102,7 @@ public:
while (it != expr.end())
{
char c = *it;
- it++;
+ ++it;
if (c == '`')
return false;
if (c > 0 && c == otherDelim)
@@ -140,7 +140,7 @@ public:
if (!isalpha(c))
break;
name += c;
- it++;
+ ++it;
}
ControlQualifier qualifier;
diff --git a/Source/Core/VideoBackends/D3D/D3DUtil.cpp b/Source/Core/VideoBackends/D3D/D3DUtil.cpp
index c64230f..b7f0370 100644
--- a/Source/Core/VideoBackends/D3D/D3DUtil.cpp
+++ b/Source/Core/VideoBackends/D3D/D3DUtil.cpp
@@ -41,8 +41,8 @@ public:
offset = 0;
context->Map(buf, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
- for(std::list<bool*>::iterator it = observers.begin(); it != observers.end(); ++it)
- **it = true;
+ for(auto& observer : observers)
+ *observer = true;
}
else
{
diff --git a/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp b/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp
index 944dca3..1974a71 100644
--- a/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp
+++ b/Source/Core/VideoBackends/D3D/LineGeometryShader.cpp
@@ -149,9 +149,9 @@ void LineGeometryShader::Shutdown()
{
m_ready = false;
- for (ComboMap::iterator it = m_shaders.begin(); it != m_shaders.end(); ++it)
+ for (auto& it : m_shaders)
{
- SAFE_RELEASE(it->second);
+ SAFE_RELEASE(it.second);
}
m_shaders.clear();
diff --git a/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp b/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp
index badeb0f..0a8243e 100644
--- a/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp
+++ b/Source/Core/VideoBackends/D3D/PSTextureEncoder.cpp
@@ -1012,10 +1012,9 @@ void PSTextureEncoder::Shutdown()
SAFE_RELEASE(m_classLinkage);
SAFE_RELEASE(m_dynamicShader);
- for (ComboMap::iterator it = m_staticShaders.begin();
- it != m_staticShaders.end(); ++it)
+ for (auto& it : m_staticShaders)
{
- SAFE_RELEASE(it->second);
+ SAFE_RELEASE(it.second);
}
m_staticShaders.clear();
diff --git a/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp b/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
index d8716c8..bb87720 100644
--- a/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
+++ b/Source/Core/VideoBackends/D3D/PixelShaderCache.cpp
@@ -410,8 +410,8 @@ void PixelShaderCache::Init()
// ONLY to be used during shutdown.
void PixelShaderCache::Clear()
{
- for (PSCache::iterator iter = PixelShaders.begin(); iter != PixelShaders.end(); iter++)
- iter->second.Destroy();
+ for (auto& iter : PixelShaders)
+ iter.second.Destroy();
PixelShaders.clear();
pixel_uid_checker.Invalidate();
diff --git a/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp b/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp
index 34d87ef..d8dc173 100644
--- a/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp
+++ b/Source/Core/VideoBackends/D3D/PointGeometryShader.cpp
@@ -143,9 +143,9 @@ void PointGeometryShader::Shutdown()
{
m_ready = false;
- for (ComboMap::iterator it = m_shaders.begin(); it != m_shaders.end(); ++it)
+ for (auto& it : m_shaders)
{
- SAFE_RELEASE(it->second);
+ SAFE_RELEASE(it.second);
}
m_shaders.clear();
diff --git a/Source/Core/VideoBackends/D3D/VertexShaderCache.cpp b/Source/Core/VideoBackends/D3D/VertexShaderCache.cpp
index e17f273..b3a399e 100644
--- a/Source/Core/VideoBackends/D3D/VertexShaderCache.cpp
+++ b/Source/Core/VideoBackends/D3D/VertexShaderCache.cpp
@@ -157,8 +157,8 @@ void VertexShaderCache::Init()
void VertexShaderCache::Clear()
{
- for (VSCache::iterator iter = vshaders.begin(); iter != vshaders.end(); ++iter)
- iter->second.Destroy();
+ for (auto& iter : vshaders)
+ iter.second.Destroy();
vshaders.clear();
vertex_uid_checker.Invalidate();
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp
index 8921fdd..e7b2723 100644
--- a/Source/Core/VideoBackends/OGL/Render.cpp
+++ b/Source/Core/VideoBackends/OGL/Render.cpp
@@ -710,15 +710,14 @@ void Renderer::DrawDebugInfo()
int a = 0;
GLfloat color[3] = {0.0f, 1.0f, 1.0f};
- for (std::vector<EFBRectangle>::const_iterator it = stats.efb_regions.begin();
- it != stats.efb_regions.end(); ++it)
+ for (const auto& rect : stats.efb_regions)
{
GLfloat halfWidth = EFB_WIDTH / 2.0f;
GLfloat halfHeight = EFB_HEIGHT / 2.0f;
- GLfloat x = (GLfloat) -1.0f + ((GLfloat)it->left / halfWidth);
- GLfloat y = (GLfloat) 1.0f - ((GLfloat)it->top / halfHeight);
- GLfloat x2 = (GLfloat) -1.0f + ((GLfloat)it->right / halfWidth);
- GLfloat y2 = (GLfloat) 1.0f - ((GLfloat)it->bottom / halfHeight);
+ GLfloat x = (GLfloat) -1.0f + ((GLfloat)rect.left / halfWidth);
+ GLfloat y = (GLfloat) 1.0f - ((GLfloat)rect.top / halfHeight);
+ GLfloat x2 = (GLfloat) -1.0f + ((GLfloat)rect.right / halfWidth);
+ GLfloat y2 = (GLfloat) 1.0f - ((GLfloat)rect.bottom / halfHeight);
Vertices[a++] = x;
Vertices[a++] = y;
@@ -1782,7 +1781,7 @@ void Renderer::FlipImageData(u8 *data, int w, int h, int pixel_width)
{
for(int x = 0; x < w; ++x)
{
- for (auto delta = 0; delta < pixel_width; ++delta)
+ for (int delta = 0; delta < pixel_width; ++delta)
std::swap(data[(y * w + x) * pixel_width + delta], data[((h - 1 - y) * w + x) * pixel_width + delta]);
}
}
diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp
index a3224bc..6903f77 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.cpp
+++ b/Source/Core/VideoCommon/TextureCacheBase.cpp
@@ -172,7 +172,7 @@ void TextureCache::MakeRangeDynamic(u32 start_address, u32 size)
tcend = textures.upper_bound(start_address + size);
if (iter != textures.begin())
- iter--;
+ --iter;
for (; iter != tcend; ++iter)
{
diff --git a/Source/Core/VideoCommon/VertexLoaderManager.cpp b/Source/Core/VideoCommon/VertexLoaderManager.cpp
index d1f1acf..69393c8 100644
--- a/Source/Core/VideoCommon/VertexLoaderManager.cpp
+++ b/Source/Core/VideoCommon/VertexLoaderManager.cpp
@@ -75,19 +75,19 @@ void AppendListToString(std::string *dest)
std::vector<entry> entries;
size_t total_size = 0;
- for (VertexLoaderMap::const_iterator iter = g_VertexLoaderMap.begin(); iter != g_VertexLoaderMap.end(); ++iter)
+ for (const auto& map_entry : g_VertexLoaderMap)
{
entry e;
- iter->second->AppendToString(&e.text);
- e.num_verts = iter->second->GetNumLoadedVerts();
+ map_entry.second->AppendToString(&e.text);
+ e.num_verts = map_entry.second->GetNumLoadedVerts();
entries.push_back(e);
total_size += e.text.size() + 1;
}
sort(entries.begin(), entries.end());
dest->reserve(dest->size() + total_size);
- for (std::vector<entry>::const_iterator iter = entries.begin(); iter != entries.end(); ++iter)
+ for (const auto& entry : entries)
{
- dest->append(iter->text);
+ dest->append(entry.text);
}
}
diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp
index b99b674..133a927 100644
--- a/Source/Core/VideoCommon/VideoBackendBase.cpp
+++ b/Source/Core/VideoCommon/VideoBackendBase.cpp
@@ -72,7 +72,7 @@ void VideoBackend::ActivateBackend(const std::string& name)
if (name.length() == 0) // If NULL, set it to the default backend (expected behavior)
g_video_backend = s_default_backend;
- for (std::vector<VideoBackend*>::const_iterator it = g_available_video_backends.begin(); it != g_available_video_backends.end(); ++it)
- if (name == (*it)->GetName())
- g_video_backend = *it;
+ for (const auto& backend : g_available_video_backends)
+ if (name == backend->GetName())
+ g_video_backend = backend;
}