Turn loops into range-based form

and some things suggested by cppcheck and compiler warnings.
This commit is contained in:
Tillmann Karras
2014-02-12 16:00:34 +01:00
parent 2ff794d299
commit 404624bf0b
52 changed files with 199 additions and 230 deletions

View File

@ -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 TBreakPoint& 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 TBreakPoint& bp : m_BreakPoints)
if (bp.iAddress == _iAddress && bp.bTemporary)
return true;
return false;
@ -29,7 +28,7 @@ bool BreakPoints::IsTempBreakPoint(u32 _iAddress)
BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const
{
TBreakPointsStr bps;
for (const auto& bp : m_BreakPoints)
for (const TBreakPoint& bp : m_BreakPoints)
{
if (!bp.bTemporary)
{
@ -44,7 +43,7 @@ BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const
void BreakPoints::AddFromStrings(const TBreakPointsStr& bpstrs)
{
for (const auto& bpstr : bpstrs)
for (const std::string& bpstr : bpstrs)
{
TBreakPoint bp;
std::stringstream ss;
@ -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 TBreakPoint& bp : m_BreakPoints)
{
jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4);
}
}
m_BreakPoints.clear();
@ -114,7 +111,7 @@ void BreakPoints::Clear()
MemChecks::TMemChecksStr MemChecks::GetStrings() const
{
TMemChecksStr mcs;
for (const auto& bp : m_MemChecks)
for (const TMemCheck& bp : m_MemChecks)
{
std::stringstream mc;
mc << std::hex << bp.StartAddress;
@ -129,7 +126,7 @@ MemChecks::TMemChecksStr MemChecks::GetStrings() const
void MemChecks::AddFromStrings(const TMemChecksStr& mcstrs)
{
for (const auto& mcstr : mcstrs)
for (const std::string& mcstr : mcstrs)
{
TMemCheck mc;
std::stringstream ss;
@ -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)
{
@ -168,7 +165,7 @@ void MemChecks::Remove(u32 _Address)
TMemCheck *MemChecks::GetMemCheck(u32 address)
{
for (auto& bp : m_MemChecks)
for (TMemCheck& bp : m_MemChecks)
{
if (bp.bRange)
{