From 35624553b69de736148004b8e7ed050e2db249a7 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Wed, 11 Oct 2017 12:23:54 -0230 Subject: [PATCH] First pass at code cleanup from enabling higher levels of warnings in clang/gcc. --- src/common/FSNodeFactory.hxx | 2 +- src/common/PNGLibrary.cxx | 2 +- src/common/PNGLibrary.hxx | 4 ++-- src/common/StateManager.cxx | 2 +- src/common/ZipHandler.cxx | 1 - src/common/smartmod.hxx | 2 +- src/common/tv_filters/AtariNTSC.cxx | 8 ++++---- src/common/tv_filters/AtariNTSC.hxx | 2 +- src/debugger/CartDebug.cxx | 8 +++++--- src/debugger/Debugger.cxx | 2 ++ src/debugger/TIADebug.cxx | 6 +++--- src/debugger/gui/CartBUSWidget.cxx | 4 ++-- src/debugger/gui/PromptWidget.cxx | 2 +- src/debugger/gui/RomListWidget.cxx | 1 - src/debugger/gui/TiaWidget.cxx | 2 +- src/emucore/Cart3E.cxx | 2 +- src/emucore/Cart4KSC.cxx | 2 +- src/emucore/CartBFSC.cxx | 2 +- src/emucore/CartBUS.cxx | 4 ++-- src/emucore/CartCDF.cxx | 7 +++---- src/emucore/CartCM.cxx | 2 +- src/emucore/CartCV.cxx | 6 +++--- src/emucore/CartCVPlus.cxx | 6 +++--- src/emucore/CartDFSC.cxx | 2 +- src/emucore/CartE0.cxx | 2 +- src/emucore/CartE7.cxx | 4 ++-- src/emucore/CartEFSC.cxx | 2 +- src/emucore/CartF4SC.cxx | 2 +- src/emucore/CartF6SC.cxx | 2 +- src/emucore/CartF8SC.cxx | 2 +- src/emucore/CartFA.cxx | 2 +- src/emucore/CartFA2.cxx | 2 +- src/emucore/CartWD.cxx | 2 -- src/emucore/Console.cxx | 4 ++-- src/emucore/Control.cxx | 2 +- src/emucore/Control.hxx | 2 +- src/emucore/FSNode.cxx | 6 +++--- src/emucore/KidVid.cxx | 4 ++-- src/emucore/M6502.cxx | 28 ++++++++++++++-------------- src/emucore/M6502.hxx | 10 +++++----- src/emucore/M6532.cxx | 9 ++++----- src/emucore/OSystem.cxx | 4 ++-- src/emucore/TIASnd.cxx | 2 +- src/emucore/TIASurface.cxx | 10 +++++----- src/emucore/TIASurface.hxx | 2 +- src/emucore/Thumbulator.cxx | 3 +-- src/emucore/tia/DelayQueueMember.hxx | 2 +- src/emucore/tia/FrameManager.cxx | 12 ++++++------ src/emucore/tia/Player.hxx | 4 ++-- src/emucore/tia/Playfield.cxx | 2 +- src/emucore/tia/TIA.hxx | 2 +- src/emucore/tia/VblankManager.cxx | 4 ++-- src/emucore/tia/VblankManager.hxx | 2 +- src/gui/ConsoleBFont.hxx | 6 +++--- src/gui/ConsoleFont.hxx | 8 ++++---- src/gui/ConsoleMediumBFont.hxx | 6 +++--- src/gui/ConsoleMediumFont.hxx | 6 +++--- src/gui/Dialog.cxx | 4 ++-- src/gui/GuiObject.hxx | 2 +- src/gui/LauncherDialog.cxx | 1 - src/gui/Menu.cxx | 2 +- src/gui/StellaFont.hxx | 6 +++--- src/gui/StellaLargeFont.hxx | 6 +++--- src/gui/StellaMediumFont.hxx | 6 +++--- src/gui/UIDialog.cxx | 2 +- src/gui/VideoDialog.cxx | 10 +++++----- src/unix/FSNodePOSIX.cxx | 8 ++++---- src/unix/OSystemUNIX.cxx | 2 +- src/yacc/YaccParser.cxx | 10 +++++----- src/yacc/stella.y | 2 +- src/yacc/y.tab.c | 2 +- 71 files changed, 150 insertions(+), 154 deletions(-) diff --git a/src/common/FSNodeFactory.hxx b/src/common/FSNodeFactory.hxx index 439872085..11eb1ff8e 100644 --- a/src/common/FSNodeFactory.hxx +++ b/src/common/FSNodeFactory.hxx @@ -55,7 +55,7 @@ class FilesystemNodeFactory return new FilesystemNodeZIP(path); break; } - return 0; + return nullptr; } private: diff --git a/src/common/PNGLibrary.cxx b/src/common/PNGLibrary.cxx index c1eb0c46a..48db0d95e 100644 --- a/src/common/PNGLibrary.cxx +++ b/src/common/PNGLibrary.cxx @@ -108,7 +108,7 @@ void PNGLibrary::loadImage(const string& filename, FBSurface& surface) // Cleanup done: 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) throw runtime_error(err_message); diff --git a/src/common/PNGLibrary.hxx b/src/common/PNGLibrary.hxx index e3245a1e2..b85f70039 100644 --- a/src/common/PNGLibrary.hxx +++ b/src/common/PNGLibrary.hxx @@ -140,8 +140,8 @@ class PNGLibrary 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_io_flush(png_structp ctx); - 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_warn(png_structp ctx, png_const_charp str); + [[noreturn]] static void png_user_error(png_structp ctx, png_const_charp str); private: // Following constructors and assignment operators not supported diff --git a/src/common/StateManager.cxx b/src/common/StateManager.cxx index 2261f8329..5533017b6 100644 --- a/src/common/StateManager.cxx +++ b/src/common/StateManager.cxx @@ -29,7 +29,7 @@ #include "StateManager.hxx" #define STATE_HEADER "05000302state" -#define MOVIE_HEADER "03030000movie" +// #define MOVIE_HEADER "03030000movie" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - StateManager::StateManager(OSystem& osystem) diff --git a/src/common/ZipHandler.cxx b/src/common/ZipHandler.cxx index a8de1bbfe..100beefcf 100644 --- a/src/common/ZipHandler.cxx +++ b/src/common/ZipHandler.cxx @@ -168,7 +168,6 @@ bool ZipHandler::stream_read(fstream* stream, void* buffer, uInt64 offset, { return false; } - return false; } diff --git a/src/common/smartmod.hxx b/src/common/smartmod.hxx index bd1b293f1..d69efd1c4 100644 --- a/src/common/smartmod.hxx +++ b/src/common/smartmod.hxx @@ -83,4 +83,4 @@ inline uInt8 smartmod<256>(uInt8 x) return x & 0xFF; } -#endif // SMARTMOD_HXX \ No newline at end of file +#endif // SMARTMOD_HXX diff --git a/src/common/tv_filters/AtariNTSC.cxx b/src/common/tv_filters/AtariNTSC.cxx index a16a3649a..f5c008b69 100644 --- a/src/common/tv_filters/AtariNTSC.cxx +++ b/src/common/tv_filters/AtariNTSC.cxx @@ -56,12 +56,12 @@ void AtariNTSC::initializePalette(const uInt8* palette) uInt32* kernel = myColorTable[entry]; 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 - - kernel [i ] - kernel [(i+10)%14+14] - - kernel [i + 7] - kernel [i + 3 +14]; - kernel [i + 3 + 14] += error; + kernel [c ] - kernel [(c+10)%14+14] - + kernel [c + 7] - kernel [c + 3 +14]; + kernel [c + 3 + 14] += error; } } } diff --git a/src/common/tv_filters/AtariNTSC.hxx b/src/common/tv_filters/AtariNTSC.hxx index d5dbecdda..9941548b6 100644 --- a/src/common/tv_filters/AtariNTSC.hxx +++ b/src/common/tv_filters/AtariNTSC.hxx @@ -123,7 +123,7 @@ class AtariNTSC Used to calculate an averaged color for the 'phosphor' effect. @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 */ diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index fc173af0c..cca34452d 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -723,7 +723,7 @@ string CartDebug::loadListFile() if(addr_s.length() == 0) continue; const char* p = addr_s[0] == 'U' ? addr_s.c_str() + 1 : addr_s.c_str(); - addr = int(strtoul(p, NULL, 16)); + addr = int(strtoul(p, nullptr, 16)); // For now, completely ignore ROM addresses if(!(addr & 0x1000)) @@ -1462,8 +1462,10 @@ const char* const CartDebug::ourTIAMnemonicW[64] = { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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" + "SWCHA", "SWACNT", "SWCHB", "SWBCNT", "INTIM", "TIMINT", + "$286", "$287", "$288", "$289", "$28a", "$28b", "$28c", + "$28d", "$28e", "$28f", "$290", "$291", "$292", "$293", + "TIM1T", "TIM8T", "TIM64T", "T1024T" }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 16e03b407..f07267819 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -59,6 +59,7 @@ Debugger* Debugger::myStaticDebugger = nullptr; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// FIXME - use a vector for this static const char* const builtin_functions[][3] = { // { "name", "definition", "help text" } @@ -91,6 +92,7 @@ static const char* const builtin_functions[][3] = { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // Names are defined here, but processed in YaccParser +// FIXME - use a vector for this static const char* const pseudo_registers[][2] = { // { "name", "help text" } diff --git a/src/debugger/TIADebug.cxx b/src/debugger/TIADebug.cxx index 6a6dd008d..4d2615972 100644 --- a/src/debugger/TIADebug.cxx +++ b/src/debugger/TIADebug.cxx @@ -349,8 +349,8 @@ bool TIADebug::collision(CollisionBit id) const case Cx_BLPF: return myTIA.collCXBLPF() & 0x80; case Cx_P0P1: return myTIA.collCXPPMM() & 0x80; 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 { - return (int)myTIA.cycles(); + return int(myTIA.cycles()); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int TIADebug::cyclesHi() const { - return (int)(myTIA.cycles() >> 32); + return int(myTIA.cycles() >> 32); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/gui/CartBUSWidget.cxx b/src/debugger/gui/CartBUSWidget.cxx index 39574f297..d6cc09a93 100644 --- a/src/debugger/gui/CartBUSWidget.cxx +++ b/src/debugger/gui/CartBUSWidget.cxx @@ -324,7 +324,7 @@ void CartridgeBUSWidget::loadConfig() for(int i = 0; i < 3; ++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); @@ -332,7 +332,7 @@ void CartridgeBUSWidget::loadConfig() for(int i = 0; i < 3; ++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); diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx index 7ad406431..943db4971 100644 --- a/src/debugger/gui/PromptWidget.cxx +++ b/src/debugger/gui/PromptWidget.cxx @@ -213,7 +213,7 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod) { str[i] = buffer(_promptStartPos + i) & 0x7f; // whitespace characters - if(strchr("{*@<> =[]()+-/&|!^~%", str[i]) != NULL ) + if(strchr("{*@<> =[]()+-/&|!^~%", str[i])) { lastDelimPos = i; delimiter = str[i]; diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index 19e30b4dd..9dd525d19 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -115,7 +115,6 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont, default: // TODO - properly handle all other cases return false; } - return false; }; setTextFilter(f); } diff --git a/src/debugger/gui/TiaWidget.cxx b/src/debugger/gui/TiaWidget.cxx index d6ef0c074..e87ffa480 100644 --- a/src/debugger/gui/TiaWidget.cxx +++ b/src/debugger/gui/TiaWidget.cxx @@ -561,7 +561,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, addFocusWidget(myPF[2]); // 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; xpos = 10 + 2*fontWidth + 5 + start(colw); int _ypos = ypos - sfHeight; diff --git a/src/emucore/Cart3E.cxx b/src/emucore/Cart3E.cxx index ca2e8a573..808d25dbf 100644 --- a/src/emucore/Cart3E.cxx +++ b/src/emucore/Cart3E.cxx @@ -178,7 +178,7 @@ bool Cartridge3E::bank(uInt16 bank) mySystem->setPageAccess(addr, access); } - access.directPeekBase = 0; + access.directPeekBase = nullptr; access.type = System::PA_WRITE; // Map write-port RAM image into the system diff --git a/src/emucore/Cart4KSC.cxx b/src/emucore/Cart4KSC.cxx index f2c939663..70faa0a48 100644 --- a/src/emucore/Cart4KSC.cxx +++ b/src/emucore/Cart4KSC.cxx @@ -53,7 +53,7 @@ void Cartridge4KSC::install(System& system) } // Set the page accessing method for the RAM reading pages - access.directPokeBase = 0; + access.directPokeBase = nullptr; access.type = System::PA_READ; for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE) { diff --git a/src/emucore/CartBFSC.cxx b/src/emucore/CartBFSC.cxx index c4b7a1815..5075c7461 100644 --- a/src/emucore/CartBFSC.cxx +++ b/src/emucore/CartBFSC.cxx @@ -58,7 +58,7 @@ void CartridgeBFSC::install(System& system) } // Set the page accessing method for the RAM reading pages - access.directPokeBase = 0; + access.directPokeBase = nullptr; access.type = System::PA_READ; for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE) { diff --git a/src/emucore/CartBUS.cxx b/src/emucore/CartBUS.cxx index c5cabd6ae..1cda69022 100644 --- a/src/emucore/CartBUS.cxx +++ b/src/emucore/CartBUS.cxx @@ -65,7 +65,8 @@ CartridgeBUS::CartridgeBUS(const BytePtr& image, uInt32 size, #ifdef THUMB_SUPPORT // Create Thumbulator ARM emulator - myThumbEmulator = make_unique((uInt16*)myImage, (uInt16*)myBUSRAM, + myThumbEmulator = make_unique( + reinterpret_cast(myImage), reinterpret_cast(myBUSRAM), settings.getBool("thumb.trapfatal"), Thumbulator::ConfigureFor::BUS, this); #endif setInitialState(); @@ -528,7 +529,6 @@ uInt32 CartridgeBUS::thumbCallback(uInt8 function, uInt32 value1, uInt32 value2) // _GetWavePtr - return the counter case 2: return myMusicCounters[value1]; - break; // _SetWaveSize - set size of waveform buffer case 3: diff --git a/src/emucore/CartCDF.cxx b/src/emucore/CartCDF.cxx index 93cd02553..23ed2d577 100644 --- a/src/emucore/CartCDF.cxx +++ b/src/emucore/CartCDF.cxx @@ -69,9 +69,9 @@ CartridgeCDF::CartridgeCDF(const BytePtr& image, uInt32 size, #ifdef THUMB_SUPPORT // Create Thumbulator ARM emulator myThumbEmulator = make_unique( - (uInt16*)myImage, (uInt16*)myCDFRAM, settings.getBool("thumb.trapfatal"), - myVersion ? Thumbulator::ConfigureFor::CDF1 : Thumbulator::ConfigureFor::CDF, - this); + reinterpret_cast(myImage), reinterpret_cast(myCDFRAM), + settings.getBool("thumb.trapfatal"), myVersion ? + Thumbulator::ConfigureFor::CDF1 : Thumbulator::ConfigureFor::CDF, this); #endif setInitialState(); } @@ -465,7 +465,6 @@ uInt32 CartridgeCDF::thumbCallback(uInt8 function, uInt32 value1, uInt32 value2) // _GetWavePtr - return the counter case 2: return myMusicCounters[value1]; - break; // _SetWaveSize - set size of waveform buffer case 3: diff --git a/src/emucore/CartCM.cxx b/src/emucore/CartCM.cxx index 0acfca19f..0c8570566 100644 --- a/src/emucore/CartCM.cxx +++ b/src/emucore/CartCM.cxx @@ -143,7 +143,7 @@ bool CartridgeCM::bank(uInt16 bank) if((mySWCHA & 0x30) == 0x20) access.directPokeBase = &myRAM[addr & 0x7FF]; else - access.directPokeBase = 0; + access.directPokeBase = nullptr; mySystem->setPageAccess(addr, access); } diff --git a/src/emucore/CartCV.cxx b/src/emucore/CartCV.cxx index 4888611a2..71f75c168 100644 --- a/src/emucore/CartCV.cxx +++ b/src/emucore/CartCV.cxx @@ -74,8 +74,8 @@ void CartridgeCV::install(System& system) } // Set the page accessing method for the RAM writing pages - access.directPeekBase = 0; - access.codeAccessBase = 0; + access.directPeekBase = nullptr; + access.codeAccessBase = nullptr; access.type = System::PA_WRITE; 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 - access.directPokeBase = 0; + access.directPokeBase = nullptr; access.type = System::PA_READ; for(uInt16 addr = 0x1000; addr < 0x1400; addr += System::PAGE_SIZE) { diff --git a/src/emucore/CartCVPlus.cxx b/src/emucore/CartCVPlus.cxx index 8718deb1a..f62467a7a 100644 --- a/src/emucore/CartCVPlus.cxx +++ b/src/emucore/CartCVPlus.cxx @@ -58,8 +58,8 @@ void CartridgeCVPlus::install(System& system) mySystem->setPageAccess(addr, access); // Set the page accessing method for the RAM writing pages - access.directPeekBase = 0; - access.codeAccessBase = 0; + access.directPeekBase = nullptr; + access.codeAccessBase = nullptr; access.type = System::PA_WRITE; 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 - access.directPokeBase = 0; + access.directPokeBase = nullptr; access.type = System::PA_READ; for(uInt16 addr = 0x1000; addr < 0x1400; addr += System::PAGE_SIZE) { diff --git a/src/emucore/CartDFSC.cxx b/src/emucore/CartDFSC.cxx index 1db4103e8..36af35928 100644 --- a/src/emucore/CartDFSC.cxx +++ b/src/emucore/CartDFSC.cxx @@ -58,7 +58,7 @@ void CartridgeDFSC::install(System& system) } // Set the page accessing method for the RAM reading pages - access.directPokeBase = 0; + access.directPokeBase = nullptr; access.type = System::PA_READ; for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE) { diff --git a/src/emucore/CartE0.cxx b/src/emucore/CartE0.cxx index a00611aad..fea98c908 100644 --- a/src/emucore/CartE0.cxx +++ b/src/emucore/CartE0.cxx @@ -57,7 +57,7 @@ void CartridgeE0::install(System& system) myCurrentSlice[3] = 7; // Set the page accessing methods for the hot spots in the last segment - access.directPeekBase = 0; + access.directPeekBase = nullptr; access.codeAccessBase = &myCodeAccessBase[8128]; access.type = System::PA_READ; for(uInt16 addr = (0x1FE0 & ~System::PAGE_MASK); addr < 0x2000; diff --git a/src/emucore/CartE7.cxx b/src/emucore/CartE7.cxx index 25f6778a6..57c680282 100644 --- a/src/emucore/CartE7.cxx +++ b/src/emucore/CartE7.cxx @@ -162,7 +162,7 @@ void CartridgeE7::bankRAM(uInt16 bank) } // Set the page accessing method for the 256 bytes of RAM reading pages - access.directPokeBase = 0; + access.directPokeBase = nullptr; access.type = System::PA_READ; 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 - access.directPokeBase = 0; + access.directPokeBase = nullptr; access.type = System::PA_READ; for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE) { diff --git a/src/emucore/CartEFSC.cxx b/src/emucore/CartEFSC.cxx index 14e5dd113..ed37b1038 100644 --- a/src/emucore/CartEFSC.cxx +++ b/src/emucore/CartEFSC.cxx @@ -58,7 +58,7 @@ void CartridgeEFSC::install(System& system) } // Set the page accessing method for the RAM reading pages - access.directPokeBase = 0; + access.directPokeBase = nullptr; access.type = System::PA_READ; for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE) { diff --git a/src/emucore/CartF4SC.cxx b/src/emucore/CartF4SC.cxx index 8e32f3fa6..99f87b0e0 100644 --- a/src/emucore/CartF4SC.cxx +++ b/src/emucore/CartF4SC.cxx @@ -58,7 +58,7 @@ void CartridgeF4SC::install(System& system) } // Set the page accessing method for the RAM reading pages - access.directPokeBase = 0; + access.directPokeBase = nullptr; access.type = System::PA_READ; for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE) { diff --git a/src/emucore/CartF6SC.cxx b/src/emucore/CartF6SC.cxx index cbe4139b8..96d801acc 100644 --- a/src/emucore/CartF6SC.cxx +++ b/src/emucore/CartF6SC.cxx @@ -58,7 +58,7 @@ void CartridgeF6SC::install(System& system) } // Set the page accessing method for the RAM reading pages - access.directPokeBase = 0; + access.directPokeBase = nullptr; access.type = System::PA_READ; for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE) { diff --git a/src/emucore/CartF8SC.cxx b/src/emucore/CartF8SC.cxx index 7094233e4..2694b7f2b 100644 --- a/src/emucore/CartF8SC.cxx +++ b/src/emucore/CartF8SC.cxx @@ -58,7 +58,7 @@ void CartridgeF8SC::install(System& system) } // Set the page accessing method for the RAM reading pages - access.directPokeBase = 0; + access.directPokeBase = nullptr; access.type = System::PA_READ; for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE) { diff --git a/src/emucore/CartFA.cxx b/src/emucore/CartFA.cxx index f0808f9a5..693706444 100644 --- a/src/emucore/CartFA.cxx +++ b/src/emucore/CartFA.cxx @@ -58,7 +58,7 @@ void CartridgeFA::install(System& system) } // Set the page accessing method for the RAM reading pages - access.directPokeBase = 0; + access.directPokeBase = nullptr; access.type = System::PA_READ; for(uInt16 addr = 0x1100; addr < 0x1200; addr += System::PAGE_SIZE) { diff --git a/src/emucore/CartFA2.cxx b/src/emucore/CartFA2.cxx index 162cc54e1..55a7074da 100644 --- a/src/emucore/CartFA2.cxx +++ b/src/emucore/CartFA2.cxx @@ -70,7 +70,7 @@ void CartridgeFA2::install(System& system) } // Set the page accessing method for the RAM reading pages - access.directPokeBase = 0; + access.directPokeBase = nullptr; access.type = System::PA_READ; for(uInt16 addr = 0x1100; addr < 0x1200; addr += System::PAGE_SIZE) { diff --git a/src/emucore/CartWD.cxx b/src/emucore/CartWD.cxx index 340000fc4..32ac33527 100644 --- a/src/emucore/CartWD.cxx +++ b/src/emucore/CartWD.cxx @@ -132,8 +132,6 @@ uInt8 CartridgeWD::peek(uInt16 address) else return mySegment3[address & 0x03FF]; } - - return 0; // Make the compiler happy; we'll never reach this } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 81de0ba90..9d8d48b71 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -869,7 +869,7 @@ void Console::generateColorLossPalette() uInt32* palette[9] = { &ourNTSCPalette[0], &ourPALPalette[0], &ourSECAMPalette[0], &ourNTSCPaletteZ26[0], &ourPALPaletteZ26[0], &ourSECAMPaletteZ26[0], - 0, 0, 0 + nullptr, nullptr, nullptr }; if(myUserPaletteDefined) { @@ -880,7 +880,7 @@ void Console::generateColorLossPalette() for(int i = 0; i < 9; ++i) { - if(palette[i] == 0) + if(palette[i] == nullptr) continue; // Fill the odd numbered palette entries with gray values (calculated diff --git a/src/emucore/Control.cxx b/src/emucore/Control.cxx index 6168fe276..b2be42132 100644 --- a/src/emucore/Control.cxx +++ b/src/emucore/Control.cxx @@ -27,7 +27,7 @@ Controller::Controller(Jack jack, const Event& event, const System& system, myEvent(event), mySystem(system), myType(type), - myOnAnalogPinUpdateCallback(0) + myOnAnalogPinUpdateCallback(nullptr) { myDigitalPinState[One] = myDigitalPinState[Two] = diff --git a/src/emucore/Control.hxx b/src/emucore/Control.hxx index f2c0757ec..3436b0e71 100644 --- a/src/emucore/Control.hxx +++ b/src/emucore/Control.hxx @@ -183,7 +183,7 @@ class Controller : public Serializable console is about to be destroyed. It may be necessary to override 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 diff --git a/src/emucore/FSNode.cxx b/src/emucore/FSNode.cxx index cd91672fb..bf0cd7525 100644 --- a/src/emucore/FSNode.cxx +++ b/src/emucore/FSNode.cxx @@ -123,17 +123,17 @@ string FilesystemNode::getShortPathWithExt(const string& ext) const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool FilesystemNode::hasParent() const { - return _realNode ? (_realNode->getParent() != 0) : false; + return _realNode ? (_realNode->getParent() != nullptr) : false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FilesystemNode FilesystemNode::getParent() const { - if (_realNode == 0) + if (_realNode == nullptr) return *this; AbstractFSNode* node = _realNode->getParent(); - return (node == 0) ? *this : FilesystemNode(node); + return node ? FilesystemNode(node) : *this; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/KidVid.cxx b/src/emucore/KidVid.cxx index a53bf5a8e..f51716565 100644 --- a/src/emucore/KidVid.cxx +++ b/src/emucore/KidVid.cxx @@ -178,11 +178,11 @@ void KidVid::openSampleFile() if(myTape == 4) i -= 3; mySampleFile = fopen(kvNameTable[i], "rb"); - if(mySampleFile != NULL) + if(mySampleFile != nullptr) { cerr << "opened file: " << kvNameTable[i] << endl; mySharedSampleFile = fopen("kvshared.wav", "rb"); - if(mySharedSampleFile == NULL) + if(mySharedSampleFile == nullptr) { fclose(mySampleFile); myFileOpened = false; diff --git a/src/emucore/M6502.cxx b/src/emucore/M6502.cxx index 7598a60b0..d993ecabb 100644 --- a/src/emucore/M6502.cxx +++ b/src/emucore/M6502.cxx @@ -23,21 +23,21 @@ // Flags for disassembly types #define DISASM_CODE CartDebug::CODE - #define DISASM_GFX CartDebug::GFX - #define DISASM_PGFX CartDebug::PGFX +// #define DISASM_GFX CartDebug::GFX // TODO - uncomment when needed +// #define DISASM_PGFX CartDebug::PGFX // TODO - uncomment when needed #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_NONE 0 #else // Flags for disassembly types #define DISASM_CODE 0 - #define DISASM_GFX 0 - #define DISASM_PGFX 0 +// #define DISASM_GFX 0 // TODO - uncomment when needed +// #define DISASM_PGFX 0 // TODO - uncomment when needed #define DISASM_DATA 0 - #define DISASM_ROW 0 +// #define DISASM_ROW 0 // TODO - uncomment when needed #define DISASM_NONE 0 - #define DISASM_WRITE 0 + #define DISASM_WRITE 0 #endif #include "Settings.hxx" #include "Vec.hxx" @@ -62,7 +62,7 @@ M6502::M6502(const Settings& settings) myLastSrcAddressX(-1), myLastSrcAddressY(-1), myDataAddressForPoke(0), - myOnHaltCallback(0), + myOnHaltCallback(nullptr), myHaltRequested(false) { #ifdef DEBUGGER_SUPPORT @@ -132,7 +132,7 @@ inline uInt8 M6502::peek(uInt16 address, uInt8 flags) int cond = evalCondTraps(); if(cond > -1) { - myJustHitReadTrapFlag = true; + myJustHitReadTrapFlag = true; myHitTrapInfo.message = "RTrap(" + myTrapCondNames[cond] + "): "; myHitTrapInfo.address = address; } @@ -153,8 +153,8 @@ inline void M6502::poke(uInt16 address, uInt8 value, uInt8 flags) myLastAddress = address; } //////////////////////////////////////////////// - mySystem->incrementCycles(SYSTEM_CYCLES_PER_CPU); - mySystem->poke(address, value, flags); + mySystem->incrementCycles(SYSTEM_CYCLES_PER_CPU); + mySystem->poke(address, value, flags); myLastPokeAddress = address; #ifdef DEBUGGER_SUPPORT @@ -169,7 +169,7 @@ inline void M6502::poke(uInt16 address, uInt8 value, uInt8 flags) myHitTrapInfo.address = address; } } -#endif // DEBUGGER_SUPPORT +#endif // DEBUGGER_SUPPORT } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -204,7 +204,7 @@ bool M6502::execute(uInt32 number) { myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false; if(myDebugger && myDebugger->start(myHitTrapInfo.message, myHitTrapInfo.address, myJustHitReadTrapFlag)) - { + { return true; } } @@ -469,7 +469,7 @@ bool M6502::delCondTrap(uInt32 brk) return true; } return false; -} +} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void M6502::clearCondTraps() diff --git a/src/emucore/M6502.hxx b/src/emucore/M6502.hxx index 2f5ec5c8f..876fe7e6a 100644 --- a/src/emucore/M6502.hxx +++ b/src/emucore/M6502.hxx @@ -103,7 +103,7 @@ class M6502 : public Serializable /** 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 @@ -149,17 +149,17 @@ class M6502 : public Serializable return myLastPokeAddress ? (myLastPokeAddress != myLastPeekAddress ? myLastPeekAddress : 0) : myLastPeekAddress; - } + } /** - Return the last address that was part of a read/peek. + Return the last address that was part of a read/peek. @return The address of the last read */ uInt16 lastReadBaseAddress() const { return myLastPeekBaseAddress; } /** - Return the last address that was part of a write/poke. + Return the last address that was part of a write/poke. @return The address of the last write */ @@ -395,7 +395,7 @@ class M6502 : public Serializable return i; return -1; // no trapif hit - } + } /// Pointer to the debugger for this processor or the null pointer Debugger* myDebugger; diff --git a/src/emucore/M6532.cxx b/src/emucore/M6532.cxx index 557ba5c71..18a5d0f7e 100644 --- a/src/emucore/M6532.cxx +++ b/src/emucore/M6532.cxx @@ -41,7 +41,7 @@ M6532::M6532(const Console& console, const Settings& settings) myInterruptFlag(false), myEdgeDetectPositive(false), myRAMAccessBase(nullptr) -{ +{ } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -481,15 +481,14 @@ uInt8 M6532::getAccessFlags(uInt16 address) const { if (address & IO_BIT) return myIOAccessBase[address & IO_MASK]; - else if (address & STACK_BIT) + else if (address & STACK_BIT) return myStackAccessBase[address & STACK_MASK]; else return myRAMAccessBase[address & RAM_MASK]; - return 0; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void M6532::setAccessFlags(uInt16 address, uInt8 flags) +void M6532::setAccessFlags(uInt16 address, uInt8 flags) { // ignore none flag if (flags != CartDebug::NONE) { @@ -506,4 +505,4 @@ void M6532::setAccessFlags(uInt16 address, uInt8 flags) } } } -#endif // DEBUGGER_SUPPORT \ No newline at end of file +#endif // DEBUGGER_SUPPORT diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index ea27471eb..d8eece728 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -62,7 +62,7 @@ OSystem::OSystem() myQuitLoop(false) { // Calculate startup time - myMillisAtStart = uInt32(time(NULL) * 1000); + myMillisAtStart = uInt32(time(nullptr) * 1000); // Get built-in features #ifdef SOUND_SUPPORT @@ -596,7 +596,7 @@ uInt64 OSystem::getTicks() const #ifdef HAVE_GETTIMEOFDAY // Gettimeofday natively refers to the UNIX epoch (a set time in the past) timeval now; - gettimeofday(&now, 0); + gettimeofday(&now, nullptr); return uInt64(now.tv_sec) * 1000000 + now.tv_usec; #else diff --git a/src/emucore/TIASnd.cxx b/src/emucore/TIASnd.cxx index 8eb976123..ed8457e26 100644 --- a/src/emucore/TIASnd.cxx +++ b/src/emucore/TIASnd.cxx @@ -74,8 +74,8 @@ string TIASound::channels(uInt32 hardware, bool stereo) case Hardware1: return "Hardware1"; case Hardware2Mono: return "Hardware2Mono"; case Hardware2Stereo: return "Hardware2Stereo"; - default: return EmptyString; } + return EmptyString; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx index 4cef17504..e3c14c9e5 100644 --- a/src/emucore/TIASurface.cxx +++ b/src/emucore/TIASurface.cxx @@ -17,7 +17,7 @@ #include #include -#include +#include #include "FrameBuffer.hxx" #include "Settings.hxx" @@ -118,7 +118,7 @@ const FBSurface& TIASurface::baseSurface(GUI::Rect& rect) const // Get Blargg buffer and width uInt32 *blarggBuf, blarggPitch; myTiaSurface->basePtr(blarggBuf, blarggPitch); - double blarggXFactor = (double)blarggPitch / width; + double blarggXFactor = double(blarggPitch) / width; bool useBlargg = ntscEnabled(); // Fill the surface with pixels from the TIA, scaled 2x horizontally @@ -130,8 +130,8 @@ const FBSurface& TIASurface::baseSurface(GUI::Rect& rect) const for(uInt32 x = 0; x < width; ++x) { if (useBlargg) - *buf_ptr++ = blarggBuf[y * blarggPitch + (uInt32)nearbyint(x * blarggXFactor)]; - else + *buf_ptr++ = blarggBuf[y * blarggPitch + uInt32(nearbyint(x * blarggXFactor))]; + else *buf_ptr++ = myPalette[*(myTIA->frameBuffer() + y * tiaw + x / 2)]; } } @@ -398,7 +398,7 @@ void TIASurface::reRender() myTiaSurface->basePtr(outPtr, outPitch); - switch (myFilter) + switch (myFilter) { // for non-phosphor modes, render the frame again case Filter::Normal: diff --git a/src/emucore/TIASurface.hxx b/src/emucore/TIASurface.hxx index 9563cd5db..5bdc9c747 100644 --- a/src/emucore/TIASurface.hxx +++ b/src/emucore/TIASurface.hxx @@ -133,7 +133,7 @@ class TIASurface Used to calculate an averaged color for the 'phosphor' effect. @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 */ diff --git a/src/emucore/Thumbulator.cxx b/src/emucore/Thumbulator.cxx index 84c2e6a29..c41a5a51f 100644 --- a/src/emucore/Thumbulator.cxx +++ b/src/emucore/Thumbulator.cxx @@ -94,12 +94,11 @@ void Thumbulator::setConsoleTiming(ConsoleTiming timing) constexpr double PAL = 70.0 / 1.182298; // PAL 6507 clock rate constexpr double SECAM = 70.0 / 1.187500; // SECAM 6507 clock rate - switch (timing) + switch(timing) { case ConsoleTiming::ntsc: timing_factor = NTSC; break; case ConsoleTiming::secam: timing_factor = SECAM; break; case ConsoleTiming::pal: timing_factor = PAL; break; - default: timing_factor = NTSC; break; } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/tia/DelayQueueMember.hxx b/src/emucore/tia/DelayQueueMember.hxx index 754971197..ea560f5e1 100644 --- a/src/emucore/tia/DelayQueueMember.hxx +++ b/src/emucore/tia/DelayQueueMember.hxx @@ -160,4 +160,4 @@ string DelayQueueMember::name() const return "TIA_DelayQueueMember"; } -#endif // TIA_DELAY_QUEUE_MEMBER \ No newline at end of file +#endif // TIA_DELAY_QUEUE_MEMBER diff --git a/src/emucore/tia/FrameManager.cxx b/src/emucore/tia/FrameManager.cxx index 094c9390e..73dee8b1c 100644 --- a/src/emucore/tia/FrameManager.cxx +++ b/src/emucore/tia/FrameManager.cxx @@ -140,8 +140,8 @@ void FrameManager::nextLine() } break; - default: - throw runtime_error("frame manager: invalid state"); +// default: +// throw runtime_error("frame manager: invalid state"); } if (myState == State::frame && previousState == State::frame) myY++; @@ -182,8 +182,8 @@ void FrameManager::setVsync(bool vsync) if (myVsync) setState(State::waitForVsyncEnd); break; - default: - throw runtime_error("frame manager: invalid state"); +// default: +// throw runtime_error("frame manager: invalid state"); } } @@ -341,8 +341,8 @@ void FrameManager::updateLayout(FrameLayout layout) myOverscanLines = Metrics::overscanPAL; break; - default: - throw runtime_error("frame manager: invalid TV mode"); +// default: +// throw runtime_error("frame manager: invalid TV mode"); } myFrameLines = Metrics::vsync + myVblankLines + myKernelLines + myOverscanLines; diff --git a/src/emucore/tia/Player.hxx b/src/emucore/tia/Player.hxx index 8addd44e8..033a40dc3 100644 --- a/src/emucore/tia/Player.hxx +++ b/src/emucore/tia/Player.hxx @@ -74,8 +74,8 @@ class Player : public Serializable uInt8 getPosition() const; void setPosition(uInt8 newPosition); - uInt8 getGRPOld() const { return myPatternOld; }; - uInt8 getGRPNew() const { return myPatternNew; }; + uInt8 getGRPOld() const { return myPatternOld; } + uInt8 getGRPNew() const { return myPatternNew; } void setGRPOld(uInt8 pattern); diff --git a/src/emucore/tia/Playfield.cxx b/src/emucore/tia/Playfield.cxx index 332da7de4..24f850031 100644 --- a/src/emucore/tia/Playfield.cxx +++ b/src/emucore/tia/Playfield.cxx @@ -302,7 +302,7 @@ bool Playfield::load(Serializer& in) myDebugColor = in.getByte(); myDebugEnabled = in.getBool(); - myColorMode = (ColorMode)in.getByte(); + myColorMode = ColorMode(in.getByte()); myPattern = in.getInt(); myEffectivePattern = in.getInt(); diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index 7e388124a..05bd11ec0 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -186,7 +186,7 @@ class TIA : public Device /** Returns a pointer to the internal frame buffer. */ - uInt8* frameBuffer() const { return (uInt8*)(myFramebuffer); } + uInt8* frameBuffer() { return static_cast(myFramebuffer); } /** Answers dimensional info about the framebuffer. diff --git a/src/emucore/tia/VblankManager.cxx b/src/emucore/tia/VblankManager.cxx index 554537a4c..aacb2c1c8 100644 --- a/src/emucore/tia/VblankManager.cxx +++ b/src/emucore/tia/VblankManager.cxx @@ -207,13 +207,13 @@ bool VblankManager::shouldTransition(bool isGarbageFrame) // Fixed mode: use external ystart value case VblankMode::fixed: - transition = (Int32)myCurrentLine >= + transition = Int32(myCurrentLine) >= std::max(myYstart + std::min(myJitter, Metrics::maxJitter), 0); break; // Final mode: use detected ystart value case VblankMode::final: - transition = (Int32)myCurrentLine >= + transition = Int32(myCurrentLine) >= std::max(myLastVblankLines + std::min(myJitter, Metrics::maxJitter), 0); break; } diff --git a/src/emucore/tia/VblankManager.hxx b/src/emucore/tia/VblankManager.hxx index a63beddb7..c8632f237 100644 --- a/src/emucore/tia/VblankManager.hxx +++ b/src/emucore/tia/VblankManager.hxx @@ -47,7 +47,7 @@ class VblankManager : public Serializable bool vblank() const { return myVblank; } - uInt32 currentLine() const { return myCurrentLine; }; + uInt32 currentLine() const { return myCurrentLine; } void setJitter(Int32 jitter); void setJitterFactor(uInt8 jitterFactor) { myJitterFactor = jitterFactor; } diff --git a/src/gui/ConsoleBFont.hxx b/src/gui/ConsoleBFont.hxx index 3c817af03..75d019cf8 100644 --- a/src/gui/ConsoleBFont.hxx +++ b/src/gui/ConsoleBFont.hxx @@ -3353,9 +3353,9 @@ static const FontDesc consoleBDesc = { 30, 97, consoleB_font_bits, - 0, /* no encode table*/ - 0, /* fixed width*/ - 0, /* fixed bbox*/ + nullptr, /* no encode table*/ + nullptr, /* fixed width*/ + nullptr, /* fixed bbox*/ 32, // Originally 30 sizeof(consoleB_font_bits)/sizeof(uInt16) }; diff --git a/src/gui/ConsoleFont.hxx b/src/gui/ConsoleFont.hxx index 7d48e60ac..e58697c77 100644 --- a/src/gui/ConsoleFont.hxx +++ b/src/gui/ConsoleFont.hxx @@ -75,7 +75,7 @@ static const uInt16 console_font_bits[] = { 0x0000, 0b1101101100000000, 0x0000, - 0x0000, + 0x0000, /* MODIFIED Character 30 (0x1e): large centered rounded rectangle @@ -3388,9 +3388,9 @@ static const FontDesc consoleDesc = { 29, 98, console_font_bits, - 0, /* no encode table*/ - 0, /* fixed width*/ - 0, /* fixed bbox*/ + nullptr, /* no encode table*/ + nullptr, /* fixed width*/ + nullptr, /* fixed bbox*/ 32, // Originally 30 sizeof(console_font_bits)/sizeof(uInt16) }; diff --git a/src/gui/ConsoleMediumBFont.hxx b/src/gui/ConsoleMediumBFont.hxx index cae3ba8fe..168281f14 100644 --- a/src/gui/ConsoleMediumBFont.hxx +++ b/src/gui/ConsoleMediumBFont.hxx @@ -3741,9 +3741,9 @@ static const FontDesc consoleMediumBDesc = { 30, 97, consoleMediumB_font_bits, - 0, /* no encode table*/ - 0, /* fixed width*/ - 0, /* fixed bbox*/ + nullptr, /* no encode table*/ + nullptr, /* fixed width*/ + nullptr, /* fixed bbox*/ 32, // Originally 30 sizeof(consoleMediumB_font_bits)/sizeof(uInt16) }; diff --git a/src/gui/ConsoleMediumFont.hxx b/src/gui/ConsoleMediumFont.hxx index e3c28c057..ed68bd158 100644 --- a/src/gui/ConsoleMediumFont.hxx +++ b/src/gui/ConsoleMediumFont.hxx @@ -3741,9 +3741,9 @@ static const FontDesc consoleMediumDesc = { 30, 97, consoleMedium_font_bits, - 0, /* no encode table*/ - 0, /* fixed width*/ - 0, /* fixed bbox*/ + nullptr, /* no encode table*/ + nullptr, /* fixed width*/ + nullptr, /* fixed bbox*/ 32, // Originally 30 sizeof(consoleMedium_font_bits)/sizeof(uInt16) }; diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 2dcb76ae5..22447c37e 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -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), button, clickCount); - _dragWidget = 0; + _dragWidget = nullptr; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -438,7 +438,7 @@ void Dialog::handleMouseMoved(int x, int y, int button) } else if (!mouseInFocusedWidget && _mouseWidget == w) { - _mouseWidget = 0; + _mouseWidget = nullptr; w->handleMouseLeft(button); } diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx index 60f40766c..eddd13b19 100644 --- a/src/gui/GuiObject.hxx +++ b/src/gui/GuiObject.hxx @@ -60,7 +60,7 @@ class GuiObject : public CommandReceiver myDialog(dialog), _x(x), _y(y), _w(w), _h(h), _dirty(false), - _firstWidget(0) { } + _firstWidget(nullptr) { } virtual ~GuiObject() = default; diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index eb7396685..078a9af78 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -419,7 +419,6 @@ bool LauncherDialog::matchPattern(const string& s, const string& pattern) const } } } - return false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/Menu.cxx b/src/gui/Menu.cxx index 41f62046c..444806d2b 100644 --- a/src/gui/Menu.cxx +++ b/src/gui/Menu.cxx @@ -25,6 +25,6 @@ Menu::Menu(OSystem& osystem) : DialogContainer(osystem) { - myBaseDialog = new OptionsDialog(myOSystem, *this, 0, + myBaseDialog = new OptionsDialog(myOSystem, *this, nullptr, FrameBuffer::kFBMinW, FrameBuffer::kFBMinH, false); } diff --git a/src/gui/StellaFont.hxx b/src/gui/StellaFont.hxx index a1f8180cb..4e21874ab 100644 --- a/src/gui/StellaFont.hxx +++ b/src/gui/StellaFont.hxx @@ -2713,9 +2713,9 @@ static const FontDesc stellaDesc = { 32, 95, stella_font_bits, - 0, /* no encode table*/ - 0, /* fixed width*/ - 0, /* fixed bbox*/ + nullptr, /* no encode table*/ + nullptr, /* fixed width*/ + nullptr, /* fixed bbox*/ 32, sizeof(stella_font_bits)/sizeof(uInt16) }; diff --git a/src/gui/StellaLargeFont.hxx b/src/gui/StellaLargeFont.hxx index 1f06c60f4..8cb55bce1 100644 --- a/src/gui/StellaLargeFont.hxx +++ b/src/gui/StellaLargeFont.hxx @@ -4762,9 +4762,9 @@ static const FontDesc stellaLargeDesc = { 29, 98, stellaLarge_font_bits, - 0, /* no encode table*/ - 0, /* fixed width*/ - 0, /* fixed bbox*/ + nullptr, /* no encode table*/ + nullptr, /* fixed width*/ + nullptr, /* fixed bbox*/ 32, sizeof(stellaLarge_font_bits)/sizeof(uInt16) }; diff --git a/src/gui/StellaMediumFont.hxx b/src/gui/StellaMediumFont.hxx index 009f9d459..a55dc12d8 100644 --- a/src/gui/StellaMediumFont.hxx +++ b/src/gui/StellaMediumFont.hxx @@ -4370,9 +4370,9 @@ static const FontDesc stellaMediumDesc = { 29, 98, stellaMedium_font_bits, - 0, /* no encode table*/ - 0, /* fixed width*/ - 0, /* fixed bbox*/ + nullptr, /* no encode table*/ + nullptr, /* fixed width*/ + nullptr, /* fixed bbox*/ 32, // Originally 30 sizeof(stellaMedium_font_bits)/sizeof(uInt16) }; diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx index 14c1bfa49..565ad7844 100644 --- a/src/gui/UIDialog.cxx +++ b/src/gui/UIDialog.cxx @@ -333,7 +333,7 @@ void UIDialog::loadConfig() #ifdef DEBUGGER_SUPPORT // Debugger size 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)); h = std::max(h, uInt32(DebuggerDialog::kSmallFontMinH)); w = std::min(w, ds.w); diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx index 6ba00650b..1a35df895 100644 --- a/src/gui/VideoDialog.cxx +++ b/src/gui/VideoDialog.cxx @@ -214,7 +214,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent, VarList::push_back(items, "Bad adjust", NTSCFilter::PRESET_BAD); VarList::push_back(items, "Custom", NTSCFilter::PRESET_CUSTOM); lwidth = font.getStringWidth("TV Mode "); - pwidth = font.getStringWidth("Bad adjust"), + pwidth = font.getStringWidth("Bad adjust"); myTVMode = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items, "TV Mode ", lwidth, kTVModeChanged); @@ -510,13 +510,13 @@ void VideoDialog::saveConfig() instance().settings().setValue("tia.aspectp", myPAspectRatioLabel->getLabel()); // Framerate - int i = myFrameRate->getValue(); - instance().settings().setValue("framerate", i); + int f = myFrameRate->getValue(); + instance().settings().setValue("framerate", f); if(instance().hasConsole()) { // Make sure auto-frame calculation is only enabled when necessary - instance().console().tia().enableAutoFrame(i <= 0); - instance().console().setFramerate(float(i)); + instance().console().tia().enableAutoFrame(f <= 0); + instance().console().setFramerate(float(f)); } // Fullscreen diff --git a/src/unix/FSNodePOSIX.cxx b/src/unix/FSNodePOSIX.cxx index 74f93d811..e8e3d163a 100644 --- a/src/unix/FSNodePOSIX.cxx +++ b/src/unix/FSNodePOSIX.cxx @@ -59,7 +59,7 @@ FilesystemNodePOSIX::FilesystemNodePOSIX(const string& p, bool verify) if(_path[0] == '~') { const char* home = getenv("HOME"); - if (home != NULL) + if (home != nullptr) _path.replace(0, 1, home); } @@ -79,7 +79,7 @@ string FilesystemNodePOSIX::getShortPath() const { // If the path starts with the home directory, replace it with '~' const char* home = getenv("HOME"); - if(home != NULL && BSPF::startsWithIgnoreCase(_path, home)) + if(home != nullptr && BSPF::startsWithIgnoreCase(_path, home)) { string path = "~"; 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()); struct dirent* dp; - if (dirp == NULL) + if (dirp == nullptr) return false; // loop over dir entries using readdir - while ((dp = readdir(dirp)) != NULL) + while ((dp = readdir(dirp)) != nullptr) { // Skip 'invisible' files if necessary if (dp->d_name[0] == '.' && !hidden) diff --git a/src/unix/OSystemUNIX.cxx b/src/unix/OSystemUNIX.cxx index 84ffe23dd..cb14ce10a 100644 --- a/src/unix/OSystemUNIX.cxx +++ b/src/unix/OSystemUNIX.cxx @@ -35,7 +35,7 @@ OSystemUNIX::OSystemUNIX() { // Use XDG_CONFIG_HOME if defined, otherwise use the default const char* configDir = getenv("XDG_CONFIG_HOME"); - if(configDir == NULL) configDir = "~/.config"; + if(configDir == nullptr) configDir = "~/.config"; string stellaDir = string(configDir) + "/stella"; diff --git a/src/yacc/YaccParser.cxx b/src/yacc/YaccParser.cxx index ec16e5523..48e3d5361 100644 --- a/src/yacc/YaccParser.cxx +++ b/src/yacc/YaccParser.cxx @@ -45,7 +45,7 @@ const string& errorMessage() Expression* getResult() { - lastExp = 0; + lastExp = nullptr; return result.exp; } @@ -70,7 +70,7 @@ void setInput(const char *in) int parse(const char *in) { - lastExp = 0; + lastExp = nullptr; errMsg = "(no error)"; setInput(in); return yyparse(); @@ -196,7 +196,7 @@ CpuMethod getCpuSpecial(char* ch) else if(BSPF::equalsIgnoreCase(ch, "b")) return &CpuDebug::b; else - return 0; + return nullptr; } // special methods that get Cart RAM/ROM internal state @@ -211,7 +211,7 @@ CartMethod getCartSpecial(char* ch) else if(BSPF::equalsIgnoreCase(ch, "__lastwrite")) return &CartDebug::lastWriteBaseAddress; else - return 0; + return nullptr; } // special methods that get TIA internal state @@ -234,7 +234,7 @@ TiaMethod getTiaSpecial(char* ch) else if(BSPF::equalsIgnoreCase(ch, "_vblank")) return &TIADebug::vblankAsInt; else - return 0; + return nullptr; } int yylex() { diff --git a/src/yacc/stella.y b/src/yacc/stella.y index 9e3d7ef25..4f13cb6d4 100644 --- a/src/yacc/stella.y +++ b/src/yacc/stella.y @@ -99,6 +99,6 @@ expression: expression '+' expression { if(DEBUG_EXP) fprintf(stderr, " +"); $$ | CART_METHOD { if(DEBUG_EXP) fprintf(stderr, " (CartMethod)"); $$ = new CartMethodExpression($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 = $$; } - | 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; } ; %% diff --git a/src/yacc/y.tab.c b/src/yacc/y.tab.c index 13f4d7746..d6a0f9660 100644 --- a/src/yacc/y.tab.c +++ b/src/yacc/y.tab.c @@ -1543,7 +1543,7 @@ yyreduce: case 36: #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 */ break;