From 19da02fb9c8dc48f4f9634e4a5e9ed02ab395a60 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sun, 21 Aug 2022 19:33:08 -0230 Subject: [PATCH] Final batch of fixes from clang-tidy (for now). --- src/cheat/CheatCodeDialog.cxx | 2 +- src/common/AudioSettings.cxx | 2 +- src/common/Base.cxx | 2 +- src/common/EventHandlerSDL2.cxx | 3 ++- src/common/FBBackendSDL2.cxx | 9 +++++---- src/common/FBSurfaceSDL2.cxx | 2 +- src/common/FSNodeZIP.cxx | 2 +- src/common/HighScoresManager.hxx | 1 + src/common/JoyMap.cxx | 8 ++++---- src/common/KeyMap.cxx | 10 +++++----- src/common/LinkedObjectPool.hxx | 2 +- src/common/PaletteHandler.cxx | 7 ++++--- src/common/PhysicalJoystick.cxx | 2 +- src/common/Rect.hxx | 2 +- src/common/RewindManager.cxx | 2 +- src/common/Stack.hxx | 2 +- src/common/StaggeredLogger.cxx | 2 +- src/common/Vec.hxx | 2 +- src/common/audio/LanczosResampler.cxx | 8 ++++---- .../repository/CompositeKVRJsonAdapter.cxx | 5 +++-- .../repository/KeyValueRepositoryJsonFile.cxx | 2 +- .../KeyValueRepositoryPropertyFile.cxx | 2 +- src/common/repository/sqlite/StellaDb.cxx | 2 +- src/common/sdl_blitter/QisBlitter.hxx | 2 +- src/common/tv_filters/NTSCFilter.cxx | 9 --------- src/common/tv_filters/NTSCFilter.hxx | 9 ++++++++- src/debugger/CartDebug.cxx | 9 +++++---- src/debugger/DebuggerParser.cxx | 10 +++++----- src/debugger/TIADebug.cxx | 20 +++++++++---------- src/debugger/gui/CartARMWidget.cxx | 13 +++++++----- src/debugger/gui/CartBUSWidget.cxx | 15 +++++++++----- src/debugger/gui/CartCDFWidget.cxx | 18 +++++++++++------ src/debugger/gui/CartDPCPlusWidget.cxx | 9 ++++++--- src/debugger/gui/CartEnhancedWidget.cxx | 2 +- src/debugger/gui/DataGridWidget.cxx | 12 +++++------ src/debugger/gui/DebuggerDialog.cxx | 2 +- src/debugger/gui/RiotWidget.cxx | 20 +++++++++---------- src/debugger/gui/RomListWidget.cxx | 2 +- src/debugger/gui/TiaWidget.cxx | 4 ++-- src/debugger/gui/ToggleWidget.cxx | 8 ++++---- src/emucore/Cart.cxx | 2 +- src/emucore/Cart0840.cxx | 4 ++-- src/emucore/Cart0840.hxx | 2 +- src/emucore/Cart0FA0.cxx | 4 ++-- src/emucore/Cart0FA0.hxx | 2 +- src/emucore/Cart2K.hxx | 2 +- src/emucore/Cart4K.hxx | 2 +- src/emucore/CartBF.hxx | 2 +- src/emucore/CartCDF.cxx | 2 +- src/emucore/CartCV.hxx | 2 +- src/emucore/CartDF.hxx | 2 +- src/emucore/CartE0.hxx | 2 +- src/emucore/CartEF.hxx | 2 +- src/emucore/CartEnhanced.cxx | 17 +++++++++------- src/emucore/CartEnhanced.hxx | 2 +- src/emucore/CartF0.hxx | 2 +- src/emucore/CartF4.hxx | 2 +- src/emucore/CartF6.hxx | 2 +- src/emucore/CartF8.hxx | 2 +- src/emucore/CartFA.hxx | 2 +- src/emucore/CartFA2.hxx | 2 +- src/emucore/CartFC.cxx | 2 +- src/emucore/CartFC.hxx | 2 +- src/emucore/CartMDM.cxx | 4 ++-- src/emucore/CartMDM.hxx | 2 +- src/emucore/CartMVC.cxx | 10 +++++----- src/emucore/CartSB.cxx | 4 ++-- src/emucore/CartSB.hxx | 2 +- src/emucore/CartTVBoy.hxx | 2 +- src/emucore/CartUA.cxx | 4 ++-- src/emucore/CartUA.hxx | 2 +- src/emucore/CartWD.hxx | 2 +- src/emucore/CartX07.cxx | 4 ++-- src/emucore/CartX07.hxx | 2 +- src/emucore/Console.cxx | 10 +++++----- src/emucore/Control.cxx | 3 ++- src/emucore/EmulationTiming.cxx | 2 +- src/emucore/EventHandler.cxx | 8 ++++---- src/emucore/FBSurface.cxx | 2 +- src/emucore/FrameBuffer.cxx | 3 ++- src/emucore/MD5.cxx | 8 ++++---- src/emucore/MD5.hxx | 2 +- src/emucore/MT24LC256.cxx | 6 +++--- src/emucore/OSystem.cxx | 2 +- src/emucore/PlusROM.cxx | 2 +- src/emucore/ProfilingRunner.cxx | 5 +++-- src/emucore/Settings.cxx | 4 ++-- src/emucore/TIASurface.cxx | 18 ++++++++++------- src/emucore/Thumbulator.cxx | 10 +++++----- src/emucore/tia/AnalogReadout.cxx | 2 +- src/emucore/tia/Audio.cxx | 2 +- src/emucore/tia/Playfield.cxx | 2 +- src/emucore/tia/TIA.cxx | 6 +++--- .../frame-manager/AbstractFrameManager.cxx | 2 +- .../tia/frame-manager/FrameManager.cxx | 2 +- src/gui/DeveloperDialog.cxx | 4 ++-- src/gui/EmulationDialog.cxx | 9 +++++---- src/gui/EventMappingWidget.cxx | 3 ++- src/gui/FileListWidget.cxx | 9 +++++---- src/gui/Font.cxx | 2 +- src/gui/Font.hxx | 2 +- src/gui/Icon.hxx | 2 +- src/gui/Icons.hxx | 2 +- src/gui/Launcher.cxx | 4 ++-- src/gui/LauncherFileListWidget.cxx | 18 ++++++++++------- src/gui/MessageBox.cxx | 2 +- src/gui/MessageBox.hxx | 2 +- src/gui/RadioButtonWidget.cxx | 5 +++-- src/gui/RomImageWidget.cxx | 6 ++++-- src/gui/TimeLineWidget.cxx | 4 ++-- src/gui/ToolTip.cxx | 4 ++-- src/gui/VideoAudioDialog.cxx | 2 +- src/os/unix/FSNodePOSIX.cxx | 8 ++++---- src/os/unix/OSystemUNIX.cxx | 2 +- 114 files changed, 290 insertions(+), 249 deletions(-) diff --git a/src/cheat/CheatCodeDialog.cxx b/src/cheat/CheatCodeDialog.cxx index bbb3c2a2a..bcb5c8f89 100644 --- a/src/cheat/CheatCodeDialog.cxx +++ b/src/cheat/CheatCodeDialog.cxx @@ -128,7 +128,7 @@ void CheatCodeDialog::loadConfig() for(const auto& c: list) { l.push_back(c->name()); - b.push_back(bool(c->enabled())); + b.push_back(c->enabled()); } myCheatList->setList(l, b); diff --git a/src/common/AudioSettings.cxx b/src/common/AudioSettings.cxx index c0f7eb961..5a28d0df1 100644 --- a/src/common/AudioSettings.cxx +++ b/src/common/AudioSettings.cxx @@ -39,7 +39,7 @@ namespace { numericResamplingQuality <= static_cast(AudioSettings::ResamplingQuality::lanczos_3) ) ? static_cast(numericResamplingQuality) : AudioSettings::DEFAULT_RESAMPLING_QUALITY; } -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AudioSettings::AudioSettings(Settings& settings) diff --git a/src/common/Base.cxx b/src/common/Base.cxx index 79f632dc6..333050d91 100644 --- a/src/common/Base.cxx +++ b/src/common/Base.cxx @@ -126,4 +126,4 @@ Base::Fmt Base::myDefaultBase = Base::Fmt::_16; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - std::ios_base::fmtflags Base::myHexflags = std::ios_base::hex; // NOLINT -} // Namespace Common +} // namespace Common diff --git a/src/common/EventHandlerSDL2.cxx b/src/common/EventHandlerSDL2.cxx index d4d8766cf..e4d148fb9 100644 --- a/src/common/EventHandlerSDL2.cxx +++ b/src/common/EventHandlerSDL2.cxx @@ -30,7 +30,8 @@ EventHandlerSDL2::EventHandlerSDL2(OSystem& osystem) #ifdef GUI_SUPPORT { ostringstream buf; - myQwertz = int{'y'} == static_cast(SDL_GetKeyFromScancode(SDL_Scancode(KBDK_Z))); + myQwertz = int{'y'} == static_cast + (SDL_GetKeyFromScancode(static_cast(KBDK_Z))); buf << "Keyboard: " << (myQwertz ? "QWERTZ" : "QWERTY"); Logger::debug(buf.str()); } diff --git a/src/common/FBBackendSDL2.cxx b/src/common/FBBackendSDL2.cxx index dec71cadc..117c6c551 100644 --- a/src/common/FBBackendSDL2.cxx +++ b/src/common/FBBackendSDL2.cxx @@ -357,8 +357,8 @@ bool FBBackendSDL2::adaptRefreshRate(Int32 displayIndex, const int wantedRefreshRate = myOSystem.hasConsole() ? myOSystem.console().gameRefreshRate() : 0; // Take care of rounded refresh rates (e.g. 59.94 Hz) - float factor = std::min(float(currentRefreshRate) / wantedRefreshRate, - float(currentRefreshRate) / (wantedRefreshRate - 1)); + float factor = std::min( + static_cast(currentRefreshRate) / wantedRefreshRate, static_cast(currentRefreshRate) / (wantedRefreshRate - 1)); // Calculate difference taking care of integer factors (e.g. 100/120) float bestDiff = std::abs(factor - std::round(factor)) / factor; bool adapt = false; @@ -377,8 +377,9 @@ bool FBBackendSDL2::adaptRefreshRate(Int32 displayIndex, Logger::error("ERROR: Closest display mode could not be retrieved"); return adapt; } - factor = std::min(float(sdlMode.refresh_rate) / sdlMode.refresh_rate, - float(sdlMode.refresh_rate) / (sdlMode.refresh_rate - 1)); + factor = std::min( + static_cast(sdlMode.refresh_rate) / sdlMode.refresh_rate, + static_cast(sdlMode.refresh_rate) / (sdlMode.refresh_rate - 1)); const float diff = std::abs(factor - std::round(factor)) / factor; if(diff < bestDiff) { diff --git a/src/common/FBSurfaceSDL2.cxx b/src/common/FBSurfaceSDL2.cxx index 6899b982d..749c93bf0 100644 --- a/src/common/FBSurfaceSDL2.cxx +++ b/src/common/FBSurfaceSDL2.cxx @@ -38,7 +38,7 @@ namespace { throw runtime_error("unreachable"); } } -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FBSurfaceSDL2::FBSurfaceSDL2(FBBackendSDL2& backend, diff --git a/src/common/FSNodeZIP.cxx b/src/common/FSNodeZIP.cxx index 65dc0a82b..acbc1fc3c 100644 --- a/src/common/FSNodeZIP.cxx +++ b/src/common/FSNodeZIP.cxx @@ -39,7 +39,7 @@ FSNodeZIP::FSNodeZIP(const string& p) if (_zipFile[0] == '~') { #if defined(BSPF_UNIX) || defined(BSPF_MACOS) - const char* home = std::getenv("HOME"); + const char* home = std::getenv("HOME"); // NOLINT (not thread safe) if (home != nullptr) _zipFile.replace(0, 1, home); #elif defined(BSPF_WINDOWS) diff --git a/src/common/HighScoresManager.hxx b/src/common/HighScoresManager.hxx index 2af491eb4..9b1e18c6a 100644 --- a/src/common/HighScoresManager.hxx +++ b/src/common/HighScoresManager.hxx @@ -263,4 +263,5 @@ class HighScoresManager HighScoresManager& operator=(const HighScoresManager&) = delete; HighScoresManager& operator=(HighScoresManager&&) = delete; }; + #endif diff --git a/src/common/JoyMap.cxx b/src/common/JoyMap.cxx index d6ef88aca..6f679f040 100644 --- a/src/common/JoyMap.cxx +++ b/src/common/JoyMap.cxx @@ -298,18 +298,18 @@ json JoyMap::convertLegacyMapping(string list) { json eventMapping = json::object(); - eventMapping["event"] = Event::Type(event); + eventMapping["event"] = static_cast(event); if(button != JOY_CTRL_NONE) eventMapping["button"] = button; if(static_cast(axis) != JoyAxis::NONE) { - eventMapping["axis"] = JoyAxis(axis); - eventMapping["axisDirection"] = JoyDir(adir); + eventMapping["axis"] = static_cast(axis); + eventMapping["axisDirection"] = static_cast(adir); } if(hat != -1) { eventMapping["hat"] = hat; - eventMapping["hatDirection"] = JoyHatDir(hdir); + eventMapping["hatDirection"] = static_cast(hdir); } eventMappings.push_back(eventMapping); diff --git a/src/common/KeyMap.cxx b/src/common/KeyMap.cxx index 496448af9..e05e90f02 100644 --- a/src/common/KeyMap.cxx +++ b/src/common/KeyMap.cxx @@ -66,7 +66,7 @@ namespace { return mask; } -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void KeyMap::add(const Event::Type event, const Mapping& mapping) @@ -301,11 +301,11 @@ json KeyMap::convertLegacyMapping(string list) { json mapping = json::object(); - mapping["event"] = Event::Type(event); - mapping["key"] = StellaKey(key); + mapping["event"] = static_cast(event); + mapping["key"] = static_cast(key); - if(StellaMod(mod) != StellaMod::KBDM_NONE) - mapping["mod"] = serializeModkeyMask(StellaMod(mod)); + if(static_cast(mod) != StellaMod::KBDM_NONE) + mapping["mod"] = serializeModkeyMask(static_cast(mod)); convertedMapping.push_back(mapping); } diff --git a/src/common/LinkedObjectPool.hxx b/src/common/LinkedObjectPool.hxx index ec50ab32f..6ff9cd476 100644 --- a/src/common/LinkedObjectPool.hxx +++ b/src/common/LinkedObjectPool.hxx @@ -287,6 +287,6 @@ class LinkedObjectPool LinkedObjectPool& operator=(LinkedObjectPool&&) = delete; }; -} // Namespace Common +} // namespace Common #endif diff --git a/src/common/PaletteHandler.cxx b/src/common/PaletteHandler.cxx index d0d809ffd..c8a9987e5 100644 --- a/src/common/PaletteHandler.cxx +++ b/src/common/PaletteHandler.cxx @@ -46,7 +46,7 @@ PaletteHandler::PaletteType PaletteHandler::toPaletteType(const string& name) co // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string PaletteHandler::toPaletteName(PaletteType type) { - const string SETTING_NAMES[int(PaletteType::NumTypes)] = { + const string SETTING_NAMES[static_cast(PaletteType::NumTypes)] = { SETTING_STANDARD, SETTING_Z26, SETTING_USER, SETTING_CUSTOM }; @@ -321,12 +321,13 @@ void PaletteHandler::setPalette() // Look at all the palettes, since we don't know which one is // currently active - static constexpr BSPF::array2D palettes = {{ + static constexpr BSPF::array2D(ConsoleTiming::numTimings)> palettes = {{ { &ourNTSCPalette, &ourPALPalette, &ourSECAMPalette }, { &ourNTSCPaletteZ26, &ourPALPaletteZ26, &ourSECAMPaletteZ26 }, { &ourUserNTSCPalette, &ourUserPALPalette, &ourUserSECAMPalette }, { &ourCustomNTSCPalette, &ourCustomPALPalette, &ourSECAMPalette } - }}; + }}; // See which format we should be using const ConsoleTiming timing = myOSystem.console().timing(); const PaletteType paletteType = toPaletteType(name); diff --git a/src/common/PhysicalJoystick.cxx b/src/common/PhysicalJoystick.cxx index 78ccac8fa..0e747917e 100644 --- a/src/common/PhysicalJoystick.cxx +++ b/src/common/PhysicalJoystick.cxx @@ -39,7 +39,7 @@ namespace { return result; } -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PhysicalJoystick::initialize(int index, const string& desc, diff --git a/src/common/Rect.hxx b/src/common/Rect.hxx index 36bb12359..24653aec5 100644 --- a/src/common/Rect.hxx +++ b/src/common/Rect.hxx @@ -186,6 +186,6 @@ public: } }; -} // End of namespace Common +} // namespace Common #endif diff --git a/src/common/RewindManager.cxx b/src/common/RewindManager.cxx index 8383923db..9053fcae3 100644 --- a/src/common/RewindManager.cxx +++ b/src/common/RewindManager.cxx @@ -469,7 +469,7 @@ IntArray RewindManager::cyclesList() const const uInt64 firstCycle = getFirstCycles(); // NOLINTNEXTLINE (TODO: convert myStateList to use range-for) for(auto it = myStateList.cbegin(); it != myStateList.cend(); ++it) - arr.push_back(uInt32(it->cycles - firstCycle)); + arr.push_back(static_cast(it->cycles - firstCycle)); return arr; } diff --git a/src/common/Stack.hxx b/src/common/Stack.hxx index 4329ecab1..c755a5b73 100644 --- a/src/common/Stack.hxx +++ b/src/common/Stack.hxx @@ -79,6 +79,6 @@ class FixedStack FixedStack& operator=(FixedStack&&) = delete; }; -} // Namespace Common +} // namespace Common #endif diff --git a/src/common/StaggeredLogger.cxx b/src/common/StaggeredLogger.cxx index f9243feae..62210c287 100644 --- a/src/common/StaggeredLogger.cxx +++ b/src/common/StaggeredLogger.cxx @@ -33,7 +33,7 @@ namespace { return formattedTime.data(); } -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - StaggeredLogger::StaggeredLogger(const string& message, Logger::Level level) diff --git a/src/common/Vec.hxx b/src/common/Vec.hxx index 8e4de470c..d9dff2fae 100644 --- a/src/common/Vec.hxx +++ b/src/common/Vec.hxx @@ -40,6 +40,6 @@ void removeAt(vector& dst, uInt32 idx) dst.erase(dst.cbegin()+idx); } -} // Namespace Vec +} // namespace Vec #endif diff --git a/src/common/audio/LanczosResampler.cxx b/src/common/audio/LanczosResampler.cxx index bc83256df..4134fefce 100644 --- a/src/common/audio/LanczosResampler.cxx +++ b/src/common/audio/LanczosResampler.cxx @@ -50,7 +50,7 @@ namespace { return sinc(x) * sinc(x / static_cast(a)); } -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LanczosResampler::LanczosResampler( @@ -72,9 +72,9 @@ LanczosResampler::LanczosResampler( myPrecomputedKernelCount{reducedDenominator(formatFrom.sampleRate, formatTo.sampleRate)}, myKernelSize{2 * kernelParameter}, myKernelParameter{kernelParameter}, - myHighPassL{HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)}, - myHighPassR{HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)}, - myHighPass{HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)} + myHighPassL{HIGH_PASS_CUT_OFF, static_cast(formatFrom.sampleRate)}, + myHighPassR{HIGH_PASS_CUT_OFF, static_cast(formatFrom.sampleRate)}, + myHighPass{HIGH_PASS_CUT_OFF, static_cast(formatFrom.sampleRate)} { myPrecomputedKernels = make_unique( static_cast(myPrecomputedKernelCount) * myKernelSize); diff --git a/src/common/repository/CompositeKVRJsonAdapter.cxx b/src/common/repository/CompositeKVRJsonAdapter.cxx index 896557dfb..3c2c8699f 100644 --- a/src/common/repository/CompositeKVRJsonAdapter.cxx +++ b/src/common/repository/CompositeKVRJsonAdapter.cxx @@ -51,12 +51,13 @@ namespace { KeyValueRepositoryAtomic& myKvr; const string& myKey; }; -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CompositeKVRJsonAdapter::CompositeKVRJsonAdapter(KeyValueRepositoryAtomic& kvr) : myKvr{kvr} -{} +{ +} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - shared_ptr CompositeKVRJsonAdapter::get(const string& key) diff --git a/src/common/repository/KeyValueRepositoryJsonFile.cxx b/src/common/repository/KeyValueRepositoryJsonFile.cxx index d047d0f78..a49e9afe9 100644 --- a/src/common/repository/KeyValueRepositoryJsonFile.cxx +++ b/src/common/repository/KeyValueRepositoryJsonFile.cxx @@ -27,7 +27,7 @@ namespace { return parsed.is_discarded() ? json(s) : parsed; } -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - KeyValueRepositoryJsonFile::KeyValueRepositoryJsonFile(const FSNode& node) diff --git a/src/common/repository/KeyValueRepositoryPropertyFile.cxx b/src/common/repository/KeyValueRepositoryPropertyFile.cxx index 141a23642..ff582663d 100644 --- a/src/common/repository/KeyValueRepositoryPropertyFile.cxx +++ b/src/common/repository/KeyValueRepositoryPropertyFile.cxx @@ -66,7 +66,7 @@ namespace { } out.put('"'); } -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - KeyValueRepositoryPropertyFile::KeyValueRepositoryPropertyFile( diff --git a/src/common/repository/sqlite/StellaDb.cxx b/src/common/repository/sqlite/StellaDb.cxx index b632bd330..e36319c2d 100644 --- a/src/common/repository/sqlite/StellaDb.cxx +++ b/src/common/repository/sqlite/StellaDb.cxx @@ -36,7 +36,7 @@ namespace { constexpr Int32 CURRENT_VERSION = 1; -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - StellaDb::StellaDb(const string& databaseDirectory, const string& databaseName) diff --git a/src/common/sdl_blitter/QisBlitter.hxx b/src/common/sdl_blitter/QisBlitter.hxx index 92e31f139..b682ed7b5 100644 --- a/src/common/sdl_blitter/QisBlitter.hxx +++ b/src/common/sdl_blitter/QisBlitter.hxx @@ -37,7 +37,7 @@ class QisBlitter : public Blitter { SDL_Rect srcRect, SDL_Rect destRect, FBSurface::Attributes attributes, - SDL_Surface* staticData = nullptr + SDL_Surface* staticData ) override; void blit(SDL_Surface& surface) override; diff --git a/src/common/tv_filters/NTSCFilter.cxx b/src/common/tv_filters/NTSCFilter.cxx index c1b6e61e3..00af294ee 100644 --- a/src/common/tv_filters/NTSCFilter.cxx +++ b/src/common/tv_filters/NTSCFilter.cxx @@ -192,12 +192,3 @@ void NTSCFilter::convertToAdjustable(Adjustable& adjustable, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AtariNTSC::Setup NTSCFilter::myCustomSetup = AtariNTSC::TV_Composite; - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const std::array NTSCFilter::ourCustomAdjustables = { { - { "sharpness", &myCustomSetup.sharpness }, - { "resolution", &myCustomSetup.resolution }, - { "artifacts", &myCustomSetup.artifacts }, - { "fringing", &myCustomSetup.fringing }, - { "bleeding", &myCustomSetup.bleed } -} }; diff --git a/src/common/tv_filters/NTSCFilter.hxx b/src/common/tv_filters/NTSCFilter.hxx index dcd59925d..aec8454c2 100644 --- a/src/common/tv_filters/NTSCFilter.hxx +++ b/src/common/tv_filters/NTSCFilter.hxx @@ -148,7 +148,14 @@ class NTSCFilter float* value{nullptr}; }; uInt32 myCurrentAdjustable{0}; - static const std::array ourCustomAdjustables; + + static constexpr std::array ourCustomAdjustables = {{ + { "sharpness", &myCustomSetup.sharpness }, + { "resolution", &myCustomSetup.resolution }, + { "artifacts", &myCustomSetup.artifacts }, + { "fringing", &myCustomSetup.fringing }, + { "bleeding", &myCustomSetup.bleed } + }}; private: // Following constructors and assignment operators not supported diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 4c730b04d..22561c378 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -248,7 +248,8 @@ bool CartDebug::disassembleAddr(uInt16 address, bool force) const Cartridge& cart = myConsole.cartridge(); const int segCount = cart.segmentCount(); // ROM/RAM bank or ZP-RAM? - const int addrBank = (address & 0x1000) ? getBank(address) : int(myBankInfo.size()) - 1; + const int addrBank = (address & 0x1000) + ? getBank(address) : static_cast(myBankInfo.size()) - 1; if(segCount > 1) { @@ -476,7 +477,7 @@ bool CartDebug::addDirective(Device::AccessType type, if(bank < 0) // Do we want the current bank or ZP RAM? bank = (myDebugger.cpuDebug().pc() & 0x1000) ? - getBank(myDebugger.cpuDebug().pc()) : int(myBankInfo.size())-1; + getBank(myDebugger.cpuDebug().pc()) : static_cast(myBankInfo.size())-1; bank = std::min(bank, romBankCount()); BankInfo& info = myBankInfo[bank]; @@ -628,7 +629,7 @@ bool CartDebug::addLabel(const string& label, uInt16 address) removeLabel(label); myUserAddresses.emplace(label, address); myUserLabels.emplace(address, label); - myLabelLength = std::max(myLabelLength, uInt16(label.size())); + myLabelLength = std::max(myLabelLength, static_cast(label.size())); mySystem.setDirtyPage(address); return true; } @@ -1393,7 +1394,7 @@ string CartDebug::saveDisassembly(string path) << ";-----------------------------------------------------------\n\n"; int max_len = 16; for(const auto& iter: myUserLabels) - max_len = std::max(max_len, int(iter.second.size())); + max_len = std::max(max_len, static_cast(iter.second.size())); for(const auto& iter: myUserLabels) out << ALIGN(max_len) << iter.second << "= $" << iter.first << "\n"; } diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index 95acc5b63..7f27b5eab 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -563,7 +563,7 @@ string DebuggerParser::eval() if(args[i] < 0x10000) buf << " %" << Base::toString(args[i], Base::Fmt::_2); - buf << " #" << int(args[i]); + buf << " #" << static_cast(args[i]); if(i != argCount - 1) buf << endl; } @@ -756,7 +756,7 @@ void DebuggerParser::executeDirective(Device::AccessType type) // "a" void DebuggerParser::executeA() { - debugger.cpuDebug().setA(uInt8(args[0])); + debugger.cpuDebug().setA(static_cast(args[0])); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1909,7 +1909,7 @@ void DebuggerParser::executeRunToPc() // "s" void DebuggerParser::executeS() { - debugger.cpuDebug().setSP(uInt8(args[0])); + debugger.cpuDebug().setSP(static_cast(args[0])); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2488,14 +2488,14 @@ void DebuggerParser::executeWinds(bool unwind) // "x" void DebuggerParser::executeX() { - debugger.cpuDebug().setX(uInt8(args[0])); + debugger.cpuDebug().setX(static_cast(args[0])); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // "y" void DebuggerParser::executeY() { - debugger.cpuDebug().setY(uInt8(args[0])); + debugger.cpuDebug().setY(static_cast(args[0])); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/TIADebug.cxx b/src/debugger/TIADebug.cxx index 17fc528a3..1fb34cee3 100644 --- a/src/debugger/TIADebug.cxx +++ b/src/debugger/TIADebug.cxx @@ -293,7 +293,7 @@ void TIADebug::saveOldState() bool TIADebug::vdelP0(int newVal) { if(newVal > -1) - mySystem.poke(VDELP0, bool(newVal)); + mySystem.poke(VDELP0, static_cast(newVal)); return myTIA.registerValue(VDELP0) & 0x01; } @@ -302,7 +302,7 @@ bool TIADebug::vdelP0(int newVal) bool TIADebug::vdelP1(int newVal) { if(newVal > -1) - mySystem.poke(VDELP1, bool(newVal)); + mySystem.poke(VDELP1, static_cast(newVal)); return myTIA.registerValue(VDELP1) & 0x01; } @@ -311,7 +311,7 @@ bool TIADebug::vdelP1(int newVal) bool TIADebug::vdelBL(int newVal) { if(newVal > -1) - mySystem.poke(VDELBL, bool(newVal)); + mySystem.poke(VDELBL, static_cast(newVal)); return myTIA.registerValue(VDELBL) & 0x01; } @@ -320,7 +320,7 @@ bool TIADebug::vdelBL(int newVal) bool TIADebug::enaM0(int newVal) { if(newVal > -1) - mySystem.poke(ENAM0, bool(newVal) << 1); + mySystem.poke(ENAM0, static_cast(newVal) << 1); return myTIA.registerValue(ENAM0) & 0x02; } @@ -329,7 +329,7 @@ bool TIADebug::enaM0(int newVal) bool TIADebug::enaM1(int newVal) { if(newVal > -1) - mySystem.poke(ENAM1, bool(newVal) << 1); + mySystem.poke(ENAM1, static_cast(newVal) << 1); return myTIA.registerValue(ENAM1) & 0x02; } @@ -338,7 +338,7 @@ bool TIADebug::enaM1(int newVal) bool TIADebug::enaBL(int newVal) { if(newVal > -1) - mySystem.poke(ENABL, bool(newVal) << 1); + mySystem.poke(ENABL, static_cast(newVal) << 1); return myTIA.registerValue(ENABL) & 0x02; } @@ -347,7 +347,7 @@ bool TIADebug::enaBL(int newVal) bool TIADebug::resMP0(int newVal) { if(newVal > -1) - mySystem.poke(RESMP0, bool(newVal) << 1); + mySystem.poke(RESMP0, static_cast(newVal) << 1); return myTIA.registerValue(RESMP0) & 0x02; } @@ -356,7 +356,7 @@ bool TIADebug::resMP0(int newVal) bool TIADebug::resMP1(int newVal) { if(newVal > -1) - mySystem.poke(RESMP1, bool(newVal) << 1); + mySystem.poke(RESMP1, static_cast(newVal) << 1); return myTIA.registerValue(RESMP1) & 0x02; } @@ -365,7 +365,7 @@ bool TIADebug::resMP1(int newVal) bool TIADebug::refP0(int newVal) { if(newVal > -1) - mySystem.poke(REFP0, bool(newVal) << 3); + mySystem.poke(REFP0, static_cast(newVal) << 3); return myTIA.registerValue(REFP0) & 0x08; } @@ -374,7 +374,7 @@ bool TIADebug::refP0(int newVal) bool TIADebug::refP1(int newVal) { if(newVal > -1) - mySystem.poke(REFP1, bool(newVal) << 3); + mySystem.poke(REFP1, static_cast(newVal) << 3); return myTIA.registerValue(REFP1) & 0x08; } diff --git a/src/debugger/gui/CartARMWidget.cxx b/src/debugger/gui/CartARMWidget.cxx index 0a43dd488..3361e9ce7 100644 --- a/src/debugger/gui/CartARMWidget.cxx +++ b/src/debugger/gui/CartARMWidget.cxx @@ -162,23 +162,26 @@ void CartridgeARMWidget::loadConfig() alist.clear(); vlist.clear(); changed.clear(); alist.push_back(0); vlist.push_back(myCart.prevCycles()); - changed.push_back(myCart.prevCycles() != uInt32(myOldState.armPrevRun[0])); + changed.push_back(myCart.prevCycles() != + static_cast(myOldState.armPrevRun[0])); myPrevThumbCycles->setList(alist, vlist, changed); alist.clear(); vlist.clear(); changed.clear(); alist.push_back(0); vlist.push_back(myCart.prevStats().instructions); - changed.push_back(myCart.prevStats().instructions != uInt32(myOldState.armPrevRun[1])); + changed.push_back(myCart.prevStats().instructions != + static_cast(myOldState.armPrevRun[1])); myPrevThumbInstructions->setList(alist, vlist, changed); alist.clear(); vlist.clear(); changed.clear(); alist.push_back(0); vlist.push_back(myCart.cycles()); - changed.push_back(myCart.cycles() != uInt32(myOldState.armRun[0])); + changed.push_back(myCart.cycles() != + static_cast(myOldState.armRun[0])); myThumbCycles->setList(alist, vlist, changed); - alist.clear(); vlist.clear(); changed.clear(); alist.push_back(0); vlist.push_back(myCart.stats().instructions); - changed.push_back(myCart.stats().instructions != uInt32(myOldState.armRun[1])); + changed.push_back(myCart.stats().instructions != + static_cast(myOldState.armRun[1])); myThumbInstructions->setList(alist, vlist, changed); CartDebugWidget::loadConfig(); diff --git a/src/debugger/gui/CartBUSWidget.cxx b/src/debugger/gui/CartBUSWidget.cxx index 47486de61..38095001c 100644 --- a/src/debugger/gui/CartBUSWidget.cxx +++ b/src/debugger/gui/CartBUSWidget.cxx @@ -368,7 +368,8 @@ 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] != + static_cast(myOldState.mcounters[i])); } myMusicCounters->setList(alist, vlist, changed); @@ -376,7 +377,8 @@ 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] != + static_cast(myOldState.mfreqs[i])); } myMusicFrequencies->setList(alist, vlist, changed); @@ -384,7 +386,8 @@ void CartridgeBUSWidget::loadConfig() for(int i = 0; i < 3; ++i) { alist.push_back(0); vlist.push_back(myCart.getWaveform(i) >> 5); - changed.push_back((myCart.getWaveform(i) >> 5) != uInt32(myOldState.mwaves[i])); + changed.push_back((myCart.getWaveform(i) >> 5) != + static_cast(myOldState.mwaves[i])); } myMusicWaveforms->setList(alist, vlist, changed); @@ -392,7 +395,8 @@ void CartridgeBUSWidget::loadConfig() for(int i = 0; i < 3; ++i) { alist.push_back(0); vlist.push_back(myCart.getWaveformSize(i)); - changed.push_back((myCart.getWaveformSize(i)) != uInt32(myOldState.mwavesizes[i])); + changed.push_back((myCart.getWaveformSize(i)) != + static_cast(myOldState.mwavesizes[i])); } myMusicWaveformSizes->setList(alist, vlist, changed); @@ -400,7 +404,8 @@ void CartridgeBUSWidget::loadConfig() { alist.clear(); vlist.clear(); changed.clear(); alist.push_back(0); vlist.push_back(myCart.getSample()); - changed.push_back((myCart.getSample()) != uInt32(myOldState.samplepointer[0])); + changed.push_back((myCart.getSample()) != + static_cast(myOldState.samplepointer[0])); mySamplePointer->setList(alist, vlist, changed); } diff --git a/src/debugger/gui/CartCDFWidget.cxx b/src/debugger/gui/CartCDFWidget.cxx index f73801350..21d2dbb6c 100644 --- a/src/debugger/gui/CartCDFWidget.cxx +++ b/src/debugger/gui/CartCDFWidget.cxx @@ -285,7 +285,8 @@ void CartridgeCDFWidget::loadConfig() { alist.clear(); vlist.clear(); changed.clear(); alist.push_back(0); vlist.push_back(myCart.myRAM[myCart.myFastFetcherOffset]); - changed.push_back((myCart.myRAM[myCart.myFastFetcherOffset]) != uInt32(myOldState.fastfetchoffset[0])); + changed.push_back((myCart.myRAM[myCart.myFastFetcherOffset]) != + static_cast(myOldState.fastfetchoffset[0])); myFastFetcherOffset->setList(alist, vlist, changed); } @@ -360,7 +361,8 @@ void CartridgeCDFWidget::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] != + static_cast(myOldState.mcounters[i])); } myMusicCounters->setList(alist, vlist, changed); @@ -368,7 +370,8 @@ void CartridgeCDFWidget::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] != + static_cast(myOldState.mfreqs[i])); } myMusicFrequencies->setList(alist, vlist, changed); @@ -376,7 +379,8 @@ void CartridgeCDFWidget::loadConfig() for(int i = 0; i < 3; ++i) { alist.push_back(0); vlist.push_back(myCart.getWaveform(i) >> 5); - changed.push_back((myCart.getWaveform(i) >> 5) != uInt32(myOldState.mwaves[i])); + changed.push_back((myCart.getWaveform(i) >> 5) != + static_cast(myOldState.mwaves[i])); } myMusicWaveforms->setList(alist, vlist, changed); @@ -384,13 +388,15 @@ void CartridgeCDFWidget::loadConfig() for(int i = 0; i < 3; ++i) { alist.push_back(0); vlist.push_back(myCart.getWaveformSize(i)); - changed.push_back((myCart.getWaveformSize(i)) != uInt32(myOldState.mwavesizes[i])); + changed.push_back((myCart.getWaveformSize(i)) != + static_cast(myOldState.mwavesizes[i])); } myMusicWaveformSizes->setList(alist, vlist, changed); alist.clear(); vlist.clear(); changed.clear(); alist.push_back(0); vlist.push_back(myCart.getSample()); - changed.push_back((myCart.getSample()) != uInt32(myOldState.samplepointer[0])); + changed.push_back((myCart.getSample()) != + static_cast(myOldState.samplepointer[0])); mySamplePointer->setList(alist, vlist, changed); myFastFetch->setState((myCart.myMode & 0x0f) == 0); diff --git a/src/debugger/gui/CartDPCPlusWidget.cxx b/src/debugger/gui/CartDPCPlusWidget.cxx index 424558aff..889cfe93b 100644 --- a/src/debugger/gui/CartDPCPlusWidget.cxx +++ b/src/debugger/gui/CartDPCPlusWidget.cxx @@ -262,7 +262,8 @@ void CartridgeDPCPlusWidget::loadConfig() for(int i = 0; i < 8; ++i) { alist.push_back(0); vlist.push_back(myCart.myFractionalCounters[i]); - changed.push_back(myCart.myFractionalCounters[i] != uInt32(myOldState.fraccounters[i])); + changed.push_back(myCart.myFractionalCounters[i] != + static_cast(myOldState.fraccounters[i])); } myFracCounters->setList(alist, vlist, changed); @@ -286,7 +287,8 @@ void CartridgeDPCPlusWidget::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] != + static_cast(myOldState.mcounters[i])); } myMusicCounters->setList(alist, vlist, changed); @@ -294,7 +296,8 @@ void CartridgeDPCPlusWidget::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] != + static_cast(myOldState.mfreqs[i])); } myMusicFrequencies->setList(alist, vlist, changed); diff --git a/src/debugger/gui/CartEnhancedWidget.cxx b/src/debugger/gui/CartEnhancedWidget.cxx index 7e3f90703..6508e33ec 100644 --- a/src/debugger/gui/CartEnhancedWidget.cxx +++ b/src/debugger/gui/CartEnhancedWidget.cxx @@ -123,7 +123,7 @@ string CartridgeEnhancedWidget::romDescription() else { uInt16 start = (image[myCart.mySize - 3] << 8) | image[myCart.mySize - 4]; - start -= start % std::min(int(size), 0x1000); + start -= start % std::min(static_cast(size), 0x1000); const uInt16 end = start + static_cast(myCart.mySize) - 1; // special check for ROMs where the extra RAM is not included in the image (e.g. CV). if((start & 0xFFFU) < size) diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx index 943c9e23e..25f7c3900 100644 --- a/src/debugger/gui/DataGridWidget.cxx +++ b/src/debugger/gui/DataGridWidget.cxx @@ -374,12 +374,12 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod) break; case KBDK_DOWN: - if (_currentRow < int(_rows) - 1) + if (_currentRow < _rows - 1) { _currentRow++; dirty = true; } - else if(_currentCol < int(_cols) - 1) + else if(_currentCol < _cols - 1) { _currentRow = 0; _currentCol++; @@ -402,12 +402,12 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod) break; case KBDK_RIGHT: - if (_currentCol < int(_cols) - 1) + if (_currentCol < _cols - 1) { _currentCol++; dirty = true; } - else if(_currentRow < int(_rows) - 1) + else if(_currentRow < _rows - 1) { _currentCol = 0; _currentRow++; @@ -428,7 +428,7 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod) case KBDK_PAGEDOWN: if(StellaModTest::isShift(mod) && _scrollBar) handleMouseWheel(0, 0, +1); - else if (_currentRow < int(_rows) - 1) + else if (_currentRow < _rows - 1) { _currentRow = _rows - 1; dirty = true; @@ -444,7 +444,7 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod) break; case KBDK_END: - if (_currentCol < int(_cols) - 1) + if (_currentCol < _cols - 1) { _currentCol = _cols - 1; dirty = true; diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index 334a71270..cf751e81d 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -741,7 +741,7 @@ Common::Rect DebuggerDialog::getStatusBounds() const return { tia.x() + tia.w() + 1, 0, - tia.x() + tia.w() + 225 + (_w > 1030 ? int(0.35 * (_w - 1030)) : 0), + tia.x() + tia.w() + 225 + (_w > 1030 ? static_cast(0.35 * (_w - 1030)) : 0), tia.y() + tia.h() }; } diff --git a/src/debugger/gui/RiotWidget.cxx b/src/debugger/gui/RiotWidget.cxx index 42890ffc7..469f4525a 100644 --- a/src/debugger/gui/RiotWidget.cxx +++ b/src/debugger/gui/RiotWidget.cxx @@ -69,15 +69,15 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, StringList labels; -#define CREATE_IO_REGS(desc, bits, bitsID, editable) \ - t = new StaticTextWidget(boss, lfont, xpos, ypos+2, lwidth, fontHeight,\ - desc); \ - xpos += t->getWidth() + 5; \ - bits = new ToggleBitWidget(boss, nfont, xpos, ypos, 8, 1, 1, labels); \ - bits->setTarget(this); \ - bits->setID(bitsID); \ - if(editable) addFocusWidget(bits); else bits->setEditable(false); \ - bits->setList(off, on); +#define CREATE_IO_REGS(desc, bits, bitsID, editable) \ + t = new StaticTextWidget(boss, lfont, xpos, ypos+2, lwidth, fontHeight, \ + desc); \ + xpos += t->getWidth() + 5; \ + (bits) = new ToggleBitWidget(boss, nfont, xpos, ypos, 8, 1, 1, labels); \ + (bits)->setTarget(this); \ + (bits)->setID(bitsID); \ + if(editable) addFocusWidget(bits); else (bits)->setEditable(false); \ + (bits)->setList(off, on); // SWCHA bits in 'poke' mode labels.clear(); @@ -286,7 +286,7 @@ void RiotWidget::loadConfig() changed.clear(); \ for(uInt32 i = 0; i < state.s_bits.size(); ++i) \ changed.push_back(state.s_bits[i] != oldstate.s_bits[i]); \ - bits->setState(state.s_bits, changed); + (bits)->setState(state.s_bits, changed); IntArray alist; IntArray vlist; diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index 8fe4dc132..d3260dcb0 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -63,7 +63,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont, const int fontWidth = lfont.getMaxCharWidth(), numchars = w / fontWidth; - _labelWidth = std::max(14, int(0.45 * (numchars - 8 - 8 - 9 - 2))) * fontWidth - 1; + _labelWidth = std::max(14, static_cast(0.45 * (numchars - 8 - 8 - 9 - 2))) * fontWidth - 1; _bytesWidth = 9 * fontWidth; /////////////////////////////////////////////////////// diff --git a/src/debugger/gui/TiaWidget.cxx b/src/debugger/gui/TiaWidget.cxx index 5824f68c6..27e7a7fc8 100644 --- a/src/debugger/gui/TiaWidget.cxx +++ b/src/debugger/gui/TiaWidget.cxx @@ -115,7 +115,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, t = new StaticTextWidget(boss, lfont, xpos, ypos + 2, 2*fontWidth, fontHeight, dbgLabels[row], TextAlign::Left); myFixedColors[row] = new ColorWidget(boss, nfont, xpos + 2 + t->getWidth() + 4, - ypos + 2, uInt32(1.5*lineHeight), lineHeight - 4); + ypos + 2, static_cast(1.5*lineHeight), lineHeight - 4); myFixedColors[row]->setTarget(this); } xpos += t->getWidth() + myFixedColors[0]->getWidth() + 24; @@ -126,7 +126,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, t = new StaticTextWidget(boss, lfont, xpos, ypos + 2, 2*fontWidth, fontHeight, dbgLabels[row], TextAlign::Left); myFixedColors[row] = new ColorWidget(boss, nfont, xpos + 2 + t->getWidth() + 4, - ypos + 2, uInt32(1.5*lineHeight), lineHeight - 4); + ypos + 2, static_cast(1.5*lineHeight), lineHeight - 4); myFixedColors[row]->setTarget(this); } diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx index eabb7603d..d9a5d808d 100644 --- a/src/debugger/gui/ToggleWidget.cxx +++ b/src/debugger/gui/ToggleWidget.cxx @@ -116,7 +116,7 @@ bool ToggleWidget::handleKeyDown(StellaKey key, StellaMod mod) break; case KBDK_DOWN: - if (_currentRow < int(_rows) - 1) + if (_currentRow < _rows - 1) { _currentRow++; dirty = true; @@ -132,7 +132,7 @@ bool ToggleWidget::handleKeyDown(StellaKey key, StellaMod mod) break; case KBDK_RIGHT: - if (_currentCol < int(_cols) - 1) + if (_currentCol < _cols - 1) { _currentCol++; dirty = true; @@ -148,7 +148,7 @@ bool ToggleWidget::handleKeyDown(StellaKey key, StellaMod mod) break; case KBDK_PAGEDOWN: - if (_currentRow < int(_rows) - 1) + if (_currentRow < _rows - 1) { _currentRow = _rows - 1; dirty = true; @@ -164,7 +164,7 @@ bool ToggleWidget::handleKeyDown(StellaKey key, StellaMod mod) break; case KBDK_END: - if (_currentCol < int(_cols) - 1) + if (_currentCol < _cols - 1) { _currentCol = _cols - 1; dirty = true; diff --git a/src/emucore/Cart.cxx b/src/emucore/Cart.cxx index 2d2008d34..2aa3ee034 100644 --- a/src/emucore/Cart.cxx +++ b/src/emucore/Cart.cxx @@ -31,7 +31,7 @@ Cartridge::Cartridge(const Settings& settings, const string& md5) : mySettings{settings} { const auto to_uInt32 = [](const string& s, uInt32 pos) { - return uInt32(std::stoul(s.substr(pos, 8), nullptr, 16)); + return static_cast(std::stoul(s.substr(pos, 8), nullptr, 16)); }; const uInt32 seed = to_uInt32(md5, 0) ^ to_uInt32(md5, 8) ^ diff --git a/src/emucore/Cart0840.cxx b/src/emucore/Cart0840.cxx index f85c73157..da43fba28 100644 --- a/src/emucore/Cart0840.cxx +++ b/src/emucore/Cart0840.cxx @@ -73,7 +73,7 @@ bool Cartridge0840::checkSwitchBank(uInt16 address, uInt8) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt8 Cartridge0840::peek(uInt16 address) { - checkSwitchBank(address); + checkSwitchBank(address, 0); // Because of the way we've set up accessing above, we can only // get here when the addresses are from 0x800 - 0xFFF @@ -84,7 +84,7 @@ uInt8 Cartridge0840::peek(uInt16 address) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Cartridge0840::poke(uInt16 address, uInt8 value) { - checkSwitchBank(address); + checkSwitchBank(address, 0); // Because of the way accessing is set up, we will may get here by // doing a write to 0x800 - 0xFFF or cart; we ignore the cart write diff --git a/src/emucore/Cart0840.hxx b/src/emucore/Cart0840.hxx index b882679bf..05fd1e611 100644 --- a/src/emucore/Cart0840.hxx +++ b/src/emucore/Cart0840.hxx @@ -96,7 +96,7 @@ class Cartridge0840 : public CartridgeEnhanced bool poke(uInt16 address, uInt8 value) override; private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8) override; uInt16 hotspot() const override { return 0x0840; } diff --git a/src/emucore/Cart0FA0.cxx b/src/emucore/Cart0FA0.cxx index 8c97768a0..fe4ef2555 100644 --- a/src/emucore/Cart0FA0.cxx +++ b/src/emucore/Cart0FA0.cxx @@ -81,7 +81,7 @@ uInt8 Cartridge0FA0::peek(uInt16 address) { address &= myBankMask; - checkSwitchBank(address); + checkSwitchBank(address, 0); // Because of the way accessing is set up, we will only get here // when doing a TIA read @@ -93,7 +93,7 @@ bool Cartridge0FA0::poke(uInt16 address, uInt8 value) { address &= myBankMask; - checkSwitchBank(address); + checkSwitchBank(address, 0); // Because of the way accessing is set up, we will may get here by // doing a write to TIA or cart; we ignore the cart write diff --git a/src/emucore/Cart0FA0.hxx b/src/emucore/Cart0FA0.hxx index 1bac20a4b..701efd5ea 100644 --- a/src/emucore/Cart0FA0.hxx +++ b/src/emucore/Cart0FA0.hxx @@ -105,7 +105,7 @@ class Cartridge0FA0 : public CartridgeEnhanced */ bool randomStartBank() const override { return false; } - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8) override; uInt16 hotspot() const override { return 0x06a0; } diff --git a/src/emucore/Cart2K.hxx b/src/emucore/Cart2K.hxx index 09d9a1f37..c936bcec2 100644 --- a/src/emucore/Cart2K.hxx +++ b/src/emucore/Cart2K.hxx @@ -74,7 +74,7 @@ class Cartridge2K : public CartridgeEnhanced #endif private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override { return false; } + bool checkSwitchBank(uInt16, uInt8) override { return false; } private: // Following constructors and assignment operators not supported diff --git a/src/emucore/Cart4K.hxx b/src/emucore/Cart4K.hxx index ab31d314d..9264a596b 100644 --- a/src/emucore/Cart4K.hxx +++ b/src/emucore/Cart4K.hxx @@ -71,7 +71,7 @@ class Cartridge4K : public CartridgeEnhanced #endif private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override { return false; } + bool checkSwitchBank(uInt16, uInt8) override { return false; } private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartBF.hxx b/src/emucore/CartBF.hxx index e362570a6..b6743e0d6 100644 --- a/src/emucore/CartBF.hxx +++ b/src/emucore/CartBF.hxx @@ -72,7 +72,7 @@ class CartridgeBF : public CartridgeEnhanced #endif private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8) override; uInt16 hotspot() const override { return 0x1F80; } diff --git a/src/emucore/CartCDF.cxx b/src/emucore/CartCDF.cxx index 2645630c4..a835162e0 100644 --- a/src/emucore/CartCDF.cxx +++ b/src/emucore/CartCDF.cxx @@ -58,7 +58,7 @@ namespace { throw runtime_error("unreachable"); } } -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size, diff --git a/src/emucore/CartCV.hxx b/src/emucore/CartCV.hxx index 2feb4ddfd..25d660c1b 100644 --- a/src/emucore/CartCV.hxx +++ b/src/emucore/CartCV.hxx @@ -79,7 +79,7 @@ class CartridgeCV : public CartridgeEnhanced #endif private: - bool checkSwitchBank(uInt16, uInt8 = 0) override { return false; } + bool checkSwitchBank(uInt16, uInt8) override { return false; } protected: // Initial RAM data from the cart (doesn't always exist) diff --git a/src/emucore/CartDF.hxx b/src/emucore/CartDF.hxx index f184f179e..fd7e81673 100644 --- a/src/emucore/CartDF.hxx +++ b/src/emucore/CartDF.hxx @@ -72,7 +72,7 @@ class CartridgeDF : public CartridgeEnhanced #endif private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8) override; uInt16 hotspot() const override { return 0x1FC0; } diff --git a/src/emucore/CartE0.hxx b/src/emucore/CartE0.hxx index 6498469b4..fc94d12ef 100644 --- a/src/emucore/CartE0.hxx +++ b/src/emucore/CartE0.hxx @@ -85,7 +85,7 @@ class CartridgeE0 : public CartridgeEnhanced #endif private: - bool checkSwitchBank(uInt16 address, uInt8 = 0) override; + bool checkSwitchBank(uInt16 address, uInt8) override; uInt16 hotspot() const override { return 0x1FE0; } diff --git a/src/emucore/CartEF.hxx b/src/emucore/CartEF.hxx index 9ed15f546..623dff8e7 100644 --- a/src/emucore/CartEF.hxx +++ b/src/emucore/CartEF.hxx @@ -72,7 +72,7 @@ class CartridgeEF : public CartridgeEnhanced #endif private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8) override; uInt16 hotspot() const override { return 0x1FE0; } diff --git a/src/emucore/CartEnhanced.cxx b/src/emucore/CartEnhanced.cxx index f2d191adf..3ed2a3702 100644 --- a/src/emucore/CartEnhanced.cxx +++ b/src/emucore/CartEnhanced.cxx @@ -66,7 +66,8 @@ CartridgeEnhanced::CartridgeEnhanced(const ByteBuffer& image, size_t size, void CartridgeEnhanced::install(System& system) { // limit banked RAM size to the size of one RAM bank - const uInt16 ramSize = myRamBankCount > 0 ? 1 << (myBankShift - 1) : uInt16(myRamSize); + const uInt16 ramSize = myRamBankCount > 0 ? 1 << (myBankShift - 1) : + static_cast(myRamSize); // calculate bank switching and RAM sizes and masks myBankSize = 1 << myBankShift; // e.g. = 2 ^ 12 = 4K = 0x1000 @@ -74,7 +75,7 @@ void CartridgeEnhanced::install(System& system) // Either the bankswitching supports multiple segments // or the ROM is < 4K (-> 1 segment) myBankSegs = std::min(1 << (MAX_BANK_SHIFT - myBankShift), - int(mySize) / myBankSize); // e.g. = 1 + static_cast(mySize) / myBankSize); // e.g. = 1 // ROM has an offset if RAM inside a bank (e.g. for F8SC) myRomOffset = myRamBankCount > 0U ? 0U : static_cast(myRamSize * 2); myRamMask = ramSize - 1; // e.g. = 0xFFFF (doesn't matter for RAM size 0) @@ -160,7 +161,7 @@ uInt8 CartridgeEnhanced::peek(uInt16 address) // hotspots in TIA range are reacting to pokes only if (hotspot() >= 0x80) - checkSwitchBank(address & ADDR_MASK); + checkSwitchBank(address & ADDR_MASK, 0); if(isRamBank(address)) { @@ -202,7 +203,7 @@ bool CartridgeEnhanced::poke(uInt16 address, uInt8 value) if(isRamBank(address)) { - if(bool(address & (myBankSize >> 1)) == myRamWpHigh) + if(static_cast(address & (myBankSize >> 1)) == myRamWpHigh) { address &= myRamMask; // The RAM banks follow the ROM banks and are half the size of a ROM bank @@ -214,7 +215,7 @@ bool CartridgeEnhanced::poke(uInt16 address, uInt8 value) else { //address &= myBankMask; - if(bool(address & myRamSize) == myRamWpHigh) + if(static_cast(address & myRamSize) == myRamWpHigh) { pokeRAM(myRAM[address & myRamMask], pokeAddress, value); return true; @@ -272,10 +273,12 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment) // Setup RAM bank const uInt16 ramBank = (bank - romBankCount()) % myRamBankCount; // The RAM banks follow the ROM banks and are half the size of a ROM bank - const uInt32 bankOffset = uInt32(mySize) + (ramBank << (myBankShift - 1)); + const uInt32 bankOffset = static_cast(mySize) + + (ramBank << (myBankShift - 1)); // Remember what bank is in this segment - myCurrentSegOffset[segment] = uInt32(mySize) + (ramBank << myBankShift); + myCurrentSegOffset[segment] = static_cast(mySize) + + (ramBank << myBankShift); // Set the page accessing method for the RAM writing pages // Note: Writes are mapped to poke() (NOT using directPokeBase) to check for read from write port (RWP) diff --git a/src/emucore/CartEnhanced.hxx b/src/emucore/CartEnhanced.hxx index 79a00d678..1558a967b 100644 --- a/src/emucore/CartEnhanced.hxx +++ b/src/emucore/CartEnhanced.hxx @@ -286,7 +286,7 @@ class CartridgeEnhanced : public Cartridge @return True if a bank switch happened. */ - virtual bool checkSwitchBank(uInt16 address, uInt8 value = 0) = 0; + virtual bool checkSwitchBank(uInt16 address, uInt8 value) = 0; private: /** diff --git a/src/emucore/CartF0.hxx b/src/emucore/CartF0.hxx index 44d4f12c4..53a8d24f7 100644 --- a/src/emucore/CartF0.hxx +++ b/src/emucore/CartF0.hxx @@ -69,7 +69,7 @@ class CartridgeF0 : public CartridgeEnhanced #endif private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8 value) override; uInt16 hotspot() const override { return 0x1FF0; } diff --git a/src/emucore/CartF4.hxx b/src/emucore/CartF4.hxx index 14388ed48..22238315f 100644 --- a/src/emucore/CartF4.hxx +++ b/src/emucore/CartF4.hxx @@ -68,7 +68,7 @@ class CartridgeF4 : public CartridgeEnhanced #endif private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8) override; uInt16 hotspot() const override { return 0x1FF4; } diff --git a/src/emucore/CartF6.hxx b/src/emucore/CartF6.hxx index 03c025439..3a3520862 100644 --- a/src/emucore/CartF6.hxx +++ b/src/emucore/CartF6.hxx @@ -68,7 +68,7 @@ class CartridgeF6 : public CartridgeEnhanced #endif private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8 value) override; uInt16 hotspot() const override { return 0x1FF6; } diff --git a/src/emucore/CartF8.hxx b/src/emucore/CartF8.hxx index 432dcbe15..b2aa7235e 100644 --- a/src/emucore/CartF8.hxx +++ b/src/emucore/CartF8.hxx @@ -68,7 +68,7 @@ class CartridgeF8 : public CartridgeEnhanced #endif private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8 value) override; uInt16 hotspot() const override { return 0x1FF8; } diff --git a/src/emucore/CartFA.hxx b/src/emucore/CartFA.hxx index d64a98d56..903db002c 100644 --- a/src/emucore/CartFA.hxx +++ b/src/emucore/CartFA.hxx @@ -72,7 +72,7 @@ class CartridgeFA : public CartridgeEnhanced #endif private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8) override; uInt16 hotspot() const override { return 0x1FF8; } diff --git a/src/emucore/CartFA2.hxx b/src/emucore/CartFA2.hxx index c0e595d23..bfa373945 100644 --- a/src/emucore/CartFA2.hxx +++ b/src/emucore/CartFA2.hxx @@ -109,7 +109,7 @@ class CartridgeFA2 : public CartridgeFA bool poke(uInt16 address, uInt8 value) override; private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8 value) override; uInt16 hotspot() const override { return 0x1FF5; } diff --git a/src/emucore/CartFC.cxx b/src/emucore/CartFC.cxx index e594a448f..5eac6a792 100644 --- a/src/emucore/CartFC.cxx +++ b/src/emucore/CartFC.cxx @@ -74,7 +74,7 @@ bool CartridgeFC::poke(uInt16 address, uInt8 value) break; default: - checkSwitchBank(address); + checkSwitchBank(address, 0); } return false; } diff --git a/src/emucore/CartFC.hxx b/src/emucore/CartFC.hxx index 94d13c6ae..d234eb4cf 100644 --- a/src/emucore/CartFC.hxx +++ b/src/emucore/CartFC.hxx @@ -90,7 +90,7 @@ class CartridgeFC : public CartridgeEnhanced bool poke(uInt16 address, uInt8 value) override; private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8) override; uInt16 hotspot() const override { return 0x1FF8; } diff --git a/src/emucore/CartMDM.cxx b/src/emucore/CartMDM.cxx index 258d3b34d..c116b4829 100644 --- a/src/emucore/CartMDM.cxx +++ b/src/emucore/CartMDM.cxx @@ -67,7 +67,7 @@ uInt8 CartridgeMDM::peek(uInt16 address) // Because of the way we've set up accessing above, we can only // get here when the addresses are from 0x800 - 0xBFF - checkSwitchBank(address); + checkSwitchBank(address, 0); const int hotspot = ((address & 0x0F00) >> 8) - 8; return myHotSpotPageAccess[hotspot].device->peek(address); @@ -80,7 +80,7 @@ bool CartridgeMDM::poke(uInt16 address, uInt8 value) // about those below $1000 if(!(address & 0x1000)) { - checkSwitchBank(address); + checkSwitchBank(address, 0); const int hotspot = ((address & 0x0F00) >> 8) - 8; myHotSpotPageAccess[hotspot].device->poke(address, value); diff --git a/src/emucore/CartMDM.hxx b/src/emucore/CartMDM.hxx index d116d3e37..a8c39f833 100644 --- a/src/emucore/CartMDM.hxx +++ b/src/emucore/CartMDM.hxx @@ -137,7 +137,7 @@ class CartridgeMDM : public CartridgeEnhanced bool poke(uInt16 address, uInt8 value) override; private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8) override; private: // Previous Device's page access diff --git a/src/emucore/CartMVC.cxx b/src/emucore/CartMVC.cxx index fe9914f27..8c5d75d48 100755 --- a/src/emucore/CartMVC.cxx +++ b/src/emucore/CartMVC.cxx @@ -22,9 +22,9 @@ /** Implementation of MovieCart. - 1K of memory is presented on the bus, but is repeated to fill the 4K image space. - Contents are dynamically altered with streaming image and audio content as specific - 128-byte regions are entered. + 1K of memory is presented on the bus, but is repeated to fill the 4K image + space. Contents are dynamically altered with streaming image and audio content + as specific 128-byte regions are entered. Original implementation: github.com/lodefmode/moviecart @author Rob Bairos @@ -45,7 +45,7 @@ namespace { constexpr int BACK_SECONDS = 10; constexpr int TITLE_CYCLES = 1000000; -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /** @@ -61,7 +61,7 @@ class StreamReader : public Serializable if(myFile) myFileSize = myFile.size(); - return bool(myFile); + return static_cast(myFile); } void blankPartialLines(bool index) { diff --git a/src/emucore/CartSB.cxx b/src/emucore/CartSB.cxx index 80e90cbcb..8a55eae4d 100644 --- a/src/emucore/CartSB.cxx +++ b/src/emucore/CartSB.cxx @@ -66,7 +66,7 @@ uInt8 CartridgeSB::peek(uInt16 address) { address &= (0x17FF + romBankCount()); - checkSwitchBank(address); + checkSwitchBank(address, 0); if(!(address & 0x1000)) { @@ -84,7 +84,7 @@ bool CartridgeSB::poke(uInt16 address, uInt8 value) { address &= (0x17FF + romBankCount()); - checkSwitchBank(address); + checkSwitchBank(address, 0); if(!(address & 0x1000)) { diff --git a/src/emucore/CartSB.hxx b/src/emucore/CartSB.hxx index 9d726e316..3e9de0795 100644 --- a/src/emucore/CartSB.hxx +++ b/src/emucore/CartSB.hxx @@ -98,7 +98,7 @@ class CartridgeSB : public CartridgeEnhanced bool poke(uInt16 address, uInt8 value) override; private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8) override; uInt16 hotspot() const override { return 0x0800; } diff --git a/src/emucore/CartTVBoy.hxx b/src/emucore/CartTVBoy.hxx index 3764daa3e..2658b583b 100644 --- a/src/emucore/CartTVBoy.hxx +++ b/src/emucore/CartTVBoy.hxx @@ -97,7 +97,7 @@ class CartridgeTVBoy : public CartridgeEnhanced #endif private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8 value) override; uInt16 hotspot() const override { return 0x1800; } diff --git a/src/emucore/CartUA.cxx b/src/emucore/CartUA.cxx index ba2aca628..8d9523f36 100644 --- a/src/emucore/CartUA.cxx +++ b/src/emucore/CartUA.cxx @@ -85,7 +85,7 @@ uInt8 CartridgeUA::peek(uInt16 address) { address &= myBankMask; - checkSwitchBank(address); + checkSwitchBank(address, 0); // Because of the way accessing is set up, we will only get here // when doing a TIA read @@ -98,7 +98,7 @@ bool CartridgeUA::poke(uInt16 address, uInt8 value) { address &= myBankMask; - checkSwitchBank(address); + checkSwitchBank(address, 0); // Because of the way accessing is set up, we will may get here by // doing a write to TIA or cart; we ignore the cart write diff --git a/src/emucore/CartUA.hxx b/src/emucore/CartUA.hxx index fb0434bac..6b99fefc4 100644 --- a/src/emucore/CartUA.hxx +++ b/src/emucore/CartUA.hxx @@ -99,7 +99,7 @@ class CartridgeUA : public CartridgeEnhanced bool poke(uInt16 address, uInt8 value) override; private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8) override; uInt16 hotspot() const override { return 0x0220; } diff --git a/src/emucore/CartWD.hxx b/src/emucore/CartWD.hxx index 292944d22..2ae2be696 100644 --- a/src/emucore/CartWD.hxx +++ b/src/emucore/CartWD.hxx @@ -158,7 +158,7 @@ class CartridgeWD : public CartridgeEnhanced */ bool randomStartBank() const override { return false; } - bool checkSwitchBank(uInt16, uInt8 = 0) override { return false; } + bool checkSwitchBank(uInt16, uInt8) override { return false; } uInt16 hotspot() const override { return 0x0030; } diff --git a/src/emucore/CartX07.cxx b/src/emucore/CartX07.cxx index 686a089f0..bec63de9b 100644 --- a/src/emucore/CartX07.cxx +++ b/src/emucore/CartX07.cxx @@ -74,7 +74,7 @@ uInt8 CartridgeX07::peek(uInt16 address) else if(!(lowAddress & 0x200)) value = mySystem->tia().peek(address); - checkSwitchBank(address); + checkSwitchBank(address, 0); return value; } @@ -90,7 +90,7 @@ bool CartridgeX07::poke(uInt16 address, uInt8 value) else if(!(lowAddress & 0x200)) mySystem->tia().poke(address, value); - checkSwitchBank(address); + checkSwitchBank(address, 0); return false; } diff --git a/src/emucore/CartX07.hxx b/src/emucore/CartX07.hxx index 8fc7304f7..b40583f3e 100644 --- a/src/emucore/CartX07.hxx +++ b/src/emucore/CartX07.hxx @@ -106,7 +106,7 @@ class CartridgeX07 : public CartridgeEnhanced bool poke(uInt16 address, uInt8 value) override; private: - bool checkSwitchBank(uInt16 address, uInt8 value = 0) override; + bool checkSwitchBank(uInt16 address, uInt8) override; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 2a1081a2d..8273adfff 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -77,9 +77,10 @@ #include "Console.hxx" namespace { - // Emulation speed is a positive float that multiplies the framerate. However, the UI controls - // adjust speed in terms of a speedup factor (1/10, 1/9 .. 1/2, 1, 2, 3, .., 10). The following - // mapping and formatting functions implement this conversion. The speedup factor is represented + // Emulation speed is a positive float that multiplies the framerate. However, + // the UI controls adjust speed in terms of a speedup factor (1/10, + // 1/9 .. 1/2, 1, 2, 3, .., 10). The following mapping and formatting + // functions implement this conversion. The speedup factor is represented // by an integer value between -900 and 900 (0 means no speedup). constexpr int MAX_SPEED = 900; @@ -112,8 +113,7 @@ namespace { return ss.str(); } -} - +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Console::Console(OSystem& osystem, unique_ptr& cart, diff --git a/src/emucore/Control.cxx b/src/emucore/Control.cxx index 7ffc779be..da1864111 100644 --- a/src/emucore/Control.cxx +++ b/src/emucore/Control.cxx @@ -120,7 +120,8 @@ string Controller::getName(const Type type) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string Controller::getPropName(const Type type) { - static constexpr std::array PROP_NAMES = + static constexpr std::array(Controller::Type::LastType)> PROP_NAMES = { "AUTO", "AMIGAMOUSE", "ATARIMOUSE", "ATARIVOX", "BOOSTERGRIP", "COMPUMATE", diff --git a/src/emucore/EmulationTiming.cxx b/src/emucore/EmulationTiming.cxx index 57928bae4..1d98183c8 100644 --- a/src/emucore/EmulationTiming.cxx +++ b/src/emucore/EmulationTiming.cxx @@ -26,7 +26,7 @@ namespace { { return n / d + ((n % d == 0) ? 0 : 1); } -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EmulationTiming::EmulationTiming(FrameLayout frameLayout, ConsoleTiming consoleTiming) diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index f676c9a92..aa4213ea2 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -2033,14 +2033,14 @@ json EventHandler::convertLegacyComboMapping(string list) buf >> event; // skip all NoType events if(event != Event::NoType) - events.push_back(Event::Type(event)); + events.push_back(static_cast(event)); } // only store if there are any NoType events if(!events.empty()) { json combo; - combo["combo"] = Event::Type(Event::Combo1 + i); + combo["combo"] = static_cast(Event::Combo1 + i); combo["events"] = events; convertedMapping.push_back(combo); } @@ -2171,14 +2171,14 @@ void EventHandler::saveComboMapping() // skip all NoType events if(event != Event::NoType) - events.push_back(Event::Type(event)); + events.push_back(static_cast(event)); } // only store if there are any NoType events if(!events.empty()) { json combo; - combo["combo"] = Event::Type(Event::Combo1 + i); + combo["combo"] = static_cast(Event::Combo1 + i); combo["events"] = events; mapping.push_back(combo); } diff --git a/src/emucore/FBSurface.cxx b/src/emucore/FBSurface.cxx index d451ff7f2..596bb4578 100644 --- a/src/emucore/FBSurface.cxx +++ b/src/emucore/FBSurface.cxx @@ -356,7 +356,7 @@ int FBSurface::drawString(const GUI::Font& font, const string& s, drawString(font, leftStr, x, y, w, color, align, deltax, false, shadowColor, linkStart, linkLen, underline); if(linkStart != string::npos) - linkStart = std::max(0, int(linkStart - leftStr.length())); + linkStart = std::max(0, static_cast(linkStart - leftStr.length())); h -= font.getFontHeight(); y += font.getFontHeight(); diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index f3f47cedd..11cfedec2 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -616,7 +616,8 @@ void FrameBuffer::createMessage(const string& message, MessagePosition position, const int fontHeight = font().getFontHeight(); const int VBORDER = fontHeight / 4; - myMsg.counter = std::min(uInt32(myOSystem.frameRate()) * 2, 120U); // Show message for 2 seconds + // Show message for 2 seconds + myMsg.counter = std::min(static_cast(myOSystem.frameRate()) * 2, 120U); if(myMsg.counter == 0) myMsg.counter = 120; diff --git a/src/emucore/MD5.cxx b/src/emucore/MD5.cxx index 81bac4fa8..9ea48666c 100644 --- a/src/emucore/MD5.cxx +++ b/src/emucore/MD5.cxx @@ -89,10 +89,10 @@ static uInt8 PADDING[64] = { }; // F, G, H and I are basic MD5 functions. -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define F(x, y, z) (((x) & (y)) | ((~(x)) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~(z)))) #define H(x, y, z) ((x) ^ (y) ^ (z)) -#define I(x, y, z) ((y) ^ ((x) | (~z))) +#define I(x, y, z) ((y) ^ ((x) | (~(z)))) // ROTATE_LEFT rotates x left n bits. #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) @@ -336,4 +336,4 @@ string hash(const uInt8* buffer, size_t length) return result; } -} // Namespace MD5 +} // namespace MD5 diff --git a/src/emucore/MD5.hxx b/src/emucore/MD5.hxx index 8b99d243e..748da758b 100644 --- a/src/emucore/MD5.hxx +++ b/src/emucore/MD5.hxx @@ -49,6 +49,6 @@ namespace MD5 { */ string hash(const string& buffer); -} // Namespace MD5 +} // namespace MD5 #endif diff --git a/src/emucore/MT24LC256.cxx b/src/emucore/MT24LC256.cxx index 9993a007b..da37be523 100644 --- a/src/emucore/MT24LC256.cxx +++ b/src/emucore/MT24LC256.cxx @@ -262,7 +262,7 @@ void MT24LC256::jpee_clock_fall() { if (!jpee_pptr) { - jpee_packet[0] = uInt8(jpee_nb); + jpee_packet[0] = static_cast(jpee_nb); if (jpee_smallmode && ((jpee_nb & 0xF0) == 0xA0)) { jpee_packet[1] = (jpee_nb >> 1) & 7; @@ -307,7 +307,7 @@ void MT24LC256::jpee_clock_fall() { if (!jpee_pptr) { - jpee_packet[0] = uInt8(jpee_nb); + jpee_packet[0] = static_cast(jpee_nb); if (jpee_smallmode) jpee_pptr=2; else @@ -316,7 +316,7 @@ void MT24LC256::jpee_clock_fall() else if (jpee_pptr < 70) { JPEE_LOG1("I2C_SENT(%02X)",jpee_nb & 0xFF) - jpee_packet[jpee_pptr++] = uInt8(jpee_nb); + jpee_packet[jpee_pptr++] = static_cast(jpee_nb); jpee_address = (jpee_packet[1] << 8) | jpee_packet[2]; if (jpee_pptr > 2) jpee_ad_known = 1; diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index 3d7393ec2..faf367a5e 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -176,7 +176,7 @@ bool OSystem::initialize(const Settings::Options& options) createSound(); // Create random number generator - myRandom = make_unique(uInt32(TimerManager::getTicks())); + myRandom = make_unique(static_cast(TimerManager::getTicks())); #ifdef CHEATCODE_SUPPORT myCheatManager = make_unique(*this); diff --git a/src/emucore/PlusROM.cxx b/src/emucore/PlusROM.cxx index 07313faa0..9a76cb2e0 100644 --- a/src/emucore/PlusROM.cxx +++ b/src/emucore/PlusROM.cxx @@ -39,7 +39,7 @@ namespace { constexpr uInt16 WRITE_SEND_BUFFER = 0x1FF1; constexpr uInt16 RECEIVE_BUFFER = 0x1FF2; constexpr uInt16 RECEIVE_BUFFER_SIZE = 0x1FF3; -} +} // namespace #endif using std::chrono::milliseconds; diff --git a/src/emucore/ProfilingRunner.cxx b/src/emucore/ProfilingRunner.cxx index 82835ed2b..58af4eb84 100644 --- a/src/emucore/ProfilingRunner.cxx +++ b/src/emucore/ProfilingRunner.cxx @@ -51,7 +51,7 @@ namespace { from++; } } -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ProfilingRunner::ProfilingRunner(int argc, char* argv[]) @@ -187,7 +187,8 @@ bool ProfilingRunner::runOne(const ProfilingRun& run) if (tia.newFramePending()) tia.renderToFrameBuffer(); - const uInt32 percentNow = uInt32(std::min((100 * cycles) / cyclesTarget, static_cast(100))); + const uInt32 percentNow = static_cast(std::min((100 * cycles) / + cyclesTarget, static_cast(100))); updateProgress(percent, percentNow); percent = percentNow; diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 670aa626d..f351b377c 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -194,7 +194,7 @@ Settings::Settings() // Misc options - setPermanent("loglevel", int(Logger::Level::INFO)); + setPermanent("loglevel", static_cast(Logger::Level::INFO)); setPermanent("logtoconsole", "0"); setPermanent("avoxport", ""); setPermanent("fastscbios", "true"); @@ -473,7 +473,7 @@ void Settings::validate() i = getInt("loglevel"); if(i < static_cast(Logger::Level::MIN) || i > static_cast(Logger::Level::MAX)) - setValue("loglevel", int(Logger::Level::INFO)); + setValue("loglevel", static_cast(Logger::Level::INFO)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx index db6909ce7..fa22228b9 100644 --- a/src/emucore/TIASurface.cxx +++ b/src/emucore/TIASurface.cxx @@ -42,7 +42,7 @@ namespace { ScalingInterpolation::sharp; #endif } -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TIASurface::TIASurface(OSystem& system) @@ -257,7 +257,7 @@ void TIASurface::changeScanlineIntensity(int direction) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TIASurface::ScanlineMask TIASurface::scanlineMaskType(int direction) { - const string Masks[int(ScanlineMask::NumMasks)] = { + const string Masks[static_cast(ScanlineMask::NumMasks)] = { SETTING_STANDARD, SETTING_THIN, SETTING_PIXELS, @@ -276,7 +276,7 @@ TIASurface::ScanlineMask TIASurface::scanlineMaskType(int direction) i = BSPF::clampw(i + direction, 0, static_cast(ScanlineMask::NumMasks) - 1); myOSystem.settings().setValue("tv.scanmask", Masks[i]); } - return ScanlineMask(i); + return static_cast(i); } ++i; } @@ -286,7 +286,7 @@ TIASurface::ScanlineMask TIASurface::scanlineMaskType(int direction) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIASurface::cycleScanlineMask(int direction) { - const string Names[int(ScanlineMask::NumMasks)] = { + const string Names[static_cast(ScanlineMask::NumMasks)] = { "Standard", "Thin lines", "Pixelated", @@ -310,7 +310,9 @@ void TIASurface::enablePhosphor(bool enable, int blend) if(myPhosphorHandler.initialize(enable, blend)) { myPBlend = blend; - myFilter = static_cast(enable ? uInt8(myFilter) | 0x01 : uInt8(myFilter) & 0x10); + myFilter = static_cast( + enable ? static_cast(myFilter) | 0x01 + : static_cast(myFilter) & 0x10); myRGBFramebuffer.fill(0); } } @@ -334,7 +336,7 @@ void TIASurface::createScanlineSurface() : vRepeats(c_vRepeats), data(c_data) {} }; - static std::array Patterns = {{ + static std::array(ScanlineMask::NumMasks)> Patterns = {{ Pattern(1, // standard { { 0x00000000 }, @@ -438,7 +440,9 @@ void TIASurface::createScanlineSurface() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIASurface::enableNTSC(bool enable) { - myFilter = static_cast(enable ? uInt8(myFilter) | 0x10 : uInt8(myFilter) & 0x01); + myFilter = static_cast( + enable ? static_cast(myFilter) | 0x10 + : static_cast(myFilter) & 0x01); const uInt32 surfaceWidth = enable ? AtariNTSC::outWidth(TIAConstants::frameBufferWidth) : TIAConstants::frameBufferWidth; diff --git a/src/emucore/Thumbulator.cxx b/src/emucore/Thumbulator.cxx index e6c48ca4d..ef0c1cccf 100644 --- a/src/emucore/Thumbulator.cxx +++ b/src/emucore/Thumbulator.cxx @@ -45,10 +45,10 @@ using Common::Base; #endif #ifdef __BIG_ENDIAN__ - #define CONV_DATA(d) (((d & 0xFFFF)>>8) | ((d & 0xffff)<<8)) & 0xffff - #define CONV_RAMROM(d) ((d>>8) | (d<<8)) & 0xffff + #define CONV_DATA(d) ((((d) & 0xFFFF)>>8) | (((d) & 0xffff)<<8)) & 0xffff + #define CONV_RAMROM(d) (((d)>>8) | ((d)<<8)) & 0xffff #else - #define CONV_DATA(d) (d & 0xFFFF) + #define CONV_DATA(d) ((d) & 0xFFFF) #define CONV_RAMROM(d) (d) #endif @@ -679,7 +679,7 @@ uInt32 Thumbulator::read32(uInt32 addr) fatalError("read32", addr, "abort - out of range"); #endif data = read16(addr+0); - data |= (uInt32(read16(addr+2))) << 16; + data |= read16(addr+2) << 16; DO_DBUG(statusMsg << "read32(" << Base::HEX8 << addr << ")=" << Base::HEX8 << data << endl); return data; @@ -689,7 +689,7 @@ uInt32 Thumbulator::read32(uInt32 addr) fatalError("read32", addr, "abort - out of range"); #endif data = read16(addr+0); - data |= (static_cast(read16(addr+2))) << 16; + data |= read16(addr+2) << 16; DO_DBUG(statusMsg << "read32(" << Base::HEX8 << addr << ")=" << Base::HEX8 << data << endl); return data; diff --git a/src/emucore/tia/AnalogReadout.cxx b/src/emucore/tia/AnalogReadout.cxx index 64c8d3be7..1e144ae62 100644 --- a/src/emucore/tia/AnalogReadout.cxx +++ b/src/emucore/tia/AnalogReadout.cxx @@ -127,7 +127,7 @@ bool AnalogReadout::save(Serializer& out) const myConnection.save(out); out.putLong(myTimestamp); - out.putInt(int(myConsoleTiming)); + out.putInt(static_cast(myConsoleTiming)); out.putDouble(myClockFreq); out.putBool(myIsDumped); diff --git a/src/emucore/tia/Audio.cxx b/src/emucore/tia/Audio.cxx index bb97c5eb6..493469bd5 100644 --- a/src/emucore/tia/Audio.cxx +++ b/src/emucore/tia/Audio.cxx @@ -31,7 +31,7 @@ namespace { (R_MAX + R * static_cast(vMax)) / (R_MAX + R * static_cast(v))) ); } -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Audio::Audio() diff --git a/src/emucore/tia/Playfield.cxx b/src/emucore/tia/Playfield.cxx index 41ef06819..0dd25e60d 100644 --- a/src/emucore/tia/Playfield.cxx +++ b/src/emucore/tia/Playfield.cxx @@ -290,7 +290,7 @@ bool Playfield::save(Serializer& out) const out.putByte(myDebugColor); out.putBool(myDebugEnabled); - out.putByte(uInt8(myColorMode)); + out.putByte(static_cast(myColorMode)); out.putBool(myScoreGlitch); out.putInt(myPattern); diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index 198516949..63a9b63f9 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -275,7 +275,7 @@ bool TIA::save(Serializer& out) const if(!myInput0.save(out)) return false; if(!myInput1.save(out)) return false; - out.putInt(int(myHstate)); + out.putInt(static_cast(myHstate)); out.putInt(myHctr); out.putInt(myHctrDelta); @@ -291,7 +291,7 @@ bool TIA::save(Serializer& out) const out.putInt(myLinesSinceChange); - out.putInt(int(myPriority)); + out.putInt(static_cast(myPriority)); out.putByte(mySubClock); out.putLong(myLastCycle); @@ -1251,7 +1251,7 @@ bool TIA::driveUnusedPinsRandom(uInt8 mode) // If mode is 0 or 1, use it as a boolean (off or on) // Otherwise, return the state if (mode == 0 || mode == 1) - myTIAPinsDriven = bool(mode); + myTIAPinsDriven = static_cast(mode); return myTIAPinsDriven; } diff --git a/src/emucore/tia/frame-manager/AbstractFrameManager.cxx b/src/emucore/tia/frame-manager/AbstractFrameManager.cxx index d69476dd8..473e197fa 100644 --- a/src/emucore/tia/frame-manager/AbstractFrameManager.cxx +++ b/src/emucore/tia/frame-manager/AbstractFrameManager.cxx @@ -120,7 +120,7 @@ bool AbstractFrameManager::save(Serializer& out) const out.putInt(myCurrentFrameFinalLines); out.putInt(myPreviousFrameFinalLines); out.putInt(myTotalFrames); - out.putInt(uInt32(myLayout)); + out.putInt(static_cast(myLayout)); return onSave(out); } diff --git a/src/emucore/tia/frame-manager/FrameManager.cxx b/src/emucore/tia/frame-manager/FrameManager.cxx index 7ef7b9cd3..702cfb2be 100644 --- a/src/emucore/tia/frame-manager/FrameManager.cxx +++ b/src/emucore/tia/frame-manager/FrameManager.cxx @@ -175,7 +175,7 @@ bool FrameManager::onSave(Serializer& out) const { if (!myJitterEmulation.save(out)) return false; - out.putInt(uInt32(myState)); + out.putInt(static_cast(myState)); out.putInt(myLineInState); out.putInt(myVsyncLines); out.putInt(myY); diff --git a/src/gui/DeveloperDialog.cxx b/src/gui/DeveloperDialog.cxx index 391071fda..b6375d19c 100644 --- a/src/gui/DeveloperDialog.cxx +++ b/src/gui/DeveloperDialog.cxx @@ -437,8 +437,8 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font) pwidth, lineHeight, items, desc, lwidth, dbg_cmds[idx]); wid.push_back(myDbgColour[idx]); x += myDbgColour[idx]->getWidth() + fontWidth * 1.25; - myDbgColourSwatch[idx] = new ColorWidget(myTab, font, x, ypos - 1, - uInt32(2 * lineHeight), lineHeight); + myDbgColourSwatch[idx] = new ColorWidget( + myTab, font, x, ypos - 1, static_cast(2 * lineHeight), lineHeight); ypos += lineHeight + VGAP * 1; }; diff --git a/src/gui/EmulationDialog.cxx b/src/gui/EmulationDialog.cxx index ec25db59a..3ea0511f1 100644 --- a/src/gui/EmulationDialog.cxx +++ b/src/gui/EmulationDialog.cxx @@ -24,9 +24,10 @@ #include "EmulationDialog.hxx" namespace { - // Emulation speed is a positive float that multiplies the framerate. However, the UI controls - // adjust speed in terms of a speedup factor (1/10, 1/9 .. 1/2, 1, 2, 3, .., 10). The following - // mapping and formatting functions implement this conversion. The speedup factor is represented + // Emulation speed is a positive float that multiplies the framerate. However, + // the UI controls adjust speed in terms of a speedup factor (1/10, + // 1/9 .. 1/2, 1, 2, 3, .., 10). The following mapping and formatting + // functions implement this conversion. The speedup factor is represented // by an integer value between -900 and 900 (0 means no speedup). constexpr int MAX_SPEED = 900; @@ -59,7 +60,7 @@ namespace { return ss.str(); } -} +} // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EmulationDialog::EmulationDialog(OSystem& osystem, DialogContainer& parent, diff --git a/src/gui/EventMappingWidget.cxx b/src/gui/EventMappingWidget.cxx index d2f7e6e25..b6377dbb6 100644 --- a/src/gui/EventMappingWidget.cxx +++ b/src/gui/EventMappingWidget.cxx @@ -330,7 +330,8 @@ bool EventMappingWidget::handleKeyUp(StellaKey key, StellaMod mod) if(myMod & KBDM_GUI) myMod |= KBDM_GUI; } - if (instance().eventHandler().addKeyMapping(event, myEventMode, StellaKey(myLastKey), StellaMod(myMod))) + if (instance().eventHandler().addKeyMapping(event, myEventMode, + static_cast(myLastKey), static_cast(myMod))) stopRemapping(); } return true; diff --git a/src/gui/FileListWidget.cxx b/src/gui/FileListWidget.cxx index 78f9a59e3..ea99e29d2 100644 --- a/src/gui/FileListWidget.cxx +++ b/src/gui/FileListWidget.cxx @@ -680,16 +680,17 @@ const FileListWidget::Icon* FileListWidget::getIcon(int i) const 0b11111111111'11111111110, 0b11111111111'11111111110 }; - static const Icon* small_icons[int(IconType::numTypes)] = { + const int idx = static_cast(IconType::numTypes); + static const Icon* small_icons[idx] = { &unknown_small, &rom_small, &directory_small, &zip_small, &up_small }; - static const Icon* large_icons[int(IconType::numTypes)] = { + static const Icon* large_icons[idx] = { &unknown_large, &rom_large, &directory_large, &zip_large, &up_large, }; const bool smallIcon = iconWidth() < 24; - const int iconType = int(_iconTypeList[i]); + const int iconType = static_cast(_iconTypeList[i]); - assert(iconType < int(IconType::numTypes)); + assert(iconType < idx); return smallIcon ? small_icons[iconType] : large_icons[iconType]; } diff --git a/src/gui/Font.cxx b/src/gui/Font.cxx index b2a47f364..53b2d5a50 100644 --- a/src/gui/Font.cxx +++ b/src/gui/Font.cxx @@ -59,4 +59,4 @@ int Font::getStringWidth(const string& str) const [&](int x, char c) { return x + getCharWidth(c); }); } -} // namespace GUI +} // namespace GUI diff --git a/src/gui/Font.hxx b/src/gui/Font.hxx index a23e5b45d..e451e0ee6 100644 --- a/src/gui/Font.hxx +++ b/src/gui/Font.hxx @@ -79,6 +79,6 @@ class Font Font& operator=(Font&&) = delete; }; -} // namespace GUI +} // namespace GUI #endif diff --git a/src/gui/Icon.hxx b/src/gui/Icon.hxx index 090598ba5..89b4e6192 100644 --- a/src/gui/Icon.hxx +++ b/src/gui/Icon.hxx @@ -57,6 +57,6 @@ class Icon Icon& operator=(Icon&&) = delete; }; -} // namespace GUI +} // namespace GUI #endif diff --git a/src/gui/Icons.hxx b/src/gui/Icons.hxx index bab1f21a6..c0c9193e8 100644 --- a/src/gui/Icons.hxx +++ b/src/gui/Icons.hxx @@ -526,6 +526,6 @@ static const Icon icon_help_large( 0b0000000011100000000 }); -} // namespace GUI +} // namespace GUI #endif diff --git a/src/gui/Launcher.cxx b/src/gui/Launcher.cxx index f05b7258f..bac8a7c00 100644 --- a/src/gui/Launcher.cxx +++ b/src/gui/Launcher.cxx @@ -39,8 +39,8 @@ Launcher::Launcher(OSystem& osystem) // Do not include overscan when launcher saving size myOSystem.settings().setValue("launcherres", mySize); // Now make overscan effective - mySize.w = std::min(mySize.w, uInt32(d.w * overscan)); - mySize.h = std::min(mySize.h, uInt32(d.h * overscan)); + mySize.w = std::min(mySize.w, static_cast(d.w * overscan)); + mySize.h = std::min(mySize.h, static_cast(d.h * overscan)); myBaseDialog = new LauncherDialog(myOSystem, *this, 0, 0, mySize.w, mySize.h); } diff --git a/src/gui/LauncherFileListWidget.cxx b/src/gui/LauncherFileListWidget.cxx index 1b0848cf6..618da666f 100644 --- a/src/gui/LauncherFileListWidget.cxx +++ b/src/gui/LauncherFileListWidget.cxx @@ -508,21 +508,25 @@ const FileListWidget::Icon* LauncherFileListWidget::getIcon(int i) const 0b11111111111'11111111110, 0b11111111111'11111111110 }; - static const Icon* small_icons[int(IconType::numLauncherTypes)] = { - &favrom_small, &favdir_small, &favzip_small, &user_small, &recent_small, &popular_small + static constexpr auto NLT = static_cast(IconType::numLauncherTypes); + static const Icon* small_icons[NLT] = { + &favrom_small, &favdir_small, &favzip_small, + &user_small, &recent_small, &popular_small }; - static const Icon* large_icons[int(IconType::numLauncherTypes)] = { - &favrom_large, &favdir_large, &favzip_large, &user_large, &recent_large, &popular_large + static const Icon* large_icons[NLT] = { + &favrom_large, &favdir_large, &favzip_large, + &user_large, &recent_large, &popular_large }; - if(int(_iconTypeList[i]) < static_cast(IconType::numTypes)) + if(static_cast(_iconTypeList[i]) < static_cast(IconType::numTypes)) return FileListWidget::getIcon(i); const bool smallIcon = iconWidth() < 24; - const int iconType = int(_iconTypeList[i]) - static_cast(IconType::numTypes); + const int iconType = + static_cast(_iconTypeList[i]) - static_cast(IconType::numTypes); - assert(iconType < int(IconType::numLauncherTypes)); + assert(iconType < NLT); return smallIcon ? small_icons[iconType] : large_icons[iconType]; } diff --git a/src/gui/MessageBox.cxx b/src/gui/MessageBox.cxx index e249c47ec..c03262d35 100644 --- a/src/gui/MessageBox.cxx +++ b/src/gui/MessageBox.cxx @@ -125,4 +125,4 @@ void MessageBox::handleCommand(CommandSender* sender, int cmd, int data, int id) Dialog::handleCommand(sender, cmd, data, id); } -} // namespace GUI +} // namespace GUI diff --git a/src/gui/MessageBox.hxx b/src/gui/MessageBox.hxx index 331856ab4..f1e15b8eb 100644 --- a/src/gui/MessageBox.hxx +++ b/src/gui/MessageBox.hxx @@ -76,6 +76,6 @@ class MessageBox : public Dialog, public CommandSender MessageBox& operator=(MessageBox&&) = delete; }; -} // namespace GUI +} // namespace GUI #endif diff --git a/src/gui/RadioButtonWidget.cxx b/src/gui/RadioButtonWidget.cxx index 30ec2bfc5..b568a9af1 100644 --- a/src/gui/RadioButtonWidget.cxx +++ b/src/gui/RadioButtonWidget.cxx @@ -244,11 +244,12 @@ RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font, _w = _buttonSize; else _w = font.getStringWidth(label) + _buttonSize + font.getMaxCharWidth() * 0.75; - _h = font.getFontHeight() < int(_buttonSize) ? _buttonSize : font.getFontHeight(); + _h = font.getFontHeight() < static_cast(_buttonSize) + ? _buttonSize : font.getFontHeight(); // Depending on font size, either the font or box will need to be // centered vertically - if(_h > int(_buttonSize)) // center box + if(_h > static_cast(_buttonSize)) // center box _boxY = (_h - _buttonSize) / 2; else // center text _textY = (_buttonSize - _font.getFontHeight()) / 2; diff --git a/src/gui/RomImageWidget.cxx b/src/gui/RomImageWidget.cxx index 9562b3fd7..166696ece 100644 --- a/src/gui/RomImageWidget.cxx +++ b/src/gui/RomImageWidget.cxx @@ -266,8 +266,10 @@ bool RomImageWidget::loadImage(const string& fileName) { // Scale surface to available image area const Common::Rect& src = mySurface->srcRect(); - const float scale = std::min(float(_w) / src.w(), float(myImageHeight) / src.h()) * - instance().frameBuffer().hidpiScaleFactor(); + const float scale = std::min( + static_cast(_w) / src.w(), + static_cast(myImageHeight) / src.h()) * + instance().frameBuffer().hidpiScaleFactor(); mySurface->setDstSize(static_cast(src.w() * scale), static_cast(src.h() * scale)); } diff --git a/src/gui/TimeLineWidget.cxx b/src/gui/TimeLineWidget.cxx index 30508965e..dbc30fddc 100644 --- a/src/gui/TimeLineWidget.cxx +++ b/src/gui/TimeLineWidget.cxx @@ -90,7 +90,7 @@ void TimeLineWidget::setStepValues(const IntArray& steps) // Skip the very last value; we take care of it outside the end of the loop for(uInt32 i = 0; i < steps.size() - 1; ++i) - _stepValue.push_back(int(steps[i] * scale)); + _stepValue.push_back(static_cast(steps[i] * scale)); // Due to integer <-> double conversion, the last value is sometimes // slightly less than the maximum value; we assign it manually to fix this @@ -103,7 +103,7 @@ void TimeLineWidget::setStepValues(const IntArray& steps) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TimeLineWidget::handleMouseMoved(int x, int y) { - if(isEnabled() && _isDragging && x >= int(_labelWidth)) + if(isEnabled() && _isDragging && x >= static_cast(_labelWidth)) setValue(posToValue(x - _labelWidth)); } diff --git a/src/gui/ToolTip.cxx b/src/gui/ToolTip.cxx index 80479afe0..0690aa889 100644 --- a/src/gui/ToolTip.cxx +++ b/src/gui/ToolTip.cxx @@ -159,7 +159,7 @@ void ToolTip::show(const string& tip) string leftStr, rightStr; surface()->splitString(*myFont, inStr, maxWidth, leftStr, rightStr); - width = std::max(width, uInt32(myFont->getStringWidth(leftStr))); + width = std::max(width, static_cast(myFont->getStringWidth(leftStr))); inStr = rightStr; } width += myTextXOfs * 2; @@ -174,7 +174,7 @@ void ToolTip::show(const string& tip) // Limit position to app size and adjust accordingly const Int32 xAbs = myTipPos.x + dialogRect.x() / myScale; const uInt32 yAbs = myTipPos.y + dialogRect.y() / myScale; - Int32 x = std::min(xAbs, Int32(imageRect.w() / myScale - width)); + Int32 x = std::min(xAbs, static_cast(imageRect.w() / myScale - width)); const uInt32 y = (yAbs + height + H_CURSOR > imageRect.h() / myScale) ? yAbs - height - V_GAP : yAbs + H_CURSOR / myScale + V_GAP; diff --git a/src/gui/VideoAudioDialog.cxx b/src/gui/VideoAudioDialog.cxx index d1a9a0cb1..94af92af7 100644 --- a/src/gui/VideoAudioDialog.cxx +++ b/src/gui/VideoAudioDialog.cxx @@ -982,7 +982,7 @@ void VideoAudioDialog::handleTVModeChange(NTSCFilter::Preset preset) void VideoAudioDialog::loadTVAdjustables(NTSCFilter::Preset preset) { NTSCFilter::Adjustable adj; - NTSCFilter::getAdjustables(adj, NTSCFilter::Preset(preset)); + NTSCFilter::getAdjustables(adj, preset); myTVSharp->setValue(adj.sharpness); myTVRes->setValue(adj.resolution); myTVArtifacts->setValue(adj.artifacts); diff --git a/src/os/unix/FSNodePOSIX.cxx b/src/os/unix/FSNodePOSIX.cxx index bee29cc89..ca7ad53b4 100644 --- a/src/os/unix/FSNodePOSIX.cxx +++ b/src/os/unix/FSNodePOSIX.cxx @@ -39,7 +39,7 @@ FSNodePOSIX::FSNodePOSIX(const string& path, bool verify) // Expand '~' to the HOME environment variable if(_path[0] == '~') { - const char* home = std::getenv("HOME"); + const char* home = std::getenv("HOME"); // NOLINT (not thread safe) if (home != nullptr) _path.replace(0, 1, home); } @@ -80,7 +80,7 @@ void FSNodePOSIX::setFlags() string FSNodePOSIX::getShortPath() const { // If the path starts with the home directory, replace it with '~' - const char* env_home = std::getenv("HOME"); + const char* env_home = std::getenv("HOME"); // NOLINT (not thread safe) const string& home = env_home != nullptr ? env_home : EmptyString; if(home != EmptyString && BSPF::startsWithIgnoreCase(_path, home)) @@ -112,7 +112,7 @@ bool FSNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode) const // Loop over dir entries using readdir struct dirent* dp = nullptr; - while ((dp = readdir(dirp)) != nullptr) + while ((dp = readdir(dirp)) != nullptr) // NOLINT (not thread safe) { // Ignore all hidden files if (dp->d_name[0] == '.') @@ -236,5 +236,5 @@ AbstractFSNodePtr FSNodePOSIX::getParent() const const char* start = _path.c_str(); const char* end = lastPathComponent(_path); - return make_unique(string(start, size_t(end - start))); + return make_unique(string(start, static_cast(end - start))); } diff --git a/src/os/unix/OSystemUNIX.cxx b/src/os/unix/OSystemUNIX.cxx index 5192e3531..28de8144b 100644 --- a/src/os/unix/OSystemUNIX.cxx +++ b/src/os/unix/OSystemUNIX.cxx @@ -26,7 +26,7 @@ void OSystemUNIX::getBaseDirectories(string& basedir, string& homedir, bool useappdir, const string& usedir) { // Use XDG_CONFIG_HOME if defined, otherwise use the default - const char* cfg_home = std::getenv("XDG_CONFIG_HOME"); + const char* cfg_home = std::getenv("XDG_CONFIG_HOME"); // NOLINT const string& configDir = cfg_home != nullptr ? cfg_home : "~/.config"; basedir = configDir + "/stella"; homedir = "~/";