First pass at code cleanup from enabling higher levels of warnings in clang/gcc.

This commit is contained in:
Stephen Anthony 2017-10-11 12:23:54 -02:30
parent 5883f2dfcc
commit 35624553b6
71 changed files with 150 additions and 154 deletions

View File

@ -55,7 +55,7 @@ class FilesystemNodeFactory
return new FilesystemNodeZIP(path); return new FilesystemNodeZIP(path);
break; break;
} }
return 0; return nullptr;
} }
private: private:

View File

@ -108,7 +108,7 @@ void PNGLibrary::loadImage(const string& filename, FBSurface& surface)
// Cleanup // Cleanup
done: done:
if(png_ptr) if(png_ptr)
png_destroy_read_struct(&png_ptr, info_ptr ? &info_ptr : 0, 0); png_destroy_read_struct(&png_ptr, info_ptr ? &info_ptr : nullptr, nullptr);
if(err_message) if(err_message)
throw runtime_error(err_message); throw runtime_error(err_message);

View File

@ -140,8 +140,8 @@ class PNGLibrary
static void png_read_data(png_structp ctx, png_bytep area, png_size_t size); static void png_read_data(png_structp ctx, png_bytep area, png_size_t size);
static void png_write_data(png_structp ctx, png_bytep area, png_size_t size); static void png_write_data(png_structp ctx, png_bytep area, png_size_t size);
static void png_io_flush(png_structp ctx); static void png_io_flush(png_structp ctx);
static void png_user_warn(png_structp ctx, png_const_charp str); [[noreturn]] static void png_user_warn(png_structp ctx, png_const_charp str);
static void png_user_error(png_structp ctx, png_const_charp str); [[noreturn]] static void png_user_error(png_structp ctx, png_const_charp str);
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported

View File

@ -29,7 +29,7 @@
#include "StateManager.hxx" #include "StateManager.hxx"
#define STATE_HEADER "05000302state" #define STATE_HEADER "05000302state"
#define MOVIE_HEADER "03030000movie" // #define MOVIE_HEADER "03030000movie"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StateManager::StateManager(OSystem& osystem) StateManager::StateManager(OSystem& osystem)

View File

@ -168,7 +168,6 @@ bool ZipHandler::stream_read(fstream* stream, void* buffer, uInt64 offset,
{ {
return false; return false;
} }
return false;
} }

View File

@ -56,12 +56,12 @@ void AtariNTSC::initializePalette(const uInt8* palette)
uInt32* kernel = myColorTable[entry]; uInt32* kernel = myColorTable[entry];
genKernel(myImpl, y, i, q, kernel); genKernel(myImpl, y, i, q, kernel);
for ( uInt32 i = 0; i < rgb_kernel_size / 2; i++ ) for ( uInt32 c = 0; c < rgb_kernel_size / 2; ++c )
{ {
uInt32 error = rgb - uInt32 error = rgb -
kernel [i ] - kernel [(i+10)%14+14] - kernel [c ] - kernel [(c+10)%14+14] -
kernel [i + 7] - kernel [i + 3 +14]; kernel [c + 7] - kernel [c + 3 +14];
kernel [i + 3 + 14] += error; kernel [c + 3 + 14] += error;
} }
} }
} }

View File

@ -123,7 +123,7 @@ class AtariNTSC
Used to calculate an averaged color for the 'phosphor' effect. Used to calculate an averaged color for the 'phosphor' effect.
@param c RGB Color 1 (current frame) @param c RGB Color 1 (current frame)
@param p RGB Color 2 (previous frame) @param cp RGB Color 2 (previous frame)
@return Averaged value of the two RGB colors @return Averaged value of the two RGB colors
*/ */

View File

