From 7b57d522609eb9e18dbe0d43595209a00694448a Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sun, 2 Jul 2017 20:46:27 -0230 Subject: [PATCH] My neverending quest to protect against raw pointers. Changed many 'const char* ...' to 'const char* const ...'. --- src/common/Base.cxx | 6 +++--- src/common/Base.hxx | 6 +++--- src/common/EventHandlerSDL2.hxx | 2 +- src/common/Variant.hxx | 2 +- src/common/ZipHandler.cxx | 2 +- src/common/tv_filters/NTSCFilter.hxx | 2 +- src/debugger/CartDebug.cxx | 8 ++++---- src/debugger/CartDebug.hxx | 8 ++++---- src/debugger/DiStella.hxx | 2 +- src/debugger/gui/Cart0840Widget.cxx | 2 +- src/debugger/gui/CartBFSCWidget.cxx | 2 +- src/debugger/gui/CartBFWidget.cxx | 2 +- src/debugger/gui/CartBUSWidget.cxx | 24 +++++++++++------------ src/debugger/gui/CartCDFWidget.cxx | 2 +- src/debugger/gui/CartCTYWidget.cxx | 2 +- src/debugger/gui/CartDASHWidget.cxx | 2 +- src/debugger/gui/CartDFSCWidget.cxx | 2 +- src/debugger/gui/CartDFWidget.cxx | 2 +- src/debugger/gui/CartDPCPlusWidget.cxx | 2 +- src/debugger/gui/CartDPCWidget.cxx | 2 +- src/debugger/gui/CartE0Widget.cxx | 6 +++--- src/debugger/gui/CartE7Widget.cxx | 4 ++-- src/debugger/gui/CartEFSCWidget.cxx | 2 +- src/debugger/gui/CartEFWidget.cxx | 2 +- src/debugger/gui/CartF4SCWidget.cxx | 2 +- src/debugger/gui/CartF4Widget.cxx | 2 +- src/debugger/gui/CartF6SCWidget.cxx | 2 +- src/debugger/gui/CartF6Widget.cxx | 2 +- src/debugger/gui/CartF8SCWidget.cxx | 2 +- src/debugger/gui/CartF8Widget.cxx | 2 +- src/debugger/gui/CartFA2Widget.cxx | 2 +- src/debugger/gui/CartFAWidget.cxx | 2 +- src/debugger/gui/CartFEWidget.cxx | 2 +- src/debugger/gui/CartUAWidget.cxx | 2 +- src/debugger/gui/CartWDWidget.cxx | 2 +- src/debugger/gui/CpuWidget.cxx | 4 ++-- src/debugger/gui/RiotWidget.cxx | 14 ++++++------- src/debugger/gui/TiaWidget.cxx | 10 +++++----- src/emucore/EventHandler.hxx | 3 ++- src/emucore/KidVid.cxx | 2 +- src/emucore/Thumbulator.cxx | 2 +- src/gui/Font.hxx | 2 +- src/gui/LauncherFilterDialog.cxx | 6 +++--- src/gui/LauncherFilterDialog.hxx | 2 +- src/macosx/SDLMain.m | 4 ++-- src/tools/evdev-joystick/evdev-joystick.c | 2 +- 46 files changed, 85 insertions(+), 84 deletions(-) diff --git a/src/common/Base.cxx b/src/common/Base.cxx index cdb2f2869..b788f04eb 100644 --- a/src/common/Base.cxx +++ b/src/common/Base.cxx @@ -108,12 +108,12 @@ Base::Format Base::myDefaultBase = Base::F_16; std::ios_base::fmtflags Base::myHexflags = std::ios_base::hex; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const char* Base::myLowerFmt[4] = { +const char* const Base::myLowerFmt[4] = { "%1x", "%02x", "%04x", "%08x" }; -const char* Base::myUpperFmt[4] = { +const char* const Base::myUpperFmt[4] = { "%1X", "%02X", "%04X", "%08X" }; -const char** Base::myFmt = Base::myLowerFmt; +const char* const* Base::myFmt = Base::myLowerFmt; } // Namespace Common diff --git a/src/common/Base.hxx b/src/common/Base.hxx index eceb68db6..dd92a81a9 100644 --- a/src/common/Base.hxx +++ b/src/common/Base.hxx @@ -93,9 +93,9 @@ class Base // Format specifiers to use for sprintf (eventually we may convert // to C++ streams - static const char* myLowerFmt[4]; - static const char* myUpperFmt[4]; - static const char** myFmt; + static const char* const myLowerFmt[4]; + static const char* const myUpperFmt[4]; + static const char* const* myFmt; private: // Following constructors and assignment operators not supported diff --git a/src/common/EventHandlerSDL2.hxx b/src/common/EventHandlerSDL2.hxx index 591d878c4..130225497 100644 --- a/src/common/EventHandlerSDL2.hxx +++ b/src/common/EventHandlerSDL2.hxx @@ -46,7 +46,7 @@ class EventHandlerSDL2 : public EventHandler /** Returns the human-readable name for a StellaKey. */ - const char* nameForKey(StellaKey key) const override { + const char* const nameForKey(StellaKey key) const override { return SDL_GetScancodeName(SDL_Scancode(key)); } diff --git a/src/common/Variant.hxx b/src/common/Variant.hxx index 6ae801648..c535c3a39 100644 --- a/src/common/Variant.hxx +++ b/src/common/Variant.hxx @@ -56,7 +56,7 @@ class Variant // Conversion methods const string& toString() const { return data; } - const char* toCString() const { return data.c_str(); } + const char* const toCString() const { return data.c_str(); } const Int32 toInt() const { return atoi(data.c_str()); } const float toFloat() const { return float(atof(data.c_str())); } const bool toBool() const { return data == "1" || data == "true"; } diff --git a/src/common/ZipHandler.cxx b/src/common/ZipHandler.cxx index 59d7e4abc..c8f668002 100644 --- a/src/common/ZipHandler.cxx +++ b/src/common/ZipHandler.cxx @@ -87,7 +87,7 @@ string ZipHandler::next() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt32 ZipHandler::decompress(BytePtr& image) { - static const char* zip_error_s[] = { + static const char* const zip_error_s[] = { "ZIPERR_NONE", "ZIPERR_OUT_OF_MEMORY", "ZIPERR_FILE_ERROR", diff --git a/src/common/tv_filters/NTSCFilter.hxx b/src/common/tv_filters/NTSCFilter.hxx index c1403521f..7226f200e 100644 --- a/src/common/tv_filters/NTSCFilter.hxx +++ b/src/common/tv_filters/NTSCFilter.hxx @@ -147,7 +147,7 @@ class NTSCFilter uInt8 myTIAPalette[AtariNTSC::palette_size * 3]; struct AdjustableTag { - const char* type; + const char* const type; double* value; }; uInt32 myCurrentAdjustable; diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index d1acd75b9..efca5e565 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -1391,13 +1391,13 @@ void CartDebug::disasmTypeAsString(ostream& buf, uInt8 flags) const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const char* CartDebug::ourTIAMnemonicR[16] = { +const char* const CartDebug::ourTIAMnemonicR[16] = { "CXM0P", "CXM1P", "CXP0FB", "CXP1FB", "CXM0FB", "CXM1FB", "CXBLPF", "CXPPMM", "INPT0", "INPT1", "INPT2", "INPT3", "INPT4", "INPT5", 0, 0 }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const char* CartDebug::ourTIAMnemonicW[64] = { +const char* const CartDebug::ourTIAMnemonicW[64] = { "VSYNC", "VBLANK", "WSYNC", "RSYNC", "NUSIZ0", "NUSIZ1", "COLUP0", "COLUP1", "COLUPF", "COLUBK", "CTRLPF", "REFP0", "REFP1", "PF0", "PF1", "PF2", "RESP0", "RESP1", "RESM0", "RESM1", "RESBL", "AUDC0", "AUDC1", "AUDF0", @@ -1408,13 +1408,13 @@ const char* CartDebug::ourTIAMnemonicW[64] = { }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const char* CartDebug::ourIOMnemonic[24] = { +const char* const CartDebug::ourIOMnemonic[24] = { "SWCHA", "SWACNT", "SWCHB", "SWBCNT", "INTIM", "TIMINT", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "TIM1T", "TIM8T", "TIM64T", "T1024T" }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const char* CartDebug::ourZPMnemonic[128] = { +const char* const CartDebug::ourZPMnemonic[128] = { "ram_80", "ram_81", "ram_82", "ram_83", "ram_84", "ram_85", "ram_86", "ram_87", "ram_88", "ram_89", "ram_8A", "ram_8B", "ram_8C", "ram_8D", "ram_8E", "ram_8F", "ram_90", "ram_91", "ram_92", "ram_93", "ram_94", "ram_95", "ram_96", "ram_97", diff --git a/src/debugger/CartDebug.hxx b/src/debugger/CartDebug.hxx index d101838ea..d8aed7b88 100644 --- a/src/debugger/CartDebug.hxx +++ b/src/debugger/CartDebug.hxx @@ -382,10 +382,10 @@ class CartDebug : public DebuggerSystem string myListFile, mySymbolFile, myCfgFile, myDisasmFile, myRomFile; /// Table of instruction mnemonics - static const char* ourTIAMnemonicR[16]; // read mode - static const char* ourTIAMnemonicW[64]; // write mode - static const char* ourIOMnemonic[24]; - static const char* ourZPMnemonic[128]; + static const char* const ourTIAMnemonicR[16]; // read mode + static const char* const ourTIAMnemonicW[64]; // write mode + static const char* const ourIOMnemonic[24]; + static const char* const ourZPMnemonic[128]; private: // Following constructors and assignment operators not supported diff --git a/src/debugger/DiStella.hxx b/src/debugger/DiStella.hxx index 7a1bce22e..43cf5fad3 100644 --- a/src/debugger/DiStella.hxx +++ b/src/debugger/DiStella.hxx @@ -174,7 +174,7 @@ class DiStella }; struct Instruction_tag { - const char* mnemonic; + const char* const mnemonic; AddressingMode addr_mode; AccessMode source; ReadWriteMode rw_mode; diff --git a/src/debugger/gui/Cart0840Widget.cxx b/src/debugger/gui/Cart0840Widget.cxx index bb1da1406..4b33fdc5a 100644 --- a/src/debugger/gui/Cart0840Widget.cxx +++ b/src/debugger/gui/Cart0840Widget.cxx @@ -82,7 +82,7 @@ string Cartridge0840Widget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { "$800", "$840" }; + static const char* const spot[] = { "$800", "$840" }; buf << "Bank = " << std::dec << myCart.myCurrentBank << ", hotspot = " << spot[myCart.myCurrentBank]; diff --git a/src/debugger/gui/CartBFSCWidget.cxx b/src/debugger/gui/CartBFSCWidget.cxx index 8fd17eff2..03ae13442 100644 --- a/src/debugger/gui/CartBFSCWidget.cxx +++ b/src/debugger/gui/CartBFSCWidget.cxx @@ -157,7 +157,7 @@ string CartridgeBFSCWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { + static const char* const spot[] = { "$FF80", "$FF81", "$FF82", "$FF83", "$FF84", "$FF85", "$FF86", "$FF87", "$FF88", "$FF89", "$FF8A", "$FF8B", "$FF8C", "$FF8D", "$FF8E", "$FF8F", "$FF90", "$FF91", "$FF92", "$FF93", "$FF94", "$FF95", "$FF96", "$FF97", diff --git a/src/debugger/gui/CartBFWidget.cxx b/src/debugger/gui/CartBFWidget.cxx index f204cbf32..48f82e589 100644 --- a/src/debugger/gui/CartBFWidget.cxx +++ b/src/debugger/gui/CartBFWidget.cxx @@ -144,7 +144,7 @@ string CartridgeBFWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { + static const char* const spot[] = { "$FF80", "$FF81", "$FF82", "$FF83", "$FF84", "$FF85", "$FF86", "$FF87", "$FF88", "$FF89", "$FF8A", "$FF8B", "$FF8C", "$FF8D", "$FF8E", "$FF8F", "$FF90", "$FF91", "$FF92", "$FF93", "$FF94", "$FF95", "$FF96", "$FF97", diff --git a/src/debugger/gui/CartBUSWidget.cxx b/src/debugger/gui/CartBUSWidget.cxx index 88e230aa2..387536e97 100644 --- a/src/debugger/gui/CartBUSWidget.cxx +++ b/src/debugger/gui/CartBUSWidget.cxx @@ -80,11 +80,11 @@ CartridgeBUSWidget::CartridgeBUSWidget( myDatastreamPointers = new DataGridWidget(boss, _nfont, DS_X, ypos+myLineHeight-2, 4, 4, 6, 32, Common::Base::F_16_3_2); myDatastreamPointers->setTarget(this); myDatastreamPointers->setEditable(false); - + myDatastreamPointers2 = new DataGridWidget(boss, _nfont, DS_X + myDatastreamPointers->getWidth() * 3 / 4, ypos+myLineHeight-2 + 4*myLineHeight, 1, 2, 6, 32, Common::Base::F_16_3_2); myDatastreamPointers2->setTarget(this); myDatastreamPointers2->setEditable(false); - + uInt32 row; for(row = 0; row < 4; ++row) { @@ -112,7 +112,7 @@ CartridgeBUSWidget::CartridgeBUSWidget( myDatastreamIncrements = new DataGridWidget(boss, _nfont, xpos, ypos+myLineHeight-2, 4, 4, 5, 32, Common::Base::F_16_2_2); myDatastreamIncrements->setTarget(this); myDatastreamIncrements->setEditable(false); - + myDatastreamIncrements2 = new DataGridWidget(boss, _nfont, xpos, ypos+myLineHeight-2 + 4*myLineHeight, 1, 2, 5, 32, Common::Base::F_16_2_2); myDatastreamIncrements2->setTarget(this); myDatastreamIncrements2->setEditable(false); @@ -155,12 +155,12 @@ CartridgeBUSWidget::CartridgeBUSWidget( myMusicWaveforms = new DataGridWidget(boss, _nfont, xpos, ypos-2, 3, 1, 4, 16, Common::Base::F_16_2); myMusicWaveforms->setTarget(this); myMusicWaveforms->setEditable(false); - + int xpossp = xpos + myMusicWaveforms->getWidth() + 20; int lwidth2 = _font.getStringWidth("Sample Pointer "); new StaticTextWidget(boss, _font, xpossp, ypos, lwidth2, myFontHeight, "Sample Pointer ", kTextAlignLeft); - + mySamplePointer = new DataGridWidget(boss, _nfont, xpossp + lwidth2, ypos-2, 1, 1, 8, 32, Common::Base::F_16_8); mySamplePointer->setTarget(this); mySamplePointer->setEditable(false); @@ -181,7 +181,7 @@ CartridgeBUSWidget::CartridgeBUSWidget( myBusOverdrive = new CheckboxWidget(boss, _font, xpos, ypos, "BUS Overdrive enabled"); myBusOverdrive->setTarget(this); myBusOverdrive->setEditable(false); - + myDigitalSample = new CheckboxWidget(boss, _font, xpossp, ypos, "Digital Sample mode"); myDigitalSample->setTarget(this); myDigitalSample->setEditable(false); @@ -225,7 +225,7 @@ void CartridgeBUSWidget::saveOldState() { myOldState.addressmaps.push_back(myCart.getAddressMap(i)); } - + for(uInt32 i = 37; i < 40; i++) // but need 40 for the grid { myOldState.addressmaps.push_back(0); @@ -245,7 +245,7 @@ void CartridgeBUSWidget::saveOldState() for(uInt32 i = 0; i < internalRamSize(); ++i) myOldState.internalram.push_back(myCart.myBUSRAM[i]); - + myOldState.samplepointer.push_back(myCart.getSample()); } @@ -277,7 +277,7 @@ void CartridgeBUSWidget::loadConfig() changed.push_back(pointervalue != myOldState.datastreampointers[i]); } myDatastreamPointers->setList(alist, vlist, changed); - + alist.clear(); vlist.clear(); changed.clear(); for(int i = 16; i < 18; ++i) { @@ -286,7 +286,7 @@ void CartridgeBUSWidget::loadConfig() changed.push_back(pointervalue != myOldState.datastreampointers[i]); } myDatastreamPointers2->setList(alist, vlist, changed); - + alist.clear(); vlist.clear(); changed.clear(); for(int i = 0; i < 16; ++i) { @@ -295,7 +295,7 @@ void CartridgeBUSWidget::loadConfig() changed.push_back(incrementvalue != myOldState.datastreamincrements[i]); } myDatastreamIncrements->setList(alist, vlist, changed); - + alist.clear(); vlist.clear(); changed.clear(); for(int i = 16; i < 18; ++i) { @@ -394,7 +394,7 @@ string CartridgeBUSWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { + static const char* const spot[] = { "$FFF5", "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB" }; buf << "Bank = " << std::dec << myCart.myCurrentBank diff --git a/src/debugger/gui/CartCDFWidget.cxx b/src/debugger/gui/CartCDFWidget.cxx index b97a478c1..04e308c83 100644 --- a/src/debugger/gui/CartCDFWidget.cxx +++ b/src/debugger/gui/CartCDFWidget.cxx @@ -357,7 +357,7 @@ string CartridgeCDFWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { + static const char* const spot[] = { "$FFF5", "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB" }; buf << "Bank = " << std::dec << myCart.myCurrentBank diff --git a/src/debugger/gui/CartCTYWidget.cxx b/src/debugger/gui/CartCTYWidget.cxx index 4d6f12ec4..428050a48 100644 --- a/src/debugger/gui/CartCTYWidget.cxx +++ b/src/debugger/gui/CartCTYWidget.cxx @@ -90,7 +90,7 @@ string CartridgeCTYWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { + static const char* const spot[] = { "", "$FFF5", "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB" }; uInt16 bank = myCart.getBank(); diff --git a/src/debugger/gui/CartDASHWidget.cxx b/src/debugger/gui/CartDASHWidget.cxx index cf617856f..0e3e38bed 100644 --- a/src/debugger/gui/CartDASHWidget.cxx +++ b/src/debugger/gui/CartDASHWidget.cxx @@ -254,7 +254,7 @@ void CartridgeDASHWidget::updateUIState() else { int bankno = segment & myCart.BIT_BANK_MASK; - const char* banktype = segment & myCart.BITMASK_ROMRAM ? "RAM" : "ROM"; + const string& banktype = segment & myCart.BITMASK_ROMRAM ? "RAM" : "ROM"; myBankNumber[i]->setSelected(bankno); myBankType[i]->setSelected(banktype); diff --git a/src/debugger/gui/CartDFSCWidget.cxx b/src/debugger/gui/CartDFSCWidget.cxx index d4450326f..90a542840 100644 --- a/src/debugger/gui/CartDFSCWidget.cxx +++ b/src/debugger/gui/CartDFSCWidget.cxx @@ -125,7 +125,7 @@ string CartridgeDFSCWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { + static const char* const spot[] = { "$FFC0", "$FFC1", "$FFC2", "$FFC3", "$FFC4", "$FFC5", "$FFC6", "$FFC7", "$FFC8", "$FFC9", "$FFCA", "$FFCB", "$FFCC", "$FFCD", "$FFCE", "$FFCF", "$FFD0", "$FFD1", "$FFD2", "$FFD3", "$FFD4", "$FFD5", "$FFD6", "$FFE7", diff --git a/src/debugger/gui/CartDFWidget.cxx b/src/debugger/gui/CartDFWidget.cxx index 00faa7e24..1cd34929f 100644 --- a/src/debugger/gui/CartDFWidget.cxx +++ b/src/debugger/gui/CartDFWidget.cxx @@ -112,7 +112,7 @@ string CartridgeDFWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { + static const char* const spot[] = { "$FFC0", "$FFC1", "$FFC2", "$FFC3", "$FFC4", "$FFC5", "$FFC6", "$FFC7", "$FFC8", "$FFC9", "$FFCA", "$FFCB", "$FFCC", "$FFCD", "$FFCE", "$FFCF", "$FFD0", "$FFD1", "$FFD2", "$FFD3", "$FFD4", "$FFD5", "$FFD6", "$FFD7", diff --git a/src/debugger/gui/CartDPCPlusWidget.cxx b/src/debugger/gui/CartDPCPlusWidget.cxx index a4ea0feaa..538e91874 100644 --- a/src/debugger/gui/CartDPCPlusWidget.cxx +++ b/src/debugger/gui/CartDPCPlusWidget.cxx @@ -324,7 +324,7 @@ string CartridgeDPCPlusWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { + static const char* const spot[] = { "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB" }; buf << "Bank = " << std::dec << myCart.myCurrentBank diff --git a/src/debugger/gui/CartDPCWidget.cxx b/src/debugger/gui/CartDPCWidget.cxx index fddf7f550..37c18bb47 100644 --- a/src/debugger/gui/CartDPCWidget.cxx +++ b/src/debugger/gui/CartDPCWidget.cxx @@ -227,7 +227,7 @@ string CartridgeDPCWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { "$FFF8", "$FFF9" }; + static const char* const spot[] = { "$FFF8", "$FFF9" }; buf << "Bank = " << std::dec << myCart.myCurrentBank << ", hotspot = " << spot[myCart.myCurrentBank]; diff --git a/src/debugger/gui/CartE0Widget.cxx b/src/debugger/gui/CartE0Widget.cxx index 7ffe02305..893ea8608 100644 --- a/src/debugger/gui/CartE0Widget.cxx +++ b/src/debugger/gui/CartE0Widget.cxx @@ -19,15 +19,15 @@ #include "PopUpWidget.hxx" #include "CartE0Widget.hxx" -static const char* seg0[] = { +static const char* const seg0[] = { "0 ($FFE0)", "1 ($FFE1)", "2 ($FFE2)", "3 ($FFE3)", "4 ($FFE4)", "5 ($FFE5)", "6 ($FFE6)", "7 ($FFE7)" }; -static const char* seg1[] = { +static const char* const seg1[] = { "0 ($FFE8)", "1 ($FFE9)", "2 ($FFEA)", "3 ($FFEB)", "4 ($FFEC)", "5 ($FFED)", "6 ($FFEE)", "7 ($FFEF)" }; -static const char* seg2[] = { +static const char* const seg2[] = { "0 ($FFF0)", "1 ($FFF1)", "2 ($FFF2)", "3 ($FFF3)", "4 ($FFF4)", "5 ($FFF5)", "6 ($FFF6)", "7 ($FFF7)" }; diff --git a/src/debugger/gui/CartE7Widget.cxx b/src/debugger/gui/CartE7Widget.cxx index 790a52bb7..e8b0b6252 100644 --- a/src/debugger/gui/CartE7Widget.cxx +++ b/src/debugger/gui/CartE7Widget.cxx @@ -19,11 +19,11 @@ #include "PopUpWidget.hxx" #include "CartE7Widget.hxx" -static const char* spot_lower[] = { +static const char* const spot_lower[] = { "0 - ROM ($FFE0)", "1 - ROM ($FFE1)", "2 - ROM ($FFE2)", "3 - ROM ($FFE3)", "4 - ROM ($FFE4)", "5 - ROM ($FFE5)", "6 - ROM ($FFE6)", "7 - RAM ($FFE7)" }; -static const char* spot_upper[] = { +static const char* const spot_upper[] = { "0 - RAM ($FFE8)", "1 - RAM ($FFE9)", "2 - RAM ($FFEA)", "3 - RAM ($FFEB)" }; diff --git a/src/debugger/gui/CartEFSCWidget.cxx b/src/debugger/gui/CartEFSCWidget.cxx index 838a39aa1..6e97bec34 100644 --- a/src/debugger/gui/CartEFSCWidget.cxx +++ b/src/debugger/gui/CartEFSCWidget.cxx @@ -109,7 +109,7 @@ string CartridgeEFSCWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { + static const char* const spot[] = { "$FFE0", "$FFE1", "$FFE2", "$FFE3", "$FFE4", "$FFE5", "$FFE6", "$FFE7", "$FFE8", "$FFE9", "$FFEA", "$FFEB", "$FFEC", "$FFED", "$FFEE", "$FFEF" }; diff --git a/src/debugger/gui/CartEFWidget.cxx b/src/debugger/gui/CartEFWidget.cxx index 9eda82221..2ce7b5fbd 100644 --- a/src/debugger/gui/CartEFWidget.cxx +++ b/src/debugger/gui/CartEFWidget.cxx @@ -96,7 +96,7 @@ string CartridgeEFWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { + static const char* const spot[] = { "$FFE0", "$FFE1", "$FFE2", "$FFE3", "$FFE4", "$FFE5", "$FFE6", "$FFE7", "$FFE8", "$FFE9", "$FFEA", "$FFEB", "$FFEC", "$FFED", "$FFEE", "$FFEF" }; diff --git a/src/debugger/gui/CartF4SCWidget.cxx b/src/debugger/gui/CartF4SCWidget.cxx index 1452bf531..98d67e952 100644 --- a/src/debugger/gui/CartF4SCWidget.cxx +++ b/src/debugger/gui/CartF4SCWidget.cxx @@ -100,7 +100,7 @@ string CartridgeF4SCWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { + static const char* const spot[] = { "$FFF4", "$FFF5", "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB" }; buf << "Bank = " << std::dec << myCart.myCurrentBank diff --git a/src/debugger/gui/CartF4Widget.cxx b/src/debugger/gui/CartF4Widget.cxx index a1a0ab95b..df62423ea 100644 --- a/src/debugger/gui/CartF4Widget.cxx +++ b/src/debugger/gui/CartF4Widget.cxx @@ -87,7 +87,7 @@ string CartridgeF4Widget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { + static const char* const spot[] = { "$FFF4", "$FFF5", "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB" }; buf << "Bank = " << std::dec << myCart.myCurrentBank diff --git a/src/debugger/gui/CartF6SCWidget.cxx b/src/debugger/gui/CartF6SCWidget.cxx index 62aa33ce7..4ba888d0f 100644 --- a/src/debugger/gui/CartF6SCWidget.cxx +++ b/src/debugger/gui/CartF6SCWidget.cxx @@ -96,7 +96,7 @@ string CartridgeF6SCWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { "$FFF6", "$FFF7", "$FFF8", "$FFF9" }; + static const char* const spot[] = { "$FFF6", "$FFF7", "$FFF8", "$FFF9" }; buf << "Bank = " << std::dec << myCart.myCurrentBank << ", hotspot = " << spot[myCart.myCurrentBank]; diff --git a/src/debugger/gui/CartF6Widget.cxx b/src/debugger/gui/CartF6Widget.cxx index 971afd96d..3bd34235b 100644 --- a/src/debugger/gui/CartF6Widget.cxx +++ b/src/debugger/gui/CartF6Widget.cxx @@ -83,7 +83,7 @@ string CartridgeF6Widget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { "$FFF6", "$FFF7", "$FFF8", "$FFF9" }; + static const char* const spot[] = { "$FFF6", "$FFF7", "$FFF8", "$FFF9" }; buf << "Bank = " << std::dec << myCart.myCurrentBank << ", hotspot = " << spot[myCart.myCurrentBank]; diff --git a/src/debugger/gui/CartF8SCWidget.cxx b/src/debugger/gui/CartF8SCWidget.cxx index 7b16242ad..78b256714 100644 --- a/src/debugger/gui/CartF8SCWidget.cxx +++ b/src/debugger/gui/CartF8SCWidget.cxx @@ -94,7 +94,7 @@ string CartridgeF8SCWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { "$FFF8", "$FFF9" }; + static const char* const spot[] = { "$FFF8", "$FFF9" }; buf << "Bank = " << std::dec << myCart.myCurrentBank << ", hotspot = " << spot[myCart.myCurrentBank]; diff --git a/src/debugger/gui/CartF8Widget.cxx b/src/debugger/gui/CartF8Widget.cxx index 3070a61bc..416f1d427 100644 --- a/src/debugger/gui/CartF8Widget.cxx +++ b/src/debugger/gui/CartF8Widget.cxx @@ -81,7 +81,7 @@ string CartridgeF8Widget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { "$FFF8", "$FFF9" }; + static const char* const spot[] = { "$FFF8", "$FFF9" }; buf << "Bank = " << std::dec << myCart.myCurrentBank << ", hotspot = " << spot[myCart.myCurrentBank]; diff --git a/src/debugger/gui/CartFA2Widget.cxx b/src/debugger/gui/CartFA2Widget.cxx index 7e86f2252..5827abb13 100644 --- a/src/debugger/gui/CartFA2Widget.cxx +++ b/src/debugger/gui/CartFA2Widget.cxx @@ -146,7 +146,7 @@ string CartridgeFA2Widget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { + static const char* const spot[] = { "$FFF5", "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB" }; buf << "Bank = " << std::dec << myCart.myCurrentBank diff --git a/src/debugger/gui/CartFAWidget.cxx b/src/debugger/gui/CartFAWidget.cxx index bbd6a04f0..b41496cb9 100644 --- a/src/debugger/gui/CartFAWidget.cxx +++ b/src/debugger/gui/CartFAWidget.cxx @@ -95,7 +95,7 @@ string CartridgeFAWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { "$FFF8", "$FFF9", "$FFFA" }; + static const char* const spot[] = { "$FFF8", "$FFF9", "$FFFA" }; buf << "Bank = " << std::dec << myCart.myCurrentBank << ", hotspot = " << spot[myCart.myCurrentBank]; diff --git a/src/debugger/gui/CartFEWidget.cxx b/src/debugger/gui/CartFEWidget.cxx index 86b7a9754..db779620b 100644 --- a/src/debugger/gui/CartFEWidget.cxx +++ b/src/debugger/gui/CartFEWidget.cxx @@ -43,7 +43,7 @@ string CartridgeFEWidget::bankState() { ostringstream& buf = buffer(); - static const char* range[] = { "$F000", "$D000" }; + static const char* const range[] = { "$F000", "$D000" }; buf << "Bank = " << std::dec << myCart.getBank() << ", address range = " << range[myCart.getBank()]; diff --git a/src/debugger/gui/CartUAWidget.cxx b/src/debugger/gui/CartUAWidget.cxx index 5a80a5745..1503ad13e 100644 --- a/src/debugger/gui/CartUAWidget.cxx +++ b/src/debugger/gui/CartUAWidget.cxx @@ -82,7 +82,7 @@ string CartridgeUAWidget::bankState() { ostringstream& buf = buffer(); - static const char* spot[] = { "$200", "$240" }; + static const char* const spot[] = { "$200", "$240" }; buf << "Bank = " << std::dec << myCart.myCurrentBank << ", hotspot = " << spot[myCart.myCurrentBank]; diff --git a/src/debugger/gui/CartWDWidget.cxx b/src/debugger/gui/CartWDWidget.cxx index ce36cb015..71072cb94 100644 --- a/src/debugger/gui/CartWDWidget.cxx +++ b/src/debugger/gui/CartWDWidget.cxx @@ -98,7 +98,7 @@ string CartridgeWDWidget::bankState() { ostringstream& buf = buffer(); - static const char* segments[] = { + static const char* const segments[] = { "[0,0,1,2]", "[0,1,3,2]", "[4,5,6,7]", "[7,4,3,2]", "[0,0,6,7]", "[0,1,7,6]", "[3,2,4,5]", "[6,0,5,1]", "[0,0,1,2]", "[0,1,3,2]", "[4,5,6,7]", "[7,4,3,2]", diff --git a/src/debugger/gui/CpuWidget.cxx b/src/debugger/gui/CpuWidget.cxx index 438c94107..dba3b9ab7 100644 --- a/src/debugger/gui/CpuWidget.cxx +++ b/src/debugger/gui/CpuWidget.cxx @@ -117,8 +117,8 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n // Set the strings to be used in the PSRegister // We only do this once because it's the state that changes, not the strings - const char* offstr[] = { "n", "v", "-", "b", "d", "i", "z", "c" }; - const char* onstr[] = { "N", "V", "-", "B", "D", "I", "Z", "C" }; + const char* const offstr[] = { "n", "v", "-", "b", "d", "i", "z", "c" }; + const char* const onstr[] = { "N", "V", "-", "B", "D", "I", "Z", "C" }; StringList off, on; for(int i = 0; i < 8; ++i) { diff --git a/src/debugger/gui/RiotWidget.cxx b/src/debugger/gui/RiotWidget.cxx index 5adb3ab17..f7d425775 100644 --- a/src/debugger/gui/RiotWidget.cxx +++ b/src/debugger/gui/RiotWidget.cxx @@ -97,7 +97,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, CREATE_IO_REGS("SWCHB(R)", mySWCHBReadBits, 0, false); // Timer registers (R/W) - const char* writeNames[] = { "TIM1T", "TIM8T", "TIM64T", "T1024T" }; + const char* const writeNames[] = { "TIM1T", "TIM8T", "TIM64T", "T1024T" }; xpos = 10; ypos += 2*lineHeight; for(int row = 0; row < 4; ++row) { @@ -111,7 +111,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, addFocusWidget(myTimWrite); // Timer registers (RO) - const char* readNames[] = { "INTIM", "TIMINT", "Total Clks", "INTIM Clks" }; + const char* const readNames[] = { "INTIM", "TIMINT", "Total Clks", "INTIM Clks" }; xpos = 10; ypos += myTimWrite->getHeight() + lineHeight; for(int row = 0; row < 4; ++row) { @@ -133,7 +133,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, riot.controller(Controller::Right)); // TIA INPTx registers (R), left port - const char* contLeftReadNames[] = { "INPT0", "INPT1", "INPT4" }; + const char* const contLeftReadNames[] = { "INPT0", "INPT1", "INPT4" }; xpos = col; ypos += myLeftControl->getHeight() + 2 * lineHeight; for(int row = 0; row < 3; ++row) { @@ -146,7 +146,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, myLeftINPT->setEditable(false); // TIA INPTx registers (R), right port - const char* contRightReadNames[] = { "INPT2", "INPT3", "INPT5" }; + const char* const contRightReadNames[] = { "INPT2", "INPT3", "INPT5" }; xpos = col + myLeftControl->getWidth() + 15; for(int row = 0; row < 3; ++row) { @@ -230,7 +230,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, new StaticTextWidget(boss, lfont, xpos, ypos+1, lwidth, fontHeight, "Randomize CPU ", kTextAlignLeft); xpos += lwidth + 10; - const char* cpuregs[] = { "SP", "A", "X", "Y", "PS" }; + const char* const cpuregs[] = { "SP", "A", "X", "Y", "PS" }; for(int i = 0; i < 5; ++i) { myRandomizeCPU[i] = new CheckboxWidget(boss, lfont, xpos, ypos+1, @@ -340,7 +340,7 @@ void RiotWidget::loadConfig() myRandomizeRAM->setState(instance().settings().getBool("ramrandom")); const string& cpurandom = instance().settings().getString("cpurandom"); - const char* cpuregs[] = { "S", "A", "X", "Y", "P" }; + const char* const cpuregs[] = { "S", "A", "X", "Y", "P" }; for(int i = 0; i < 5; ++i) myRandomizeCPU[i]->setState(BSPF::containsIgnoreCase(cpurandom, cpuregs[i])); } @@ -473,7 +473,7 @@ ControllerWidget* RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font& void RiotWidget::handleRandomCPU() { string cpurandom; - const char* cpuregs[] = { "S", "A", "X", "Y", "P" }; + const char* const cpuregs[] = { "S", "A", "X", "Y", "P" }; for(int i = 0; i < 5; ++i) if(myRandomizeCPU[i]->getState()) cpurandom += cpuregs[i]; diff --git a/src/debugger/gui/TiaWidget.cxx b/src/debugger/gui/TiaWidget.cxx index 04933df14..b78bc60f7 100644 --- a/src/debugger/gui/TiaWidget.cxx +++ b/src/debugger/gui/TiaWidget.cxx @@ -46,7 +46,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, ButtonWidget* b = nullptr; // Color registers - const char* regNames[] = { "COLUP0", "COLUP1", "COLUPF", "COLUBK" }; + const char* const regNames[] = { "COLUP0", "COLUP1", "COLUPF", "COLUBK" }; for(int row = 0; row < 4; ++row) { new StaticTextWidget(boss, lfont, xpos, ypos + row*lineHeight + 2, @@ -85,7 +85,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, myFixedEnabled->setTarget(this); addFocusWidget(myFixedEnabled); - const char* dbgLabels[] = { "P0", "P1", "PF", "BK", "M0", "M1", "BL", "HM" }; + const char* const dbgLabels[] = { "P0", "P1", "PF", "BK", "M0", "M1", "BL", "HM" }; for(uInt32 row = 0; row <= 3; ++row) { ypos += lineHeight; @@ -115,8 +115,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, // Add all 15 collision bits (with labels) uInt32 cxclrY = 0; xpos -= 2*fontWidth + 5; ypos += lineHeight; - const char* rowLabel[] = { "P0", "P1", "M0", "M1", "BL" }; - const char* colLabel[] = { "PF", "BL", "M1", "M0", "P1" }; + const char* const rowLabel[] = { "P0", "P1", "M0", "M1", "BL" }; + const char* const colLabel[] = { "PF", "BL", "M1", "M0", "P1" }; uInt32 lwidth = 2*fontWidth, collX = xpos + lwidth + 5, collY = ypos, idx = 0; for(uInt32 row = 0; row < 5; ++row) { @@ -534,7 +534,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& sf = instance().frameBuffer().smallFont(); const int sfWidth = sf.getMaxCharWidth(), sfHeight = sf.getFontHeight(); - const char* bitNames[] = { "0", "1", "2", "3", "4", "5", "6", "7" }; + const char* const bitNames[] = { "0", "1", "2", "3", "4", "5", "6", "7" }; // PF0 xpos = 10; ypos += lineHeight + sfHeight + 6; diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index ee33947c4..d6dc58b5e 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -358,7 +358,8 @@ class EventHandler /** Returns the human-readable name for a StellaKey. */ - virtual const char* nameForKey(StellaKey key) const { return EmptyString.c_str(); } + virtual const char* const nameForKey(StellaKey key) const + { return EmptyString.c_str(); } /** Collects and dispatches any pending events. diff --git a/src/emucore/KidVid.cxx b/src/emucore/KidVid.cxx index c1a485055..52eb4d759 100644 --- a/src/emucore/KidVid.cxx +++ b/src/emucore/KidVid.cxx @@ -165,7 +165,7 @@ cerr << "myTape = " << myTape << endl; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void KidVid::openSampleFile() { - static const char* kvNameTable[6] = { + static const char* const kvNameTable[6] = { "kvs3.wav", "kvs1.wav", "kvs2.wav", "kvb3.wav", "kvb1.wav", "kvb2.wav" }; static uInt32 StartSong[6] = { diff --git a/src/emucore/Thumbulator.cxx b/src/emucore/Thumbulator.cxx index c3dcf21ae..9363b642e 100644 --- a/src/emucore/Thumbulator.cxx +++ b/src/emucore/Thumbulator.cxx @@ -129,7 +129,7 @@ inline int Thumbulator::fatalError(const char* opcode, uInt32 v1, const char* ms // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - inline int Thumbulator::fatalError(const char* opcode, uInt32 v1, uInt32 v2, - const char* msg) + const char* msg) { statusMsg << "Thumb ARM emulation fatal error: " << endl << opcode << "(" << Base::HEX8 << v1 << "," << v2 << "), " << msg << endl; diff --git a/src/gui/Font.hxx b/src/gui/Font.hxx index 2d2df84da..e4ea5c9d2 100644 --- a/src/gui/Font.hxx +++ b/src/gui/Font.hxx @@ -35,7 +35,7 @@ struct BBX /* based on The Microwindows Project http://microwindows.org */ struct FontDesc { - const char* name; /* font name */ + const char* const name; /* font name */ int maxwidth; /* max width in pixels */ int height; /* height in pixels */ int fbbw, fbbh, fbbx, fbby; /* max bounding box */ diff --git a/src/gui/LauncherFilterDialog.cxx b/src/gui/LauncherFilterDialog.cxx index a1a553d9a..e1f58d4e4 100644 --- a/src/gui/LauncherFilterDialog.cxx +++ b/src/gui/LauncherFilterDialog.cxx @@ -121,7 +121,7 @@ bool LauncherFilterDialog::isValidRomName(const string& name, string::size_type idx = name.find_last_of('.'); if(idx != string::npos) { - const char* ext = name.c_str() + idx + 1; + const char* const ext = name.c_str() + idx + 1; for(const auto& s: exts) if(BSPF::equalsIgnoreCase(ext, s)) @@ -138,7 +138,7 @@ bool LauncherFilterDialog::isValidRomName(const FilesystemNode& node, string& ex string::size_type idx = name.find_last_of('.'); if(idx != string::npos) { - const char* e = name.c_str() + idx + 1; + const char* const e = name.c_str() + idx + 1; for(uInt32 i = 0; i < 5; ++i) { @@ -249,7 +249,7 @@ void LauncherFilterDialog::handleCommand(CommandSender* sender, int cmd, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const char* LauncherFilterDialog::ourRomTypes[2][5] = { +const char* const LauncherFilterDialog::ourRomTypes[2][5] = { { ".a26", ".bin", ".rom", ".zip", ".gz" }, { "a26", "bin", "rom", "zip", "gz" } }; diff --git a/src/gui/LauncherFilterDialog.hxx b/src/gui/LauncherFilterDialog.hxx index 070424b8e..eacc87654 100644 --- a/src/gui/LauncherFilterDialog.hxx +++ b/src/gui/LauncherFilterDialog.hxx @@ -72,7 +72,7 @@ class LauncherFilterDialog : public Dialog, public CommandSender }; // Holds static strings representing ROM types - static const char* ourRomTypes[2][5]; + static const char* const ourRomTypes[2][5]; private: // Following constructors and assignment operators not supported diff --git a/src/macosx/SDLMain.m b/src/macosx/SDLMain.m index fb17d9c3e..220f03197 100644 --- a/src/macosx/SDLMain.m +++ b/src/macosx/SDLMain.m @@ -123,8 +123,8 @@ static int IsRootCwd() static int IsTenPointNineOrLater() { - /* -instancesRespondToSelector is available in 10.9, but it says that it's - available in 10.10. Either way, if it's there, we're on 10.9 or higher: + /* -instancesRespondToSelector is available in 10.9, but it says that it's + available in 10.10. Either way, if it's there, we're on 10.9 or higher: just return true so we don't clobber the user's console with this. */ if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) { return 1; diff --git a/src/tools/evdev-joystick/evdev-joystick.c b/src/tools/evdev-joystick/evdev-joystick.c index 4440d6651..9d5c27f09 100644 --- a/src/tools/evdev-joystick/evdev-joystick.c +++ b/src/tools/evdev-joystick/evdev-joystick.c @@ -88,7 +88,7 @@ void listDevices() int devlen = strlen(dp->d_name); if(devlen >= len) { - const char* start = dp->d_name + devlen - len; + const char* const start = dp->d_name + devlen - len; if(strncmp(start, "event-joystick", len) == 0) printf("%s%s\n", EVDEV_DIR, dp->d_name); }