Fixed errors preventing clang from compiling

Also did some changed the whitespace of the affected functions.
This commit is contained in:
Arthur Moore 2015-03-11 00:54:22 -04:00
parent 34bd14628c
commit 477621c489
2 changed files with 88 additions and 69 deletions

View File

@ -19,5 +19,7 @@ fi
mkdir "$BUILD_DIRECTORY" mkdir "$BUILD_DIRECTORY"
cd build cd build
# cmake -DCMAKE_BUILD_TYPE=Debug .. # cmake -DCMAKE_BUILD_TYPE=Debug ..
#scan-build cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang ..
cmake .. cmake ..
make make
#scan-build make

View File

@ -520,65 +520,76 @@ public:
// It might be safest to only support desc edits, and force the // It might be safest to only support desc edits, and force the
// user to re-enter codes to change them // user to re-enter codes to change them
int ncodes = isgb ? gbCheatNumber : cheatsNumber; int ncodes = isgb ? gbCheatNumber : cheatsNumber;
if(ncodes > id + 1) { if(ncodes > id + 1)
wxString codes[ncodes - id - 1]; {
wxString descs[ncodes - id - 1]; std::vector<wxString> codes;
bool checked[ncodes - id - 1]; std::vector<wxString> descs;
bool v3[ncodes - id - 1]; bool checked[ncodes - id - 1];
for(int i = id + 1; i < ncodes; i++) { bool v3[ncodes - id - 1];
codes[i - id - 1] = wxString(isgb ? for(int i = id + 1; i < ncodes; i++) {
gbCheatList[i].cheatCode : codes[i - id - 1] = wxString(isgb ?
cheatsList[i].codestring, gbCheatList[i].cheatCode :
wxConvLibc); cheatsList[i].codestring,
descs[i - id - 1] = wxString(isgb ? wxConvLibc);
gbCheatList[i].cheatDesc : descs[i - id - 1] = wxString(isgb ?
cheatsList[i].desc, gbCheatList[i].cheatDesc :
wxConvUTF8); cheatsList[i].desc,
checked[i - id - 1] = isgb ? gbCheatList[i].enabled : wxConvUTF8);
cheatsList[i].enabled; checked[i - id - 1] = isgb ? gbCheatList[i].enabled :
v3[i - id - 1] = isgb ? false : cheatsList[i].code == 257; cheatsList[i].enabled;
} v3[i - id - 1] = isgb ? false : cheatsList[i].code == 257;
for(int i = ncodes - 1; i >= id; i--) { }
list->DeleteItem(i); for(int i = ncodes - 1; i >= id; i--) {
if(isgb) list->DeleteItem(i);
gbCheatRemove(i); if(isgb)
else gbCheatRemove(i);
cheatsDelete(i, cheatsList[i].enabled); else
} cheatsDelete(i, cheatsList[i].enabled);
AddCheat(); }
if(!ochecked) { AddCheat();
if(isgb) if(!ochecked) {
gbCheatDisable(id); if(isgb)
else gbCheatDisable(id);
cheatsDisable(id); else
} cheatsDisable(id);
for(int i = id + 1; i < ncodes; i++) { }
ce_codes = codes[i - id - 1]; for(int i = id + 1; i < ncodes; i++) {
ce_desc = descs[i - id - 1]; ce_codes = codes[i - id - 1];
if(isgb) { ce_desc = descs[i - id - 1];
if(ce_codes.find(wxT('-')) == wxString::npos) if(isgb)
ce_type = 0; {
else if(ce_codes.find(wxT('-')) == wxString::npos)
ce_type = 1; ce_type = 0;
} else { else
if(ce_codes.find(wxT(':')) != wxString::npos) ce_type = 1;
ce_type = 0; }
else if(ce_codes.find(wxT(' ')) == wxString::npos) { else
ce_type = 1; {
if(v3[i - id - 1]) if(ce_codes.find(wxT(':')) != wxString::npos)
ce_codes.insert(8, 1, wxT(' ')); ce_type = 0;
} else else if(ce_codes.find(wxT(' ')) == wxString::npos)
ce_type = 2; {
} ce_type = 1;
AddCheat(); if(v3[i - id - 1])
if(!checked[i - id - 1]) { ce_codes.insert(8, 1, wxT(' '));
if(isgb) }
gbCheatDisable(i); else
else {
cheatsDisable(i); ce_type = 2;
} }
} }
} else { AddCheat();
if(!checked[i - id - 1])
{
if(isgb)
gbCheatDisable(i);
else
cheatsDisable(i);
}
}
}
else
{
list->DeleteItem(id); list->DeleteItem(id);
if(isgb) if(isgb)
gbCheatRemove(id); gbCheatRemove(id);
@ -3188,16 +3199,22 @@ void MainFrame::set_global_accels()
if(!accels[i].GetMenuItem()) if(!accels[i].GetMenuItem())
len++; len++;
if(len) { if(len) {
wxAcceleratorEntry tab[len]; wxAcceleratorEntry * tab = new wxAcceleratorEntry[len];
for(int i = 0, j = 0; i < accels.size(); i++) for(int i = 0, j = 0; i < accels.size(); i++)
if(!accels[i].GetMenuItem()) {
tab[j++] = accels[i]; if(!accels[i].GetMenuItem())
wxAcceleratorTable atab(len, tab); tab[j++] = accels[i];
// set the table on the panel, where focus usually is }
// otherwise accelerators are lost sometimes wxAcceleratorTable atab(len, tab);
panel->SetAcceleratorTable(atab); // set the table on the panel, where focus usually is
} else // otherwise accelerators are lost sometimes
panel->SetAcceleratorTable(wxNullAcceleratorTable); panel->SetAcceleratorTable(atab);
delete tab;
}
else
{
panel->SetAcceleratorTable(wxNullAcceleratorTable);
}
// save recent accels // save recent accels
for(int i = 0; i < 10; i++) for(int i = 0; i < 10; i++)