Fix minor warnings from clang-tidy.

This commit is contained in:
Stephen Anthony 2025-06-13 18:17:05 -02:30
parent 69857756e3
commit 6a251308e8
9 changed files with 18 additions and 22 deletions

View File

@ -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<Common::Size>& 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: "

View File

@ -356,7 +356,7 @@ void SoundSDL::audioCallback(void* object, SDL_AudioStream* stream,
std::vector<uInt8>& buf = self->myBuffer;
// Make sure we always have enough room in the buffer
if(additional_amt >= static_cast<int>(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<WavHandler*>(object);
uInt32 len = static_cast<uInt32>(additional_amt);
uInt32& remaining = self->myRemaining;
auto len = static_cast<uInt32>(additional_amt);
auto& remaining = self->myRemaining;
if(remaining)
{

View File

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

View File

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

View File

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

View File

@ -497,8 +497,6 @@ class EventHandler
// Global Event object
Event myEvent;
int lastX;
// Indicates current overlay object
DialogContainer* myOverlay{nullptr};

View File

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

View File

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

View File

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