diff --git a/examples/event_handling/EventHandling.cpp b/examples/event_handling/EventHandling.cpp index b14d413e2..d033e38d7 100644 --- a/examples/event_handling/EventHandling.cpp +++ b/examples/event_handling/EventHandling.cpp @@ -40,7 +40,7 @@ public: // The operator()s can also have void return type if there is nothing to return. struct Visitor { - Visitor(Application& app) : application(app) + explicit Visitor(Application& app) : application(app) { } diff --git a/examples/sound_effects/SoundEffects.cpp b/examples/sound_effects/SoundEffects.cpp index e64c99514..45926f872 100644 --- a/examples/sound_effects/SoundEffects.cpp +++ b/examples/sound_effects/SoundEffects.cpp @@ -75,7 +75,7 @@ public: } protected: - Effect(std::string name) : m_name(std::move(name)) + explicit Effect(std::string name) : m_name(std::move(name)) { } @@ -665,7 +665,7 @@ public: } protected: - Processing(std::string name) : + explicit Processing(std::string name) : Effect(std::move(name)), m_enabledText(getFont(), "Processing: Enabled"), m_instructions(getFont(), "Press Space to enable/disable processing") @@ -990,7 +990,7 @@ private: class FIRFilter { public: - FIRFilter(std::vector taps) : m_taps(std::move(taps)) + explicit FIRFilter(std::vector taps) : m_taps(std::move(taps)) { } diff --git a/include/SFML/Audio/InputSoundFile.hpp b/include/SFML/Audio/InputSoundFile.hpp index d315af62d..206b0a3e1 100644 --- a/include/SFML/Audio/InputSoundFile.hpp +++ b/include/SFML/Audio/InputSoundFile.hpp @@ -76,7 +76,7 @@ public: /// \throws `sf::Exception` if opening the file was unsuccessful /// //////////////////////////////////////////////////////////// - InputSoundFile(const std::filesystem::path& filename); + explicit InputSoundFile(const std::filesystem::path& filename); //////////////////////////////////////////////////////////// /// \brief Construct a sound file in memory for reading @@ -103,7 +103,7 @@ public: /// \throws `sf::Exception` if opening the file was unsuccessful /// //////////////////////////////////////////////////////////// - InputSoundFile(InputStream& stream); + explicit InputSoundFile(InputStream& stream); //////////////////////////////////////////////////////////// /// \brief Open a sound file from the disk for reading diff --git a/include/SFML/Audio/Music.hpp b/include/SFML/Audio/Music.hpp index 9073f087e..682b3111b 100644 --- a/include/SFML/Audio/Music.hpp +++ b/include/SFML/Audio/Music.hpp @@ -93,7 +93,7 @@ public: /// \see `openFromMemory`, `openFromStream` /// //////////////////////////////////////////////////////////// - Music(const std::filesystem::path& filename); + explicit Music(const std::filesystem::path& filename); //////////////////////////////////////////////////////////// /// \brief Construct a music from an audio file in memory @@ -137,7 +137,7 @@ public: /// \see `openFromFile`, `openFromMemory` /// //////////////////////////////////////////////////////////// - Music(InputStream& stream); + explicit Music(InputStream& stream); //////////////////////////////////////////////////////////// /// \brief Destructor diff --git a/include/SFML/Audio/Sound.hpp b/include/SFML/Audio/Sound.hpp index 3deab037d..6bf7297e5 100644 --- a/include/SFML/Audio/Sound.hpp +++ b/include/SFML/Audio/Sound.hpp @@ -59,7 +59,7 @@ public: /// \brief Disallow construction from a temporary sound buffer /// //////////////////////////////////////////////////////////// - explicit Sound(const SoundBuffer&& buffer) = delete; + Sound(const SoundBuffer&& buffer) = delete; //////////////////////////////////////////////////////////// /// \brief Copy constructor diff --git a/include/SFML/Audio/SoundBuffer.hpp b/include/SFML/Audio/SoundBuffer.hpp index 870a1b5aa..f85fe763d 100644 --- a/include/SFML/Audio/SoundBuffer.hpp +++ b/include/SFML/Audio/SoundBuffer.hpp @@ -84,7 +84,7 @@ public: /// \see `loadFromMemory`, `loadFromStream`, `loadFromSamples`, `saveToFile` /// //////////////////////////////////////////////////////////// - SoundBuffer(const std::filesystem::path& filename); + explicit SoundBuffer(const std::filesystem::path& filename); //////////////////////////////////////////////////////////// /// \brief Construct the sound buffer from a file in memory @@ -115,7 +115,7 @@ public: /// \see `loadFromFile`, `loadFromMemory`, `loadFromSamples` /// //////////////////////////////////////////////////////////// - SoundBuffer(InputStream& stream); + explicit SoundBuffer(InputStream& stream); //////////////////////////////////////////////////////////// /// \brief Construct the sound buffer from an array of audio samples diff --git a/include/SFML/Graphics/Font.hpp b/include/SFML/Graphics/Font.hpp index c8a00f143..86fb0e015 100644 --- a/include/SFML/Graphics/Font.hpp +++ b/include/SFML/Graphics/Font.hpp @@ -100,7 +100,7 @@ public: /// \see `openFromFile`, `openFromMemory`, `openFromStream` /// //////////////////////////////////////////////////////////// - Font(const std::filesystem::path& filename); + explicit Font(const std::filesystem::path& filename); //////////////////////////////////////////////////////////// /// \brief Construct the font from a file in memory @@ -143,7 +143,7 @@ public: /// \see `openFromFile`, `openFromMemory`, `openFromStream` /// //////////////////////////////////////////////////////////// - Font(InputStream& stream); + explicit Font(InputStream& stream); //////////////////////////////////////////////////////////// /// \brief Open the font from a file diff --git a/include/SFML/Network/Socket.hpp b/include/SFML/Network/Socket.hpp index cd4bc5523..f96bd93b7 100644 --- a/include/SFML/Network/Socket.hpp +++ b/include/SFML/Network/Socket.hpp @@ -139,7 +139,7 @@ protected: /// \param type Type of the socket (TCP or UDP) /// //////////////////////////////////////////////////////////// - Socket(Type type); + explicit Socket(Type type); //////////////////////////////////////////////////////////// /// \brief Return the internal handle of the socket diff --git a/src/SFML/Audio/SoundRecorder.cpp b/src/SFML/Audio/SoundRecorder.cpp index da4493dce..c6c1839c3 100644 --- a/src/SFML/Audio/SoundRecorder.cpp +++ b/src/SFML/Audio/SoundRecorder.cpp @@ -45,7 +45,7 @@ namespace sf { struct SoundRecorder::Impl { - Impl(SoundRecorder* ownerPtr) : owner(ownerPtr) + explicit Impl(SoundRecorder* ownerPtr) : owner(ownerPtr) { } diff --git a/src/SFML/Audio/SoundStream.cpp b/src/SFML/Audio/SoundStream.cpp index d334ad9bc..6480a80d6 100644 --- a/src/SFML/Audio/SoundStream.cpp +++ b/src/SFML/Audio/SoundStream.cpp @@ -45,7 +45,7 @@ namespace sf { struct SoundStream::Impl : priv::MiniaudioUtils::SoundBase { - Impl(SoundStream* ownerPtr) : + explicit Impl(SoundStream* ownerPtr) : SoundBase(vtable, [](void* ptr) { static_cast(ptr)->initialize(); }), owner(ownerPtr) { diff --git a/src/SFML/Network/Ftp.cpp b/src/SFML/Network/Ftp.cpp index a0fa86ed5..28d4b38d7 100644 --- a/src/SFML/Network/Ftp.cpp +++ b/src/SFML/Network/Ftp.cpp @@ -48,7 +48,7 @@ class Ftp::DataChannel { public: //////////////////////////////////////////////////////////// - DataChannel(Ftp& owner); + explicit DataChannel(Ftp& owner); //////////////////////////////////////////////////////////// /// \brief Deleted copy constructor diff --git a/src/SFML/Window/Unix/GlxContext.cpp b/src/SFML/Window/Unix/GlxContext.cpp index 34b874827..0b234d1b9 100644 --- a/src/SFML/Window/Unix/GlxContext.cpp +++ b/src/SFML/Window/Unix/GlxContext.cpp @@ -84,7 +84,7 @@ int handleXError(::Display*, XErrorEvent*) class GlxErrorHandler { public: - GlxErrorHandler(::Display* display) : m_display(display) + explicit GlxErrorHandler(::Display* display) : m_display(display) { glxErrorOccurred = false; m_previousHandler = XSetErrorHandler(handleXError); diff --git a/src/SFML/Window/Unix/GlxContext.hpp b/src/SFML/Window/Unix/GlxContext.hpp index f112bdce8..db6dc2d14 100644 --- a/src/SFML/Window/Unix/GlxContext.hpp +++ b/src/SFML/Window/Unix/GlxContext.hpp @@ -51,7 +51,7 @@ public: /// \param shared Context to share the new one with (can be a null pointer) /// //////////////////////////////////////////////////////////// - GlxContext(GlxContext* shared); + explicit GlxContext(GlxContext* shared); //////////////////////////////////////////////////////////// /// \brief Create a new context attached to a window diff --git a/src/SFML/Window/Unix/WindowImplX11.hpp b/src/SFML/Window/Unix/WindowImplX11.hpp index 0b79f292d..a4013ece2 100644 --- a/src/SFML/Window/Unix/WindowImplX11.hpp +++ b/src/SFML/Window/Unix/WindowImplX11.hpp @@ -53,7 +53,7 @@ public: /// \param handle Platform-specific handle of the control /// //////////////////////////////////////////////////////////// - WindowImplX11(WindowHandle handle); + explicit WindowImplX11(WindowHandle handle); //////////////////////////////////////////////////////////// /// \brief Create the window implementation diff --git a/test/System/FileInputStream.test.cpp b/test/System/FileInputStream.test.cpp index dd0b2c864..acefba99e 100644 --- a/test/System/FileInputStream.test.cpp +++ b/test/System/FileInputStream.test.cpp @@ -28,7 +28,7 @@ class TemporaryFile { public: // Create a temporary file with a randomly generated path, containing 'contents'. - TemporaryFile(const std::string& contents) : m_path(getTemporaryFilePath()) + explicit TemporaryFile(const std::string& contents) : m_path(getTemporaryFilePath()) { std::ofstream ofs(m_path); assert(ofs && "Stream encountered an error");