diff --git a/src/SFML/Audio/SoundFileReaderFlac.cpp b/src/SFML/Audio/SoundFileReaderFlac.cpp index 21875adca..719012e6e 100644 --- a/src/SFML/Audio/SoundFileReaderFlac.cpp +++ b/src/SFML/Audio/SoundFileReaderFlac.cpp @@ -362,13 +362,10 @@ std::uint64_t SoundFileReaderFlac::read(std::int16_t* samples, std::uint64_t max if (left > maxCount) { // There are more leftovers than needed - std::copy(m_clientData.leftovers.begin(), - m_clientData.leftovers.begin() + static_cast::difference_type>(maxCount), - samples); - std::vector leftovers(m_clientData.leftovers.begin() + - static_cast::difference_type>(maxCount), - m_clientData.leftovers.end()); - m_clientData.leftovers.swap(leftovers); + const auto signedMaxCount = static_cast::difference_type>(maxCount); + std::copy(m_clientData.leftovers.begin(), m_clientData.leftovers.begin() + signedMaxCount, samples); + m_clientData.leftovers = std::vector(m_clientData.leftovers.begin() + signedMaxCount, + m_clientData.leftovers.end()); return maxCount; } diff --git a/src/SFML/Graphics/Image.cpp b/src/SFML/Graphics/Image.cpp index 02a989829..251aa71e1 100644 --- a/src/SFML/Graphics/Image.cpp +++ b/src/SFML/Graphics/Image.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -154,7 +155,7 @@ void Image::resize(Vector2u size, Color color) } // Commit the new pixel buffer - m_pixels.swap(newPixels); + m_pixels = std::move(newPixels); // Assign the new size m_size = size; @@ -179,7 +180,7 @@ void Image::resize(Vector2u size, const std::uint8_t* pixels) std::vector newPixels(pixels, pixels + size.x * size.y * 4); // Commit the new pixel buffer - m_pixels.swap(newPixels); + m_pixels = std::move(newPixels); // Assign the new size m_size = size;