From 259b57d9b9124fd29c3e4efd15654868477cee6e Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Sat, 13 Aug 2022 01:18:22 -0600 Subject: [PATCH] Use in-class member initializers --- include/SFML/Audio/InputSoundFile.hpp | 14 ++++++------- include/SFML/Audio/Music.hpp | 29 ++------------------------ include/SFML/Audio/Sound.hpp | 2 +- include/SFML/Audio/SoundBuffer.hpp | 2 +- include/SFML/Audio/SoundFileReader.hpp | 6 +++--- include/SFML/Audio/SoundRecorder.hpp | 14 ++++++------- include/SFML/Audio/SoundStream.hpp | 24 ++++++++++----------- src/SFML/Audio/InputSoundFile.cpp | 14 +++---------- src/SFML/Audio/Music.cpp | 10 ++------- src/SFML/Audio/OutputSoundFile.cpp | 4 +--- src/SFML/Audio/Sound.cpp | 8 +++---- src/SFML/Audio/SoundBuffer.cpp | 3 +-- src/SFML/Audio/SoundFileReaderFlac.cpp | 4 +--- src/SFML/Audio/SoundFileReaderFlac.hpp | 10 ++++----- src/SFML/Audio/SoundFileReaderMp3.cpp | 2 +- src/SFML/Audio/SoundFileReaderMp3.hpp | 8 +++---- src/SFML/Audio/SoundFileReaderOgg.cpp | 2 +- src/SFML/Audio/SoundFileReaderOgg.hpp | 4 ++-- src/SFML/Audio/SoundFileReaderWav.cpp | 4 +--- src/SFML/Audio/SoundFileReaderWav.hpp | 8 +++---- src/SFML/Audio/SoundFileWriterFlac.cpp | 4 +--- src/SFML/Audio/SoundFileWriterFlac.hpp | 6 +++--- src/SFML/Audio/SoundFileWriterOgg.cpp | 4 +--- src/SFML/Audio/SoundFileWriterOgg.hpp | 10 ++++----- src/SFML/Audio/SoundFileWriterWav.cpp | 4 +--- src/SFML/Audio/SoundRecorder.cpp | 10 +-------- src/SFML/Audio/SoundStream.cpp | 16 +------------- 27 files changed, 75 insertions(+), 151 deletions(-) diff --git a/include/SFML/Audio/InputSoundFile.hpp b/include/SFML/Audio/InputSoundFile.hpp index 8eb82c0c9..fbde269e7 100644 --- a/include/SFML/Audio/InputSoundFile.hpp +++ b/include/SFML/Audio/InputSoundFile.hpp @@ -233,18 +233,18 @@ private: void operator()(InputStream* ptr) const; - bool owned; + bool owned{true}; }; //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - std::unique_ptr m_reader; //!< Reader that handles I/O on the file's format - std::unique_ptr m_stream; //!< Input stream used to access the file's data - std::uint64_t m_sampleOffset; //!< Sample Read Position - std::uint64_t m_sampleCount; //!< Total number of samples in the file - unsigned int m_channelCount; //!< Number of channels of the sound - unsigned int m_sampleRate; //!< Number of samples per second + std::unique_ptr m_reader; //!< Reader that handles I/O on the file's format + std::unique_ptr m_stream{nullptr, false}; //!< Input stream used to access the file's data + std::uint64_t m_sampleOffset{}; //!< Sample Read Position + std::uint64_t m_sampleCount{}; //!< Total number of samples in the file + unsigned int m_channelCount{}; //!< Number of channels of the sound + unsigned int m_sampleRate{}; //!< Number of samples per second }; } // namespace sf diff --git a/include/SFML/Audio/Music.hpp b/include/SFML/Audio/Music.hpp index 99f74091b..280426948 100644 --- a/include/SFML/Audio/Music.hpp +++ b/include/SFML/Audio/Music.hpp @@ -56,38 +56,13 @@ public: template struct Span { - //////////////////////////////////////////////////////////// - /// \brief Default constructor - /// - //////////////////////////////////////////////////////////// - Span() - { - } - - //////////////////////////////////////////////////////////// - /// \brief Initialization constructor - /// - /// \param off Initial Offset - /// \param len Initial Length - /// - //////////////////////////////////////////////////////////// - Span(T off, T len) : offset(off), length(len) - { - } - - T offset; //!< The beginning offset of the time range - T length; //!< The length of the time range + T offset{}; //!< The beginning offset of the time range + T length{}; //!< The length of the time range }; // Define the relevant Span types using TimeSpan = Span