@ -723,7 +723,7 @@ string CartDebug::loadListFile()
if(addr_s.length() == 0) if(addr_s.length() == 0)
continue; continue;
const char* p = addr_s[0] == 'U' ? addr_s.c_str() + 1 : addr_s.c_str(); 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, nullptr, 16));
// For now, completely ignore ROM addresses // For now, completely ignore ROM addresses
if(!(addr & 0x1000)) if(!(addr & 0x1000))
@ -1462,8 +1462,10 @@ const char* const CartDebug::ourTIAMnemonicW[64] = {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* const CartDebug::ourIOMnemonic[24] = { const char* const CartDebug::ourIOMnemonic[24] = {
"SWCHA", "SWACNT", "SWCHB", "SWBCNT", "INTIM", "TIMINT", 0, 0, 0, 0, 0, "SWCHA", "SWACNT", "SWCHB", "SWBCNT", "INTIM", "TIMINT",
0, 0, 0, 0, 0, 0, 0, 0, 0, "TIM1T", "TIM8T", "TIM64T", "T1024T" "$286", "$287", "$288", "$289", "$28a", "$28b", "$28c",
"$28d", "$28e", "$28f", "$290", "$291", "$292", "$293",
"TIM1T", "TIM8T", "TIM64T", "T1024T"
}; };
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -59,6 +59,7 @@
Debugger* Debugger::myStaticDebugger = nullptr; Debugger* Debugger::myStaticDebugger = nullptr;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// FIXME - use a vector for this
static const char* const builtin_functions[][3] = { static const char* const builtin_functions[][3] = {
// { "name", "definition", "help text" } // { "name", "definition", "help text" }
@ -91,6 +92,7 @@ static const char* const builtin_functions[][3] = {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Names are defined here, but processed in YaccParser // Names are defined here, but processed in YaccParser
// FIXME - use a vector for this
static const char* const pseudo_registers[][2] = { static const char* const pseudo_registers[][2] = {
// { "name", "help text" } // { "name", "help text" }

View File

@ -349,8 +349,8 @@ bool TIADebug::collision(CollisionBit id) const
case Cx_BLPF: return myTIA.collCXBLPF() & 0x80; case Cx_BLPF: return myTIA.collCXBLPF() & 0x80;
case Cx_P0P1: return myTIA.collCXPPMM() & 0x80; case Cx_P0P1: return myTIA.collCXPPMM() & 0x80;
case Cx_M0M1: return myTIA.collCXPPMM() & 0x40; case Cx_M0M1: return myTIA.collCXPPMM() & 0x40;
default: return false; // make compiler happy
} }
return false; // make compiler happy
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -703,13 +703,13 @@ int TIADebug::frameCycles() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int TIADebug::cyclesLo() const int TIADebug::cyclesLo() const
{ {
return (int)myTIA.cycles(); return int(myTIA.cycles());
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int TIADebug::cyclesHi() const int TIADebug::cyclesHi() const
{ {
return (int)(myTIA.cycles() >> 32); return int(myTIA.cycles() >> 32);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -324,7 +324,7 @@ void CartridgeBUSWidget::loadConfig()
for(int i = 0; i < 3; ++i) for(int i = 0; i < 3; ++i)
{ {
alist.push_back(0); vlist.push_back(myCart.myMusicCounters[i]); alist.push_back(0); vlist.push_back(myCart.myMusicCounters[i]);
changed.push_back(myCart.myMusicCounters[i] != (uInt32)myOldState.mcounters[i]); changed.push_back(myCart.myMusicCounters[i] != uInt32(myOldState.mcounters[i]));
} }
myMusicCounters->setList(alist, vlist, changed); myMusicCounters->setList(alist, vlist, changed);
@ -332,7 +332,7 @@ void CartridgeBUSWidget::loadConfig()
for(int i = 0; i < 3; ++i) for(int i = 0; i < 3; ++i)
{ {
alist.push_back(0); vlist.push_back(myCart.myMusicFrequencies[i]); alist.push_back(0); vlist.push_back(myCart.myMusicFrequencies[i]);
changed.push_back(myCart.myMusicFrequencies[i] != (uInt32)myOldState.mfreqs[i]); changed.push_back(myCart.myMusicFrequencies[i] != uInt32(myOldState.mfreqs[i]));
} }
myMusicFrequencies->setList(alist, vlist, changed); myMusicFrequencies->setList(alist, vlist, changed);

View File

@ -213,7 +213,7 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod)
{ {
str[i] = buffer(_promptStartPos + i) & 0x7f; str[i] = buffer(_promptStartPos + i) & 0x7f;
// whitespace characters // whitespace characters
if(strchr("{*@<> =[]()+-/&|!^~%", str[i]) != NULL ) if(strchr("{*@<> =[]()+-/&|!^~%", str[i]))
{ {
lastDelimPos = i; lastDelimPos = i;
delimiter = str[i]; delimiter = str[i];

View File

@ -115,7 +115,6 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
default: // TODO - properly handle all other cases default: // TODO - properly handle all other cases
return false; return false;
} }
return false;
}; };
setTextFilter(f); setTextFilter(f);
} }

View File

@ -561,7 +561,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
addFocusWidget(myPF[2]); addFocusWidget(myPF[2]);
// PFx bit labels // PFx bit labels
auto start = [&](int w) { return (w - sfWidth) / 2; }; auto start = [&](int sw) { return (sw - sfWidth) / 2; };
int colw = myPF[0]->getWidth() / 4; int colw = myPF[0]->getWidth() / 4;
xpos = 10 + 2*fontWidth + 5 + start(colw); xpos = 10 + 2*fontWidth + 5 + start(colw);
int _ypos = ypos - sfHeight; int _ypos = ypos - sfHeight;

View File

@ -178,7 +178,7 @@ bool Cartridge3E::bank(uInt16 bank)
mySystem->setPageAccess(addr, access); mySystem->setPageAccess(addr, access);
} }
access.directPeekBase = 0; access.directPeekBase = nullptr;
access.type = System::PA_WRITE; access.type = System::PA_WRITE;
// Map write-port RAM image into the system // Map write-port RAM image into the system

View File

@ -53,7 +53,7 @@ void Cartridge4KSC::install(System& system)
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0; access.directPokeBase = nullptr;
access.type = System::PA_READ; access.type = System::PA_READ;
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{ {

View File

@ -58,7 +58,7 @@ void CartridgeBFSC::install(System& system)
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0; access.directPokeBase = nullptr;
access.type = System::PA_READ; access.type = System::PA_READ;
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{ {

View File

@ -65,7 +65,8 @@ CartridgeBUS::CartridgeBUS(const BytePtr& image, uInt32 size,
#ifdef THUMB_SUPPORT #ifdef THUMB_SUPPORT
// Create Thumbulator ARM emulator // Create Thumbulator ARM emulator
myThumbEmulator = make_unique<Thumbulator>((uInt16*)myImage, (uInt16*)myBUSRAM, myThumbEmulator = make_unique<Thumbulator>(
reinterpret_cast<uInt16*>(myImage), reinterpret_cast<uInt16*>(myBUSRAM),
settings.getBool("thumb.trapfatal"), Thumbulator::ConfigureFor::BUS, this); settings.getBool("thumb.trapfatal"), Thumbulator::ConfigureFor::BUS, this);
#endif #endif
setInitialState(); setInitialState();
@ -528,7 +529,6 @@ uInt32 CartridgeBUS::thumbCallback(uInt8 function, uInt32 value1, uInt32 value2)
// _GetWavePtr - return the counter // _GetWavePtr - return the counter
case 2: case 2:
return myMusicCounters[value1]; return myMusicCounters[value1];
break;
// _SetWaveSize - set size of waveform buffer // _SetWaveSize - set size of waveform buffer
case 3: case 3:

View File

@ -69,9 +69,9 @@ CartridgeCDF::CartridgeCDF(const BytePtr& image, uInt32 size,
#ifdef THUMB_SUPPORT #ifdef THUMB_SUPPORT
// Create Thumbulator ARM emulator // Create Thumbulator ARM emulator
myThumbEmulator = make_unique<Thumbulator>( myThumbEmulator = make_unique<Thumbulator>(
(uInt16*)myImage, (uInt16*)myCDFRAM, settings.getBool("thumb.trapfatal"), reinterpret_cast<uInt16*>(myImage), reinterpret_cast<uInt16*>(myCDFRAM),
myVersion ? Thumbulator::ConfigureFor::CDF1 : Thumbulator::ConfigureFor::CDF, settings.getBool("thumb.trapfatal"), myVersion ?
this); Thumbulator::ConfigureFor::CDF1 : Thumbulator::ConfigureFor::CDF, this);
#endif #endif
setInitialState(); setInitialState();
} }
@ -465,7 +465,6 @@ uInt32 CartridgeCDF::thumbCallback(uInt8 function, uInt32 value1, uInt32 value2)
// _GetWavePtr - return the counter // _GetWavePtr - return the counter
case 2: case 2:
return myMusicCounters[value1]; return myMusicCounters[value1];
break;
// _SetWaveSize - set size of waveform buffer // _SetWaveSize - set size of waveform buffer
case 3: case 3:

View File

@ -143,7 +143,7 @@ bool CartridgeCM::bank(uInt16 bank)
if((mySWCHA & 0x30) == 0x20) if((mySWCHA & 0x30) == 0x20)
access.directPokeBase = &myRAM[addr & 0x7FF]; access.directPokeBase = &myRAM[addr & 0x7FF];
else else
access.directPokeBase = 0; access.directPokeBase = nullptr;
mySystem->setPageAccess(addr, access); mySystem->setPageAccess(addr, access);
} }

View File

@ -74,8 +74,8 @@ void CartridgeCV::install(System& system)
} }
// Set the page accessing method for the RAM writing pages // Set the page accessing method for the RAM writing pages
access.directPeekBase = 0; access.directPeekBase = nullptr;
access.codeAccessBase = 0; access.codeAccessBase = nullptr;
access.type = System::PA_WRITE; access.type = System::PA_WRITE;
for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE)
{ {
@ -84,7 +84,7 @@ void CartridgeCV::install(System& system)
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0; access.directPokeBase = nullptr;
access.type = System::PA_READ; access.type = System::PA_READ;
for(uInt16 addr = 0x1000; addr < 0x1400; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1000; addr < 0x1400; addr += System::PAGE_SIZE)
{ {

View File

@ -58,8 +58,8 @@ void CartridgeCVPlus::install(System& system)
mySystem->setPageAccess(addr, access); mySystem->setPageAccess(addr, access);
// Set the page accessing method for the RAM writing pages // Set the page accessing method for the RAM writing pages
access.directPeekBase = 0; access.directPeekBase = nullptr;
access.codeAccessBase = 0; access.codeAccessBase = nullptr;
access.type = System::PA_WRITE; access.type = System::PA_WRITE;
for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE)
{ {
@ -69,7 +69,7 @@ void CartridgeCVPlus::install(System& system)
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0; access.directPokeBase = nullptr;
access.type = System::PA_READ; access.type = System::PA_READ;
for(uInt16 addr = 0x1000; addr < 0x1400; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1000; addr < 0x1400; addr += System::PAGE_SIZE)
{ {

View File

@ -58,7 +58,7 @@ void CartridgeDFSC::install(System& system)
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0; access.directPokeBase = nullptr;
access.type = System::PA_READ; access.type = System::PA_READ;
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{ {

View File

@ -57,7 +57,7 @@ void CartridgeE0::install(System& system)
myCurrentSlice[3] = 7; myCurrentSlice[3] = 7;
// Set the page accessing methods for the hot spots in the last segment // Set the page accessing methods for the hot spots in the last segment
access.directPeekBase = 0; access.directPeekBase = nullptr;
access.codeAccessBase = &myCodeAccessBase[8128]; access.codeAccessBase = &myCodeAccessBase[8128];
access.type = System::PA_READ; access.type = System::PA_READ;
for(uInt16 addr = (0x1FE0 & ~System::PAGE_MASK); addr < 0x2000; for(uInt16 addr = (0x1FE0 & ~System::PAGE_MASK); addr < 0x2000;

View File

@ -162,7 +162,7 @@ void CartridgeE7::bankRAM(uInt16 bank)
} }
// Set the page accessing method for the 256 bytes of RAM reading pages // Set the page accessing method for the 256 bytes of RAM reading pages
access.directPokeBase = 0; access.directPokeBase = nullptr;
access.type = System::PA_READ; access.type = System::PA_READ;
for(uInt16 addr = 0x1900; addr < 0x1A00; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1900; addr < 0x1A00; addr += System::PAGE_SIZE)
{ {
@ -208,7 +208,7 @@ bool CartridgeE7::bank(uInt16 slice)
} }
// Set the page accessing method for the 1K slice of RAM reading pages // Set the page accessing method for the 1K slice of RAM reading pages
access.directPokeBase = 0; access.directPokeBase = nullptr;
access.type = System::PA_READ; access.type = System::PA_READ;
for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE)
{ {

View File

@ -58,7 +58,7 @@ void CartridgeEFSC::install(System& system)
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0; access.directPokeBase = nullptr;
access.type = System::PA_READ; access.type = System::PA_READ;
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{ {

View File

@ -58,7 +58,7 @@ void CartridgeF4SC::install(System& system)
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0; access.directPokeBase = nullptr;
access.type = System::PA_READ; access.type = System::PA_READ;
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{ {

View File

@ -58,7 +58,7 @@ void CartridgeF6SC::install(System& system)
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0; access.directPokeBase = nullptr;
access.type = System::PA_READ; access.type = System::PA_READ;
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{ {

View File

@ -58,7 +58,7 @@ void CartridgeF8SC::install(System& system)
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0; access.directPokeBase = nullptr;
access.type = System::PA_READ; access.type = System::PA_READ;
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{ {

View File

@ -58,7 +58,7 @@ void CartridgeFA::install(System& system)
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0; access.directPokeBase = nullptr;
access.type = System::PA_READ; access.type = System::PA_READ;
for(uInt16 addr = 0x1100; addr < 0x1200; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1100; addr < 0x1200; addr += System::PAGE_SIZE)
{ {

View File

@ -70,7 +70,7 @@ void CartridgeFA2::install(System& system)
} }
// Set the page accessing method for the RAM reading pages // Set the page accessing method for the RAM reading pages
access.directPokeBase = 0; access.directPokeBase = nullptr;
access.type = System::PA_READ; access.type = System::PA_READ;
for(uInt16 addr = 0x1100; addr < 0x1200; addr += System::PAGE_SIZE) for(uInt16 addr = 0x1100; addr < 0x1200; addr += System::PAGE_SIZE)
{ {

View File

@ -132,8 +132,6 @@ uInt8 CartridgeWD::peek(uInt16 address)
else else
return mySegment3[address & 0x03FF]; return mySegment3[address & 0x03FF];
} }
return 0; // Make the compiler happy; we'll never reach this
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -869,7 +869,7 @@ void Console::generateColorLossPalette()
uInt32* palette[9] = { uInt32* palette[9] = {
&ourNTSCPalette[0], &ourPALPalette[0], &ourSECAMPalette[0], &ourNTSCPalette[0], &ourPALPalette[0], &ourSECAMPalette[0],
&ourNTSCPaletteZ26[0], &ourPALPaletteZ26[0], &ourSECAMPaletteZ26[0], &ourNTSCPaletteZ26[0], &ourPALPaletteZ26[0], &ourSECAMPaletteZ26[0],
0, 0, 0 nullptr, nullptr, nullptr
}; };
if(myUserPaletteDefined) if(myUserPaletteDefined)
{ {
@ -880,7 +880,7 @@ void Console::generateColorLossPalette()
for(int i = 0; i < 9; ++i) for(int i = 0; i < 9; ++i)
{ {
if(palette[i] == 0) if(palette[i] == nullptr)
continue; continue;
// Fill the odd numbered palette entries with gray values (calculated // Fill the odd numbered palette entries with gray values (calculated

View File

@ -27,7 +27,7 @@ Controller::Controller(Jack jack, const Event& event, const System& system,
myEvent(event), myEvent(event),
mySystem(system), mySystem(system),
myType(type), myType(type),
myOnAnalogPinUpdateCallback(0) myOnAnalogPinUpdateCallback(nullptr)
{ {
myDigitalPinState[One] = myDigitalPinState[One] =
myDigitalPinState[Two] = myDigitalPinState[Two] =

View File

@ -183,7 +183,7 @@ class Controller : public Serializable
console is about to be destroyed. It may be necessary to override console is about to be destroyed. It may be necessary to override
this method for controllers that need cleanup before exiting. this method for controllers that need cleanup before exiting.
*/ */
virtual void close() { }; virtual void close() { }
/** /**
Determines how this controller will treat values received from the Determines how this controller will treat values received from the

View File

@ -123,17 +123,17 @@ string FilesystemNode::getShortPathWithExt(const string& ext) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNode::hasParent() const bool FilesystemNode::hasParent() const
{ {
return _realNode ? (_realNode->getParent() != 0) : false; return _realNode ? (_realNode->getParent() != nullptr) : false;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNode FilesystemNode::getParent() const FilesystemNode FilesystemNode::getParent() const
{ {
if (_realNode == 0) if (_realNode == nullptr)
return *this; return *this;
AbstractFSNode* node = _realNode->getParent(); AbstractFSNode* node = _realNode->getParent();
return (node == 0) ? *this : FilesystemNode(node); return node ? FilesystemNode(node) : *this;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -178,11 +178,11 @@ void KidVid::openSampleFile()
if(myTape == 4) i -= 3; if(myTape == 4) i -= 3;
mySampleFile = fopen(kvNameTable[i], "rb"); mySampleFile = fopen(kvNameTable[i], "rb");
if(mySampleFile != NULL) if(mySampleFile != nullptr)
{ {
cerr << "opened file: " << kvNameTable[i] << endl; cerr << "opened file: " << kvNameTable[i] << endl;
mySharedSampleFile = fopen("kvshared.wav", "rb"); mySharedSampleFile = fopen("kvshared.wav", "rb");
if(mySharedSampleFile == NULL) if(mySharedSampleFile == nullptr)
{ {
fclose(mySampleFile); fclose(mySampleFile);
myFileOpened = false; myFileOpened = false;

View File

@ -23,19 +23,19 @@
// Flags for disassembly types // Flags for disassembly types
#define DISASM_CODE CartDebug::CODE #define DISASM_CODE CartDebug::CODE
#define DISASM_GFX CartDebug::GFX // #define DISASM_GFX CartDebug::GFX // TODO - uncomment when needed
#define DISASM_PGFX CartDebug::PGFX // #define DISASM_PGFX CartDebug::PGFX // TODO - uncomment when needed
#define DISASM_DATA CartDebug::DATA #define DISASM_DATA CartDebug::DATA
#define DISASM_ROW CartDebug::ROW // #define DISASM_ROW CartDebug::ROW // TODO - uncomment when needed
#define DISASM_WRITE CartDebug::WRITE #define DISASM_WRITE CartDebug::WRITE
#define DISASM_NONE 0 #define DISASM_NONE 0
#else #else
// Flags for disassembly types // Flags for disassembly types
#define DISASM_CODE 0 #define DISASM_CODE 0
#define DISASM_GFX 0 // #define DISASM_GFX 0 // TODO - uncomment when needed
#define DISASM_PGFX 0 // #define DISASM_PGFX 0 // TODO - uncomment when needed
#define DISASM_DATA 0 #define DISASM_DATA 0
#define DISASM_ROW 0 // #define DISASM_ROW 0 // TODO - uncomment when needed
#define DISASM_NONE 0 #define DISASM_NONE 0
#define DISASM_WRITE 0 #define DISASM_WRITE 0
#endif #endif
@ -62,7 +62,7 @@ M6502::M6502(const Settings& settings)
myLastSrcAddressX(-1), myLastSrcAddressX(-1),
myLastSrcAddressY(-1), myLastSrcAddressY(-1),
myDataAddressForPoke(0), myDataAddressForPoke(0),
myOnHaltCallback(0), myOnHaltCallback(nullptr),
myHaltRequested(false) myHaltRequested(false)
{ {
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT

View File

@ -103,7 +103,7 @@ class M6502 : public Serializable
/** /**
Pull RDY high again before the callback was triggered. Pull RDY high again before the callback was triggered.
*/ */
void clearHaltRequest() { myHaltRequested = false; }; void clearHaltRequest() { myHaltRequested = false; }
/** /**
Execute instructions until the specified number of instructions Execute instructions until the specified number of instructions

View File

@ -485,7 +485,6 @@ uInt8 M6532::getAccessFlags(uInt16 address) const
return myStackAccessBase[address & STACK_MASK]; return myStackAccessBase[address & STACK_MASK];
else else
return myRAMAccessBase[address & RAM_MASK]; return myRAMAccessBase[address & RAM_MASK];
return 0;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -62,7 +62,7 @@ OSystem::OSystem()
myQuitLoop(false) myQuitLoop(false)
{ {
// Calculate startup time // Calculate startup time
myMillisAtStart = uInt32(time(NULL) * 1000); myMillisAtStart = uInt32(time(nullptr) * 1000);
// Get built-in features // Get built-in features
#ifdef SOUND_SUPPORT #ifdef SOUND_SUPPORT
@ -596,7 +596,7 @@ uInt64 OSystem::getTicks() const
#ifdef HAVE_GETTIMEOFDAY #ifdef HAVE_GETTIMEOFDAY
// Gettimeofday natively refers to the UNIX epoch (a set time in the past) // Gettimeofday natively refers to the UNIX epoch (a set time in the past)
timeval now; timeval now;
gettimeofday(&now, 0); gettimeofday(&now, nullptr);
return uInt64(now.tv_sec) * 1000000 + now.tv_usec; return uInt64(now.tv_sec) * 1000000 + now.tv_usec;
#else #else

View File

@ -74,8 +74,8 @@ string TIASound::channels(uInt32 hardware, bool stereo)
case Hardware1: return "Hardware1"; case Hardware1: return "Hardware1";
case Hardware2Mono: return "Hardware2Mono"; case Hardware2Mono: return "Hardware2Mono";
case Hardware2Stereo: return "Hardware2Stereo"; case Hardware2Stereo: return "Hardware2Stereo";
default: return EmptyString;
} }
return EmptyString;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -118,7 +118,7 @@ const FBSurface& TIASurface::baseSurface(GUI::Rect& rect) const
// Get Blargg buffer and width // Get Blargg buffer and width
uInt32 *blarggBuf, blarggPitch; uInt32 *blarggBuf, blarggPitch;
myTiaSurface->basePtr(blarggBuf, blarggPitch); myTiaSurface->basePtr(blarggBuf, blarggPitch);
double blarggXFactor = (double)blarggPitch / width; double blarggXFactor = double(blarggPitch) / width;
bool useBlargg = ntscEnabled(); bool useBlargg = ntscEnabled();
// Fill the surface with pixels from the TIA, scaled 2x horizontally // Fill the surface with pixels from the TIA, scaled 2x horizontally
@ -130,7 +130,7 @@ const FBSurface& TIASurface::baseSurface(GUI::Rect& rect) const
for(uInt32 x = 0; x < width; ++x) for(uInt32 x = 0; x < width; ++x)
{ {
if (useBlargg) if (useBlargg)
*buf_ptr++ = blarggBuf[y * blarggPitch + (uInt32)nearbyint(x * blarggXFactor)]; *buf_ptr++ = blarggBuf[y * blarggPitch + uInt32(nearbyint(x * blarggXFactor))];
else else
*buf_ptr++ = myPalette[*(myTIA->frameBuffer() + y * tiaw + x / 2)]; *buf_ptr++ = myPalette[*(myTIA->frameBuffer() + y * tiaw + x / 2)];
} }

View File

@ -133,7 +133,7 @@ class TIASurface
Used to calculate an averaged color for the 'phosphor' effect. Used to calculate an averaged color for the 'phosphor' effect.
@param c RGB Color 1 (current frame) @param c RGB Color 1 (current frame)
@param p RGB Color 2 (previous frame) @param cp RGB Color 2 (previous frame)
@return Averaged value of the two RGB colors @return Averaged value of the two RGB colors
*/ */

View File

@ -99,7 +99,6 @@ void Thumbulator::setConsoleTiming(ConsoleTiming timing)
case ConsoleTiming::ntsc: timing_factor = NTSC; break; case ConsoleTiming::ntsc: timing_factor = NTSC; break;
case ConsoleTiming::secam: timing_factor = SECAM; break; case ConsoleTiming::secam: timing_factor = SECAM; break;
case ConsoleTiming::pal: timing_factor = PAL; break; case ConsoleTiming::pal: timing_factor = PAL; break;
default: timing_factor = NTSC; break;
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -140,8 +140,8 @@ void FrameManager::nextLine()
} }
break; break;
default: // default:
throw runtime_error("frame manager: invalid state"); // throw runtime_error("frame manager: invalid state");
} }
if (myState == State::frame && previousState == State::frame) myY++; if (myState == State::frame && previousState == State::frame) myY++;
@ -182,8 +182,8 @@ void FrameManager::setVsync(bool vsync)
if (myVsync) setState(State::waitForVsyncEnd); if (myVsync) setState(State::waitForVsyncEnd);
break; break;
default: // default:
throw runtime_error("frame manager: invalid state"); // throw runtime_error("frame manager: invalid state");
} }
} }
@ -341,8 +341,8 @@ void FrameManager::updateLayout(FrameLayout layout)
myOverscanLines = Metrics::overscanPAL; myOverscanLines = Metrics::overscanPAL;
break; break;
default: // default:
throw runtime_error("frame manager: invalid TV mode"); // throw runtime_error("frame manager: invalid TV mode");
} }
myFrameLines = Metrics::vsync + myVblankLines + myKernelLines + myOverscanLines; myFrameLines = Metrics::vsync + myVblankLines + myKernelLines + myOverscanLines;

View File

@ -74,8 +74,8 @@ class Player : public Serializable
uInt8 getPosition() const; uInt8 getPosition() const;
void setPosition(uInt8 newPosition); void setPosition(uInt8 newPosition);
uInt8 getGRPOld() const { return myPatternOld; }; uInt8 getGRPOld() const { return myPatternOld; }
uInt8 getGRPNew() const { return myPatternNew; }; uInt8 getGRPNew() const { return myPatternNew; }
void setGRPOld(uInt8 pattern); void setGRPOld(uInt8 pattern);

View File

@ -302,7 +302,7 @@ bool Playfield::load(Serializer& in)
myDebugColor = in.getByte(); myDebugColor = in.getByte();
myDebugEnabled = in.getBool(); myDebugEnabled = in.getBool();
myColorMode = (ColorMode)in.getByte(); myColorMode = ColorMode(in.getByte());
myPattern = in.getInt(); myPattern = in.getInt();
myEffectivePattern = in.getInt(); myEffectivePattern = in.getInt();

View File

@ -186,7 +186,7 @@ class TIA : public Device
/** /**
Returns a pointer to the internal frame buffer. Returns a pointer to the internal frame buffer.
*/ */
uInt8* frameBuffer() const { return (uInt8*)(myFramebuffer); } uInt8* frameBuffer() { return static_cast<uInt8*>(myFramebuffer); }
/** /**
Answers dimensional info about the framebuffer. Answers dimensional info about the framebuffer.

View File

@ -207,13 +207,13 @@ bool VblankManager::shouldTransition(bool isGarbageFrame)
// Fixed mode: use external ystart value // Fixed mode: use external ystart value
case VblankMode::fixed: case VblankMode::fixed:
transition = (Int32)myCurrentLine >= transition = Int32(myCurrentLine) >=
std::max<Int32>(myYstart + std::min<Int32>(myJitter, Metrics::maxJitter), 0); std::max<Int32>(myYstart + std::min<Int32>(myJitter, Metrics::maxJitter), 0);
break; break;
// Final mode: use detected ystart value // Final mode: use detected ystart value
case VblankMode::final: case VblankMode::final:
transition = (Int32)myCurrentLine >= transition = Int32(myCurrentLine) >=
std::max<Int32>(myLastVblankLines + std::min<Int32>(myJitter, Metrics::maxJitter), 0); std::max<Int32>(myLastVblankLines + std::min<Int32>(myJitter, Metrics::maxJitter), 0);
break; break;
} }

View File

@ -47,7 +47,7 @@ class VblankManager : public Serializable
bool vblank() const { return myVblank; } bool vblank() const { return myVblank; }
uInt32 currentLine() const { return myCurrentLine; }; uInt32 currentLine() const { return myCurrentLine; }
void setJitter(Int32 jitter); void setJitter(Int32 jitter);
void setJitterFactor(uInt8 jitterFactor) { myJitterFactor = jitterFactor; } void setJitterFactor(uInt8 jitterFactor) { myJitterFactor = jitterFactor; }

View File

@ -3353,9 +3353,9 @@ static const FontDesc consoleBDesc = {
30, 30,
97, 97,
consoleB_font_bits, consoleB_font_bits,
0, /* no encode table*/ nullptr, /* no encode table*/
0, /* fixed width*/ nullptr, /* fixed width*/
0, /* fixed bbox*/ nullptr, /* fixed bbox*/
32, // Originally 30 32, // Originally 30
sizeof(consoleB_font_bits)/sizeof(uInt16) sizeof(consoleB_font_bits)/sizeof(uInt16)
}; };

View File

@ -3388,9 +3388,9 @@ static const FontDesc consoleDesc = {
29, 29,
98, 98,
console_font_bits, console_font_bits,
0, /* no encode table*/ nullptr, /* no encode table*/
0, /* fixed width*/ nullptr, /* fixed width*/
0, /* fixed bbox*/ nullptr, /* fixed bbox*/
32, // Originally 30 32, // Originally 30
sizeof(console_font_bits)/sizeof(uInt16) sizeof(console_font_bits)/sizeof(uInt16)
}; };

View File

@ -3741,9 +3741,9 @@ static const FontDesc consoleMediumBDesc = {
30, 30,
97, 97,
consoleMediumB_font_bits, consoleMediumB_font_bits,
0, /* no encode table*/ nullptr, /* no encode table*/
0, /* fixed width*/ nullptr, /* fixed width*/
0, /* fixed bbox*/ nullptr, /* fixed bbox*/
32, // Originally 30 32, // Originally 30
sizeof(consoleMediumB_font_bits)/sizeof(uInt16) sizeof(consoleMediumB_font_bits)/sizeof(uInt16)
}; };

View File

@ -3741,9 +3741,9 @@ static const FontDesc consoleMediumDesc = {
30, 30,
97, 97,
consoleMedium_font_bits, consoleMedium_font_bits,
0, /* no encode table*/ nullptr, /* no encode table*/
0, /* fixed width*/ nullptr, /* fixed width*/
0, /* fixed bbox*/ nullptr, /* fixed bbox*/
32, // Originally 30 32, // Originally 30
sizeof(consoleMedium_font_bits)/sizeof(uInt16) sizeof(consoleMedium_font_bits)/sizeof(uInt16)
}; };

View File

@ -398,7 +398,7 @@ void Dialog::handleMouseUp(int x, int y, int button, int clickCount)
w->handleMouseUp(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y), w->handleMouseUp(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y),
button, clickCount); button, clickCount);
_dragWidget = 0; _dragWidget = nullptr;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -438,7 +438,7 @@ void Dialog::handleMouseMoved(int x, int y, int button)
} }
else if (!mouseInFocusedWidget && _mouseWidget == w) else if (!mouseInFocusedWidget && _mouseWidget == w)
{ {
_mouseWidget = 0; _mouseWidget = nullptr;
w->handleMouseLeft(button); w->handleMouseLeft(button);
} }

View File

@ -60,7 +60,7 @@ class GuiObject : public CommandReceiver
myDialog(dialog), myDialog(dialog),
_x(x), _y(y), _w(w), _h(h), _x(x), _y(y), _w(w), _h(h),
_dirty(false), _dirty(false),
_firstWidget(0) { } _firstWidget(nullptr) { }
virtual ~GuiObject() = default; virtual ~GuiObject() = default;

View File

@ -419,7 +419,6 @@ bool LauncherDialog::matchPattern(const string& s, const string& pattern) const
} }
} }
} }
return false;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -25,6 +25,6 @@
Menu::Menu(OSystem& osystem) Menu::Menu(OSystem& osystem)
: DialogContainer(osystem) : DialogContainer(osystem)
{ {
myBaseDialog = new OptionsDialog(myOSystem, *this, 0, myBaseDialog = new OptionsDialog(myOSystem, *this, nullptr,
FrameBuffer::kFBMinW, FrameBuffer::kFBMinH, false); FrameBuffer::kFBMinW, FrameBuffer::kFBMinH, false);
} }

View File

@ -2713,9 +2713,9 @@ static const FontDesc stellaDesc = {
32, 32,
95, 95,
stella_font_bits, stella_font_bits,
0, /* no encode table*/ nullptr, /* no encode table*/
0, /* fixed width*/ nullptr, /* fixed width*/
0, /* fixed bbox*/ nullptr, /* fixed bbox*/
32, 32,
sizeof(stella_font_bits)/sizeof(uInt16) sizeof(stella_font_bits)/sizeof(uInt16)
}; };

View File

@ -4762,9 +4762,9 @@ static const FontDesc stellaLargeDesc = {
29, 29,
98, 98,
stellaLarge_font_bits, stellaLarge_font_bits,
0, /* no encode table*/ nullptr, /* no encode table*/
0, /* fixed width*/ nullptr, /* fixed width*/
0, /* fixed bbox*/ nullptr, /* fixed bbox*/
32, 32,
sizeof(stellaLarge_font_bits)/sizeof(uInt16) sizeof(stellaLarge_font_bits)/sizeof(uInt16)
}; };

