From 368ff9dace1f9ca97f8a6660f3ae3ecf6b22b7d6 Mon Sep 17 00:00:00 2001 From: vittorioromeo Date: Sat, 3 Feb 2024 22:05:48 +0100 Subject: [PATCH] Header include clean-up and minor refactoring --- include/SFML/Audio/InputSoundFile.hpp | 1 + include/SFML/Audio/Music.hpp | 2 ++ include/SFML/Audio/SoundRecorder.hpp | 3 +++ include/SFML/Audio/SoundStream.hpp | 3 ++- src/SFML/Audio/InputSoundFile.cpp | 2 +- src/SFML/Graphics/GLCheck.cpp | 1 + src/SFML/Graphics/GLCheck.hpp | 2 -- src/SFML/Graphics/RenderTarget.cpp | 1 + src/SFML/Graphics/RenderTextureImplDefault.cpp | 1 + src/SFML/Graphics/RenderTextureImplFBO.cpp | 1 + src/SFML/Graphics/RenderWindow.cpp | 1 + src/SFML/Graphics/Shader.cpp | 1 + src/SFML/Graphics/Texture.cpp | 1 + src/SFML/Graphics/TextureSaver.cpp | 1 + src/SFML/Graphics/VertexBuffer.cpp | 1 + src/SFML/Network/Ftp.cpp | 12 +++--------- 16 files changed, 21 insertions(+), 13 deletions(-) diff --git a/include/SFML/Audio/InputSoundFile.hpp b/include/SFML/Audio/InputSoundFile.hpp index 72c295783..615d6bb97 100644 --- a/include/SFML/Audio/InputSoundFile.hpp +++ b/include/SFML/Audio/InputSoundFile.hpp @@ -35,6 +35,7 @@ #include #include +#include namespace sf diff --git a/include/SFML/Audio/Music.hpp b/include/SFML/Audio/Music.hpp index 178d529fc..b294aa286 100644 --- a/include/SFML/Audio/Music.hpp +++ b/include/SFML/Audio/Music.hpp @@ -35,6 +35,8 @@ #include #include +#include + namespace sf { diff --git a/include/SFML/Audio/SoundRecorder.hpp b/include/SFML/Audio/SoundRecorder.hpp index e142cf242..8abf11e30 100644 --- a/include/SFML/Audio/SoundRecorder.hpp +++ b/include/SFML/Audio/SoundRecorder.hpp @@ -37,6 +37,9 @@ #include #include +#include +#include + namespace sf { diff --git a/include/SFML/Audio/SoundStream.hpp b/include/SFML/Audio/SoundStream.hpp index 4a72a8f32..e39c73cfb 100644 --- a/include/SFML/Audio/SoundStream.hpp +++ b/include/SFML/Audio/SoundStream.hpp @@ -36,7 +36,8 @@ #include #include -#include +#include +#include namespace sf diff --git a/src/SFML/Audio/InputSoundFile.cpp b/src/SFML/Audio/InputSoundFile.cpp index 28ea65df7..5f621c2fb 100644 --- a/src/SFML/Audio/InputSoundFile.cpp +++ b/src/SFML/Audio/InputSoundFile.cpp @@ -58,7 +58,7 @@ InputSoundFile::StreamDeleter::StreamDeleter(const std::default_delete&) void InputSoundFile::StreamDeleter::operator()(InputStream* ptr) const { if (owned) - std::default_delete{}(ptr); + delete ptr; } diff --git a/src/SFML/Graphics/GLCheck.cpp b/src/SFML/Graphics/GLCheck.cpp index 20b7f67b9..7a181959c 100644 --- a/src/SFML/Graphics/GLCheck.cpp +++ b/src/SFML/Graphics/GLCheck.cpp @@ -26,6 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include +#include #include diff --git a/src/SFML/Graphics/GLCheck.hpp b/src/SFML/Graphics/GLCheck.hpp index 7f3c70590..eb1e0366e 100644 --- a/src/SFML/Graphics/GLCheck.hpp +++ b/src/SFML/Graphics/GLCheck.hpp @@ -29,8 +29,6 @@ //////////////////////////////////////////////////////////// #include -#include - #include #include diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp index c29da82ee..2fd383ebe 100644 --- a/src/SFML/Graphics/RenderTarget.cpp +++ b/src/SFML/Graphics/RenderTarget.cpp @@ -27,6 +27,7 @@ //////////////////////////////////////////////////////////// #include #include +#include #include #include #include diff --git a/src/SFML/Graphics/RenderTextureImplDefault.cpp b/src/SFML/Graphics/RenderTextureImplDefault.cpp index b3723518f..f8c6b6f49 100644 --- a/src/SFML/Graphics/RenderTextureImplDefault.cpp +++ b/src/SFML/Graphics/RenderTextureImplDefault.cpp @@ -26,6 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include +#include #include #include diff --git a/src/SFML/Graphics/RenderTextureImplFBO.cpp b/src/SFML/Graphics/RenderTextureImplFBO.cpp index e1d172b5d..3fa27a610 100644 --- a/src/SFML/Graphics/RenderTextureImplFBO.cpp +++ b/src/SFML/Graphics/RenderTextureImplFBO.cpp @@ -26,6 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include +#include #include #include diff --git a/src/SFML/Graphics/RenderWindow.cpp b/src/SFML/Graphics/RenderWindow.cpp index ffdbe9667..6321ea515 100644 --- a/src/SFML/Graphics/RenderWindow.cpp +++ b/src/SFML/Graphics/RenderWindow.cpp @@ -26,6 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include +#include #include #include #include diff --git a/src/SFML/Graphics/Shader.cpp b/src/SFML/Graphics/Shader.cpp index 0bd41157c..7d57bc3ea 100644 --- a/src/SFML/Graphics/Shader.cpp +++ b/src/SFML/Graphics/Shader.cpp @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////// #include #include +#include #include #include #include diff --git a/src/SFML/Graphics/Texture.cpp b/src/SFML/Graphics/Texture.cpp index c51e6aa8a..1edaa9a2a 100644 --- a/src/SFML/Graphics/Texture.cpp +++ b/src/SFML/Graphics/Texture.cpp @@ -26,6 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include +#include #include #include #include diff --git a/src/SFML/Graphics/TextureSaver.cpp b/src/SFML/Graphics/TextureSaver.cpp index 99c38c185..c47a18105 100644 --- a/src/SFML/Graphics/TextureSaver.cpp +++ b/src/SFML/Graphics/TextureSaver.cpp @@ -25,6 +25,7 @@ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// +#include #include diff --git a/src/SFML/Graphics/VertexBuffer.cpp b/src/SFML/Graphics/VertexBuffer.cpp index 81f0ed168..e5d58c648 100644 --- a/src/SFML/Graphics/VertexBuffer.cpp +++ b/src/SFML/Graphics/VertexBuffer.cpp @@ -26,6 +26,7 @@ // Headers //////////////////////////////////////////////////////////// #include +#include #include #include #include diff --git a/src/SFML/Network/Ftp.cpp b/src/SFML/Network/Ftp.cpp index 5c0909a86..435ea50e6 100644 --- a/src/SFML/Network/Ftp.cpp +++ b/src/SFML/Network/Ftp.cpp @@ -30,15 +30,13 @@ #include -#include #include -#include #include #include #include -#include -#include +#include +#include namespace sf @@ -357,11 +355,7 @@ Ftp::Response Ftp::upload(const std::filesystem::path& localFile, Ftp::Response Ftp::sendCommand(const std::string& command, const std::string& parameter) { // Build the command string - std::string commandStr; - if (!parameter.empty()) - commandStr = command + " " + parameter + "\r\n"; - else - commandStr = command + "\r\n"; + const std::string commandStr = parameter.empty() ? command + "\r\n" : command + " " + parameter + "\r\n"; // Send it to the server if (m_commandSocket.send(commandStr.c_str(), commandStr.length()) != Socket::Status::Done)