diff --git a/src/cheat/BankRomCheat.hxx b/src/cheat/BankRomCheat.hxx index ea39ba66a..c903f0c45 100644 --- a/src/cheat/BankRomCheat.hxx +++ b/src/cheat/BankRomCheat.hxx @@ -32,10 +32,10 @@ class BankRomCheat : public Cheat private: std::array savedRom; - uInt16 address; - uInt8 value; - uInt8 count; - int bank; + uInt16 address{0}; + uInt8 value{0}; + uInt8 count{0}; + int bank{0}; private: // Following constructors and assignment operators not supported diff --git a/src/cheat/Cheat.hxx b/src/cheat/Cheat.hxx index 9b516e7cd..42382faf0 100644 --- a/src/cheat/Cheat.hxx +++ b/src/cheat/Cheat.hxx @@ -28,8 +28,7 @@ class Cheat Cheat(OSystem& osystem, const string& name, const string& code) : myOSystem(osystem), myName(name == "" ? code : name), - myCode(code), - myEnabled(false) + myCode(code) { } virtual ~Cheat() = default; @@ -65,7 +64,7 @@ class Cheat string myName; string myCode; - bool myEnabled; + bool myEnabled{false}; private: // Following constructors and assignment operators not supported diff --git a/src/cheat/CheatCodeDialog.hxx b/src/cheat/CheatCodeDialog.hxx index 44437b594..64dbc721d 100644 --- a/src/cheat/CheatCodeDialog.hxx +++ b/src/cheat/CheatCodeDialog.hxx @@ -50,11 +50,11 @@ class CheatCodeDialog : public Dialog void addOneShotCheat(); private: - CheckListWidget* myCheatList; + CheckListWidget* myCheatList{nullptr}; unique_ptr myCheatInput; - ButtonWidget* myEditButton; - ButtonWidget* myRemoveButton; + ButtonWidget* myEditButton{nullptr}; + ButtonWidget* myRemoveButton{nullptr}; enum { kAddCheatCmd = 'CHTa', diff --git a/src/cheat/CheatManager.cxx b/src/cheat/CheatManager.cxx index c01c133f6..b92324240 100644 --- a/src/cheat/CheatManager.cxx +++ b/src/cheat/CheatManager.cxx @@ -28,8 +28,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CheatManager::CheatManager(OSystem& osystem) - : myOSystem(osystem), - myListIsDirty(false) + : myOSystem(osystem) { } diff --git a/src/cheat/CheatManager.hxx b/src/cheat/CheatManager.hxx index 20cf7aae5..b94149b81 100644 --- a/src/cheat/CheatManager.hxx +++ b/src/cheat/CheatManager.hxx @@ -155,7 +155,7 @@ class CheatManager string myCurrentCheat; // Indicates that the list has been modified, and should be saved to disk - bool myListIsDirty; + bool myListIsDirty{false}; private: // Following constructors and assignment operators not supported diff --git a/src/cheat/CheetahCheat.hxx b/src/cheat/CheetahCheat.hxx index 35fa958eb..bad4f6116 100644 --- a/src/cheat/CheetahCheat.hxx +++ b/src/cheat/CheetahCheat.hxx @@ -32,9 +32,9 @@ class CheetahCheat : public Cheat private: std::array savedRom; - uInt16 address; - uInt8 value; - uInt8 count; + uInt16 address{0}; + uInt8 value{0}; + uInt8 count{0}; private: // Following constructors and assignment operators not supported diff --git a/src/cheat/RamCheat.hxx b/src/cheat/RamCheat.hxx index d9157bf97..a951b9cd6 100644 --- a/src/cheat/RamCheat.hxx +++ b/src/cheat/RamCheat.hxx @@ -31,8 +31,8 @@ class RamCheat : public Cheat void evaluate() override; private: - uInt16 address; - uInt8 value; + uInt16 address{0}; + uInt8 value{0}; private: // Following constructors and assignment operators not supported diff --git a/src/common/AudioQueue.cxx b/src/common/AudioQueue.cxx index ac1ea6d66..42e805f28 100644 --- a/src/common/AudioQueue.cxx +++ b/src/common/AudioQueue.cxx @@ -25,11 +25,7 @@ AudioQueue::AudioQueue(uInt32 fragmentSize, uInt32 capacity, bool isStereo) : myFragmentSize(fragmentSize), myIsStereo(isStereo), myFragmentQueue(capacity), - myAllFragments(capacity + 2), - mySize(0), - myNextFragment(0), - myIgnoreOverflows(true), - myOverflowLogger("audio buffer overflow", Logger::Level::INFO) + myAllFragments(capacity + 2) { const uInt8 sampleSize = myIsStereo ? 2 : 1; diff --git a/src/common/AudioQueue.hxx b/src/common/AudioQueue.hxx index 6ab5ebb2c..632ab484e 100644 --- a/src/common/AudioQueue.hxx +++ b/src/common/AudioQueue.hxx @@ -99,10 +99,10 @@ class AudioQueue private: // The size of an individual fragment (in stereo / mono samples) - uInt32 myFragmentSize; + uInt32 myFragmentSize{0}; // Are we using stereo samples? - bool myIsStereo; + bool myIsStereo{false}; // The fragment queue vector myFragmentQueue; @@ -114,23 +114,23 @@ class AudioQueue unique_ptr myFragmentBuffer; // The nubmer if queued fragments - uInt32 mySize; + uInt32 mySize{0}; // The next fragment. - uInt32 myNextFragment; + uInt32 myNextFragment{0}; // We need a mutex for thread safety. std::mutex myMutex; // The first (empty) enqueue call returns this fragment. - Int16* myFirstFragmentForEnqueue; + Int16* myFirstFragmentForEnqueue{nullptr}; // The first (empty) dequeue call replaces the returned fragment with this fragment. - Int16* myFirstFragmentForDequeue; + Int16* myFirstFragmentForDequeue{nullptr}; // Log overflows? - bool myIgnoreOverflows; + bool myIgnoreOverflows{true}; - StaggeredLogger myOverflowLogger; + StaggeredLogger myOverflowLogger{"audio buffer overflow", Logger::Level::INFO}; private: diff --git a/src/common/FBSurfaceSDL2.cxx b/src/common/FBSurfaceSDL2.cxx index eac8da0ad..40ee7fd36 100644 --- a/src/common/FBSurfaceSDL2.cxx +++ b/src/common/FBSurfaceSDL2.cxx @@ -46,14 +46,7 @@ FBSurfaceSDL2::FBSurfaceSDL2(FrameBufferSDL2& buffer, FrameBuffer::ScalingInterpolation interpolation, const uInt32* staticData) : myFB(buffer), - myInterpolationMode(interpolation), - mySurface(nullptr), - mySrcR({0, 0, 0, 0}), - myDstR({0, 0, 0, 0}), - myIsVisible(true), - myIsStatic(false), - mySrcGUIR({0, 0, 0, 0}), - myDstGUIR({0, 0, 0, 0}) + myInterpolationMode(interpolation) { createSurface(width, height, staticData); } diff --git a/src/common/FBSurfaceSDL2.hxx b/src/common/FBSurfaceSDL2.hxx index 68aea08e2..737c19da0 100644 --- a/src/common/FBSurfaceSDL2.hxx +++ b/src/common/FBSurfaceSDL2.hxx @@ -98,13 +98,14 @@ class FBSurfaceSDL2 : public FBSurface FrameBufferSDL2& myFB; unique_ptr myBlitter; - FrameBuffer::ScalingInterpolation myInterpolationMode; + FrameBuffer::ScalingInterpolation myInterpolationMode + {FrameBuffer::ScalingInterpolation::none}; - SDL_Surface* mySurface; - SDL_Rect mySrcR, myDstR; + SDL_Surface* mySurface{nullptr}; + SDL_Rect mySrcR{0, 0, 0, 0}, myDstR{0, 0, 0, 0}; - bool myIsVisible; - bool myIsStatic; + bool myIsVisible{true}; + bool myIsStatic{false}; Common::Rect mySrcGUIR, myDstGUIR; }; diff --git a/src/common/FSNodeZIP.hxx b/src/common/FSNodeZIP.hxx index d9a4622f9..1d156e83d 100644 --- a/src/common/FSNodeZIP.hxx +++ b/src/common/FSNodeZIP.hxx @@ -35,11 +35,6 @@ class FilesystemNodeZIP : public AbstractFSNode { public: - /** - * Creates a FilesystemNodeZIP with the root node as path. - */ -// FilesystemNodeZIP(); - /** * Creates a FilesystemNodeZIP for a given path. * diff --git a/src/common/FpsMeter.hxx b/src/common/FpsMeter.hxx index 3db95c38d..79b576285 100644 --- a/src/common/FpsMeter.hxx +++ b/src/common/FpsMeter.hxx @@ -37,7 +37,7 @@ class FpsMeter private: struct entry { - uInt32 frames; + uInt32 frames{0}; std::chrono::time_point timestamp; }; @@ -45,14 +45,14 @@ class FpsMeter vector myQueue; - uInt32 myQueueOffset; + uInt32 myQueueOffset{0}; - uInt32 myFrameCount; + uInt32 myFrameCount{0}; - uInt32 myGarbageFrameCounter; - uInt32 myGarbageFrameLimit; + uInt32 myGarbageFrameCounter{0}; + uInt32 myGarbageFrameLimit{0}; - float myFps; + float myFps{0.F}; private: FpsMeter(const FpsMeter&) = delete; diff --git a/src/common/FrameBufferSDL2.cxx b/src/common/FrameBufferSDL2.cxx index 775fbef82..507915afe 100644 --- a/src/common/FrameBufferSDL2.cxx +++ b/src/common/FrameBufferSDL2.cxx @@ -29,15 +29,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FrameBufferSDL2::FrameBufferSDL2(OSystem& osystem) - : FrameBuffer(osystem), - myWindow(nullptr), - myRenderer(nullptr), - myCenter(false), - myRenderTargetSupport(false), - myWindowW(0), - myWindowH(0), - myRenderW(0), - myRenderH(0) + : FrameBuffer(osystem) { ASSERT_MAIN_THREAD; diff --git a/src/common/FrameBufferSDL2.hxx b/src/common/FrameBufferSDL2.hxx index eefbeae36..3cbab116e 100644 --- a/src/common/FrameBufferSDL2.hxx +++ b/src/common/FrameBufferSDL2.hxx @@ -225,23 +225,23 @@ class FrameBufferSDL2 : public FrameBuffer private: // The SDL video buffer - SDL_Window* myWindow; - SDL_Renderer* myRenderer; + SDL_Window* myWindow{nullptr}; + SDL_Renderer* myRenderer{nullptr}; // Used by mapRGB (when palettes are created) - SDL_PixelFormat* myPixelFormat; + SDL_PixelFormat* myPixelFormat{nullptr}; // Center setting of current window - bool myCenter; + bool myCenter{false}; // last position of windowed window Common::Point myWindowedPos; // Does the renderer support render targets? - bool myRenderTargetSupport; + bool myRenderTargetSupport{false}; // Window and renderer dimensions - int myWindowW, myWindowH, myRenderW, myRenderH; + int myWindowW{0}, myWindowH{0}, myRenderW{0}, myRenderH{0}; private: // Following constructors and assignment operators not supported diff --git a/src/common/Logger.hxx b/src/common/Logger.hxx index ddca52b65..69a636c40 100644 --- a/src/common/Logger.hxx +++ b/src/common/Logger.hxx @@ -52,11 +52,11 @@ class Logger { const string& logMessages() const { return myLogMessages; } protected: - Logger() { setLogParameters(Level::MAX, true); } + Logger() = default; private: - int myLogLevel; - bool myLogToConsole; + int myLogLevel{static_cast(Level::MAX)}; + bool myLogToConsole{true}; // The list of log messages string myLogMessages; diff --git a/src/common/PJoystickHandler.cxx b/src/common/PJoystickHandler.cxx index 954294099..5c1595d7a 100644 --- a/src/common/PJoystickHandler.cxx +++ b/src/common/PJoystickHandler.cxx @@ -33,16 +33,15 @@ static constexpr char CTRL_DELIM = '^'; PhysicalJoystickHandler::PhysicalJoystickHandler( OSystem& system, EventHandler& handler) : myOSystem(system), - myHandler(handler), - myLeftMode(EventMode::kEmulationMode), - myRightMode(EventMode::kEmulationMode) + myHandler(handler) { Int32 version = myOSystem.settings().getInt("event_ver"); // Load previously saved joystick mapping (if any) from settings istringstream buf(myOSystem.settings().getString("joymap")); string joymap, joyname; - // First compare if event list version has changed, and disregard the entire mapping if true + // First compare if event list version has changed, and disregard the entire + // mapping if true getline(buf, joymap, CTRL_DELIM); // event list size, ignore if(version == Event::VERSION) { diff --git a/src/common/PJoystickHandler.hxx b/src/common/PJoystickHandler.hxx index 21cdaf464..4700fa23d 100644 --- a/src/common/PJoystickHandler.hxx +++ b/src/common/PJoystickHandler.hxx @@ -138,18 +138,19 @@ class PhysicalJoystickHandler // Structures used for action menu items struct EventMapping { - Event::Type event; - int button; - JoyAxis axis = JoyAxis::NONE; - JoyDir adir = JoyDir::NONE; - int hat = JOY_CTRL_NONE; - JoyHatDir hdir = JoyHatDir::CENTER; + Event::Type event{Event::NoType}; + int button{0}; + JoyAxis axis{JoyAxis::NONE}; + JoyDir adir{JoyDir::NONE}; + int hat{JOY_CTRL_NONE}; + JoyHatDir hdir{JoyHatDir::CENTER}; }; using EventMappingArray = std::vector; void setDefaultAction(const PhysicalJoystickPtr& j, EventMapping map, Event::Type event = Event::NoType, - EventMode mode = EventMode::kEmulationMode, bool updateDefaults = false); + EventMode mode = EventMode::kEmulationMode, + bool updateDefaults = false); /** returns the event's controller mode */ EventMode getEventMode(const Event::Type event, const EventMode mode) const; @@ -165,8 +166,8 @@ class PhysicalJoystickHandler void enableMapping(const Event::Type event, EventMode mode); private: - EventMode myLeftMode; - EventMode myRightMode; + EventMode myLeftMode{EventMode::kEmulationMode}; + EventMode myRightMode{EventMode::kEmulationMode}; // Controller menu and common emulation mappings static EventMappingArray DefaultMenuMapping; diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx index b5b2568cf..8da2a22dd 100644 --- a/src/common/PKeyboardHandler.cxx +++ b/src/common/PKeyboardHandler.cxx @@ -42,12 +42,7 @@ static constexpr int MOD3 = KBDM_ALT; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PhysicalKeyboardHandler::PhysicalKeyboardHandler(OSystem& system, EventHandler& handler) : myOSystem(system), - myHandler(handler), - myLeftMode(EventMode::kEmulationMode), - myRightMode(EventMode::kEmulationMode) -#ifdef BSPF_UNIX - , myAltKeyCounter(0) -#endif + myHandler(handler) { Int32 version = myOSystem.settings().getInt("event_ver"); diff --git a/src/common/PKeyboardHandler.hxx b/src/common/PKeyboardHandler.hxx index dbfd3158b..9d6e335f1 100644 --- a/src/common/PKeyboardHandler.hxx +++ b/src/common/PKeyboardHandler.hxx @@ -81,9 +81,9 @@ class PhysicalKeyboardHandler // Structure used for action menu items struct EventMapping { - Event::Type event; - StellaKey key; - int mod = KBDM_NONE; + Event::Type event{Event::NoType}; + StellaKey key{StellaKey(0)}; + int mod{KBDM_NONE}; }; using EventMappingArray = std::vector; @@ -109,8 +109,8 @@ class PhysicalKeyboardHandler // Hashmap of key events KeyMap myKeyMap; - EventMode myLeftMode; - EventMode myRightMode; + EventMode myLeftMode{EventMode::kEmulationMode}; + EventMode myRightMode{EventMode::kEmulationMode}; #ifdef BSPF_UNIX // Sometimes key combos with the Alt key become 'stuck' after the @@ -124,7 +124,7 @@ class PhysicalKeyboardHandler // the count is updated to 2, but only if it was already updated to 1 // TODO - This may be a bug in SDL, and might be removed in the future // It only seems to be an issue in Linux - uInt8 myAltKeyCounter; + uInt8 myAltKeyCounter{0}; #endif // Controller menu and common emulation mappings diff --git a/src/common/PNGLibrary.hxx b/src/common/PNGLibrary.hxx index f1101d2ef..d6c0b5c41 100644 --- a/src/common/PNGLibrary.hxx +++ b/src/common/PNGLibrary.hxx @@ -192,6 +192,7 @@ class PNGLibrary private: // Following constructors and assignment operators not supported + PNGLibrary() = delete; PNGLibrary(const PNGLibrary&) = delete; PNGLibrary(PNGLibrary&&) = delete; PNGLibrary& operator=(const PNGLibrary&) = delete; diff --git a/src/common/Rect.hxx b/src/common/Rect.hxx index d0c457d4c..022330056 100644 --- a/src/common/Rect.hxx +++ b/src/common/Rect.hxx @@ -109,8 +109,8 @@ struct Rect public: Rect() = default; - explicit Rect(const Size& s) : top(0), left(0), bottom(s.h), right(s.w) { assert(valid()); } - Rect(uInt32 w, uInt32 h) : top(0), left(0), bottom(h), right(w) { assert(valid()); } + explicit Rect(const Size& s) : bottom(s.h), right(s.w) { assert(valid()); } + Rect(uInt32 w, uInt32 h) : bottom(h), right(w) { assert(valid()); } Rect(const Point& p, uInt32 w, uInt32 h) : top(p.y), left(p.x), bottom(h), right(w) { assert(valid()); } Rect(uInt32 x1, uInt32 y1, uInt32 x2, uInt32 y2) : top(y1), left(x1), bottom(y2), right(x2) { assert(valid()); } diff --git a/src/common/SoundSDL2.cxx b/src/common/SoundSDL2.cxx index 15bffc416..6374da9ba 100644 --- a/src/common/SoundSDL2.cxx +++ b/src/common/SoundSDL2.cxx @@ -41,13 +41,6 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SoundSDL2::SoundSDL2(OSystem& osystem, AudioSettings& audioSettings) : Sound(osystem), - myIsInitializedFlag(false), - myVolume(100), - myVolumeFactor(0xffff), - myDevice(0), - myEmulationTiming(nullptr), - myCurrentFragment(nullptr), - myUnderrun(false), myAudioSettings(audioSettings) { ASSERT_MAIN_THREAD; diff --git a/src/common/SoundSDL2.hxx b/src/common/SoundSDL2.hxx index 62a756a22..109064f00 100644 --- a/src/common/SoundSDL2.hxx +++ b/src/common/SoundSDL2.hxx @@ -131,23 +131,23 @@ class SoundSDL2 : public Sound private: // Indicates if the sound device was successfully initialized - bool myIsInitializedFlag; + bool myIsInitializedFlag{false}; // Current volume as a percentage (0 - 100) - uInt32 myVolume; - float myVolumeFactor; + uInt32 myVolume{100}; + float myVolumeFactor{0xffff}; // Audio specification structure SDL_AudioSpec myHardwareSpec; - SDL_AudioDeviceID myDevice; + SDL_AudioDeviceID myDevice{0}; shared_ptr myAudioQueue; - EmulationTiming* myEmulationTiming; + EmulationTiming* myEmulationTiming{nullptr}; - Int16* myCurrentFragment; - bool myUnderrun; + Int16* myCurrentFragment{nullptr}; + bool myUnderrun{false}; unique_ptr myResampler; diff --git a/src/common/StaggeredLogger.cxx b/src/common/StaggeredLogger.cxx index 07d1bc8dd..d1fa916e6 100644 --- a/src/common/StaggeredLogger.cxx +++ b/src/common/StaggeredLogger.cxx @@ -38,16 +38,7 @@ namespace { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - StaggeredLogger::StaggeredLogger(const string& message, Logger::Level level) : myMessage(message), - myLevel(level), - myCurrentEventCount(0), - myIsCurrentlyCollecting(false), - myCurrentIntervalSize(100), - myMaxIntervalFactor(9), - myCurrentIntervalFactor(1), - myCooldownTime(1000), - myTimer(make_unique()), - myTimerId(0), - myTimerCallbackId(0) + myLevel(level) { } diff --git a/src/common/StaggeredLogger.hxx b/src/common/StaggeredLogger.hxx index afb19d888..69f5f5c29 100644 --- a/src/common/StaggeredLogger.hxx +++ b/src/common/StaggeredLogger.hxx @@ -60,29 +60,29 @@ class StaggeredLogger string myMessage; Logger::Level myLevel; - uInt32 myCurrentEventCount; - bool myIsCurrentlyCollecting; + uInt32 myCurrentEventCount{0}; + bool myIsCurrentlyCollecting{false}; std::chrono::high_resolution_clock::time_point myLastIntervalStartTimestamp; std::chrono::high_resolution_clock::time_point myLastIntervalEndTimestamp; - uInt32 myCurrentIntervalSize; - uInt32 myMaxIntervalFactor; - uInt32 myCurrentIntervalFactor; - uInt32 myCooldownTime; + uInt32 myCurrentIntervalSize{100}; + uInt32 myMaxIntervalFactor{9}; + uInt32 myCurrentIntervalFactor{1}; + uInt32 myCooldownTime{1000}; std::mutex myMutex; // We need control over the destruction porcess and over the exact point where // the worker thread joins -> allocate on the heap end delete explicitly in // our destructor. - unique_ptr myTimer; - TimerManager::TimerId myTimerId; + unique_ptr myTimer{make_unique()}; + TimerManager::TimerId myTimerId{0}; // It is possible that the timer callback is running even after TimerManager::clear // returns. This id is unique per timer and is used to return from the callback // early in case the time is stale. - uInt32 myTimerCallbackId; + uInt32 myTimerCallbackId{0}; }; #endif // STAGGERED_LOGGER diff --git a/src/common/StateManager.cxx b/src/common/StateManager.cxx index 8bd19b539..5806ea231 100644 --- a/src/common/StateManager.cxx +++ b/src/common/StateManager.cxx @@ -31,9 +31,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - StateManager::StateManager(OSystem& osystem) - : myOSystem(osystem), - myCurrentSlot(0), - myActiveMode(Mode::Off) + : myOSystem(osystem) { myRewindManager = make_unique(myOSystem, *this); reset(); diff --git a/src/common/StateManager.hxx b/src/common/StateManager.hxx index ac7338513..0e95cc0e5 100644 --- a/src/common/StateManager.hxx +++ b/src/common/StateManager.hxx @@ -163,10 +163,10 @@ class StateManager OSystem& myOSystem; // The current slot for load/save states - int myCurrentSlot; + int myCurrentSlot{0}; // Whether the manager is in record or playback mode - Mode myActiveMode; + Mode myActiveMode{Mode::Off}; // MD5 of the currently active ROM (either in movie or rewind mode) string myMD5; diff --git a/src/common/audio/ConvolutionBuffer.cxx b/src/common/audio/ConvolutionBuffer.cxx index e3b352b53..a4518236d 100644 --- a/src/common/audio/ConvolutionBuffer.cxx +++ b/src/common/audio/ConvolutionBuffer.cxx @@ -19,8 +19,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ConvolutionBuffer::ConvolutionBuffer(uInt32 size) - : myFirstIndex(0), - mySize(size) + : mySize(size) { myData = make_unique(mySize); std::fill_n(myData.get(), mySize, 0.F); diff --git a/src/common/audio/ConvolutionBuffer.hxx b/src/common/audio/ConvolutionBuffer.hxx index c79f6089e..cb27b798b 100644 --- a/src/common/audio/ConvolutionBuffer.hxx +++ b/src/common/audio/ConvolutionBuffer.hxx @@ -34,9 +34,9 @@ class ConvolutionBuffer unique_ptr myData; - uInt32 myFirstIndex; + uInt32 myFirstIndex{0}; - uInt32 mySize; + uInt32 mySize{0}; private: diff --git a/src/common/audio/HighPass.cxx b/src/common/audio/HighPass.cxx index 632c44774..1c8c9b6a0 100644 --- a/src/common/audio/HighPass.cxx +++ b/src/common/audio/HighPass.cxx @@ -20,9 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - HighPass::HighPass(float cutOffFrequency, float frequency) - : myLastValueIn(0), - myLastValueOut(0), - myAlpha(1.F / (1.F + 2.F*BSPF::PI_f*cutOffFrequency/frequency)) + : myAlpha(1.F / (1.F + 2.F*BSPF::PI_f*cutOffFrequency/frequency)) { } diff --git a/src/common/audio/HighPass.hxx b/src/common/audio/HighPass.hxx index a36f8c8f9..66fca501b 100644 --- a/src/common/audio/HighPass.hxx +++ b/src/common/audio/HighPass.hxx @@ -28,11 +28,11 @@ class HighPass private: - float myLastValueIn; + float myLastValueIn{0.F}; - float myLastValueOut; + float myLastValueOut{0.F}; - float myAlpha; + float myAlpha{0.F}; private: diff --git a/src/common/audio/LanczosResampler.cxx b/src/common/audio/LanczosResampler.cxx index 6f3b6393c..a053f39fc 100644 --- a/src/common/audio/LanczosResampler.cxx +++ b/src/common/audio/LanczosResampler.cxx @@ -71,15 +71,10 @@ LanczosResampler::LanczosResampler( // -> we find N from fully reducing the fraction. myPrecomputedKernelCount(reducedDenominator(formatFrom.sampleRate, formatTo.sampleRate)), myKernelSize(2 * kernelParameter), - myCurrentKernelIndex(0), myKernelParameter(kernelParameter), - myCurrentFragment(nullptr), - myFragmentIndex(0), - myIsUnderrun(true), myHighPassL(HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)), myHighPassR(HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)), - myHighPass(HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)), - myTimeIndex(0) + myHighPass(HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)) { myPrecomputedKernels = make_unique(myPrecomputedKernelCount * myKernelSize); diff --git a/src/common/audio/LanczosResampler.hxx b/src/common/audio/LanczosResampler.hxx index eeba17f2a..4ab8ef50e 100644 --- a/src/common/audio/LanczosResampler.hxx +++ b/src/common/audio/LanczosResampler.hxx @@ -43,26 +43,26 @@ class LanczosResampler : public Resampler private: - uInt32 myPrecomputedKernelCount; - uInt32 myKernelSize; - uInt32 myCurrentKernelIndex; + uInt32 myPrecomputedKernelCount{0}; + uInt32 myKernelSize{0}; + uInt32 myCurrentKernelIndex{0}; unique_ptr myPrecomputedKernels; - uInt32 myKernelParameter; + uInt32 myKernelParameter{0}; unique_ptr myBuffer; unique_ptr myBufferL; unique_ptr myBufferR; - Int16* myCurrentFragment; - uInt32 myFragmentIndex; - bool myIsUnderrun; + Int16* myCurrentFragment{nullptr}; + uInt32 myFragmentIndex{0}; + bool myIsUnderrun{true}; HighPass myHighPassL; HighPass myHighPassR; HighPass myHighPass; - uInt32 myTimeIndex; + uInt32 myTimeIndex{0}; }; #endif // LANCZOS_RESAMPLER_HXX diff --git a/src/common/audio/Resampler.hxx b/src/common/audio/Resampler.hxx index 4e2a9c7b3..d2e7fb0c7 100644 --- a/src/common/audio/Resampler.hxx +++ b/src/common/audio/Resampler.hxx @@ -39,9 +39,9 @@ class Resampler { public: - uInt32 sampleRate; - uInt32 fragmentSize; - bool stereo; + uInt32 sampleRate{31400}; + uInt32 fragmentSize{512}; + bool stereo{false}; private: diff --git a/src/common/audio/SimpleResampler.hxx b/src/common/audio/SimpleResampler.hxx index e76be209f..46e7f89e0 100644 --- a/src/common/audio/SimpleResampler.hxx +++ b/src/common/audio/SimpleResampler.hxx @@ -33,11 +33,10 @@ class SimpleResampler : public Resampler void fillFragment(float* fragment, uInt32 length) override; private: - - Int16* myCurrentFragment; - uInt32 myTimeIndex; - uInt32 myFragmentIndex; - bool myIsUnderrun; + Int16* myCurrentFragment{nullptr}; + uInt32 myTimeIndex{0}; + uInt32 myFragmentIndex{0}; + bool myIsUnderrun{true}; private: diff --git a/src/common/repository/KeyValueRepositoryConfigfile.cxx b/src/common/repository/KeyValueRepositoryConfigfile.cxx index 459f3e58e..2a242bd6e 100644 --- a/src/common/repository/KeyValueRepositoryConfigfile.cxx +++ b/src/common/repository/KeyValueRepositoryConfigfile.cxx @@ -30,7 +30,8 @@ namespace { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - KeyValueRepositoryConfigfile::KeyValueRepositoryConfigfile(const string& filename) : myFilename(filename) -{} +{ +} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - std::map KeyValueRepositoryConfigfile::load() diff --git a/src/common/repository/sqlite/SqliteDatabase.cxx b/src/common/repository/sqlite/SqliteDatabase.cxx index 6a618a312..b5d917099 100644 --- a/src/common/repository/sqlite/SqliteDatabase.cxx +++ b/src/common/repository/sqlite/SqliteDatabase.cxx @@ -28,12 +28,11 @@ #endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SqliteDatabase::SqliteDatabase( - const string& databaseDirectory, - const string& databaseName -) : myDatabaseFile(databaseDirectory + SEPARATOR + databaseName + ".sqlite3"), - myHandle(nullptr) -{} +SqliteDatabase::SqliteDatabase(const string& databaseDirectory, + const string& databaseName) + : myDatabaseFile(databaseDirectory + SEPARATOR + databaseName + ".sqlite3") +{ +} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SqliteDatabase::~SqliteDatabase() diff --git a/src/common/repository/sqlite/SqliteDatabase.hxx b/src/common/repository/sqlite/SqliteDatabase.hxx index 213b58bfc..de274b6f4 100644 --- a/src/common/repository/sqlite/SqliteDatabase.hxx +++ b/src/common/repository/sqlite/SqliteDatabase.hxx @@ -42,7 +42,7 @@ class SqliteDatabase string myDatabaseFile; - sqlite3* myHandle; + sqlite3* myHandle{nullptr}; private: diff --git a/src/common/repository/sqlite/SqliteStatement.cxx b/src/common/repository/sqlite/SqliteStatement.cxx index bdba38f0f..06478fbae 100644 --- a/src/common/repository/sqlite/SqliteStatement.cxx +++ b/src/common/repository/sqlite/SqliteStatement.cxx @@ -18,7 +18,8 @@ #include "SqliteError.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SqliteStatement::SqliteStatement(sqlite3* handle, string sql) : myStmt(nullptr), myHandle(handle) +SqliteStatement::SqliteStatement(sqlite3* handle, string sql) + : myHandle(handle) { if (sqlite3_prepare_v2(handle, sql.c_str(), -1, &myStmt, nullptr) != SQLITE_OK) throw SqliteError(handle); diff --git a/src/common/repository/sqlite/SqliteStatement.hxx b/src/common/repository/sqlite/SqliteStatement.hxx index 5df447103..5c23a0816 100644 --- a/src/common/repository/sqlite/SqliteStatement.hxx +++ b/src/common/repository/sqlite/SqliteStatement.hxx @@ -41,9 +41,9 @@ class SqliteStatement { private: - sqlite3_stmt* myStmt; + sqlite3_stmt* myStmt{nullptr}; - sqlite3* myHandle; + sqlite3* myHandle{nullptr}; private: diff --git a/src/common/repository/sqlite/SqliteTransaction.cxx b/src/common/repository/sqlite/SqliteTransaction.cxx index 34882e9dd..8153d644d 100644 --- a/src/common/repository/sqlite/SqliteTransaction.cxx +++ b/src/common/repository/sqlite/SqliteTransaction.cxx @@ -20,8 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SqliteTransaction::SqliteTransaction(SqliteDatabase& db) - : myDb(db), - myTransactionClosed(false) + : myDb(db) { myDb.exec("BEGIN TRANSACTION"); } diff --git a/src/common/repository/sqlite/SqliteTransaction.hxx b/src/common/repository/sqlite/SqliteTransaction.hxx index 1485ac614..5ec269a3f 100644 --- a/src/common/repository/sqlite/SqliteTransaction.hxx +++ b/src/common/repository/sqlite/SqliteTransaction.hxx @@ -35,7 +35,7 @@ class SqliteTransaction { SqliteDatabase& myDb; - bool myTransactionClosed; + bool myTransactionClosed{false}; private: diff --git a/src/common/sdl_blitter/BilinearBlitter.cxx b/src/common/sdl_blitter/BilinearBlitter.cxx index d56fdb442..c7a2992bf 100644 --- a/src/common/sdl_blitter/BilinearBlitter.cxx +++ b/src/common/sdl_blitter/BilinearBlitter.cxx @@ -20,16 +20,9 @@ #include "ThreadDebugging.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BilinearBlitter::BilinearBlitter(FrameBufferSDL2& fb, bool interpolate) : - myTexture(nullptr), - mySecondaryTexture(nullptr), - mySrcRect({0, 0, 0, 0}), - myDstRect({0, 0, 0, 0}), - myInterpolate(interpolate), - myTexturesAreAllocated(false), - myRecreateTextures(false), - myStaticData(nullptr), - myFB(fb) +BilinearBlitter::BilinearBlitter(FrameBufferSDL2& fb, bool interpolate) + : myFB(fb), + myInterpolate(interpolate) { } diff --git a/src/common/sdl_blitter/BilinearBlitter.hxx b/src/common/sdl_blitter/BilinearBlitter.hxx index ecbbdfcf6..3a3a461ce 100644 --- a/src/common/sdl_blitter/BilinearBlitter.hxx +++ b/src/common/sdl_blitter/BilinearBlitter.hxx @@ -40,19 +40,18 @@ class BilinearBlitter : public Blitter { virtual void blit(SDL_Surface& surface) override; private: + FrameBufferSDL2& myFB; - SDL_Texture* myTexture; - SDL_Texture* mySecondaryTexture; - SDL_Rect mySrcRect, myDstRect; + SDL_Texture* myTexture{nullptr}; + SDL_Texture* mySecondaryTexture{nullptr}; + SDL_Rect mySrcRect{0, 0, 0, 0}, myDstRect{0, 0, 0, 0}; FBSurface::Attributes myAttributes; - bool myInterpolate; - bool myTexturesAreAllocated; - bool myRecreateTextures; + bool myInterpolate{false}; + bool myTexturesAreAllocated{false}; + bool myRecreateTextures{false}; - SDL_Surface* myStaticData; - - FrameBufferSDL2& myFB; + SDL_Surface* myStaticData{nullptr}; private: diff --git a/src/common/sdl_blitter/QisBlitter.cxx b/src/common/sdl_blitter/QisBlitter.cxx index 5014c81c7..eb631cab6 100644 --- a/src/common/sdl_blitter/QisBlitter.cxx +++ b/src/common/sdl_blitter/QisBlitter.cxx @@ -20,17 +20,8 @@ #include "ThreadDebugging.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -QisBlitter::QisBlitter(FrameBufferSDL2& fb) : - mySrcTexture(nullptr), - myIntermediateTexture(nullptr), - mySecondaryIntermedateTexture(nullptr), - mySrcRect({0, 0, 0, 0}), - myIntermediateRect({0, 0, 0, 0}), - myDstRect({0, 0, 0, 0}), - myTexturesAreAllocated(false), - myRecreateTextures(false), - myStaticData(nullptr), - myFB(fb) +QisBlitter::QisBlitter(FrameBufferSDL2& fb) + : myFB(fb) { } diff --git a/src/common/sdl_blitter/QisBlitter.hxx b/src/common/sdl_blitter/QisBlitter.hxx index 6c8630a08..87e5238f4 100644 --- a/src/common/sdl_blitter/QisBlitter.hxx +++ b/src/common/sdl_blitter/QisBlitter.hxx @@ -43,21 +43,21 @@ class QisBlitter : public Blitter { private: - SDL_Texture* mySrcTexture; - SDL_Texture* myIntermediateTexture; - SDL_Texture* mySecondaryIntermedateTexture; + FrameBufferSDL2& myFB; - SDL_Rect mySrcRect, myIntermediateRect, myDstRect; + SDL_Texture* mySrcTexture{nullptr}; + SDL_Texture* myIntermediateTexture{nullptr}; + SDL_Texture* mySecondaryIntermedateTexture{nullptr}; + + SDL_Rect mySrcRect{0, 0, 0, 0}, myIntermediateRect{0, 0, 0, 0}, myDstRect{0, 0, 0, 0}; FBSurface::Attributes myAttributes; - bool myTexturesAreAllocated; - bool myRecreateTextures; + bool myTexturesAreAllocated{false}; + bool myRecreateTextures{false}; - SDL_Surface* myStaticData; + SDL_Surface* myStaticData{nullptr}; unique_ptr myBlankBuffer; - FrameBufferSDL2& myFB; - private: void free(); diff --git a/src/common/tv_filters/AtariNTSC.hxx b/src/common/tv_filters/AtariNTSC.hxx index ab986b607..6cd24407f 100644 --- a/src/common/tv_filters/AtariNTSC.hxx +++ b/src/common/tv_filters/AtariNTSC.hxx @@ -179,8 +179,8 @@ class AtariNTSC struct pixel_info_t { - int offset; - float negate; + int offset{0}; + float negate{0.F}; std::array kernel; }; static const std::array atari_ntsc_pixels; diff --git a/src/debugger/CartDebug.hxx b/src/debugger/CartDebug.hxx index 3264f5cb2..8da326961 100644 --- a/src/debugger/CartDebug.hxx +++ b/src/debugger/CartDebug.hxx @@ -286,7 +286,7 @@ class CartDebug : public DebuggerSystem std::array IOReadWrite; std::array ZPRAM; AddrToLabel Label; - bool breakFound; + bool breakFound{false}; }; ReservedEquates myReserved; diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 1645d6d42..bb96dd5ea 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -63,10 +63,7 @@ Debugger* Debugger::myStaticDebugger = nullptr; Debugger::Debugger(OSystem& osystem, Console& console) : DialogContainer(osystem), myConsole(console), - mySystem(console.system()), - myDialog(nullptr), - myWidth(DebuggerDialog::kSmallFontMinW), - myHeight(DebuggerDialog::kSmallFontMinH) + mySystem(console.system()) { // Init parser myParser = make_unique(*this, osystem.settings()); diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index 92d08d0b3..964982528 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -338,7 +338,7 @@ class Debugger : public DialogContainer Console& myConsole; System& mySystem; - DebuggerDialog* myDialog; + DebuggerDialog* myDialog{nullptr}; unique_ptr myParser; unique_ptr myCartDebug; unique_ptr myCpuDebug; @@ -351,8 +351,8 @@ class Debugger : public DialogContainer FunctionDefMap myFunctionDefs; // Dimensions of the entire debugger window - uInt32 myWidth; - uInt32 myHeight; + uInt32 myWidth{DebuggerDialog::kSmallFontMinW}; + uInt32 myHeight{DebuggerDialog::kSmallFontMinH}; // Various builtin functions and operations struct BuiltinFunction { diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index 625265248..98cb93420 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -57,11 +57,7 @@ using std::right; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DebuggerParser::DebuggerParser(Debugger& d, Settings& s) : debugger(d), - settings(s), - myCommand(0), - argCount(0), - execDepth(0), - execPrefix("") + settings(s) { } diff --git a/src/debugger/DebuggerParser.hxx b/src/debugger/DebuggerParser.hxx index 10b2c63f6..4bffd26ed 100644 --- a/src/debugger/DebuggerParser.hxx +++ b/src/debugger/DebuggerParser.hxx @@ -92,8 +92,8 @@ class DebuggerParser string cmdString; string description; string extendedDesc; - bool parmsRequired; - bool refreshRequired; + bool parmsRequired{false}; + bool refreshRequired{false}; std::array parms; std::function executor; }; @@ -101,10 +101,10 @@ class DebuggerParser struct Trap { - bool read; - bool write; - uInt32 begin; - uInt32 end; + bool read{false}; + bool write{false}; + uInt32 begin{0}; + uInt32 end{0}; string condition; Trap(bool r, bool w, uInt32 b, uInt32 e, const string& c) @@ -121,13 +121,13 @@ class DebuggerParser ostringstream commandResult; // currently execute command id - int myCommand; + int myCommand{0}; // Arguments in 'int' and 'string' format for the currently running command IntArray args; StringList argStrings; - uInt32 argCount; + uInt32 argCount{0}; - uInt32 execDepth; + uInt32 execDepth{0}; string execPrefix; StringList myWatches; diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index da7b087c6..5e4d8a49f 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -30,9 +30,6 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list, myList(list), mySettings(s), myReserved(reserved), - myOffset(0), - myPC(0), - myPCEnd(0), myLabels(labels), myDirectives(directives) { @@ -1120,16 +1117,7 @@ void DiStella::processDirectives(const CartDebug::DirectiveList& directives) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -DiStella::Settings DiStella::settings = { - Base::Fmt::_2, // gfxFormat - true, // resolveCode (opposite of -d in Distella) - true, // showAddresses (not used externally; always off) - false, // aFlag (-a in Distella) - true, // fFlag (-f in Distella) - false, // rFlag (-r in Distella) - false, // bFlag (-b in Distella) - 8+1 // number of bytes to use with .byte directive -}; +DiStella::Settings DiStella::settings; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const std::array DiStella::ourLookup = { { diff --git a/src/debugger/DiStella.hxx b/src/debugger/DiStella.hxx index f68e8b229..6e0550df3 100644 --- a/src/debugger/DiStella.hxx +++ b/src/debugger/DiStella.hxx @@ -42,14 +42,14 @@ class DiStella // This will eventually grow to include all options supported by // standalone Distella struct Settings { - Common::Base::Fmt gfxFormat; - bool resolveCode; // Attempt to detect code vs. data sections - bool showAddresses; // Show PC addresses (always off for external output) - bool aFlag; // Turns 'A' off in accumulator instructions (-a in Distella) - bool fFlag; // Forces correct address length (-f in Distella) - bool rFlag; // Relocate calls out of address range (-r in Distella) - bool bFlag; // Process break routine (-b in Distella) - int bytesWidth; // Number of bytes to use per line (with .byte xxx) + Common::Base::Fmt gfxFormat{Common::Base::Fmt::_2}; + bool resolveCode{true}; // Attempt to detect code vs. data sections + bool showAddresses{true}; // Show PC addresses (always off for external output) + bool aFlag{false}; // Turns 'A' off in accumulator instructions (-a in Distella) + bool fFlag{true}; // Forces correct address length (-f in Distella) + bool rFlag{false}; // Relocate calls out of address range (-r in Distella) + bool bFlag{false}; // Process break routine (-b in Distella) + int bytesWidth{8+1}; // Number of bytes to use per line (with .byte xxx) }; static Settings settings; // Default settings @@ -123,13 +123,13 @@ class DiStella CartDebug::ReservedEquates& myReserved; stringstream myDisasmBuf; std::queue myAddressQueue; - uInt16 myOffset, myPC, myPCEnd; - uInt16 mySegType; + uInt16 myOffset{0}, myPC{0}, myPCEnd{0}; + uInt16 mySegType{0}; struct resource { - uInt16 start; - uInt16 end; - uInt16 length; + uInt16 start{0}; + uInt16 end{0}; + uInt16 length{0}; } myAppData; /* Stores info on how each address is marked, both in the general @@ -185,12 +185,12 @@ class DiStella }; struct Instruction_tag { - const char* const mnemonic; - AddressingMode addr_mode; - AccessMode source; - RWMode rw_mode; - uInt8 cycles; - uInt8 bytes; + const char* const mnemonic{nullptr}; + AddressingMode addr_mode{AddressingMode::IMPLIED}; + AccessMode source{AccessMode::NONE}; + RWMode rw_mode{RWMode::NONE}; + uInt8 cycles{0}; + uInt8 bytes{0}; }; static const std::array ourLookup;