My neverending quest to protect against raw pointers.

Changed many 'const char* ...' to 'const char* const ...'.
This commit is contained in:
Stephen Anthony 2017-07-02 20:46:27 -02:30
parent 9972af022a
commit 7b57d52260
46 changed files with 85 additions and 84 deletions

View File

@ -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

View File

@ -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

View File

@ -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));
}

View File

@ -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"; }

View File

@ -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",

View File

@ -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;

View File

@ -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",

View File

@ -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

View File

@ -174,7 +174,7 @@ class DiStella
};
struct Instruction_tag {
const char* mnemonic;
const char* const mnemonic;
AddressingMode addr_mode;
AccessMode source;
ReadWriteMode rw_mode;

View File

@ -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];

View File

@ -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",

View File

@ -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",

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -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);

View File

@ -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",

View File

@ -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",

View File

@ -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

View File

@ -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];

View File

@ -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)"
};

View File

@ -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)"
};

View File

@ -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"
};

View File

@ -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"
};

View File

@ -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

View File

@ -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

View File

@ -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];

View File

@ -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];

View File

@ -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];

View File

@ -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];

View File

@ -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

View File

@ -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];

View File

@ -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()];

View File

@ -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];

View File

@ -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]",

View File

@ -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)
{

View File

@ -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];

View File

@ -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;

View File

@ -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.

View File

@ -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] = {

View File

@ -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;

View File

@ -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 */

View File

@ -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" }
};

View File

@ -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

View File

@ -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;

View File

@ -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);
}