From f539cef173db50189448f91f39595396f9bab37e Mon Sep 17 00:00:00 2001 From: stephena Date: Sun, 13 Sep 2015 23:23:12 +0000 Subject: [PATCH] I decided to turn on '-Weverything' compiler flag in Clang++ to see what errors are present in the code. This is the first pass in cleaning up the errors it found. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3203 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/cheat/CheatManager.hxx | 2 +- src/common/Variant.hxx | 8 +-- src/common/bspf.hxx | 2 +- src/debugger/CartDebug.cxx | 14 +++--- src/debugger/Debugger.hxx | 4 +- src/debugger/DebuggerParser.cxx | 2 +- src/debugger/DebuggerParser.hxx | 2 +- src/debugger/DiStella.cxx | 74 ++++++++++++++-------------- src/debugger/TIADebug.cxx | 34 ++++++------- src/debugger/gui/CartDebugWidget.hxx | 10 ++-- src/emucore/Console.hxx | 2 +- src/emucore/Control.hxx | 6 +-- src/emucore/EventHandler.hxx | 2 +- src/emucore/FBSurface.hxx | 14 +++--- src/emucore/FrameBuffer.hxx | 8 +-- src/emucore/M6502.hxx | 2 +- src/emucore/Props.hxx | 6 ++- src/emucore/Random.hxx | 2 +- src/gui/Dialog.hxx | 2 +- src/gui/DialogContainer.hxx | 2 +- src/gui/Rect.hxx | 32 ++++++------ src/gui/Widget.hxx | 2 +- 22 files changed, 116 insertions(+), 116 deletions(-) diff --git a/src/cheat/CheatManager.hxx b/src/cheat/CheatManager.hxx index 3ee6b4d6c..c0b79d8e6 100644 --- a/src/cheat/CheatManager.hxx +++ b/src/cheat/CheatManager.hxx @@ -58,7 +58,7 @@ class CheatManager /** Remove the cheat at 'idx' from the cheat list(s). - @param index Location in myCheatList of the cheat to remove + @param idx Location in myCheatList of the cheat to remove */ void remove(int idx); diff --git a/src/common/Variant.hxx b/src/common/Variant.hxx index fbda43484..a6aef3246 100644 --- a/src/common/Variant.hxx +++ b/src/common/Variant.hxx @@ -60,13 +60,13 @@ class Variant const string& toString() const { return data; } const char* toCString() const { return data.c_str(); } const Int32 toInt() const { return atoi(data.c_str()); } - const float toFloat() const { return atof(data.c_str()); } + const float toFloat() const { return float(atof(data.c_str())); } const bool toBool() const { return data == "1" || data == "true"; } const GUI::Size toSize() const { return GUI::Size(data); } // Comparison - bool operator==(const Variant& v) const { return data == v.data; }; - bool operator!=(const Variant& v) const { return data != v.data; }; + bool operator==(const Variant& v) const { return data == v.data; } + bool operator!=(const Variant& v) const { return data != v.data; } friend ostream& operator<<(ostream& os, const Variant& v) { return os << v.data; @@ -85,7 +85,7 @@ namespace VarList { { list.emplace_back(name.toString(), tag); } -}; +} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - static const VariantList EmptyVarList; diff --git a/src/common/bspf.hxx b/src/common/bspf.hxx index a38461353..cf73b3b96 100644 --- a/src/common/bspf.hxx +++ b/src/common/bspf.hxx @@ -158,7 +158,7 @@ inline size_t BSPF_findIgnoreCase(const string& s1, const string& s2, int startp { auto pos = std::search(s1.begin()+startpos, s1.end(), s2.begin(), s2.end(), [](char ch1, char ch2) { - return toupper((uInt8)ch1) == toupper((uInt8)ch2); + return toupper(uInt8(ch1)) == toupper(uInt8(ch2)); }); return pos == s1.end() ? string::npos : pos - (s1.begin()+startpos); } diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 3916e5efb..95fe50a05 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -230,7 +230,7 @@ bool CartDebug::disassemble(bool force) bool bankChanged = myConsole.cartridge().bankChanged(); uInt16 PC = myDebugger.cpuDebug().pc(); int pcline = addressToLine(PC); - bool pcfound = (pcline != -1) && ((uInt32)pcline < myDisassembly.list.size()) && + bool pcfound = (pcline != -1) && (uInt32(pcline) < myDisassembly.list.size()) && (myDisassembly.list[pcline].disasm[0] != '.'); bool pagedirty = (PC & 0x1000) ? mySystem.isPageDirty(0x1000, 0x1FFF) : mySystem.isPageDirty(0x80, 0xFF); @@ -339,7 +339,7 @@ string CartDebug::disassemble(uInt16 start, uInt16 lines) const ostringstream buffer; // First find the lines in the range, and determine the longest string - uInt32 list_size = (int)myDisassembly.list.size(); + uInt32 list_size = uInt32(myDisassembly.list.size()); uInt32 begin = list_size, end = 0, length = 0; for(end = 0; end < list_size && lines > 0; ++end) { @@ -348,7 +348,7 @@ string CartDebug::disassemble(uInt16 start, uInt16 lines) const { if(begin == list_size) begin = end; if(tag.type != CartDebug::ROW) - length = BSPF_max(length, (uInt32)tag.disasm.length()); + length = BSPF_max(length, uInt32(tag.disasm.length())); --lines; } @@ -382,7 +382,7 @@ bool CartDebug::addDirective(CartDebug::DisasmType type, return false; if(bank < 0) // Do we want the current bank or ZP RAM? - bank = (myDebugger.cpuDebug().pc() & 0x1000) ? getBank() : (int)myBankInfo.size()-1; + bank = (myDebugger.cpuDebug().pc() & 0x1000) ? getBank() : int(myBankInfo.size())-1; bank = BSPF_min(bank, bankCount()); BankInfo& info = myBankInfo[bank]; @@ -516,7 +516,7 @@ bool CartDebug::addLabel(const string& label, uInt16 address) removeLabel(label); myUserAddresses.insert(make_pair(label, address)); myUserLabels.insert(make_pair(address, label)); - myLabelLength = BSPF_max(myLabelLength, (uInt16)label.size()); + myLabelLength = BSPF_max(myLabelLength, uInt16(label.size())); mySystem.setDirtyPage(address); return true; } @@ -714,7 +714,7 @@ string CartDebug::loadListFile() if(addr_s.length() == 0) continue; const char* p = addr_s[0] == 'U' ? addr_s.c_str() + 1 : addr_s.c_str(); - addr = (int)strtoul(p, NULL, 16); + addr = int(strtoul(p, NULL, 16)); // For now, completely ignore ROM addresses if(!(addr & 0x1000)) @@ -1136,7 +1136,7 @@ string CartDebug::saveDisassembly() << ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n"; int max_len = 0; for(const auto& iter: myUserLabels) - max_len = BSPF_max(max_len, (int)iter.second.size()); + max_len = BSPF_max(max_len, int(iter.second.size())); for(const auto& iter: myUserLabels) out << ALIGN(max_len) << iter.second << " = $" << iter.first << "\n"; } diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index 930e3535e..905ffce31 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -94,7 +94,7 @@ class Debugger : public DialogContainer that don't have access to EventHandler. @param message Message to display when entering debugger - @param data An address associated with the message + @param address An address associated with the message */ bool start(const string& message = "", int address = -1); bool startWithFatalError(const string& message = ""); @@ -164,7 +164,7 @@ class Debugger : public DialogContainer /** The current cycle count of the System. */ - int cycles() const { return mySystem.cycles(); } + int cycles() const { return int(mySystem.cycles()); } string autoExec(); diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index 3646afeab..ed6e37b8b 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -546,7 +546,7 @@ string DebuggerParser::eval() buf << "$" << Base::toString(args[i], Base::F_16_4) << " %" << Base::toString(args[i], Base::F_2_16); - buf << " #" << (int) args[i]; + buf << " #" << int(args[i]); if(i != argCount - 1) buf << endl; } diff --git a/src/debugger/DebuggerParser.hxx b/src/debugger/DebuggerParser.hxx index 553f68c2d..ac53f5034 100644 --- a/src/debugger/DebuggerParser.hxx +++ b/src/debugger/DebuggerParser.hxx @@ -71,7 +71,7 @@ class DebuggerParser private: enum { - kNumCommands = 70, + kNumCommands = 70 }; // Constants for argument processing diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index bca0cc134..9ef429940 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -257,14 +257,14 @@ void DiStella::disasm(uInt32 distart, int pass) bool isPGfx = check_bit(myPC, CartDebug::PGFX); const string& bit_string = isPGfx ? "\x1f" : "\x1e"; uInt8 byte = Debugger::debugger().peek(myPC+myOffset); - myDisasmBuf << ".byte $" << Base::HEX2 << (int)byte << " |"; + myDisasmBuf << ".byte $" << Base::HEX2 << int(byte) << " |"; for(uInt8 i = 0, c = byte; i < 8; ++i, c <<= 1) myDisasmBuf << ((c > 127) ? bit_string : " "); myDisasmBuf << "| $" << Base::HEX4 << myPC+myOffset << "'"; if(mySettings.gfx_format == Base::F_2) myDisasmBuf << Base::toString(byte, Base::F_2_8); else - myDisasmBuf << Base::HEX2 << (int)byte; + myDisasmBuf << Base::HEX2 << int(byte); addEntry(isPGfx ? CartDebug::PGFX : CartDebug::GFX); } myPC++; @@ -282,9 +282,9 @@ void DiStella::disasm(uInt32 distart, int pass) myDisasmBuf << Base::HEX4 << myPC+myOffset << "' '"; uInt8 byte = Debugger::debugger().peek(myPC+myOffset); - myDisasmBuf << ".byte $" << Base::HEX2 << (int)byte << " $" + myDisasmBuf << ".byte $" << Base::HEX2 << int(byte) << " $" << Base::HEX4 << myPC+myOffset << "'" - << Base::HEX2 << (int)byte; + << Base::HEX2 << int(byte); addEntry(CartDebug::DATA); } myPC++; @@ -311,14 +311,14 @@ void DiStella::disasm(uInt32 distart, int pass) myDisasmBuf << Base::HEX4 << myPC+myOffset << "'L" << Base::HEX4 << myPC+myOffset << "'.byte " << "$" << Base::HEX2 - << (int)Debugger::debugger().peek(myPC+myOffset); + << int(Debugger::debugger().peek(myPC+myOffset)); myPC++; bytes = 1; line_empty = false; } else if(line_empty) // start a new line without a label { - myDisasmBuf << " ' '.byte $" << Base::HEX2 << (int)Debugger::debugger().peek(myPC+myOffset); + myDisasmBuf << " ' '.byte $" << Base::HEX2 << int(Debugger::debugger().peek(myPC+myOffset)); myPC++; bytes = 1; line_empty = false; @@ -331,7 +331,7 @@ void DiStella::disasm(uInt32 distart, int pass) } else { - myDisasmBuf << ",$" << Base::HEX2 << (int)Debugger::debugger().peek(myPC+myOffset); + myDisasmBuf << ",$" << Base::HEX2 << int(Debugger::debugger().peek(myPC+myOffset)); myPC++; } @@ -375,7 +375,7 @@ void DiStella::disasm(uInt32 distart, int pass) { addr_mode = IMPLIED; if (pass == 3) - nextline << ".byte $" << Base::HEX2 << (int)op << " ;"; + nextline << ".byte $" << Base::HEX2 << int(op) << " ;"; } if (pass == 1) @@ -398,7 +398,7 @@ void DiStella::disasm(uInt32 distart, int pass) else if (pass == 3) { nextline << ourLookup[op].mnemonic; - nextlinebytes << Base::HEX2 << (int)op << " "; + nextlinebytes << Base::HEX2 << int(op) << " "; } // Add operand(s) for PC values outside the app data range @@ -419,9 +419,9 @@ void DiStella::disasm(uInt32 distart, int pass) /* Line information is already printed; append .byte since last instruction will put recompilable object larger that original binary file */ - myDisasmBuf << ".byte $" << Base::HEX2 << (int)op << " $" + myDisasmBuf << ".byte $" << Base::HEX2 << int(op) << " $" << Base::HEX4 << myPC+myOffset << "'" - << Base::HEX2 << (int)op; + << Base::HEX2 << int(op); addEntry(CartDebug::DATA); if (myPC == myAppData.end) @@ -432,9 +432,9 @@ void DiStella::disasm(uInt32 distart, int pass) myDisasmBuf << Base::HEX4 << myPC+myOffset << "' '"; op = Debugger::debugger().peek(myPC+myOffset); myPC++; - myDisasmBuf << ".byte $" << Base::HEX2 << (int)op << " $" + myDisasmBuf << ".byte $" << Base::HEX2 << int(op) << " $" << Base::HEX4 << myPC+myOffset << "'" - << Base::HEX2 << (int)op; + << Base::HEX2 << int(op); addEntry(CartDebug::DATA); } } @@ -454,7 +454,7 @@ void DiStella::disasm(uInt32 distart, int pass) { /* Line information is already printed, but we can remove the Instruction (i.e. BMI) by simply clearing the buffer to print */ - myDisasmBuf << ".byte $" << Base::HEX2 << (int)op; + myDisasmBuf << ".byte $" << Base::HEX2 << int(op); addEntry(CartDebug::ROW); nextline.str(""); nextlinebytes.str(""); @@ -522,7 +522,7 @@ void DiStella::disasm(uInt32 distart, int pass) if (labfound == 1) { LABEL_A12_HIGH(ad); - nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8); + nextlinebytes << Base::HEX2 << int(ad&0xff) << " " << Base::HEX2 << int(ad>>8); } else if (labfound == 4) { @@ -530,18 +530,18 @@ void DiStella::disasm(uInt32 distart, int pass) { int tmp = (ad & myAppData.end)+myOffset; LABEL_A12_HIGH(tmp); - nextlinebytes << Base::HEX2 << (int)(tmp&0xff) << " " << Base::HEX2 << (int)(tmp>>8); + nextlinebytes << Base::HEX2 << int(tmp&0xff) << " " << Base::HEX2 << int(tmp>>8); } else { nextline << "$" << Base::HEX4 << ad; - nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8); + nextlinebytes << Base::HEX2 << int(ad&0xff) << " " << Base::HEX2 << int(ad>>8); } } else { LABEL_A12_LOW(ad); - nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8); + nextlinebytes << Base::HEX2 << int(ad&0xff) << " " << Base::HEX2 << int(ad>>8); } } break; @@ -554,8 +554,8 @@ void DiStella::disasm(uInt32 distart, int pass) if (pass == 3) { nextline << " "; - LABEL_A12_LOW((int)d1); - nextlinebytes << Base::HEX2 << (int)d1; + LABEL_A12_LOW(int(d1)); + nextlinebytes << Base::HEX2 << int(d1); } break; } @@ -565,8 +565,8 @@ void DiStella::disasm(uInt32 distart, int pass) d1 = Debugger::debugger().peek(myPC+myOffset); myPC++; if (pass == 3) { - nextline << " #$" << Base::HEX2 << (int)d1 << " "; - nextlinebytes << Base::HEX2 << (int)d1; + nextline << " #$" << Base::HEX2 << int(d1) << " "; + nextlinebytes << Base::HEX2 << int(d1); } break; } @@ -594,7 +594,7 @@ void DiStella::disasm(uInt32 distart, int pass) { LABEL_A12_HIGH(ad); nextline << ",X"; - nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8); + nextlinebytes << Base::HEX2 << int(ad&0xff) << " " << Base::HEX2 << int(ad>>8); } else if (labfound == 4) { @@ -603,19 +603,19 @@ void DiStella::disasm(uInt32 distart, int pass) int tmp = (ad & myAppData.end)+myOffset; LABEL_A12_HIGH(tmp); nextline << ",X"; - nextlinebytes << Base::HEX2 << (int)(tmp&0xff) << " " << Base::HEX2 << (int)(tmp>>8); + nextlinebytes << Base::HEX2 << int(tmp&0xff) << " " << Base::HEX2 << int(tmp>>8); } else { nextline << "$" << Base::HEX4 << ad << ",X"; - nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8); + nextlinebytes << Base::HEX2 << int(ad&0xff) << " " << Base::HEX2 << int(ad>>8); } } else { LABEL_A12_LOW(ad); nextline << ",X"; - nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8); + nextlinebytes << Base::HEX2 << int(ad&0xff) << " " << Base::HEX2 << int(ad>>8); } } break; @@ -644,7 +644,7 @@ void DiStella::disasm(uInt32 distart, int pass) { LABEL_A12_HIGH(ad); nextline << ",Y"; - nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8); + nextlinebytes << Base::HEX2 << int(ad&0xff) << " " << Base::HEX2 << int(ad>>8); } else if (labfound == 4) { @@ -653,19 +653,19 @@ void DiStella::disasm(uInt32 distart, int pass) int tmp = (ad & myAppData.end)+myOffset; LABEL_A12_HIGH(tmp); nextline << ",Y"; - nextlinebytes << Base::HEX2 << (int)(tmp&0xff) << " " << Base::HEX2 << (int)(tmp>>8); + nextlinebytes << Base::HEX2 << int(tmp&0xff) << " " << Base::HEX2 << int(tmp>>8); } else { nextline << "$" << Base::HEX4 << ad << ",Y"; - nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8); + nextlinebytes << Base::HEX2 << int(ad&0xff) << " " << Base::HEX2 << int(ad>>8); } } else { LABEL_A12_LOW(ad); nextline << ",Y"; - nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8); + nextlinebytes << Base::HEX2 << int(ad&0xff) << " " << Base::HEX2 << int(ad>>8); } } break; @@ -680,7 +680,7 @@ void DiStella::disasm(uInt32 distart, int pass) nextline << " ("; LABEL_A12_LOW(d1); nextline << ",X)"; - nextlinebytes << Base::HEX2 << (int)d1; + nextlinebytes << Base::HEX2 << int(d1); } break; } @@ -694,7 +694,7 @@ void DiStella::disasm(uInt32 distart, int pass) nextline << " ("; LABEL_A12_LOW(d1); nextline << "),Y"; - nextlinebytes << Base::HEX2 << (int)d1; + nextlinebytes << Base::HEX2 << int(d1); } break; } @@ -709,7 +709,7 @@ void DiStella::disasm(uInt32 distart, int pass) LABEL_A12_LOW(d1); nextline << ",X"; } - nextlinebytes << Base::HEX2 << (int)d1; + nextlinebytes << Base::HEX2 << int(d1); break; } @@ -723,7 +723,7 @@ void DiStella::disasm(uInt32 distart, int pass) LABEL_A12_LOW(d1); nextline << ",Y"; } - nextlinebytes << Base::HEX2 << (int)d1; + nextlinebytes << Base::HEX2 << int(d1); break; } @@ -754,7 +754,7 @@ void DiStella::disasm(uInt32 distart, int pass) else nextline << " $" << Base::HEX4 << ad; - nextlinebytes << Base::HEX2 << (int)d1; + nextlinebytes << Base::HEX2 << int(d1); } break; } @@ -792,7 +792,7 @@ void DiStella::disasm(uInt32 distart, int pass) nextline << ")"; } - nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8); + nextlinebytes << Base::HEX2 << int(ad&0xff) << " " << Base::HEX2 << int(ad>>8); break; } @@ -816,7 +816,7 @@ void DiStella::disasm(uInt32 distart, int pass) { // A complete line of disassembly (text, cycle count, and bytes) myDisasmBuf << nextline.str() << "'" - << ";" << dec << (int)ourLookup[op].cycles << "'" + << ";" << dec << int(ourLookup[op].cycles) << "'" << nextlinebytes.str(); addEntry(CartDebug::CODE); if (op == 0x40 || op == 0x60) diff --git a/src/debugger/TIADebug.cxx b/src/debugger/TIADebug.cxx index 36392cc72..bb5468cf8 100644 --- a/src/debugger/TIADebug.cxx +++ b/src/debugger/TIADebug.cxx @@ -189,7 +189,7 @@ void TIADebug::saveOldState() bool TIADebug::vdelP0(int newVal) { if(newVal > -1) - mySystem.poke(VDELP0, ((bool)newVal)); + mySystem.poke(VDELP0, bool(newVal)); return myTIA.myVDELP0; } @@ -198,7 +198,7 @@ bool TIADebug::vdelP0(int newVal) bool TIADebug::vdelP1(int newVal) { if(newVal > -1) - mySystem.poke(VDELP1, ((bool)newVal)); + mySystem.poke(VDELP1, bool(newVal)); return myTIA.myVDELP1; } @@ -207,7 +207,7 @@ bool TIADebug::vdelP1(int newVal) bool TIADebug::vdelBL(int newVal) { if(newVal > -1) - mySystem.poke(VDELBL, ((bool)newVal)); + mySystem.poke(VDELBL, bool(newVal)); return myTIA.myVDELBL; } @@ -216,7 +216,7 @@ bool TIADebug::vdelBL(int newVal) bool TIADebug::enaM0(int newVal) { if(newVal > -1) - mySystem.poke(ENAM0, ((bool)newVal) << 1); + mySystem.poke(ENAM0, bool(newVal) << 1); return myTIA.myENAM0; } @@ -225,7 +225,7 @@ bool TIADebug::enaM0(int newVal) bool TIADebug::enaM1(int newVal) { if(newVal > -1) - mySystem.poke(ENAM1, ((bool)newVal) << 1); + mySystem.poke(ENAM1, bool(newVal) << 1); return myTIA.myENAM1; } @@ -234,7 +234,7 @@ bool TIADebug::enaM1(int newVal) bool TIADebug::enaBL(int newVal) { if(newVal > -1) - mySystem.poke(ENABL, ((bool)newVal) << 1); + mySystem.poke(ENABL, bool(newVal) << 1); return myTIA.myENABL; } @@ -243,7 +243,7 @@ bool TIADebug::enaBL(int newVal) bool TIADebug::resMP0(int newVal) { if(newVal > -1) - mySystem.poke(RESMP0, ((bool)newVal) << 1); + mySystem.poke(RESMP0, bool(newVal) << 1); return myTIA.myRESMP0; } @@ -252,7 +252,7 @@ bool TIADebug::resMP0(int newVal) bool TIADebug::resMP1(int newVal) { if(newVal > -1) - mySystem.poke(RESMP1, ((bool)newVal) << 1); + mySystem.poke(RESMP1, bool(newVal) << 1); return myTIA.myRESMP1; } @@ -261,7 +261,7 @@ bool TIADebug::resMP1(int newVal) bool TIADebug::refP0(int newVal) { if(newVal > -1) - mySystem.poke(REFP0, ((bool)newVal) << 3); + mySystem.poke(REFP0, bool(newVal) << 3); return myTIA.myREFP0; } @@ -270,7 +270,7 @@ bool TIADebug::refP0(int newVal) bool TIADebug::refP1(int newVal) { if(newVal > -1) - mySystem.poke(REFP1, ((bool)newVal) << 3); + mySystem.poke(REFP1, bool(newVal) << 3); return myTIA.myREFP1; } @@ -741,7 +741,7 @@ string TIADebug::toString() buf << "00: "; for (uInt8 j = 0; j < 0x010; j++) { - buf << Common::Base::HEX2 << (int)mySystem.peek(j) << " "; + buf << Common::Base::HEX2 << int(mySystem.peek(j)) << " "; if(j == 0x07) buf << "- "; } buf << endl; @@ -837,15 +837,15 @@ string TIADebug::toString() << endl << " " << booleanWithLabel("m0_m1 ", collM0_M1()) << endl - << "AUDF0: $" << Common::Base::HEX2 << (int)myTIA.myAUDF0 + << "AUDF0: $" << Common::Base::HEX2 << int(myTIA.myAUDF0) << "/" << audFreq(myTIA.myAUDF0) << " " - << "AUDC0: $" << Common::Base::HEX2 << (int)myTIA.myAUDC0 << " " - << "AUDV0: $" << Common::Base::HEX2 << (int)myTIA.myAUDV0 + << "AUDC0: $" << Common::Base::HEX2 << int(myTIA.myAUDC0) << " " + << "AUDV0: $" << Common::Base::HEX2 << int(myTIA.myAUDV0) << endl - << "AUDF1: $" << Common::Base::HEX2 << (int)myTIA.myAUDF1 + << "AUDF1: $" << Common::Base::HEX2 << int(myTIA.myAUDF1) << "/" << audFreq(myTIA.myAUDF1) << " " - << "AUDC1: $" << Common::Base::HEX2 << (int)myTIA.myAUDC1 << " " - << "AUDV1: $" << Common::Base::HEX2 << (int)myTIA.myAUDV1 + << "AUDC1: $" << Common::Base::HEX2 << int(myTIA.myAUDC1) << " " + << "AUDV1: $" << Common::Base::HEX2 << int(myTIA.myAUDV1) ; // note: last line should not contain \n, caller will add. return buf.str(); diff --git a/src/debugger/gui/CartDebugWidget.hxx b/src/debugger/gui/CartDebugWidget.hxx index 0d1e49d9e..2a716c394 100644 --- a/src/debugger/gui/CartDebugWidget.hxx +++ b/src/debugger/gui/CartDebugWidget.hxx @@ -48,7 +48,7 @@ class CartDebugWidget : public Widget, public CommandSender myButtonHeight(myLineHeight + 4), myDesc(nullptr) { } - virtual ~CartDebugWidget() { }; + virtual ~CartDebugWidget() { } public: int addBaseInformation(int bytes, const string& manufacturer, @@ -82,7 +82,7 @@ class CartDebugWidget : public Widget, public CommandSender StringParser bs(desc, (fwidth - kScrollBarWidth) / myFontWidth - 4); const StringList& sl = bs.stringList(); - uInt32 lines = (uInt32)sl.size(); + uInt32 lines = uInt32(sl.size()); if(lines < 3) lines = 3; if(lines > maxlines) lines = maxlines; @@ -109,7 +109,7 @@ class CartDebugWidget : public Widget, public CommandSender virtual void saveOldState() { } virtual void loadConfig() override { myDesc->setSelected(0); } - virtual void handleCommand(CommandSender* sender, int cmd, int data, int id) override { }; + virtual void handleCommand(CommandSender* sender, int cmd, int data, int id) override { } // Query internal state of the cart (usually just bankswitching info) virtual string bankState() { return "0 (non-bankswitched)"; } @@ -121,8 +121,8 @@ class CartDebugWidget : public Widget, public CommandSender virtual string internalRamDescription() { return EmptyString; } virtual const ByteArray& internalRamOld(int start, int count) { return myRamOld; } virtual const ByteArray& internalRamCurrent(int start, int count) { return myRamCurrent; } - virtual void internalRamSetValue(int addr, uInt8 value) { }; - virtual uInt8 internalRamGetValue(int addr) { return 0; }; + virtual void internalRamSetValue(int addr, uInt8 value) { } + virtual uInt8 internalRamGetValue(int addr) { return 0; } virtual string internalRamLabel(int addr) { return "Not available/applicable"; } protected: diff --git a/src/emucore/Console.hxx b/src/emucore/Console.hxx index d70fc8e38..a4f16b421 100644 --- a/src/emucore/Console.hxx +++ b/src/emucore/Console.hxx @@ -154,7 +154,7 @@ class Console : public Serializable /** Set the properties to those given - @param The properties to use for the current game + @param props The properties to use for the current game */ void setProperties(const Properties& props); diff --git a/src/emucore/Control.hxx b/src/emucore/Control.hxx index c43411f4d..6ddafe2bd 100644 --- a/src/emucore/Control.hxx +++ b/src/emucore/Control.hxx @@ -155,7 +155,7 @@ class Controller : public Serializable @param pin The pin of the controller jack to write to @param value The value to write to the pin */ - virtual void write(DigitalPin pin, bool value) { }; + virtual void write(DigitalPin pin, bool value) { } /** Called after *all* digital pins have been written on Port A. @@ -163,7 +163,7 @@ class Controller : public Serializable @param value The entire contents of the SWCHA register */ - virtual void controlWrite(uInt8 value) { }; + virtual void controlWrite(uInt8 value) { } /** Update the entire digital and analog pin state according to the @@ -176,7 +176,7 @@ class Controller : public Serializable system resets its cycle counter to zero. It may be necessary to override this method for controllers that remember cycle counts. */ - virtual void systemCyclesReset() { }; + virtual void systemCyclesReset() { } /** Determines how this controller will treat values received from the diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index ddd600d6c..d3adc9a1e 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -282,7 +282,7 @@ class EventHandler @param event The event we are remapping @param mode The mode where this event is active @param stick The joystick number - @param axis The joystick hat + @param hat The joystick hat @param value The value on the given hat @param updateMenus Whether to update the action mappings (normally we want to do this, unless there are a batch of diff --git a/src/emucore/FBSurface.hxx b/src/emucore/FBSurface.hxx index cd7e3eec6..2d021f469 100644 --- a/src/emucore/FBSurface.hxx +++ b/src/emucore/FBSurface.hxx @@ -57,8 +57,6 @@ class FBSurface public: /** Creates a new FBSurface object - - @param data If non-null, the data values to use as a static surface */ FBSurface(); @@ -155,9 +153,10 @@ class FBSurface data into a FrameBuffer surface. The pixels must already be in the format used by the surface. - @param data The data in uInt8 R/G/B format - @param row The row of the surface the data should be placed in - @param rowbytes The number of bytes in row of 'data' + @param data The data in uInt8 R/G/B format + @param x The destination x-location to start drawing pixels + @param y The destination y-location to start drawing pixels + @param numpixels The number of pixels to draw */ virtual void drawPixels(uInt32* data, uInt32 x, uInt32 y, uInt32 numpixels); @@ -193,14 +192,13 @@ class FBSurface This method should be called to draw the specified string. @param font The font to draw the string with - @param str The string to draw + @param s The string to draw @param x The x coordinate @param y The y coordinate @param w The width of the string area - @param h The height of the string area @param color The color of the text @param align The alignment of the text in the string width area - @param deltax + @param deltax FIXME @param useEllipsis Whether to use '...' when the string is too long */ virtual void drawString( diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx index bf69298a1..a2b1e7e57 100644 --- a/src/emucore/FrameBuffer.hxx +++ b/src/emucore/FrameBuffer.hxx @@ -42,7 +42,7 @@ enum FBInitStatus { kSuccess, kFailComplete, kFailTooLarge, - kFailNotSupported, + kFailNotSupported }; // Positions for onscreen/overlaid messages @@ -287,7 +287,7 @@ class FrameBuffer /** Set up the TIA/emulation palette for a screen of any depth > 8. - @param palette The array of colors in R/G/B format + @param raw_palette The array of colors in R/G/B format */ void setPalette(const uInt32* raw_palette); @@ -434,8 +434,8 @@ class FrameBuffer Returns an appropriate video mode based on the current eventhandler state, taking into account the maximum size of the window. - @param full Whether to use a windowed or fullscreen mode - @return A valid VideoMode for this framebuffer + @param fullscreen Whether to use a windowed or fullscreen mode + @return A valid VideoMode for this framebuffer */ const VideoMode& getSavedVidMode(bool fullscreen); diff --git a/src/emucore/M6502.hxx b/src/emucore/M6502.hxx index 596650358..01a972779 100644 --- a/src/emucore/M6502.hxx +++ b/src/emucore/M6502.hxx @@ -342,7 +342,7 @@ class M6502 : public Serializable return i; return -1; // no break hit - }; + } /// Pointer to the debugger for this processor or the null pointer Debugger* myDebugger; diff --git a/src/emucore/Props.hxx b/src/emucore/Props.hxx index f61c6a771..23e522c85 100644 --- a/src/emucore/Props.hxx +++ b/src/emucore/Props.hxx @@ -99,14 +99,16 @@ class Properties /** Load properties from the specified input stream - @param in The input stream to use + @param is The input stream to use + @param p The Properties object to write to */ friend istream& operator>>(istream& is, Properties& p); /** Save properties to the specified output stream - @param out The output stream to use + @param os The output stream to use + @param p The Properties object to read from */ friend ostream& operator<<(ostream& os, const Properties& p); diff --git a/src/emucore/Random.hxx b/src/emucore/Random.hxx index c3941d3cb..909f64053 100644 --- a/src/emucore/Random.hxx +++ b/src/emucore/Random.hxx @@ -47,7 +47,7 @@ class Random */ void initSeed() { - myValue = (uInt32) myOSystem.getTicks(); + myValue = uInt32(myOSystem.getTicks()); } /** diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx index 60b5e8f0a..71174d1cb 100644 --- a/src/gui/Dialog.hxx +++ b/src/gui/Dialog.hxx @@ -83,7 +83,7 @@ class Dialog : public GuiObject void addSurface(shared_ptr surface); protected: - virtual void draw() override { }; + virtual void draw() override { } void releaseFocus() override; virtual void handleText(char text); diff --git a/src/gui/DialogContainer.hxx b/src/gui/DialogContainer.hxx index c92cb17e8..01de30387 100644 --- a/src/gui/DialogContainer.hxx +++ b/src/gui/DialogContainer.hxx @@ -120,7 +120,7 @@ class DialogContainer Handle a joystick hat event. @param stick The joystick number - @param axis The joystick hat + @param hat The joystick hat @param value Value associated with given hat */ void handleJoyHatEvent(int stick, int hat, JoyHat value); diff --git a/src/gui/Rect.hxx b/src/gui/Rect.hxx index 8933c7322..336559668 100644 --- a/src/gui/Rect.hxx +++ b/src/gui/Rect.hxx @@ -37,9 +37,9 @@ struct Point int x; //!< The horizontal part of the point int y; //!< The vertical part of the point - Point() : x(0), y(0) { }; - Point(const Point& p) : x(p.x), y(p.y) { }; - explicit Point(int x1, int y1) : x(x1), y(y1) { }; + Point() : x(0), y(0) { } + Point(const Point& p) : x(p.x), y(p.y) { } + explicit Point(int x1, int y1) : x(x1), y(y1) { } Point(const string& p) { char c = '\0'; x = y = -1; @@ -48,9 +48,9 @@ struct Point if(c != 'x') x = y = 0; } - Point& operator=(const Point & p) { x = p.x; y = p.y; return *this; }; - bool operator==(const Point & p) const { return x == p.x && y == p.y; }; - bool operator!=(const Point & p) const { return x != p.x || y != p.y; }; + Point& operator=(const Point & p) { x = p.x; y = p.y; return *this; } + bool operator==(const Point & p) const { return x == p.x && y == p.y; } + bool operator!=(const Point & p) const { return x != p.x || y != p.y; } friend ostream& operator<<(ostream& os, const Point& p) { os << p.x << "x" << p.y; @@ -63,9 +63,9 @@ struct Size uInt32 w; //!< The width part of the size uInt32 h; //!< The height part of the size - Size() : w(0), h(0) { }; - Size(const Size& s) : w(s.w), h(s.h) { }; - explicit Size(uInt32 w1, uInt32 h1) : w(w1), h(h1) { }; + Size() : w(0), h(0) { } + Size(const Size& s) : w(s.w), h(s.h) { } + explicit Size(uInt32 w1, uInt32 h1) : w(w1), h(h1) { } Size(const string& s) { char c = '\0'; w = h = 0; @@ -76,13 +76,13 @@ struct Size } bool valid() const { return w > 0 && h > 0; } - Size& operator=(const Size& s) { w = s.w; h = s.h; return *this; }; - bool operator==(const Size& s) const { return w == s.w && h == s.h; }; - bool operator!=(const Size& s) const { return w != s.w || h != s.h; }; - bool operator<(const Size& s) const { return w < s.w && h < s.h; }; - bool operator<=(const Size& s) const { return w <= s.w && h <= s.h; }; - bool operator>(const Size& s) const { return w > s.w && h > s.h; }; - bool operator>=(const Size& s) const { return w >= s.w && h >= s.h; }; + Size& operator=(const Size& s) { w = s.w; h = s.h; return *this; } + bool operator==(const Size& s) const { return w == s.w && h == s.h; } + bool operator!=(const Size& s) const { return w != s.w || h != s.h; } + bool operator<(const Size& s) const { return w < s.w && h < s.h; } + bool operator<=(const Size& s) const { return w <= s.w && h <= s.h; } + bool operator>(const Size& s) const { return w > s.w && h > s.h; } + bool operator>=(const Size& s) const { return w >= s.w && h >= s.h; } friend ostream& operator<<(ostream& os, const Size& s) { os << s.w << "x" << s.h; diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx index 03b5eb9e4..a95529cce 100644 --- a/src/gui/Widget.hxx +++ b/src/gui/Widget.hxx @@ -88,7 +88,7 @@ class Widget : public GuiObject void addFocusWidget(Widget* w) override { _focusList.push_back(w); } void addToFocusList(WidgetArray& list) override { Vec::append(_focusList, list); - }; + } /** Set/clear WIDGET_ENABLED flag */ void setEnabled(bool e);