View File

@ -4370,9 +4370,9 @@ static const FontDesc stellaMediumDesc = {
29, 29,
98, 98,
stellaMedium_font_bits, stellaMedium_font_bits,
0, /* no encode table*/ nullptr, /* no encode table*/
0, /* fixed width*/ nullptr, /* fixed width*/
0, /* fixed bbox*/ nullptr, /* fixed bbox*/
32, // Originally 30 32, // Originally 30
sizeof(stellaMedium_font_bits)/sizeof(uInt16) sizeof(stellaMedium_font_bits)/sizeof(uInt16)
}; };

View File

@ -333,7 +333,7 @@ void UIDialog::loadConfig()
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
// Debugger size // Debugger size
const GUI::Size& ds = instance().settings().getSize("dbg.res"); const GUI::Size& ds = instance().settings().getSize("dbg.res");
w = ds.w, h = ds.h; w = ds.w; h = ds.h;
w = std::max(w, uInt32(DebuggerDialog::kSmallFontMinW)); w = std::max(w, uInt32(DebuggerDialog::kSmallFontMinW));
h = std::max(h, uInt32(DebuggerDialog::kSmallFontMinH)); h = std::max(h, uInt32(DebuggerDialog::kSmallFontMinH));
w = std::min(w, ds.w); w = std::min(w, ds.w);

