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

@@ -196,7 +196,7 @@ void AnalyzeFunction2(Symbol *func)
u32 flags = func->flags;
bool nonleafcall = false;
for (auto c : func->calls)
for (const SCall& 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 (u32& 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)