diff --git a/src/os/libretro/FBBackendLIBRETRO.hxx b/src/os/libretro/FBBackendLIBRETRO.hxx index 0c9f78afa..87ca7cc10 100644 --- a/src/os/libretro/FBBackendLIBRETRO.hxx +++ b/src/os/libretro/FBBackendLIBRETRO.hxx @@ -34,7 +34,7 @@ class FBBackendLIBRETRO : public FBBackend { public: explicit FBBackendLIBRETRO(OSystem&) { } - ~FBBackendLIBRETRO() override { } + ~FBBackendLIBRETRO() override = default; protected: /** diff --git a/src/os/libretro/FBSurfaceLIBRETRO.hxx b/src/os/libretro/FBSurfaceLIBRETRO.hxx index 6c3fbda02..57915b146 100644 --- a/src/os/libretro/FBSurfaceLIBRETRO.hxx +++ b/src/os/libretro/FBSurfaceLIBRETRO.hxx @@ -33,7 +33,7 @@ class FBSurfaceLIBRETRO : public FBSurface FBSurfaceLIBRETRO(uInt32 width, uInt32 height) : myWidth{width}, myHeight{height}, - myPixelData{make_unique(myWidth * myHeight)} + myPixelData{make_unique(static_cast(myWidth) * myHeight)} { //////////////////////////////////////////////////// // These *must* be set for the parent class @@ -41,7 +41,7 @@ class FBSurfaceLIBRETRO : public FBSurface myPitch = myWidth; //////////////////////////////////////////////////// } - ~FBSurfaceLIBRETRO() override { } + ~FBSurfaceLIBRETRO() override = default; // Most of the surface drawing primitives are implemented in FBSurface; void fillRect(uInt32 x, uInt32 y, uInt32 w, diff --git a/src/os/libretro/OSystemLIBRETRO.hxx b/src/os/libretro/OSystemLIBRETRO.hxx index 0a1f225a5..f2a71cd5e 100644 --- a/src/os/libretro/OSystemLIBRETRO.hxx +++ b/src/os/libretro/OSystemLIBRETRO.hxx @@ -20,7 +20,6 @@ #include "FSNode.hxx" #include "OSystem.hxx" -#include "OSystemLIBRETRO.hxx" #include "repository/KeyValueRepositoryNoop.hxx" #include "repository/CompositeKeyValueRepositoryNoop.hxx" @@ -80,6 +79,13 @@ class OSystemLIBRETRO : public OSystem protected: void initPersistence(FSNode& basedir) override { } string describePresistence() override { return "none"; } + + private: + // Following constructors and assignment operators not supported + OSystemLIBRETRO(const OSystemLIBRETRO&) = delete; + OSystemLIBRETRO(OSystemLIBRETRO&&) = delete; + OSystemLIBRETRO& operator=(const OSystemLIBRETRO&) = delete; + OSystemLIBRETRO& operator=(OSystemLIBRETRO&&) = delete; }; #endif diff --git a/src/os/libretro/SoundLIBRETRO.hxx b/src/os/libretro/SoundLIBRETRO.hxx index 0a001cb5b..8dcf84e0b 100644 --- a/src/os/libretro/SoundLIBRETRO.hxx +++ b/src/os/libretro/SoundLIBRETRO.hxx @@ -104,15 +104,15 @@ class SoundLIBRETRO : public Sound for (uInt32 i = 0; i < myAudioQueue->fragmentSize(); ++i) { - Int16 sampleL, sampleR; + Int16 sampleL = 0, sampleR = 0; if (myAudioQueue->isStereo()) { - sampleL = static_cast(myCurrentFragment[2*i + 0]); - sampleR = static_cast(myCurrentFragment[2*i + 1]); + sampleL = myCurrentFragment[2*i + 0]; + sampleR = myCurrentFragment[2*i + 1]; } else - sampleL = sampleR = static_cast(myCurrentFragment[i]); + sampleL = sampleR = myCurrentFragment[i]; stream[outIndex++] = sampleL; stream[outIndex++] = sampleR; diff --git a/src/os/libretro/StellaLIBRETRO.cxx b/src/os/libretro/StellaLIBRETRO.cxx index 6b13a9c66..e83ab1741 100644 --- a/src/os/libretro/StellaLIBRETRO.cxx +++ b/src/os/libretro/StellaLIBRETRO.cxx @@ -46,7 +46,7 @@ bool StellaLIBRETRO::create(bool logging) myOSystem = make_unique(); - Settings::Options options; + const Settings::Options options; myOSystem->initialize(options); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -92,7 +92,7 @@ bool StellaLIBRETRO::create(bool logging) settings.setValue(AudioSettings::SETTING_VOLUME, 100); settings.setValue(AudioSettings::SETTING_STEREO, audio_mode); - FSNode rom(rom_path); + const FSNode rom(rom_path); if(myOSystem->createConsole(rom) != EmptyString) return false; @@ -160,7 +160,7 @@ void StellaLIBRETRO::updateVideo() { TIA& tia = myOSystem->console().tia(); - while (1) + while (true) { tia.updateScanline(); @@ -227,7 +227,7 @@ size_t StellaLIBRETRO::getStateSize() const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - float StellaLIBRETRO::getVideoAspectPar() const { - float par; + float par = 0.F; if (getVideoNTSC()) { @@ -236,7 +236,7 @@ float StellaLIBRETRO::getVideoAspectPar() const if (video_filter != NTSCFilter::Preset::OFF) { // non-interlace square pixel clock -- 1.0 pixel @ color burst -- double-width pixels - par = (6.1363635f / 3.579545454f) / 2.0; + par = (6.1363635F / 3.579545454F) / 2.0; } else { @@ -254,7 +254,7 @@ float StellaLIBRETRO::getVideoAspectPar() const if (video_filter != NTSCFilter::Preset::OFF) { // non-interlace square pixel clock -- 0.8 pixel @ color burst -- double-width pixels - par = (7.3750000f / (4.43361875f * 4.0f / 5.0f)) / 2.0f; + par = (7.3750000F / (4.43361875F * 4.F / 5.F)) / 2.F; } else { @@ -272,7 +272,7 @@ float StellaLIBRETRO::getVideoAspectPar() const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - float StellaLIBRETRO::getVideoAspect() const { - uInt32 width = myOSystem->console().tia().width() * 2; + const uInt32 width = myOSystem->console().tia().width() * 2; // display aspect ratio return (width * getVideoAspectPar()) / getVideoHeight(); @@ -335,6 +335,7 @@ void StellaLIBRETRO::setConsoleFormat(uInt32 mode) case 4: console_format = "NTSC50"; break; case 5: console_format = "PAL60"; break; case 6: console_format = "SECAM60"; break; + default: break; } if (system_ready) @@ -371,6 +372,7 @@ void StellaLIBRETRO::setVideoPhosphor(uInt32 mode, uInt32 blend) case 0: video_phosphor = "byrom"; break; case 1: video_phosphor = "never"; break; case 2: video_phosphor = "always"; break; + default: break; } video_phosphor_blend = blend; @@ -385,6 +387,7 @@ void StellaLIBRETRO::setVideoPhosphor(uInt32 mode, uInt32 blend) case 0: myOSystem->frameBuffer().tiaSurface().enablePhosphor(phosphor_default, blend); break; case 1: myOSystem->frameBuffer().tiaSurface().enablePhosphor(false, blend); break; case 2: myOSystem->frameBuffer().tiaSurface().enablePhosphor(true, blend); break; + default: break; } } } @@ -397,6 +400,7 @@ void StellaLIBRETRO::setAudioStereo(int mode) case 0: audio_mode = "byrom"; break; case 1: audio_mode = "mono"; break; case 2: audio_mode = "stereo"; break; + default: break; } if (system_ready) diff --git a/src/os/libretro/StellaLIBRETRO.hxx b/src/os/libretro/StellaLIBRETRO.hxx index db123c17c..5dad8195a 100644 --- a/src/os/libretro/StellaLIBRETRO.hxx +++ b/src/os/libretro/StellaLIBRETRO.hxx @@ -41,6 +41,7 @@ class StellaLIBRETRO { public: StellaLIBRETRO(); + ~StellaLIBRETRO() = default; public: OSystemLIBRETRO& osystem() const { return *myOSystem; } @@ -60,7 +61,9 @@ class StellaLIBRETRO void* getROM() const { return rom_image.get(); } uInt32 getROMSize() const { return rom_size; } - constexpr uInt32 getROMMax() const { return uInt32(Cartridge::maxSize()); } + constexpr uInt32 getROMMax() const { + return static_cast(Cartridge::maxSize()); + } uInt8* getRAM() { return system_ram; } constexpr uInt32 getRAMSize() const { return 128; } diff --git a/src/os/libretro/libretro.cxx b/src/os/libretro/libretro.cxx index e75d99bd3..13e5fc073 100644 --- a/src/os/libretro/libretro.cxx +++ b/src/os/libretro/libretro.cxx @@ -1,10 +1,11 @@ +// NOLINTBEGIN (misc-use-anonymous-namespace) + #ifndef _MSC_VER -#include #include #endif -#include -#include -#include +#include +#include +#include #ifdef _MSC_VER #define snprintf _snprintf @@ -74,7 +75,7 @@ static void update_input() for (int i = 0; i <= RETRO_DEVICE_ID_JOYPAD_R3; i++) \ input_bitmask[(pad)] |= input_state_cb((pad), RETRO_DEVICE_JOYPAD, 0, i) ? (1 << i) : 0; \ } -#define MASK_EVENT(evt, pad, id) stella.setInputEvent((evt), (input_bitmask[(pad)] & (1 << id)) ? 1 : 0) +#define MASK_EVENT(evt, pad, id) stella.setInputEvent((evt), (input_bitmask[(pad)] & (1 << (id))) ? 1 : 0) int pad = 0; GET_BITMASK(pad) @@ -761,3 +762,5 @@ void retro_cheat_reset() void retro_cheat_set(unsigned index, bool enabled, const char *code) { } + +// NOLINTEND