clang-modernize -loop-convert

and some manual adjustments
This commit is contained in:
Tillmann Karras 2014-03-03 06:25:15 +01:00
commit c89f04a7c5
22 changed files with 339 additions and 293 deletions

View file

@ -338,11 +338,11 @@ void wxCheatsWindow::OnEvent_CheatsList_ItemSelected(wxCommandEvent& WXUNUSED (e
m_Label_NumCodes->SetLabel(StrToWxStr(numcodes));
m_ListBox_CodesList->Clear();
for (size_t j = 0; j < code.ops.size(); j++)
for (const AREntry& entry : code.ops)
{
char text2[CHAR_MAX];
char* ops = text2;
sprintf(ops, "%08x %08x", code.ops[j].cmd_addr, code.ops[j].value);
sprintf(ops, "%08x %08x", entry.cmd_addr, entry.value);
m_ListBox_CodesList->Append(StrToWxStr(ops));
}
}
@ -352,11 +352,11 @@ void wxCheatsWindow::OnEvent_CheatsList_ItemSelected(wxCommandEvent& WXUNUSED (e
void wxCheatsWindow::OnEvent_CheatsList_ItemToggled(wxCommandEvent& WXUNUSED (event))
{
int index = m_CheckListBox_CheatsList->GetSelection();
for (size_t i = 0; i < indexList.size(); i++)
for (const ARCodeIndex& code_index : indexList)
{
if ((int)indexList[i].uiIndex == index)
if ((int)code_index.uiIndex == index)
{
ActionReplay::SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(index), indexList[i].index);
ActionReplay::SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(index), code_index.index);
}
}
}
@ -364,9 +364,9 @@ void wxCheatsWindow::OnEvent_CheatsList_ItemToggled(wxCommandEvent& WXUNUSED (ev
void wxCheatsWindow::OnEvent_ApplyChanges_Press(wxCommandEvent& ev)
{
// Apply AR Code changes
for (size_t i = 0; i < indexList.size(); i++)
for (const ARCodeIndex& code_index : indexList)
{
ActionReplay::SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(indexList[i].uiIndex), indexList[i].index);
ActionReplay::SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(code_index.uiIndex), code_index.index);
}
// Apply Gecko Code changes
@ -385,10 +385,9 @@ void wxCheatsWindow::OnEvent_ApplyChanges_Press(wxCommandEvent& ev)
void wxCheatsWindow::OnEvent_ButtonUpdateLog_Press(wxCommandEvent& WXUNUSED (event))
{
m_TextCtrl_Log->Clear();
const std::vector<std::string> &arLog = ActionReplay::GetSelfLog();
for (u32 i = 0; i < arLog.size(); i++)
for (const std::string& text : ActionReplay::GetSelfLog())
{
m_TextCtrl_Log->AppendText(StrToWxStr(arLog[i]));
m_TextCtrl_Log->AppendText(StrToWxStr(text));
}
}
@ -440,10 +439,6 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
return;
}
std::vector<CheatSearchResult>::iterator
i = search_results.begin(),
e = search_results.end();
// Set up the sub-search results efficiently to prevent automatic re-allocations.
std::vector<CheatSearchResult> filtered_results;
filtered_results.reserve(search_results.size());
@ -459,10 +454,10 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
if (value_x_radiobtn.rad_oldvalue->GetValue()) // using old value comparison
{
for (; i!=e; ++i)
for (CheatSearchResult& result : search_results)
{
// with big endian, can just use memcmp for ><= comparison
int cmp_result = memcmp(memptr + i->address, &i->old_value, search_type_size);
int cmp_result = memcmp(memptr + result.address, &result.old_value, search_type_size);
if (cmp_result < 0)
cmp_result = 4;
else
@ -470,8 +465,8 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
if (cmp_result & filter_mask)
{
memcpy(&i->old_value, memptr + i->address, search_type_size);
filtered_results.push_back(*i);
memcpy(&result.old_value, memptr + result.address, search_type_size);
filtered_results.push_back(result);
}
}
}
@ -510,10 +505,10 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
// #endif
}
for (; i!=e; ++i)
for (CheatSearchResult& result : search_results)
{
// with big endian, can just use memcmp for ><= comparison
int cmp_result = memcmp(memptr + i->address, &user_x_val, search_type_size);
int cmp_result = memcmp(memptr + result.address, &user_x_val, search_type_size);
if (cmp_result < 0)
cmp_result = 4;
else if (cmp_result)
@ -523,8 +518,8 @@ void CheatSearchTab::FilterCheatSearchResults(wxCommandEvent&)
if (cmp_result & filter_mask)
{
memcpy(&i->old_value, memptr + i->address, search_type_size);
filtered_results.push_back(*i);
memcpy(&result.old_value, memptr + result.address, search_type_size);
filtered_results.push_back(result);
}
}
}