diff --git a/src/common/FBBackendSDL.cxx b/src/common/FBBackendSDL.cxx index 45626d569..ea3bb51c2 100644 --- a/src/common/FBBackendSDL.cxx +++ b/src/common/FBBackendSDL.cxx @@ -62,8 +62,8 @@ FBBackendSDL::~FBBackendSDL() } if(myWindow) { - SDL_SetWindowFullscreen(myWindow, 0); // on some systems, a crash occurs - // when destroying fullscreen window + SDL_SetWindowFullscreen(myWindow, false); // on some systems, a crash occurs + // when destroying fullscreen window SDL_DestroyWindow(myWindow); myWindow = nullptr; } @@ -97,7 +97,7 @@ void FBBackendSDL::queryHardware(vector& fullscreenRes, if(SDL_GetDisplayUsableBounds(displays[i], &r)) windowedRes.emplace_back(r.w, r.h); - int numModes; + int numModes = 0; ostringstream s; string lastRes; SDL_DisplayMode** modes = SDL_GetFullscreenDisplayModes(displays[i], &numModes); @@ -380,7 +380,7 @@ bool FBBackendSDL::adaptRefreshRate(Int32 displayIndex, for(int m = 1; m <= 2; ++m) { SDL_DisplayMode closestSdlMode{}; - float refresh_rate = wantedRefreshRate * m; + const float refresh_rate = wantedRefreshRate * m; if(!SDL_GetClosestFullscreenDisplayMode(displayIndex, sdlMode->w, sdlMode->h, refresh_rate, true, &closestSdlMode)) { @@ -428,7 +428,7 @@ bool FBBackendSDL::createRenderer() { recreate = recreate || video != SDL_GetRendererName(myRenderer); - SDL_PropertiesID props = SDL_GetRendererProperties(myRenderer); + const SDL_PropertiesID props = SDL_GetRendererProperties(myRenderer); const bool currentVSync = SDL_GetNumberProperty(props, SDL_PROP_RENDERER_VSYNC_NUMBER, 0) != 0; recreate = recreate || currentVSync != enableVSync; @@ -440,7 +440,7 @@ bool FBBackendSDL::createRenderer() SDL_DestroyRenderer(myRenderer); // Re-create with new properties - SDL_PropertiesID props = SDL_CreateProperties(); + const SDL_PropertiesID props = SDL_CreateProperties(); if(!video.empty()) SDL_SetStringProperty(props, SDL_PROP_RENDERER_CREATE_NAME_STRING, video.c_str()); @@ -490,7 +490,7 @@ string FBBackendSDL::about() const ostringstream out; out << "Video system: " << SDL_GetCurrentVideoDriver() << '\n'; - SDL_PropertiesID props = SDL_GetRendererProperties(myRenderer); + const SDL_PropertiesID props = SDL_GetRendererProperties(myRenderer); if(props != 0) { out << " Renderer: " diff --git a/src/common/SoundSDL.cxx b/src/common/SoundSDL.cxx index 7e6f0969d..5b23d68bf 100644 --- a/src/common/SoundSDL.cxx +++ b/src/common/SoundSDL.cxx @@ -356,7 +356,7 @@ void SoundSDL::audioCallback(void* object, SDL_AudioStream* stream, std::vector& buf = self->myBuffer; // Make sure we always have enough room in the buffer - if(additional_amt >= static_cast(buf.capacity())) + if(std::cmp_greater_equal(additional_amt, buf.capacity())) buf.resize(additional_amt); // The stream is 32-bit float (even though this callback is 8-bits), since @@ -465,8 +465,8 @@ void SoundSDL::WavHandler::wavCallback(void* object, SDL_AudioStream* stream, int additional_amt, int) { auto* self = static_cast(object); - uInt32 len = static_cast(additional_amt); - uInt32& remaining = self->myRemaining; + auto len = static_cast(additional_amt); + auto& remaining = self->myRemaining; if(remaining) { diff --git a/src/common/VideoModeHandler.cxx b/src/common/VideoModeHandler.cxx index 3742404a1..eaae7f9ee 100644 --- a/src/common/VideoModeHandler.cxx +++ b/src/common/VideoModeHandler.cxx @@ -109,13 +109,13 @@ VideoModeHandler::Mode::Mode(uInt32 iw, uInt32 ih, Stretch smode, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - VideoModeHandler::Mode::Mode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, - Stretch smode, bool fs, string_view desc, + Stretch smode, bool fullscreen, string_view desc, double zoomLevel, double overscan, Bezel::Info bezelInfo) : screenS{sw, sh}, stretch{smode}, description{desc}, zoom{zoomLevel}, //hZoom{zoomLevel}, vZoom{zoomLevel}, - fullscreen{fs} + fullscreen{fullscreen} { // Now resize based on windowed/fullscreen mode and stretch factor if(fullscreen) diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 6dc65c52d..bea4548ad 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -634,7 +634,7 @@ string CartDebug::uniqueLabel(const string& label) string uniqueLabel = label; int count = 0; - // TODO: does find return multiple items?? + // FIXME: does find return multiple items?? while(myUserAddresses.find(uniqueLabel) != myUserAddresses.end()) uniqueLabel = label + "." + std::to_string(++count); diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index a1afe8714..eb3c2f67d 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -331,14 +331,13 @@ void EventHandler::handleMouseMotionEvent(int x, int y, int xrel, int yrel) { myEvent.set(Event::MouseAxisXValue, x); // required for Lightgun controller myEvent.set(Event::MouseAxisYValue, y); // required for Lightgun controller +#if 0 // FIXME: remove debug code cerr << "dx " << (x - lastX - xrel) << ": " << x << ", " << xrel << " y:" << y << ", " << yrel << "\n"; if(x - lastX - xrel != 0) int i = 0; - - - lastX = x; +#endif myEvent.set(Event::MouseAxisXMove, xrel); myEvent.set(Event::MouseAxisYMove, yrel); } diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index e22494ba1..1bbad6ac1 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -497,8 +497,6 @@ class EventHandler // Global Event object Event myEvent; - int lastX; - // Indicates current overlay object DialogContainer* myOverlay{nullptr}; diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index d79f4b22f..fee3b00cd 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -1505,7 +1505,7 @@ bool FrameBuffer::updateTheme() { if(myOSystem.settings().getBool("autouipalette")) { - bool darkTheme = myOSystem.settings().getBool("altuipalette"); + const bool darkTheme = myOSystem.settings().getBool("altuipalette"); if((myBackend->isLightTheme() && darkTheme) || (myBackend->isDarkTheme() && !darkTheme)) diff --git a/src/emucore/Thumbulator.hxx b/src/emucore/Thumbulator.hxx index 49996d20b..035e52e04 100644 --- a/src/emucore/Thumbulator.hxx +++ b/src/emucore/Thumbulator.hxx @@ -112,7 +112,7 @@ class Thumbulator double cycleFactor() const { return _armCyclesFactor; } #else void cycleFactor(double) { } - double cycleFactor() const { return 1.0; } + double cycleFactor() const { return 1.0; } // NOLINT: we don't want static #endif /** diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index cf4f6c154..ec5fdc64f 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -330,9 +330,8 @@ void Dialog::render() //cerr << " render " << typeid(*this).name() << '\n'; #endif - if(_surface == NULL) { + if(_surface == nullptr) return; // fixes #1078 - } // Update dialog surface; also render any extra surfaces // Extra surfaces must be rendered afterwards, so they are drawn on top