diff --git a/src/common/FSNodeZIP.cxx b/src/common/FSNodeZIP.cxx index a29b3fc49..4ee101d66 100644 --- a/src/common/FSNodeZIP.cxx +++ b/src/common/FSNodeZIP.cxx @@ -25,21 +25,8 @@ #include "FSNodeFactory.hxx" #include "FSNodeZIP.hxx" -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FilesystemNodeZIP::FilesystemNodeZIP() - : _error(zip_error::NOT_A_FILE), - _numFiles(0), - _isDirectory(false), - _isFile(false) -{ -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FilesystemNodeZIP::FilesystemNodeZIP(const string& p) - : _error(zip_error::NONE), - _numFiles(0), - _isDirectory(false), - _isFile(false) { // Extract ZIP file and virtual file (if specified) size_t pos = BSPF::findIgnoreCase(p, ".zip"); @@ -107,9 +94,7 @@ FilesystemNodeZIP::FilesystemNodeZIP(const string& p) FilesystemNodeZIP::FilesystemNodeZIP( const string& zipfile, const string& virtualpath, const AbstractFSNodePtr& realnode, bool isdir) - : _error(zip_error::NONE), - _numFiles(0), - _isDirectory(isdir), + : _isDirectory(isdir), _isFile(!isdir) { setFlags(zipfile, virtualpath, realnode); diff --git a/src/common/FSNodeZIP.hxx b/src/common/FSNodeZIP.hxx index 0bb4ae0eb..d9a4622f9 100644 --- a/src/common/FSNodeZIP.hxx +++ b/src/common/FSNodeZIP.hxx @@ -38,7 +38,7 @@ class FilesystemNodeZIP : public AbstractFSNode /** * Creates a FilesystemNodeZIP with the root node as path. */ - FilesystemNodeZIP(); +// FilesystemNodeZIP(); /** * Creates a FilesystemNodeZIP for a given path. @@ -101,10 +101,10 @@ class FilesystemNodeZIP : public AbstractFSNode string _zipFile, _virtualPath; string _name, _path, _shortPath; - zip_error _error; - uInt32 _numFiles; + zip_error _error{zip_error::NONE}; + uInt32 _numFiles{0}; - bool _isDirectory, _isFile; + bool _isDirectory{false}, _isFile{false}; // ZipHandler static reference variable responsible for accessing ZIP files static unique_ptr myZipHandler; diff --git a/src/common/JoyMap.hxx b/src/common/JoyMap.hxx index 7fd9f22d8..3ec19e47e 100644 --- a/src/common/JoyMap.hxx +++ b/src/common/JoyMap.hxx @@ -32,17 +32,13 @@ class JoyMap public: struct JoyMapping { - EventMode mode; - int button; // button number - JoyAxis axis; // horizontal/vertical - JoyDir adir; // axis direction (neg/pos) - int hat; // hat number - JoyHatDir hdir; // hat direction (left/right/up/down) + EventMode mode{EventMode(0)}; + int button{0}; // button number + JoyAxis axis{JoyAxis(0)}; // horizontal/vertical + JoyDir adir{JoyDir(0)}; // axis direction (neg/pos) + int hat{0}; // hat number + JoyHatDir hdir{JoyHatDir(0)}; // hat direction (left/right/up/down) - JoyMapping() - : mode(EventMode(0)), button(0), - axis(JoyAxis(0)), adir(JoyDir(0)), - hat(0), hdir(JoyHatDir(0)) { } explicit JoyMapping(EventMode c_mode, int c_button, JoyAxis c_axis, JoyDir c_adir, int c_hat, JoyHatDir c_hdir) diff --git a/src/common/KeyMap.hxx b/src/common/KeyMap.hxx index 363ec1acf..c95ac0a05 100644 --- a/src/common/KeyMap.hxx +++ b/src/common/KeyMap.hxx @@ -32,11 +32,10 @@ class KeyMap public: struct Mapping { - EventMode mode; - StellaKey key; - StellaMod mod; + EventMode mode{EventMode(0)}; + StellaKey key{StellaKey(0)}; + StellaMod mod{StellaMod(0)}; - Mapping() : mode(EventMode(0)), key(StellaKey(0)), mod(StellaMod(0)) { } explicit Mapping(EventMode c_mode, StellaKey c_key, StellaMod c_mod) : mode(c_mode), key(c_key), mod(c_mod) { } explicit Mapping(EventMode c_mode, int c_key, int c_mod) @@ -59,7 +58,7 @@ class KeyMap }; using MappingArray = std::vector; - KeyMap() : myModEnabled(true) { } + KeyMap() = default; /** Add new mapping for given event */ void add(const Event::Type event, const Mapping& mapping); @@ -122,7 +121,7 @@ class KeyMap // being used or not (e.g. Ctrl by default is the fire button, // pressing it with a movement key could inadvertantly activate // a Ctrl combo when it isn't wanted) - bool myModEnabled; + bool myModEnabled{true}; // Following constructors and assignment operators not supported KeyMap(const KeyMap&) = delete; diff --git a/src/common/LinkedObjectPool.hxx b/src/common/LinkedObjectPool.hxx index 158bb6564..a26770e12 100644 --- a/src/common/LinkedObjectPool.hxx +++ b/src/common/LinkedObjectPool.hxx @@ -59,9 +59,7 @@ class LinkedObjectPool /* Create a pool of size CAPACITY; the active list starts out empty. */ - LinkedObjectPool() : myCurrent(myList.end()), myCapacity(0) { - resize(CAPACITY); - } + LinkedObjectPool() { resize(CAPACITY); } /** Return node data that the 'current' iterator points to. @@ -272,10 +270,10 @@ class LinkedObjectPool std::list myList, myPool; // Current position in the active list (end() indicates an invalid position) - iter myCurrent; + iter myCurrent{myList.end()}; // Total capacity of the pool - uInt32 myCapacity; + uInt32 myCapacity{0}; private: // Following constructors and assignment operators not supported diff --git a/src/common/MouseControl.cxx b/src/common/MouseControl.cxx index 49de365b2..c30eb75c8 100644 --- a/src/common/MouseControl.cxx +++ b/src/common/MouseControl.cxx @@ -26,8 +26,7 @@ MouseControl::MouseControl(Console& console, const string& mode) : myProps(console.properties()), myLeftController(console.leftController()), - myRightController(console.rightController()), - myCurrentModeNum(0) + myRightController(console.rightController()) { istringstream m_axis(mode); string m_mode; diff --git a/src/common/MouseControl.hxx b/src/common/MouseControl.hxx index 29c994bf1..91fe39939 100644 --- a/src/common/MouseControl.hxx +++ b/src/common/MouseControl.hxx @@ -76,16 +76,11 @@ class MouseControl Controller& myRightController; struct MouseMode { - Controller::Type xtype, ytype; - int xid, yid; + Controller::Type xtype{Controller::Type::Joystick}, ytype{Controller::Type::Joystick}; + int xid{-1}, yid{-1}; string message; - explicit MouseMode(const string& msg = "") - : xtype(Controller::Type::Joystick), - ytype(Controller::Type::Joystick), - xid(-1), - yid(-1), - message(msg) { } + explicit MouseMode(const string& msg = "") : message(msg) { } MouseMode(Controller::Type xt, int xi, Controller::Type yt, int yi, const string& msg) @@ -104,7 +99,7 @@ class MouseControl } }; - int myCurrentModeNum; + int myCurrentModeNum{0}; vector myModeList; private: diff --git a/src/common/PNGLibrary.cxx b/src/common/PNGLibrary.cxx index 976d29470..948cfd67e 100644 --- a/src/common/PNGLibrary.cxx +++ b/src/common/PNGLibrary.cxx @@ -32,9 +32,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PNGLibrary::PNGLibrary(OSystem& osystem) - : myOSystem(osystem), - mySnapInterval(0), - mySnapCounter(0) + : myOSystem(osystem) { } diff --git a/src/common/PNGLibrary.hxx b/src/common/PNGLibrary.hxx index 03cb0bec4..f1101d2ef 100644 --- a/src/common/PNGLibrary.hxx +++ b/src/common/PNGLibrary.hxx @@ -131,17 +131,15 @@ class PNGLibrary OSystem& myOSystem; // Used for continuous snapshot mode - uInt32 mySnapInterval; - uInt32 mySnapCounter; + uInt32 mySnapInterval{0}; + uInt32 mySnapCounter{0}; // The following data remains between invocations of allocateStorage, // and is only changed when absolutely necessary. struct ReadInfoType { vector buffer; vector row_pointers; - png_uint_32 width, height, pitch; - - ReadInfoType() : width(0), height(0), pitch(0) { } + png_uint_32 width{0}, height{0}, pitch{0}; }; static ReadInfoType ReadInfo; diff --git a/src/common/PhosphorHandler.cxx b/src/common/PhosphorHandler.cxx index 262387422..39e676943 100644 --- a/src/common/PhosphorHandler.cxx +++ b/src/common/PhosphorHandler.cxx @@ -17,13 +17,6 @@ #include "PhosphorHandler.hxx" -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -PhosphorHandler::PhosphorHandler() - : myUsePhosphor(false), - myPhosphorPercent(0.60F) -{ -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool PhosphorHandler::initialize(bool enable, int blend) { diff --git a/src/common/PhosphorHandler.hxx b/src/common/PhosphorHandler.hxx index aa4a31914..bd723d6b2 100644 --- a/src/common/PhosphorHandler.hxx +++ b/src/common/PhosphorHandler.hxx @@ -24,7 +24,7 @@ class PhosphorHandler { public: - PhosphorHandler(); + PhosphorHandler() = default; bool initialize(bool enable, int blend); @@ -54,10 +54,10 @@ class PhosphorHandler private: // Use phosphor effect - bool myUsePhosphor; + bool myUsePhosphor{false}; // Amount to blend when using phosphor effect - float myPhosphorPercent; + float myPhosphorPercent{0.60F}; // Precalculated averaged phosphor colors using PhosphorLUT = BSPF::array2D; diff --git a/src/common/PhysicalJoystick.cxx b/src/common/PhysicalJoystick.cxx index 88b4ddc32..274513aaa 100644 --- a/src/common/PhysicalJoystick.cxx +++ b/src/common/PhysicalJoystick.cxx @@ -23,17 +23,6 @@ #include "bspf.hxx" #include "PhysicalJoystick.hxx" -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -PhysicalJoystick::PhysicalJoystick() - : type(JT_NONE), - ID(-1), - name("None"), - numAxes(0), - numButtons(0), - numHats(0) -{ -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PhysicalJoystick::initialize(int index, const string& desc, int axes, int buttons, int hats, int /*balls*/) diff --git a/src/common/PhysicalJoystick.hxx b/src/common/PhysicalJoystick.hxx index aceea9cd5..8d9ac862a 100644 --- a/src/common/PhysicalJoystick.hxx +++ b/src/common/PhysicalJoystick.hxx @@ -42,7 +42,7 @@ class PhysicalJoystick static constexpr char MODE_DELIM = '>'; // must not be '^', '|' or '#' public: - PhysicalJoystick(); + PhysicalJoystick() = default; string getMap() const; bool setMap(const string& map); @@ -65,10 +65,10 @@ class PhysicalJoystick JT_2600DAPTOR_RIGHT = 5 }; - JoyType type; - int ID; - string name; - int numAxes, numButtons, numHats; + JoyType type{JT_NONE}; + int ID{-1}; + string name{"None"}; + int numAxes{0}, numButtons{0}, numHats{0}; IntArray axisLastValue; IntArray buttonLast; diff --git a/src/common/Rect.hxx b/src/common/Rect.hxx index 393204358..d0c457d4c 100644 --- a/src/common/Rect.hxx +++ b/src/common/Rect.hxx @@ -32,12 +32,12 @@ namespace Common { */ struct Point { - Int32 x; //!< The horizontal part of the point - Int32 y; //!< The vertical part of the point + Int32 x{0}; //!< The horizontal part of the point + Int32 y{0}; //!< The vertical part of the point - Point() : x(0), y(0) { } + Point() = default; explicit Point(Int32 x1, Int32 y1) : x(x1), y(y1) { } - explicit Point(const string& p) : x(0), y(0) { + explicit Point(const string& p) { char c = '\0'; istringstream buf(p); buf >> x >> c >> y; @@ -55,12 +55,12 @@ struct Point struct Size { - uInt32 w; //!< The width part of the size - uInt32 h; //!< The height part of the size + uInt32 w{0}; //!< The width part of the size + uInt32 h{0}; //!< The height part of the size - Size() : w(0), h(0) { } + Size() = default; explicit Size(uInt32 w1, uInt32 h1) : w(w1), h(h1) { } - explicit Size(const string& s) : w(0), h(0) { + explicit Size(const string& s) { char c = '\0'; istringstream buf(s); buf >> w >> c >> h; @@ -102,11 +102,13 @@ struct Size struct Rect { private: - uInt32 top, left; //!< The point at the top left of the rectangle (part of the rect). - uInt32 bottom, right; //!< The point at the bottom right of the rectangle (not part of the rect). + //!< The point at the top left of the rectangle (part of the rect). + uInt32 top{0}, left{0}; + //!< The point at the bottom right of the rectangle (not part of the rect). + uInt32 bottom{0}, right{0}; public: - Rect() : top(0), left(0), bottom(0), right(0) { assert(valid()); } + 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()); } Rect(const Point& p, uInt32 w, uInt32 h) : top(p.y), left(p.x), bottom(h), right(w) { assert(valid()); } diff --git a/src/common/RewindManager.hxx b/src/common/RewindManager.hxx index 627c86a9c..cc6ba12b8 100644 --- a/src/common/RewindManager.hxx +++ b/src/common/RewindManager.hxx @@ -170,22 +170,22 @@ class RewindManager OSystem& myOSystem; StateManager& myStateManager; - uInt32 mySize; - uInt32 myUncompressed; - uInt32 myInterval; - uInt64 myHorizon; - double myFactor; - bool myLastTimeMachineAdd; - uInt32 myStateSize; + uInt32 mySize{0}; + uInt32 myUncompressed{0}; + uInt32 myInterval{0}; + uInt64 myHorizon{0}; + double myFactor{0.0}; + bool myLastTimeMachineAdd{false}; + uInt32 myStateSize{0}; struct RewindState { Serializer data; // actual save state string message; // describes save state origin - uInt64 cycles; // cycles since emulation started + uInt64 cycles{0}; // cycles since emulation started // We do nothing on object instantiation or copy // The goal of LinkedObjectPool is to not do any allocations at all - RewindState() : cycles(0) { } + RewindState() = default; RewindState(const RewindState& rs) : cycles(rs.cycles) { } RewindState& operator= (const RewindState& rs) { cycles = rs.cycles; return *this; } diff --git a/src/common/Stack.hxx b/src/common/Stack.hxx index 03eefd548..c1b7fb447 100644 --- a/src/common/Stack.hxx +++ b/src/common/Stack.hxx @@ -32,12 +32,12 @@ class FixedStack { private: std::array _stack; - uInt32 _size; + uInt32 _size{0}; public: using StackFunction = std::function; - FixedStack() : _size(0) { } + FixedStack() { } bool empty() const { return _size <= 0; } bool full() const { return _size >= CAPACITY; } diff --git a/src/common/ThreadDebugging.cxx b/src/common/ThreadDebugging.cxx index eb6aa0382..6361471b2 100644 --- a/src/common/ThreadDebugging.cxx +++ b/src/common/ThreadDebugging.cxx @@ -17,12 +17,6 @@ #include "ThreadDebugging.hxx" -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ThreadDebuggingHelper::ThreadDebuggingHelper() - : myMainThreadIdConfigured(false) -{ -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ThreadDebuggingHelper& ThreadDebuggingHelper::instance() { diff --git a/src/common/ThreadDebugging.hxx b/src/common/ThreadDebugging.hxx index 8378b53d3..cf60a50a7 100644 --- a/src/common/ThreadDebugging.hxx +++ b/src/common/ThreadDebugging.hxx @@ -48,11 +48,11 @@ class ThreadDebuggingHelper { [[noreturn]] void fail(const string& message); - ThreadDebuggingHelper(); + ThreadDebuggingHelper() = default; std::thread::id myMainThreadId; - bool myMainThreadIdConfigured; + bool myMainThreadIdConfigured{false}; private: diff --git a/src/common/TimerManager.cxx b/src/common/TimerManager.cxx index 748f5b826..33feaa51a 100644 --- a/src/common/TimerManager.cxx +++ b/src/common/TimerManager.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TimerManager::TimerManager() : nextId(no_timer + 1), - queue(), - done(false) + queue() { } @@ -231,13 +230,6 @@ bool TimerManager::destroy_impl(ScopedLock& lock, TimerMap::iterator i, // TimerManager::Timer implementation // -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -TimerManager::Timer::Timer(TimerId tid) - : id(tid), - running(false) -{ -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TimerManager::Timer::Timer(Timer&& r) noexcept : id(r.id), @@ -254,7 +246,6 @@ TimerManager::Timer::Timer(TimerId tid, Timestamp tnext, Duration tperiod, : id(tid), next(tnext), period(tperiod), - handler(func), - running(false) + handler(func) { } diff --git a/src/common/TimerManager.hxx b/src/common/TimerManager.hxx index 59dadcfbb..a92ec724b 100644 --- a/src/common/TimerManager.hxx +++ b/src/common/TimerManager.hxx @@ -146,7 +146,7 @@ class TimerManager struct Timer { - explicit Timer(TimerId id = 0); + explicit Timer(TimerId tid = 0) : id(tid) { } Timer(Timer&& r) noexcept; Timer& operator=(Timer&& r) noexcept; @@ -156,7 +156,7 @@ class TimerManager Timer(Timer const& r) = delete; Timer& operator=(Timer const& r) = delete; - TimerId id; + TimerId id{0}; Timestamp next; Duration period; TFunction handler; @@ -164,7 +164,7 @@ class TimerManager // You must be holding the 'sync' lock to assign waitCond std::unique_ptr waitCond; - bool running; + bool running{false}; }; // Comparison functor to sort the timer "queue" by Timer::next @@ -200,7 +200,7 @@ class TimerManager mutable Lock sync; ConditionVar wakeUp; std::thread worker; - bool done; + bool done{false}; // Valid IDs are guaranteed not to be this value static TimerId constexpr no_timer = TimerId(0); diff --git a/src/common/ZipHandler.cxx b/src/common/ZipHandler.cxx index 81836bfab..5c362613e 100644 --- a/src/common/ZipHandler.cxx +++ b/src/common/ZipHandler.cxx @@ -196,9 +196,6 @@ void ZipHandler::addToCache() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ZipHandler::ZipFile::ZipFile(const string& filename) : myFilename(filename), - myLength(0), - myRomfiles(0), - myCdPos(0), myBuffer(make_unique(DECOMPRESS_BUFSIZE)) { std::fill(myBuffer.get(), myBuffer.get() + DECOMPRESS_BUFSIZE, 0); @@ -512,31 +509,4 @@ void ZipHandler::ZipFile::decompressDataType8( throw runtime_error(errorMessage(ZipError::DECOMPRESS_ERROR)); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ZipHandler::ZipHeader::ZipHeader() - : versionCreated(0), - versionNeeded(0), - bitFlag(0), - compression(0), - fileTime(0), - fileDate(0), - crc(0), - compressedLength(0), - uncompressedLength(0), - startDiskNumber(0), - localHeaderOffset(0) -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -ZipHandler::ZipEcd::ZipEcd() - : diskNumber(0), - cdStartDiskNumber(0), - cdDiskEntries(0), - cdTotalEntries(0), - cdSize(0), - cdStartDiskOffset(0) -{ -} - #endif /* ZIP_SUPPORT */ diff --git a/src/common/ZipHandler.hxx b/src/common/ZipHandler.hxx index 1470761c1..114dc74c5 100644 --- a/src/common/ZipHandler.hxx +++ b/src/common/ZipHandler.hxx @@ -69,52 +69,46 @@ class ZipHandler // Contains extracted file header information struct ZipHeader { - uInt16 versionCreated; // version made by - uInt16 versionNeeded; // version needed to extract - uInt16 bitFlag; // general purpose bit flag - uInt16 compression; // compression method - uInt16 fileTime; // last mod file time - uInt16 fileDate; // last mod file date - uInt32 crc; // crc-32 - uInt64 compressedLength; // compressed size - uInt64 uncompressedLength; // uncompressed size - uInt32 startDiskNumber; // disk number start - uInt64 localHeaderOffset; // relative offset of local header - string filename; // filename - - /** Constructor */ - ZipHeader(); + uInt16 versionCreated{0}; // version made by + uInt16 versionNeeded{0}; // version needed to extract + uInt16 bitFlag{0}; // general purpose bit flag + uInt16 compression{0}; // compression method + uInt16 fileTime{0}; // last mod file time + uInt16 fileDate{0}; // last mod file date + uInt32 crc{0}; // crc-32 + uInt64 compressedLength{0}; // compressed size + uInt64 uncompressedLength{0}; // uncompressed size + uInt32 startDiskNumber{0}; // disk number start + uInt64 localHeaderOffset{0}; // relative offset of local header + string filename; // filename }; // Contains extracted end of central directory information struct ZipEcd { - uInt32 diskNumber; // number of this disk - uInt32 cdStartDiskNumber; // number of the disk with the start of the central directory - uInt64 cdDiskEntries; // total number of entries in the central directory on this disk - uInt64 cdTotalEntries; // total number of entries in the central directory - uInt64 cdSize; // size of the central directory - uInt64 cdStartDiskOffset; // offset of start of central directory with respect to the starting disk number - - /** Constructor */ - ZipEcd(); + uInt32 diskNumber{0}; // number of this disk + uInt32 cdStartDiskNumber{0}; // number of the disk with the start of the central directory + uInt64 cdDiskEntries{0}; // total number of entries in the central directory on this disk + uInt64 cdTotalEntries{0}; // total number of entries in the central directory + uInt64 cdSize{0}; // size of the central directory + uInt64 cdStartDiskOffset{0}; // offset of start of central directory with respect to the starting disk number }; // Describes an open ZIP file struct ZipFile { - string myFilename; // copy of ZIP filename (for caching) - fstream myStream; // C++ fstream file handle - uInt64 myLength; // length of zip file - uInt16 myRomfiles; // number of ROM files in central directory + string myFilename; // copy of ZIP filename (for caching) + fstream myStream; // C++ fstream file handle + uInt64 myLength{0}; // length of zip file + uInt16 myRomfiles{0}; // number of ROM files in central directory - ZipEcd myEcd; // end of central directory + ZipEcd myEcd; // end of central directory - ByteBuffer myCd; // central directory raw data - uInt64 myCdPos; // position in central directory - ZipHeader myHeader; // current file header + ByteBuffer myCd; // central directory raw data + uInt64 myCdPos{0}; // position in central directory + ZipHeader myHeader; // current file header - ByteBuffer myBuffer; // buffer for decompression + ByteBuffer myBuffer; // buffer for decompression /** Constructor */ explicit ZipFile(const string& filename); @@ -190,7 +184,7 @@ class ZipHandler } private: - const uInt8* const myBuf; + const uInt8* const myBuf{nullptr}; }; class LocalFileHeaderReader : public ReaderBase @@ -289,7 +283,7 @@ class ZipHandler bool directoryEncryption() const { return bool(myValue & 0x2000); } private: - uInt16 myValue; + uInt16 myValue{0}; }; private: diff --git a/src/common/tv_filters/AtariNTSC.hxx b/src/common/tv_filters/AtariNTSC.hxx index a24b3139c..ab986b607 100644 --- a/src/common/tv_filters/AtariNTSC.hxx +++ b/src/common/tv_filters/AtariNTSC.hxx @@ -57,18 +57,18 @@ class AtariNTSC struct Setup { // Basic parameters - float hue; // -1 = -180 degrees +1 = +180 degrees - float saturation; // -1 = grayscale (0.0) +1 = oversaturated colors (2.0) - float contrast; // -1 = dark (0.5) +1 = light (1.5) - float brightness; // -1 = dark (0.5) +1 = light (1.5) - float sharpness; // edge contrast enhancement/blurring + float hue{0.F}; // -1 = -180 degrees +1 = +180 degrees + float saturation{0.F}; // -1 = grayscale (0.0) +1 = oversaturated colors (2.0) + float contrast{0.F}; // -1 = dark (0.5) +1 = light (1.5) + float brightness{0.F}; // -1 = dark (0.5) +1 = light (1.5) + float sharpness{0.F}; // edge contrast enhancement/blurring // Advanced parameters - float gamma; // -1 = dark (1.5) +1 = light (0.5) - float resolution; // image resolution - float artifacts; // artifacts caused by color changes - float fringing; // color artifacts caused by brightness changes - float bleed; // color bleed (color resolution reduction) + float gamma{0.F}; // -1 = dark (1.5) +1 = light (0.5) + float resolution{0.F}; // image resolution + float artifacts{0.F}; // artifacts caused by color changes + float fringing{0.F}; // color artifacts caused by brightness changes + float bleed{0.F}; // color bleed (color resolution reduction) }; // Video format presets @@ -157,19 +157,19 @@ class AtariNTSC // Rendering threads unique_ptr myThreads; // NOLINT // Number of rendering and total threads - uInt32 myWorkerThreads, myTotalThreads; + uInt32 myWorkerThreads{0}, myTotalThreads{0}; struct init_t { std::array to_rgb; std::array to_float; - float contrast; - float brightness; - float artifacts; - float fringing; + float contrast{0.F}; + float brightness{0.F}; + float artifacts{0.F}; + float fringing{0.F}; std::array kernel; - init_t() : contrast(0.0), brightness(0.0), artifacts(0.0), fringing(0.0) { + init_t() { to_rgb.fill(0.0); to_float.fill(0.0); kernel.fill(0.0); diff --git a/src/common/tv_filters/NTSCFilter.cxx b/src/common/tv_filters/NTSCFilter.cxx index 7734f3b67..35adbefc9 100644 --- a/src/common/tv_filters/NTSCFilter.cxx +++ b/src/common/tv_filters/NTSCFilter.cxx @@ -23,14 +23,6 @@ constexpr float scaleFrom100(float x) { return (x/50.F) - 1.F; } constexpr uInt32 scaleTo100(float x) { return uInt32(50*(x+1.F)); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -NTSCFilter::NTSCFilter() - : mySetup(AtariNTSC::TV_Composite), - myPreset(Preset::OFF), - myCurrentAdjustable(0) -{ -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string NTSCFilter::setPreset(Preset preset) { diff --git a/src/common/tv_filters/NTSCFilter.hxx b/src/common/tv_filters/NTSCFilter.hxx index 2377919f0..911895e9c 100644 --- a/src/common/tv_filters/NTSCFilter.hxx +++ b/src/common/tv_filters/NTSCFilter.hxx @@ -35,7 +35,7 @@ class Settings; class NTSCFilter { public: - NTSCFilter(); + NTSCFilter() = default; public: // Set one of the available preset adjustments (Composite, S-Video, RGB, etc) @@ -125,20 +125,20 @@ class NTSCFilter // Contains controls used to adjust the palette in the NTSC filter // This is the main setup object used by the underlying ntsc code - AtariNTSC::Setup mySetup; + AtariNTSC::Setup mySetup{AtariNTSC::TV_Composite}; // This setup is used only in custom mode (after it is modified, // it is copied to mySetup) static AtariNTSC::Setup myCustomSetup; // Current preset in use - Preset myPreset; + Preset myPreset{Preset::OFF}; struct AdjustableTag { - const char* const type; - float* value; + const char* const type{nullptr}; + float* value{nullptr}; }; - uInt32 myCurrentAdjustable; + uInt32 myCurrentAdjustable{0}; static const std::array ourCustomAdjustables; private: diff --git a/src/debugger/BreakpointMap.hxx b/src/debugger/BreakpointMap.hxx index dd8bcf620..38a99acb6 100644 --- a/src/debugger/BreakpointMap.hxx +++ b/src/debugger/BreakpointMap.hxx @@ -35,20 +35,14 @@ class BreakpointMap public: // breakpoint flags static const uInt32 ONE_SHOT = 1 << 0; // used for 'trace' command - static const uInt8 ANY_BANK = 255; // breakpoint valid in any bank struct Breakpoint { - uInt16 addr; - uInt8 bank; + uInt16 addr{0}; + uInt8 bank{0}; - Breakpoint() : addr(0), bank(0) { } explicit Breakpoint(uInt16 c_addr, uInt8 c_bank) : addr(c_addr), bank(c_bank) { } - Breakpoint(const Breakpoint&) = default; - Breakpoint& operator=(const Breakpoint&) = default; - Breakpoint(Breakpoint&&) = default; - Breakpoint& operator=(Breakpoint&&) = default; bool operator==(const Breakpoint& other) const { @@ -68,7 +62,7 @@ class BreakpointMap }; using BreakpointList = std::vector; - BreakpointMap() : myInitialized(false) { } + BreakpointMap() = default; bool isInitialized() const { return myInitialized; } @@ -107,7 +101,7 @@ class BreakpointMap }; std::unordered_map myMap; - bool myInitialized; + bool myInitialized{false}; // Following constructors and assignment operators not supported BreakpointMap(const BreakpointMap&) = delete; diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 432aa7fdb..aaca5bad6 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -45,10 +45,7 @@ using std::right; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem) : DebuggerSystem(dbg, console), - myOSystem(osystem), - myDebugWidget(nullptr), - myAddrToLineIsROM(true), - myLabelLength(8) // longest pre-defined label + myOSystem(osystem) { // Add case sensitive compare for user labels // TODO - should user labels be case insensitive too? diff --git a/src/debugger/CartDebug.hxx b/src/debugger/CartDebug.hxx index cd37a42d1..3264f5cb2 100644 --- a/src/debugger/CartDebug.hxx +++ b/src/debugger/CartDebug.hxx @@ -70,19 +70,19 @@ class CartDebug : public DebuggerSystem WRITE = TCODE // 0x40, address written to }; struct DisassemblyTag { - DisasmType type; - uInt16 address; + DisasmType type{NONE}; + uInt16 address{0}; string label; string disasm; string ccount; string ctotal; string bytes; - bool hllabel; + bool hllabel{false}; }; using DisassemblyList = vector; struct Disassembly { DisassemblyList list; - int fieldwidth; + int fieldwidth{0}; }; // Determine 'type' of address (ie, what part of the system accessed) @@ -260,22 +260,20 @@ class CartDebug : public DebuggerSystem using AddrTypeArray = std::array; struct DirectiveTag { - DisasmType type; - uInt16 start; - uInt16 end; + DisasmType type{NONE}; + uInt16 start{0}; + uInt16 end{0}; }; using AddressList = std::list; using DirectiveList = std::list; struct BankInfo { - uInt16 start; // start of address space - uInt16 end; // end of address space - uInt16 offset; // ORG value - size_t size; // size of a bank (in bytes) + uInt16 start{0}; // start of address space + uInt16 end{0}; // end of address space + uInt16 offset{0}; // ORG value + size_t size{0}; // size of a bank (in bytes) AddressList addressList; // addresses which PC has hit DirectiveList directiveList; // overrides for automatic code determination - - BankInfo() : start(0), end(0), offset(0), size(0) { } }; // Address type information determined by Distella @@ -316,7 +314,7 @@ class CartDebug : public DebuggerSystem CartState myState; CartState myOldState; - CartDebugWidget* myDebugWidget; + CartDebugWidget* myDebugWidget{nullptr}; // A complete record of relevant diassembly information for each bank vector myBankInfo; @@ -325,7 +323,7 @@ class CartDebug : public DebuggerSystem // to corresponding lines of text in that display Disassembly myDisassembly; std::map myAddrToLineList; - bool myAddrToLineIsROM; + bool myAddrToLineIsROM{true}; // Mappings from label to address (and vice versa) for items // defined by the user (either through a DASM symbol file or manually @@ -346,7 +344,7 @@ class CartDebug : public DebuggerSystem LabelToAddr mySystemAddresses; // The maximum length of all labels currently defined - uInt16 myLabelLength; + uInt16 myLabelLength{8}; // longest pre-defined label // Filenames to use for various I/O (currently these are hardcoded) string myListFile, mySymbolFile, myCfgFile, myDisasmFile, myRomFile; diff --git a/src/debugger/CpuDebug.hxx b/src/debugger/CpuDebug.hxx index 816f21a30..d52e8ff4c 100644 --- a/src/debugger/CpuDebug.hxx +++ b/src/debugger/CpuDebug.hxx @@ -30,11 +30,9 @@ using CpuMethod = int (CpuDebug::*)() const; class CpuState : public DebuggerState { public: - int PC, SP, PS, A, X, Y; - int srcS, srcA, srcX, srcY; + int PC{0}, SP{0}, PS{0}, A{0}, X{0}, Y{0}; + int srcS{0}, srcA{0}, srcX{0}, srcY{0}; BoolArray PSbits; - - CpuState() : PC(0), SP(0), PS(0), A(0), X(0), Y(0), srcS(0), srcA(0), srcX(0), srcY(0) { } }; class CpuDebug : public DebuggerSystem diff --git a/src/debugger/RiotDebug.hxx b/src/debugger/RiotDebug.hxx index 45cd5b395..eac41f9be 100644 --- a/src/debugger/RiotDebug.hxx +++ b/src/debugger/RiotDebug.hxx @@ -27,7 +27,7 @@ class RiotDebug; class RiotState : public DebuggerState { public: - uInt8 SWCHA_R, SWCHA_W, SWACNT, SWCHB_R, SWCHB_W, SWBCNT; + uInt8 SWCHA_R{0}, SWCHA_W{0}, SWACNT{0}, SWCHB_R{0}, SWCHB_W{0}, SWBCNT{0}; BoolArray swchaReadBits; BoolArray swchaWriteBits; BoolArray swacntBits; @@ -35,20 +35,12 @@ class RiotState : public DebuggerState BoolArray swchbWriteBits; BoolArray swbcntBits; - uInt8 TIM1T, TIM8T, TIM64T, T1024T, INTIM, TIMINT; - Int32 TIMCLKS, INTIMCLKS, TIMDIV; + uInt8 TIM1T{0}, TIM8T{0}, TIM64T{0}, T1024T{0}, INTIM{0}, TIMINT{0}; + Int32 TIMCLKS{0}, INTIMCLKS{0}, TIMDIV{0}; // These are actually from the TIA, but are I/O related - uInt8 INPT0, INPT1, INPT2, INPT3, INPT4, INPT5; - bool INPTLatch, INPTDump; - - RiotState() - : SWCHA_R(0), SWCHA_W(0), SWACNT(0), SWCHB_R(0), SWCHB_W(0), SWBCNT(0), - TIM1T(0), TIM8T(0), TIM64T(0), T1024T(0), INTIM(0), TIMINT(0), - TIMCLKS(0), INTIMCLKS(0), TIMDIV(0), - INPT0(0), INPT1(0), INPT2(0), INPT3(0), INPT4(0), INPT5(0), - INPTLatch(false), INPTDump(false) - { } + uInt8 INPT0{0}, INPT1{0}, INPT2{0}, INPT3{0}, INPT4{0}, INPT5{0}; + bool INPTLatch{false}, INPTDump{false}; }; class RiotDebug : public DebuggerSystem diff --git a/src/debugger/TrapArray.hxx b/src/debugger/TrapArray.hxx index 18ba3d634..487e9419b 100644 --- a/src/debugger/TrapArray.hxx +++ b/src/debugger/TrapArray.hxx @@ -23,7 +23,7 @@ class TrapArray { public: - TrapArray() : myInitialized(false) {} + TrapArray() = default; bool isSet(const uInt16 address) const { return myCount[address]; } bool isClear(const uInt16 address) const { return myCount[address] == 0; } @@ -46,7 +46,7 @@ class TrapArray std::array myCount; // Indicates whether we should treat this array as initialized - bool myInitialized; + bool myInitialized{false}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/Device.hxx b/src/emucore/Device.hxx index 7ab55597e..d4eaa22b0 100644 --- a/src/emucore/Device.hxx +++ b/src/emucore/Device.hxx @@ -33,7 +33,7 @@ class System; class Device : public Serializable { public: - Device() : mySystem(nullptr) { } + Device() = default; virtual ~Device() = default; public: @@ -114,7 +114,7 @@ class Device : public Serializable protected: /// Pointer to the system the device is installed in or the null pointer - System* mySystem; + System* mySystem{nullptr}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/DispatchResult.hxx b/src/emucore/DispatchResult.hxx index 5aefa98dc..9ec89d44f 100644 --- a/src/emucore/DispatchResult.hxx +++ b/src/emucore/DispatchResult.hxx @@ -27,9 +27,6 @@ class DispatchResult public: - DispatchResult() - : myStatus(Status::invalid), myCycles(0), myAddress(0), myWasReadTrap(false) { } - Status getStatus() const { return myStatus; } uInt64 getCycles() const { return myCycles; } @@ -44,7 +41,8 @@ class DispatchResult void setOk(uInt64 cycles); - void setDebugger(uInt64 cycles, const string& message = "", int address = -1, bool wasReadTrap = true); + void setDebugger(uInt64 cycles, const string& message = "", int address = -1, + bool wasReadTrap = true); void setFatal(uInt64 cycles); @@ -66,15 +64,15 @@ class DispatchResult private: - Status myStatus; + Status myStatus{Status::invalid}; - uInt64 myCycles; + uInt64 myCycles{0}; string myMessage; - int myAddress; + int myAddress{0}; - bool myWasReadTrap; + bool myWasReadTrap{false}; }; #endif // DISPATCH_RESULT_HXX diff --git a/src/emucore/EmulationTiming.cxx b/src/emucore/EmulationTiming.cxx index 2624f7ee4..5682f2cfb 100644 --- a/src/emucore/EmulationTiming.cxx +++ b/src/emucore/EmulationTiming.cxx @@ -31,12 +31,7 @@ namespace { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EmulationTiming::EmulationTiming(FrameLayout frameLayout, ConsoleTiming consoleTiming) : myFrameLayout(frameLayout), - myConsoleTiming(consoleTiming), - myPlaybackRate(44100), - myPlaybackPeriod(512), - myAudioQueueExtraFragments(1), - myAudioQueueHeadroom(2), - mySpeedFactor(1) + myConsoleTiming(consoleTiming) { recalculate(); } diff --git a/src/emucore/EmulationTiming.hxx b/src/emucore/EmulationTiming.hxx index 58b30d3ea..6f19db7c9 100644 --- a/src/emucore/EmulationTiming.hxx +++ b/src/emucore/EmulationTiming.hxx @@ -68,22 +68,22 @@ class EmulationTiming { FrameLayout myFrameLayout; ConsoleTiming myConsoleTiming; - uInt32 myPlaybackRate; - uInt32 myPlaybackPeriod; - uInt32 myAudioQueueExtraFragments; - uInt32 myAudioQueueHeadroom; + uInt32 myPlaybackRate{44100}; + uInt32 myPlaybackPeriod{512}; + uInt32 myAudioQueueExtraFragments{1}; + uInt32 myAudioQueueHeadroom{2}; - uInt32 myMaxCyclesPerTimeslice; - uInt32 myMinCyclesPerTimeslice; - uInt32 myLinesPerFrame; - uInt32 myCyclesPerFrame; - uInt32 myCyclesPerSecond; - uInt32 myAudioFragmentSize; - uInt32 myAudioSampleRate; - uInt32 myAudioQueueCapacity; - uInt32 myPrebufferFragmentCount; + uInt32 myMaxCyclesPerTimeslice{0}; + uInt32 myMinCyclesPerTimeslice{0}; + uInt32 myLinesPerFrame{0}; + uInt32 myCyclesPerFrame{0}; + uInt32 myCyclesPerSecond{0}; + uInt32 myAudioFragmentSize{0}; + uInt32 myAudioSampleRate{0}; + uInt32 myAudioQueueCapacity{0}; + uInt32 myPrebufferFragmentCount{0}; - double mySpeedFactor; + double mySpeedFactor{1.0}; private: diff --git a/src/emucore/EmulationWorker.cxx b/src/emucore/EmulationWorker.cxx index 9d55b8ba0..82d5a9bfe 100644 --- a/src/emucore/EmulationWorker.cxx +++ b/src/emucore/EmulationWorker.cxx @@ -25,14 +25,6 @@ using namespace std::chrono; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EmulationWorker::EmulationWorker() - : myPendingSignal(Signal::none), - myState(State::initializing), - myTia(nullptr), - myCyclesPerSecond(0), - myMaxCycles(0), - myMinCycles(0), - myDispatchResult(nullptr), - myTotalCycles(0) { std::mutex mutex; std::unique_lock lock(mutex); diff --git a/src/emucore/EmulationWorker.hxx b/src/emucore/EmulationWorker.hxx index ba116d88e..83a854b60 100644 --- a/src/emucore/EmulationWorker.hxx +++ b/src/emucore/EmulationWorker.hxx @@ -183,19 +183,19 @@ class EmulationWorker std::exception_ptr myPendingException; // Any pending signal (or Signal::none) - Signal myPendingSignal; + Signal myPendingSignal{Signal::none}; // The initial access to myState is not synchronized -> make this atomic - std::atomic myState; + std::atomic myState{State::initializing}; // Emulation parameters - TIA* myTia; - uInt64 myCyclesPerSecond; - uInt64 myMaxCycles; - uInt64 myMinCycles; - DispatchResult* myDispatchResult; + TIA* myTia{nullptr}; + uInt64 myCyclesPerSecond{0}; + uInt64 myMaxCycles{0}; + uInt64 myMinCycles{0}; + DispatchResult* myDispatchResult{nullptr}; // Total number of cycles during this emulation run - uInt64 myTotalCycles; + uInt64 myTotalCycles{0}; // 6507 time std::chrono::time_point myVirtualTime; diff --git a/src/emucore/FBSurface.cxx b/src/emucore/FBSurface.cxx index f89c83d4d..88af74334 100644 --- a/src/emucore/FBSurface.cxx +++ b/src/emucore/FBSurface.cxx @@ -25,19 +25,6 @@ #include "Font.hxx" #endif -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FBSurface::FBSurface() - : myPixels(nullptr), - myPitch(0) -{ - // NOTE: myPixels and myPitch MUST be set in child classes that inherit - // from this class - - // Set default attributes - myAttributes.blending = false; - myAttributes.blendalpha = 100; -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FBSurface::readPixels(uInt8* buffer, uInt32 pitch, const Common::Rect& rect) const { diff --git a/src/emucore/FBSurface.hxx b/src/emucore/FBSurface.hxx index 625977b66..4fddaeb68 100644 --- a/src/emucore/FBSurface.hxx +++ b/src/emucore/FBSurface.hxx @@ -40,12 +40,15 @@ namespace Common { is responsible for extending an FBSurface object suitable to the FrameBuffer type. + NOTE: myPixels and myPitch MUST be set in child classes that inherit + from this class + @author Stephen Anthony */ class FBSurface { public: - FBSurface(); + FBSurface() = default; virtual ~FBSurface() = default; /** @@ -327,8 +330,8 @@ class FBSurface the specific functionality actually exists. */ struct Attributes { - bool blending; // Blending is enabled - uInt32 blendalpha; // Alpha to use in blending mode (0-100%) + bool blending{false}; // Blending is enabled + uInt32 blendalpha{100}; // Alpha to use in blending mode (0-100%) bool operator==(const Attributes& other) const { return blendalpha == other.blendalpha && blending == other.blending; @@ -374,8 +377,8 @@ class FBSurface bool isWhiteSpace(const char s) const; protected: - uInt32* myPixels; - uInt32 myPitch; + uInt32* myPixels{nullptr}; // NOTE: MUST be set in child classes + uInt32 myPitch{0}; // NOTE: MUST be set in child classes Attributes myAttributes; diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index c78712ca4..922c694dd 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -47,17 +47,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FrameBuffer::FrameBuffer(OSystem& osystem) - : myOSystem(osystem), - myNumDisplays(1), - myInitializedCount(0), - myPausedCount(0), - myStatsEnabled(false), - myLastScanlines(0), - myGrabMouse(false), - myHiDPIAllowed(false), - myHiDPIEnabled(false), - myCurrentModeList(nullptr), - myTIAMaxZoom(1.0) + : myOSystem(osystem) { } @@ -1021,15 +1011,6 @@ const FrameBuffer::VideoMode& FrameBuffer::getSavedVidMode(bool fullscreen) // // VideoMode implementation // -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FrameBuffer::VideoMode::VideoMode() - : stretch(VideoMode::Stretch::None), - description(""), - zoom(1), - fsIndex(-1) -{ -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FrameBuffer::VideoMode::VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, Stretch smode, float overscan, const string& desc, @@ -1116,12 +1097,6 @@ FrameBuffer::VideoMode::VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, // // VideoModeList implementation // -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FrameBuffer::VideoModeList::VideoModeList() - : myIdx(-1) -{ -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FrameBuffer::VideoModeList::add(const VideoMode& mode) { diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx index 67235b9b6..1a23157e6 100644 --- a/src/emucore/FrameBuffer.hxx +++ b/src/emucore/FrameBuffer.hxx @@ -61,13 +61,13 @@ class FrameBuffer Common::Rect image; Common::Size screen; - Stretch stretch; + Stretch stretch{VideoMode::Stretch::None}; string description; - float zoom; - Int32 fsIndex; + float zoom{1.F}; + Int32 fsIndex{-1}; - VideoMode(); - VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, Stretch smode, float overscan = 1.0, + VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, + Stretch smode, float overscan = 1.F, const string& desc = "", float zoomLevel = 1, Int32 fsindex = -1); friend ostream& operator<<(ostream& os, const VideoMode& vm) @@ -408,7 +408,7 @@ class FrameBuffer /** This method is called to create a surface with the given attributes. -z + @param w The requested width of the new surface. @param h The requested height of the new surface. @param interpolation Interpolation mode @@ -499,10 +499,6 @@ z class VideoModeList { public: - VideoModeList(); - VideoModeList(const VideoModeList&) = default; - VideoModeList& operator=(const VideoModeList&) = default; - void add(const FrameBuffer::VideoMode& mode); void clear(); @@ -525,7 +521,7 @@ z private: vector myModeList; - int myIdx; + int myIdx{-1}; }; protected: @@ -533,7 +529,7 @@ z string myScreenTitle; // Number of displays - int myNumDisplays; + int myNumDisplays{1}; // The resolution of the attached displays in fullscreen mode // The primary display is typically the first in the array @@ -545,10 +541,10 @@ z void drawFrameStats(float framesPerSecond); // Indicates the number of times the framebuffer was initialized - uInt32 myInitializedCount; + uInt32 myInitializedCount{0}; // Used to set intervals between messages while in pause mode - Int32 myPausedCount; + Int32 myPausedCount{0}; // Dimensions of the actual image, after zooming, and taking into account // any image 'centering' @@ -592,33 +588,29 @@ z // (scanline count and framerate) struct Message { string text; - int counter; - int x, y, w, h; - MessagePosition position; - ColorId color; + int counter{-1}; + int x{0}, y{0}, w{0}, h{0}; + MessagePosition position{MessagePosition::BottomCenter}; + ColorId color{kNone}; shared_ptr surface; - bool enabled; - - Message() - : counter(-1), x(0), y(0), w(0), h(0), position(MessagePosition::BottomCenter), - color(kNone), enabled(false) { } + bool enabled{false}; }; Message myMsg; Message myStatsMsg; - bool myStatsEnabled; - uInt32 myLastScanlines; + bool myStatsEnabled{false}; + uInt32 myLastScanlines{0}; - bool myGrabMouse; - bool myHiDPIAllowed; - bool myHiDPIEnabled; + bool myGrabMouse{false}; + bool myHiDPIAllowed{false}; + bool myHiDPIEnabled{false}; // The list of all available video modes for this framebuffer - VideoModeList* myCurrentModeList; + VideoModeList* myCurrentModeList{nullptr}; VideoModeList myWindowedModeList; vector myFullscreenModeLists; // Maximum TIA zoom level that can be used for this framebuffer - float myTIAMaxZoom; + float myTIAMaxZoom{1.F}; // Holds a reference to all the surfaces that have been created vector> mySurfaceList; diff --git a/src/emucore/M6502.cxx b/src/emucore/M6502.cxx index e75f5bbff..3efc9eceb 100644 --- a/src/emucore/M6502.cxx +++ b/src/emucore/M6502.cxx @@ -53,36 +53,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - M6502::M6502(const Settings& settings) - : myExecutionStatus(0), - mySystem(nullptr), - mySettings(settings), - A(0), X(0), Y(0), SP(0), IR(0), PC(0), - N(false), V(false), B(false), D(false), I(false), notZ(false), C(false), - icycles(0), - myNumberOfDistinctAccesses(0), - myLastAddress(0), - myLastBreakCycle(ULLONG_MAX), - myLastPeekAddress(0), - myLastPokeAddress(0), - myLastPeekBaseAddress(0), - myLastPokeBaseAddress(0), - myFlags(DISASM_NONE), - myLastSrcAddressS(-1), - myLastSrcAddressA(-1), - myLastSrcAddressX(-1), - myLastSrcAddressY(-1), - myDataAddressForPoke(0), - myOnHaltCallback(nullptr), - myHaltRequested(false), - myGhostReadsTrap(false), - myReadFromWritePortBreak(false), - myWriteToReadPortBreak(false), - myStepStateByInstruction(false) + : mySettings(settings) { -#ifdef DEBUGGER_SUPPORT - myDebugger = nullptr; - myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false; -#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/M6502.hxx b/src/emucore/M6502.hxx index 06472adcc..1fc6cb375 100644 --- a/src/emucore/M6502.hxx +++ b/src/emucore/M6502.hxx @@ -336,68 +336,68 @@ class M6502 : public Serializable MaskableInterruptBit = 0x04, NonmaskableInterruptBit = 0x08 ; - uInt8 myExecutionStatus; + uInt8 myExecutionStatus{0}; /// Pointer to the system the processor is installed in or the null pointer - System* mySystem; + System* mySystem{nullptr}; /// Reference to the settings const Settings& mySettings; - uInt8 A; // Accumulator - uInt8 X; // X index register - uInt8 Y; // Y index register - uInt8 SP; // Stack Pointer - uInt8 IR; // Instruction register - uInt16 PC; // Program Counter + uInt8 A{0}; // Accumulator + uInt8 X{0}; // X index register + uInt8 Y{0}; // Y index register + uInt8 SP{0}; // Stack Pointer + uInt8 IR{0}; // Instruction register + uInt16 PC{0}; // Program Counter - bool N; // N flag for processor status register - bool V; // V flag for processor status register - bool B; // B flag for processor status register - bool D; // D flag for processor status register - bool I; // I flag for processor status register - bool notZ; // Z flag complement for processor status register - bool C; // C flag for processor status register + bool N{false}; // N flag for processor status register + bool V{false}; // V flag for processor status register + bool B{false}; // B flag for processor status register + bool D{false}; // D flag for processor status register + bool I{false}; // I flag for processor status register + bool notZ{false}; // Z flag complement for processor status register + bool C{false}; // C flag for processor status register - uInt8 icycles; // cycles of last instruction + uInt8 icycles{0}; // cycles of last instruction /// Indicates the numer of distinct memory accesses - uInt32 myNumberOfDistinctAccesses; + uInt32 myNumberOfDistinctAccesses{0}; /// Indicates the last address which was accessed - uInt16 myLastAddress; + uInt16 myLastAddress{0}; /// Last cycle that triggered a breakpoint - uInt64 myLastBreakCycle; + uInt64 myLastBreakCycle{ULLONG_MAX}; /// Indicates the last address which was accessed specifically /// by a peek or poke command - uInt16 myLastPeekAddress, myLastPokeAddress; + uInt16 myLastPeekAddress{0}, myLastPokeAddress{0}; /// Indicates the last base (= non-mirrored) address which was /// accessed specifically by a peek or poke command - uInt16 myLastPeekBaseAddress, myLastPokeBaseAddress; + uInt16 myLastPeekBaseAddress{0}, myLastPokeBaseAddress{0}; // Indicates the type of the last access - uInt8 myFlags; + uInt8 myFlags{0}; /// Indicates the last address used to access data by a peek command /// for the CPU registers (S/A/X/Y) - Int32 myLastSrcAddressS, myLastSrcAddressA, - myLastSrcAddressX, myLastSrcAddressY; + Int32 myLastSrcAddressS{-1}, myLastSrcAddressA{-1}, + myLastSrcAddressX{-1}, myLastSrcAddressY{-1}; /// Indicates the data address used by the last command that performed /// a poke (currently, the last address used by STx) /// If an address wasn't used (ie, as in immediate mode), the address /// is set to zero - uInt16 myDataAddressForPoke; + uInt16 myDataAddressForPoke{0}; /// Indicates the number of system cycles per processor cycle static constexpr uInt32 SYSTEM_CYCLES_PER_CPU = 1; /// Called when the processor enters halt state - onHaltCallback myOnHaltCallback; + onHaltCallback myOnHaltCallback{nullptr}; /// Indicates whether RDY was pulled low - bool myHaltRequested; + bool myHaltRequested{false}; #ifdef DEBUGGER_SUPPORT Int32 evalCondBreaks() { @@ -427,19 +427,17 @@ class M6502 : public Serializable } /// Pointer to the debugger for this processor or the null pointer - Debugger* myDebugger; + Debugger* myDebugger{nullptr}; // Addresses for which the specified action should occur TrapArray myReadTraps, myWriteTraps; // Did we just now hit a trap? - bool myJustHitReadTrapFlag; - bool myJustHitWriteTrapFlag; + bool myJustHitReadTrapFlag{false}; + bool myJustHitWriteTrapFlag{false}; struct HitTrapInfo { string message; - int address; - - HitTrapInfo() : message(""), address(0) { } + int address{0}; }; HitTrapInfo myHitTrapInfo; @@ -452,10 +450,10 @@ class M6502 : public Serializable StringList myTrapCondNames; #endif // DEBUGGER_SUPPORT - bool myGhostReadsTrap; // trap on ghost reads - bool myReadFromWritePortBreak; // trap on reads from write ports - bool myWriteToReadPortBreak; // trap on writes to read ports - bool myStepStateByInstruction; + bool myGhostReadsTrap{false}; // trap on ghost reads + bool myReadFromWritePortBreak{false}; // trap on reads from write ports + bool myWriteToReadPortBreak{false}; // trap on writes to read ports + bool myStepStateByInstruction{false}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index 70a575e7e..e9984122b 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -70,15 +70,8 @@ using namespace std::chrono; -namespace { - constexpr uInt32 FPS_METER_QUEUE_SIZE = 100; -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OSystem::OSystem() - : myLauncherUsed(false), - myQuitLoop(false), - myFpsMeter(FPS_METER_QUEUE_SIZE) { // Get built-in features #ifdef SOUND_SUPPORT diff --git a/src/emucore/OSystem.hxx b/src/emucore/OSystem.hxx index e9ad20362..8ed018715 100644 --- a/src/emucore/OSystem.hxx +++ b/src/emucore/OSystem.hxx @@ -502,10 +502,10 @@ class OSystem unique_ptr myTimerManager; // Indicates whether ROM launcher was ever opened during this run - bool myLauncherUsed; + bool myLauncherUsed{false}; // Indicates whether to stop the main loop - bool myQuitLoop; + bool myQuitLoop{false}; private: string myBaseDir; @@ -527,7 +527,8 @@ class OSystem string myFeatures; string myBuildInfo; - FpsMeter myFpsMeter; + static constexpr uInt32 FPS_METER_QUEUE_SIZE = 100; + FpsMeter myFpsMeter{FPS_METER_QUEUE_SIZE}; // If not empty, a hint for derived classes to use this as the // base directory (where all settings are stored) diff --git a/src/emucore/System.cxx b/src/emucore/System.cxx index 46e238d9e..10130a615 100644 --- a/src/emucore/System.cxx +++ b/src/emucore/System.cxx @@ -33,11 +33,7 @@ System::System(Random& random, M6502& m6502, M6532& m6532, myM6502(m6502), myM6532(m6532), myTIA(mTIA), - myCart(mCart), - myCycles(0), - myDataBusState(0), - myDataBusLocked(false), - mySystemInAutodetect(false) + myCart(mCart) { // Initialize page access table PageAccess access(&myNullDevice, System::PageAccessType::READ); diff --git a/src/emucore/System.hxx b/src/emucore/System.hxx index 63c314385..8a23a8647 100644 --- a/src/emucore/System.hxx +++ b/src/emucore/System.hxx @@ -260,7 +260,7 @@ class System : public Serializable to this page, while other values are the base address of an array to directly access for reads to this page. */ - uInt8* directPeekBase; + uInt8* directPeekBase{nullptr}; /** Pointer to a block of memory or the null pointer. The null pointer @@ -268,7 +268,7 @@ class System : public Serializable to this page, while other values are the base address of an array to directly access for pokes to this page. */ - uInt8* directPokeBase; + uInt8* directPokeBase{nullptr}; /** Pointer to a lookup table for marking an address as CODE. A CODE @@ -277,34 +277,23 @@ class System : public Serializable conclusively determine if a section of address space is CODE, even if the disassembler failed to mark it as such. */ - uInt8* codeAccessBase; + uInt8* codeAccessBase{nullptr}; /** Pointer to the device associated with this page or to the system's null device if the page hasn't been mapped to a device. */ - Device* device; + Device* device{nullptr}; /** The manner in which the pages are accessed by the system (READ, WRITE, READWRITE) */ - PageAccessType type; + PageAccessType type{PageAccessType::READ}; // Constructors - PageAccess() - : directPeekBase(nullptr), - directPokeBase(nullptr), - codeAccessBase(nullptr), - device(nullptr), - type(System::PageAccessType::READ) { } - - PageAccess(Device* dev, PageAccessType access) - : directPeekBase(nullptr), - directPokeBase(nullptr), - codeAccessBase(nullptr), - device(dev), - type(access) { } + PageAccess() = default; + PageAccess(Device* dev, PageAccessType access) : device(dev), type(access) { } }; /** @@ -393,7 +382,7 @@ class System : public Serializable Cartridge& myCart; // Number of system cycles executed since last reset - uInt64 myCycles; + uInt64 myCycles{0}; // Null device to use for page which are not installed NullDevice myNullDevice; @@ -405,17 +394,17 @@ class System : public Serializable std::array myPageIsDirtyTable; // The current state of the Data Bus - uInt8 myDataBusState; + uInt8 myDataBusState{0}; // Whether or not peek() updates the data bus state. This // is true during normal emulation, and false when the // debugger is active. - bool myDataBusLocked; + bool myDataBusLocked{false}; // Whether autodetection is currently running (ie, the emulation // core is attempting to autodetect display settings, cart modes, etc) // Some parts of the codebase need to act differently in such a case - bool mySystemInAutodetect; + bool mySystemInAutodetect{false}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/tia/Audio.cxx b/src/emucore/tia/Audio.cxx index 84b53295b..fc52584b9 100644 --- a/src/emucore/tia/Audio.cxx +++ b/src/emucore/tia/Audio.cxx @@ -32,11 +32,8 @@ namespace { } } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Audio::Audio() - : myAudioQueue(nullptr), - myCurrentFragment(nullptr) { for (uInt8 i = 0; i <= 0x1e; ++i) myMixingTableSum[i] = mixingTableEntry(i, 0x1e); for (uInt8 i = 0; i <= 0x0f; ++i) myMixingTableIndividual[i] = mixingTableEntry(i, 0x0f); diff --git a/src/emucore/tia/Audio.hxx b/src/emucore/tia/Audio.hxx index 7901dff86..bce5777f6 100644 --- a/src/emucore/tia/Audio.hxx +++ b/src/emucore/tia/Audio.hxx @@ -51,7 +51,7 @@ class Audio : public Serializable private: shared_ptr myAudioQueue; - uInt8 myCounter; + uInt8 myCounter{0}; AudioChannel myChannel0; AudioChannel myChannel1; @@ -59,8 +59,8 @@ class Audio : public Serializable std::array myMixingTableSum; std::array myMixingTableIndividual; - Int16* myCurrentFragment; - uInt32 mySampleIndex; + Int16* myCurrentFragment{nullptr}; + uInt32 mySampleIndex{0}; private: Audio(const Audio&) = delete; diff --git a/src/emucore/tia/Background.cxx b/src/emucore/tia/Background.cxx index b8f72a3ce..f8ad82543 100644 --- a/src/emucore/tia/Background.cxx +++ b/src/emucore/tia/Background.cxx @@ -18,13 +18,6 @@ #include "Background.hxx" #include "TIA.hxx" -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Background::Background() - : myTIA(nullptr) -{ - reset(); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Background::reset() { diff --git a/src/emucore/tia/Background.hxx b/src/emucore/tia/Background.hxx index 1c19e7192..58311e4d9 100644 --- a/src/emucore/tia/Background.hxx +++ b/src/emucore/tia/Background.hxx @@ -26,7 +26,7 @@ class TIA; class Background : public Serializable { public: - Background(); + Background() = default; public: void setTIA(TIA* tia) { myTIA = tia; } @@ -51,11 +51,11 @@ class Background : public Serializable void applyColors(); private: - uInt8 myColor; - uInt8 myObjectColor, myDebugColor; - bool myDebugEnabled; + uInt8 myColor{0}; + uInt8 myObjectColor{0}, myDebugColor{0}; + bool myDebugEnabled{false}; - TIA* myTIA; + TIA* myTIA{nullptr}; private: Background(const Background&) = delete; diff --git a/src/emucore/tia/DelayQueue.hxx b/src/emucore/tia/DelayQueue.hxx index 063e7c0d9..d7d470e30 100644 --- a/src/emucore/tia/DelayQueue.hxx +++ b/src/emucore/tia/DelayQueue.hxx @@ -51,7 +51,7 @@ class DelayQueue : public Serializable private: std::array, length> myMembers; - uInt8 myIndex; + uInt8 myIndex{0}; std::array myIndices; private: @@ -68,7 +68,6 @@ class DelayQueue : public Serializable // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - template DelayQueue::DelayQueue() - : myIndex(0) { myIndices.fill(0xFF); } diff --git a/src/emucore/tia/DelayQueueMember.hxx b/src/emucore/tia/DelayQueueMember.hxx index 700133182..a95e77746 100644 --- a/src/emucore/tia/DelayQueueMember.hxx +++ b/src/emucore/tia/DelayQueueMember.hxx @@ -26,10 +26,8 @@ class DelayQueueMember : public Serializable { public: struct Entry { - uInt8 address; - uInt8 value; - - Entry() : address(0), value(0) { } + uInt8 address{0}; + uInt8 value{0}; }; public: @@ -50,7 +48,7 @@ class DelayQueueMember : public Serializable { public: std::array myEntries; - uInt8 mySize; + uInt8 mySize{0}; private: DelayQueueMember(const DelayQueueMember&) = delete; @@ -67,7 +65,6 @@ class DelayQueueMember : public Serializable { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - template DelayQueueMember::DelayQueueMember() - : mySize(0) { } diff --git a/src/emucore/tia/frame-manager/AbstractFrameManager.cxx b/src/emucore/tia/frame-manager/AbstractFrameManager.cxx index 9f322173c..179fadcd9 100644 --- a/src/emucore/tia/frame-manager/AbstractFrameManager.cxx +++ b/src/emucore/tia/frame-manager/AbstractFrameManager.cxx @@ -18,13 +18,7 @@ #include "AbstractFrameManager.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -AbstractFrameManager::AbstractFrameManager() : - myIsRendering(false), - myVsync(false), - myVblank(false), - myLayout(FrameLayout::pal), - myOnFrameStart(nullptr), - myOnFrameComplete(nullptr) +AbstractFrameManager::AbstractFrameManager() { layout(FrameLayout::ntsc); } diff --git a/src/emucore/tia/frame-manager/AbstractFrameManager.hxx b/src/emucore/tia/frame-manager/AbstractFrameManager.hxx index 9804f0603..ece296639 100644 --- a/src/emucore/tia/frame-manager/AbstractFrameManager.hxx +++ b/src/emucore/tia/frame-manager/AbstractFrameManager.hxx @@ -244,50 +244,50 @@ class AbstractFrameManager : public Serializable /** * Rendering flag. */ - bool myIsRendering; + bool myIsRendering{false}; /** * Vsync flag. */ - bool myVsync; + bool myVsync{false}; /** * Vblank flag. */ - bool myVblank; + bool myVblank{false}; /** * Current scanline count in the current frame. */ - uInt32 myCurrentFrameTotalLines; + uInt32 myCurrentFrameTotalLines{0}; /** * Total number of scanlines in the last complete frame. */ - uInt32 myCurrentFrameFinalLines; + uInt32 myCurrentFrameFinalLines{0}; /** * Total number of scanlines in the second last complete frame. */ - uInt32 myPreviousFrameFinalLines; + uInt32 myPreviousFrameFinalLines{0}; /** * Total frame count. */ - uInt32 myTotalFrames; + uInt32 myTotalFrames{0}; private: /** * Current frame layout. */ - FrameLayout myLayout; + FrameLayout myLayout{FrameLayout::pal}; /** * The various lifecycle callbacks. */ - callback myOnFrameStart; - callback myOnFrameComplete; + callback myOnFrameStart{nullptr}; + callback myOnFrameComplete{nullptr}; private: diff --git a/src/emucore/tia/frame-manager/FrameLayoutDetector.cxx b/src/emucore/tia/frame-manager/FrameLayoutDetector.cxx index c5855c837..985772359 100644 --- a/src/emucore/tia/frame-manager/FrameLayoutDetector.cxx +++ b/src/emucore/tia/frame-manager/FrameLayoutDetector.cxx @@ -44,10 +44,6 @@ FrameLayout FrameLayoutDetector::detectedLayout() const{ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FrameLayoutDetector::FrameLayoutDetector() - : myState(State::waitForVsyncStart), - myNtscFrames(0), - myPalFrames(0), - myLinesWaitingForVsyncToStart(0) { reset(); } diff --git a/src/emucore/tia/frame-manager/FrameLayoutDetector.hxx b/src/emucore/tia/frame-manager/FrameLayoutDetector.hxx index 32ec9003c..30c87d70f 100644 --- a/src/emucore/tia/frame-manager/FrameLayoutDetector.hxx +++ b/src/emucore/tia/frame-manager/FrameLayoutDetector.hxx @@ -85,18 +85,18 @@ class FrameLayoutDetector: public AbstractFrameManager { /** * The current state. */ - State myState; + State myState{State::waitForVsyncStart}; /** * The total number of frames detected as the respective frame layout. */ - uInt32 myNtscFrames, myPalFrames; + uInt32 myNtscFrames{0}, myPalFrames{0}; /** * We count the number of scanlines we spend waiting for vsync to be * toggled. If a threshold is exceeded, we force the transition. */ - uInt32 myLinesWaitingForVsyncToStart; + uInt32 myLinesWaitingForVsyncToStart{0}; private: diff --git a/src/emucore/tia/frame-manager/FrameManager.cxx b/src/emucore/tia/frame-manager/FrameManager.cxx index cc3b9fafe..74b5f0ab7 100644 --- a/src/emucore/tia/frame-manager/FrameManager.cxx +++ b/src/emucore/tia/frame-manager/FrameManager.cxx @@ -38,18 +38,6 @@ enum Metrics: uInt32 { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FrameManager::FrameManager() - : myState(State::waitForVsyncStart), - myLineInState(0), - myVsyncLines(0), - myY(0), myLastY(0), - myVblankLines(0), - myKernelLines(0), - myOverscanLines(0), - myFrameLines(0), - myHeight(0), - myYStart(0), - myVcenter(0), - myJitterEnabled(false) { reset(); updateYStart(); diff --git a/src/emucore/tia/frame-manager/FrameManager.hxx b/src/emucore/tia/frame-manager/FrameManager.hxx index b737fa9b5..d6acc9f44 100644 --- a/src/emucore/tia/frame-manager/FrameManager.hxx +++ b/src/emucore/tia/frame-manager/FrameManager.hxx @@ -83,20 +83,20 @@ class FrameManager: public AbstractFrameManager { private: - State myState; - uInt32 myLineInState; - uInt32 myVsyncLines; - uInt32 myY, myLastY; + State myState{State::waitForVsyncStart}; + uInt32 myLineInState{0}; + uInt32 myVsyncLines{0}; + uInt32 myY{0}, myLastY{0}; - uInt32 myVblankLines; - uInt32 myKernelLines; - uInt32 myOverscanLines; - uInt32 myFrameLines; - uInt32 myHeight; - uInt32 myYStart; - Int32 myVcenter; + uInt32 myVblankLines{0}; + uInt32 myKernelLines{0}; + uInt32 myOverscanLines{0}; + uInt32 myFrameLines{0}; + uInt32 myHeight{0}; + uInt32 myYStart{0}; + Int32 myVcenter{0}; - bool myJitterEnabled; + bool myJitterEnabled{false}; JitterEmulation myJitterEmulation; diff --git a/src/emucore/tia/frame-manager/JitterEmulation.cxx b/src/emucore/tia/frame-manager/JitterEmulation.cxx index 9f2ffb666..8330bfc76 100644 --- a/src/emucore/tia/frame-manager/JitterEmulation.cxx +++ b/src/emucore/tia/frame-manager/JitterEmulation.cxx @@ -26,8 +26,6 @@ enum Metrics: uInt32 { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JitterEmulation::JitterEmulation() - : myJitterFactor(0), - myYStart(0) { reset(); } diff --git a/src/emucore/tia/frame-manager/JitterEmulation.hxx b/src/emucore/tia/frame-manager/JitterEmulation.hxx index 965ca4e17..cdff19df2 100644 --- a/src/emucore/tia/frame-manager/JitterEmulation.hxx +++ b/src/emucore/tia/frame-manager/JitterEmulation.hxx @@ -54,21 +54,21 @@ class JitterEmulation: public Serializable { private: - uInt32 myLastFrameScanlines; + uInt32 myLastFrameScanlines{0}; - Int32 myStableFrameFinalLines; + Int32 myStableFrameFinalLines{-1}; - uInt32 myStableFrames; + uInt32 myStableFrames{0}; - uInt32 myStabilizationCounter; + uInt32 myStabilizationCounter{0}; - uInt32 myDestabilizationCounter; + uInt32 myDestabilizationCounter{0}; - Int32 myJitter; + Int32 myJitter{0}; - Int32 myJitterFactor; + Int32 myJitterFactor{0}; - uInt32 myYStart; + uInt32 myYStart{0}; private: diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 745a190ab..d9576bbac 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -49,23 +49,8 @@ Dialog::Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font const string& title, int x, int y, int w, int h) : GuiObject(instance, parent, *this, x, y, w, h), _font(font), - _mouseWidget(nullptr), - _focusedWidget(nullptr), - _dragWidget(nullptr), - _defaultWidget(nullptr), - _okWidget(nullptr), - _cancelWidget(nullptr), - _visible(false), - _onTop(true), - _processCancel(false), _title(title), - _th(0), - _layer(0), - _surface(nullptr), - _tabID(0), - _flags(Widget::FLAG_ENABLED | Widget::FLAG_BORDER | Widget::FLAG_CLEARBG), - _max_w(0), - _max_h(0) + _flags(Widget::FLAG_ENABLED | Widget::FLAG_BORDER | Widget::FLAG_CLEARBG) { setTitle(title); } diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx index 8b07ab325..8094c1821 100644 --- a/src/gui/Dialog.hxx +++ b/src/gui/Dialog.hxx @@ -176,25 +176,25 @@ class Dialog : public GuiObject protected: const GUI::Font& _font; - Widget* _mouseWidget; - Widget* _focusedWidget; - Widget* _dragWidget; - Widget* _defaultWidget; - Widget* _okWidget; - Widget* _cancelWidget; + Widget* _mouseWidget{nullptr}; + Widget* _focusedWidget{nullptr}; + Widget* _dragWidget{nullptr}; + Widget* _defaultWidget{nullptr}; + Widget* _okWidget{nullptr}; + Widget* _cancelWidget{nullptr}; - bool _visible; - bool _onTop; - bool _processCancel; + bool _visible{false}; + bool _onTop{true}; + bool _processCancel{false}; string _title; - int _th; - int _layer; + int _th{0}; + int _layer{0}; Common::FixedStack> mySurfaceStack; private: struct Focus { - Widget* widget; + Widget* widget{nullptr}; WidgetArray list; explicit Focus(Widget* w = nullptr) : widget(w) { } @@ -206,11 +206,11 @@ class Dialog : public GuiObject using FocusList = vector; struct TabFocus { - TabWidget* widget; + TabWidget* widget{nullptr}; FocusList focus; - uInt32 currentTab; + uInt32 currentTab{0}; - explicit TabFocus(TabWidget* w = nullptr) : widget(w), currentTab(0) { } + explicit TabFocus(TabWidget* w = nullptr) : widget(w) { } virtual ~TabFocus() = default; TabFocus(const TabFocus&) = default; @@ -228,11 +228,11 @@ class Dialog : public GuiObject WidgetArray _buttonGroup; shared_ptr _surface; - int _tabID; - int _flags; - bool _dirty; - uInt32 _max_w; // maximum wanted width - uInt32 _max_h; // maximum wanted height + int _tabID{0}; + int _flags{0}; + bool _dirty{false}; + uInt32 _max_w{0}; // maximum wanted width + uInt32 _max_h{0}; // maximum wanted height private: // Following constructors and assignment operators not supported diff --git a/src/gui/RadioButtonWidget.hxx b/src/gui/RadioButtonWidget.hxx index e6c23ccb9..462d42692 100644 --- a/src/gui/RadioButtonWidget.hxx +++ b/src/gui/RadioButtonWidget.hxx @@ -56,7 +56,7 @@ class RadioButtonWidget : public CheckboxWidget class RadioButtonGroup { public: - RadioButtonGroup() : mySelected(0) { } + RadioButtonGroup() = default; // add widget to group void addWidget(RadioButtonWidget* widget); @@ -67,7 +67,7 @@ class RadioButtonGroup private: WidgetArray myWidgets; - uInt32 mySelected; + uInt32 mySelected{0}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx index f9f68495a..63a3bcc74 100644 --- a/src/gui/Widget.hxx +++ b/src/gui/Widget.hxx @@ -247,8 +247,8 @@ class ButtonWidget : public StaticTextWidget, public CommandSender void drawWidget(bool hilite) override; protected: - int _cmd; - bool _repeat; // button repeats + int _cmd{0}; + bool _repeat{false}; // button repeats bool _useBitmap; const uInt32* _bitmap; int _bmw, _bmh; diff --git a/src/unix/FSNodePOSIX.cxx b/src/unix/FSNodePOSIX.cxx index 6d4334701..3e965edf3 100644 --- a/src/unix/FSNodePOSIX.cxx +++ b/src/unix/FSNodePOSIX.cxx @@ -26,18 +26,12 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FilesystemNodePOSIX::FilesystemNodePOSIX() : _path(ROOT_DIR), - _displayName(_path), - _isValid(true), - _isFile(false), - _isDirectory(true) + _displayName(_path) { } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FilesystemNodePOSIX::FilesystemNodePOSIX(const string& path, bool verify) - : _isValid(true), - _isFile(false), - _isDirectory(true) { // Default to home directory _path = path.length() > 0 ? path : "~"; diff --git a/src/unix/FSNodePOSIX.hxx b/src/unix/FSNodePOSIX.hxx index b65eda523..371ca6ab7 100644 --- a/src/unix/FSNodePOSIX.hxx +++ b/src/unix/FSNodePOSIX.hxx @@ -79,9 +79,9 @@ class FilesystemNodePOSIX : public AbstractFSNode protected: string _path; string _displayName; - bool _isValid; - bool _isFile; - bool _isDirectory; + bool _isValid{true}; + bool _isFile{false}; + bool _isDirectory{true}; private: /** diff --git a/src/unix/SerialPortUNIX.cxx b/src/unix/SerialPortUNIX.cxx index f38b41e4c..5173722c9 100644 --- a/src/unix/SerialPortUNIX.cxx +++ b/src/unix/SerialPortUNIX.cxx @@ -28,8 +28,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SerialPortUNIX::SerialPortUNIX() - : SerialPort(), - myHandle(0) + : SerialPort() { } diff --git a/src/unix/SerialPortUNIX.hxx b/src/unix/SerialPortUNIX.hxx index 551c2a15d..2a51ff8e9 100644 --- a/src/unix/SerialPortUNIX.hxx +++ b/src/unix/SerialPortUNIX.hxx @@ -50,7 +50,7 @@ class SerialPortUNIX : public SerialPort private: // File descriptor for serial connection - int myHandle; + int myHandle{0}; private: // Following constructors and assignment operators not supported