View File

@ -214,7 +214,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
VarList::push_back(items, "Bad adjust", NTSCFilter::PRESET_BAD); VarList::push_back(items, "Bad adjust", NTSCFilter::PRESET_BAD);
VarList::push_back(items, "Custom", NTSCFilter::PRESET_CUSTOM); VarList::push_back(items, "Custom", NTSCFilter::PRESET_CUSTOM);
lwidth = font.getStringWidth("TV Mode "); lwidth = font.getStringWidth("TV Mode ");
pwidth = font.getStringWidth("Bad adjust"), pwidth = font.getStringWidth("Bad adjust");
myTVMode = myTVMode =
new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
items, "TV Mode ", lwidth, kTVModeChanged); items, "TV Mode ", lwidth, kTVModeChanged);
@ -510,13 +510,13 @@ void VideoDialog::saveConfig()
instance().settings().setValue("tia.aspectp", myPAspectRatioLabel->getLabel()); instance().settings().setValue("tia.aspectp", myPAspectRatioLabel->getLabel());
// Framerate // Framerate
int i = myFrameRate->getValue(); int f = myFrameRate->getValue();
instance().settings().setValue("framerate", i); instance().settings().setValue("framerate", f);
if(instance().hasConsole()) if(instance().hasConsole())
{ {
// Make sure auto-frame calculation is only enabled when necessary // Make sure auto-frame calculation is only enabled when necessary
instance().console().tia().enableAutoFrame(i <= 0); instance().console().tia().enableAutoFrame(f <= 0);
instance().console().setFramerate(float(i)); instance().console().setFramerate(float(f));
} }
// Fullscreen // Fullscreen

View File

@ -59,7 +59,7 @@ FilesystemNodePOSIX::FilesystemNodePOSIX(const string& p, bool verify)
if(_path[0] == '~') if(_path[0] == '~')
{ {
const char* home = getenv("HOME"); const char* home = getenv("HOME");
if (home != NULL) if (home != nullptr)
_path.replace(0, 1, home); _path.replace(0, 1, home);
} }
@ -79,7 +79,7 @@ string FilesystemNodePOSIX::getShortPath() const
{ {
// If the path starts with the home directory, replace it with '~' // If the path starts with the home directory, replace it with '~'
const char* home = getenv("HOME"); const char* home = getenv("HOME");
if(home != NULL && BSPF::startsWithIgnoreCase(_path, home)) if(home != nullptr && BSPF::startsWithIgnoreCase(_path, home))
{ {
string path = "~"; string path = "~";
const char* offset = _path.c_str() + strlen(home); const char* offset = _path.c_str() + strlen(home);
@ -99,11 +99,11 @@ bool FilesystemNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode,
DIR* dirp = opendir(_path.c_str()); DIR* dirp = opendir(_path.c_str());
struct dirent* dp; struct dirent* dp;
if (dirp == NULL) if (dirp == nullptr)
return false; return false;
// loop over dir entries using readdir // loop over dir entries using readdir
while ((dp = readdir(dirp)) != NULL) while ((dp = readdir(dirp)) != nullptr)
{ {
// Skip 'invisible' files if necessary // Skip 'invisible' files if necessary
if (dp->d_name[0] == '.' && !hidden) if (dp->d_name[0] == '.' && !hidden)

View File

@ -35,7 +35,7 @@ OSystemUNIX::OSystemUNIX()
{ {
// Use XDG_CONFIG_HOME if defined, otherwise use the default // Use XDG_CONFIG_HOME if defined, otherwise use the default
const char* configDir = getenv("XDG_CONFIG_HOME"); const char* configDir = getenv("XDG_CONFIG_HOME");
if(configDir == NULL) configDir = "~/.config"; if(configDir == nullptr) configDir = "~/.config";
string stellaDir = string(configDir) + "/stella"; string stellaDir = string(configDir) + "/stella";

View File

@ -45,7 +45,7 @@ const string& errorMessage()
Expression* getResult() Expression* getResult()
{ {
lastExp = 0; lastExp = nullptr;
return result.exp; return result.exp;
} }
@ -70,7 +70,7 @@ void setInput(const char *in)
int parse(const char *in) int parse(const char *in)
{ {
lastExp = 0; lastExp = nullptr;
errMsg = "(no error)"; errMsg = "(no error)";
setInput(in); setInput(in);
return yyparse(); return yyparse();
@ -196,7 +196,7 @@ CpuMethod getCpuSpecial(char* ch)
else if(BSPF::equalsIgnoreCase(ch, "b")) else if(BSPF::equalsIgnoreCase(ch, "b"))
return &CpuDebug::b; return &CpuDebug::b;
else else
return 0; return nullptr;
} }
// special methods that get Cart RAM/ROM internal state // special methods that get Cart RAM/ROM internal state
@ -211,7 +211,7 @@ CartMethod getCartSpecial(char* ch)
else if(BSPF::equalsIgnoreCase(ch, "__lastwrite")) else if(BSPF::equalsIgnoreCase(ch, "__lastwrite"))
return &CartDebug::lastWriteBaseAddress; return &CartDebug::lastWriteBaseAddress;
else else
return 0; return nullptr;
} }
// special methods that get TIA internal state // special methods that get TIA internal state
@ -234,7 +234,7 @@ TiaMethod getTiaSpecial(char* ch)
else if(BSPF::equalsIgnoreCase(ch, "_vblank")) else if(BSPF::equalsIgnoreCase(ch, "_vblank"))
return &TIADebug::vblankAsInt; return &TIADebug::vblankAsInt;
else else
return 0; return nullptr;
} }
int yylex() { int yylex() {

View File

@ -99,6 +99,6 @@ expression: expression '+' expression { if(DEBUG_EXP) fprintf(stderr, " +"); $$
| CART_METHOD { if(DEBUG_EXP) fprintf(stderr, " (CartMethod)"); $$ = new CartMethodExpression($1); lastExp = $$; } | CART_METHOD { if(DEBUG_EXP) fprintf(stderr, " (CartMethod)"); $$ = new CartMethodExpression($1); lastExp = $$; }
| TIA_METHOD { if(DEBUG_EXP) fprintf(stderr, " (TiaMethod)"); $$ = new TiaMethodExpression($1); lastExp = $$; } | TIA_METHOD { if(DEBUG_EXP) fprintf(stderr, " (TiaMethod)"); $$ = new TiaMethodExpression($1); lastExp = $$; }
| FUNCTION { if(DEBUG_EXP) fprintf(stderr, " (DefinedFunction)"); $$ = new FunctionExpression($1); lastExp = $$; } | FUNCTION { if(DEBUG_EXP) fprintf(stderr, " (DefinedFunction)"); $$ = new FunctionExpression($1); lastExp = $$; }
| ERR { if(DEBUG_EXP) fprintf(stderr, " ERR: "); yyerror((char*)"Invalid label or constant"); return 1; } | ERR { if(DEBUG_EXP) fprintf(stderr, " ERR: "); yyerror((const char*)"Invalid label or constant"); return 1; }
; ;
%% %%

View File

@ -1543,7 +1543,7 @@ yyreduce:
case 36: case 36:
#line 102 "stella.y" /* yacc.c:1646 */ #line 102 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " ERR: "); yyerror((char*)"Invalid label or constant"); return 1; } { if(DEBUG_EXP) fprintf(stderr, " ERR: "); yyerror((const char*)"Invalid label or constant"); return 1; }
#line 1548 "y.tab.c" /* yacc.c:1646 */ #line 1548 "y.tab.c" /* yacc.c:1646 */
break; break;