diff --git a/examples/vulkan/Vulkan.cpp b/examples/vulkan/Vulkan.cpp index 66c836559..c58a64224 100644 --- a/examples/vulkan/Vulkan.cpp +++ b/examples/vulkan/Vulkan.cpp @@ -188,7 +188,7 @@ GLADapiproc getVulkanFunction(const char* name) VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback( VkDebugReportFlagsEXT, VkDebugReportObjectTypeEXT, - uint64_t, + std::uint64_t, std::size_t, std::int32_t, const char*, @@ -393,7 +393,7 @@ public: { // Swapchain teardown procedure for (VkFence fence : fences) - vkWaitForFences(device, 1, &fence, VK_TRUE, std::numeric_limits::max()); + vkWaitForFences(device, 1, &fence, VK_TRUE, std::numeric_limits::max()); if (commandBuffers.size()) vkFreeCommandBuffers(device, commandPool, static_cast(commandBuffers.size()), commandBuffers.data()); @@ -2483,13 +2483,13 @@ public: std::uint32_t imageIndex = 0; // If the objects we need to submit this frame are still pending, wait here - vkWaitForFences(device, 1, &fences[currentFrame], VK_TRUE, std::numeric_limits::max()); + vkWaitForFences(device, 1, &fences[currentFrame], VK_TRUE, std::numeric_limits::max()); { // Get the next image in the swapchain VkResult result = vkAcquireNextImageKHR(device, swapchain, - std::numeric_limits::max(), + std::numeric_limits::max(), imageAvailableSemaphores[currentFrame], VK_NULL_HANDLE, &imageIndex); diff --git a/include/SFML/Audio/InputSoundFile.hpp b/include/SFML/Audio/InputSoundFile.hpp index 15e095775..54cfb563b 100644 --- a/include/SFML/Audio/InputSoundFile.hpp +++ b/include/SFML/Audio/InputSoundFile.hpp @@ -124,7 +124,7 @@ public: /// \return Number of samples /// //////////////////////////////////////////////////////////// - Uint64 getSampleCount() const; + std::uint64_t getSampleCount() const; //////////////////////////////////////////////////////////// /// \brief Get the number of channels used by the sound @@ -167,7 +167,7 @@ public: /// \return Sample position /// //////////////////////////////////////////////////////////// - Uint64 getSampleOffset() const; + std::uint64_t getSampleOffset() const; //////////////////////////////////////////////////////////// /// \brief Change the current read position to the given sample offset @@ -186,7 +186,7 @@ public: /// \param sampleOffset Index of the sample to jump to, relative to the beginning /// //////////////////////////////////////////////////////////// - void seek(Uint64 sampleOffset); + void seek(std::uint64_t sampleOffset); //////////////////////////////////////////////////////////// /// \brief Change the current read position to the given time offset @@ -211,7 +211,7 @@ public: /// \return Number of samples actually read (may be less than \a maxCount) /// //////////////////////////////////////////////////////////// - [[nodiscard]] Uint64 read(std::int16_t* samples, Uint64 maxCount); + [[nodiscard]] std::uint64_t read(std::int16_t* samples, std::uint64_t maxCount); //////////////////////////////////////////////////////////// /// \brief Close the current file @@ -242,8 +242,8 @@ private: //////////////////////////////////////////////////////////// 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 - Uint64 m_sampleOffset; //!< Sample Read Position - Uint64 m_sampleCount; //!< Total number of samples in the file + 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 }; @@ -280,7 +280,7 @@ private: /// /// // Read and process batches of samples until the end of file is reached /// std::int16_t samples[1024]; -/// sf::Uint64 count; +/// std::uint64_t count; /// do /// { /// count = file.read(samples, 1024); diff --git a/include/SFML/Audio/Music.hpp b/include/SFML/Audio/Music.hpp index 76b57da1d..64acd6c37 100644 --- a/include/SFML/Audio/Music.hpp +++ b/include/SFML/Audio/Music.hpp @@ -256,7 +256,7 @@ private: /// \return The number of samples elapsed at the given time /// //////////////////////////////////////////////////////////// - Uint64 timeToSamples(Time position) const; + std::uint64_t timeToSamples(Time position) const; //////////////////////////////////////////////////////////// /// \brief Helper to convert a sample position to an sf::Time @@ -266,7 +266,7 @@ private: /// \return The Time position of the given sample /// //////////////////////////////////////////////////////////// - Time samplesToTime(Uint64 samples) const; + Time samplesToTime(std::uint64_t samples) const; //////////////////////////////////////////////////////////// // Member data @@ -274,7 +274,7 @@ private: InputSoundFile m_file; //!< The streamed music file std::vector m_samples; //!< Temporary buffer of samples std::recursive_mutex m_mutex; //!< Mutex protecting the data - Span m_loopSpan; //!< Loop Range Specifier + Span m_loopSpan; //!< Loop Range Specifier }; } // namespace sf diff --git a/include/SFML/Audio/OutputSoundFile.hpp b/include/SFML/Audio/OutputSoundFile.hpp index f57b648e3..d14745577 100644 --- a/include/SFML/Audio/OutputSoundFile.hpp +++ b/include/SFML/Audio/OutputSoundFile.hpp @@ -93,7 +93,7 @@ public: /// \param count Number of samples to write /// //////////////////////////////////////////////////////////// - void write(const std::int16_t* samples, Uint64 count); + void write(const std::int16_t* samples, std::uint64_t count); //////////////////////////////////////////////////////////// /// \brief Close the current file diff --git a/include/SFML/Audio/SoundBuffer.hpp b/include/SFML/Audio/SoundBuffer.hpp index 7ac104274..882dc5520 100644 --- a/include/SFML/Audio/SoundBuffer.hpp +++ b/include/SFML/Audio/SoundBuffer.hpp @@ -134,7 +134,7 @@ public: /// //////////////////////////////////////////////////////////// [[nodiscard]] bool loadFromSamples(const std::int16_t* samples, - Uint64 sampleCount, + std::uint64_t sampleCount, unsigned int channelCount, unsigned int sampleRate); @@ -178,7 +178,7 @@ public: /// \see getSamples /// //////////////////////////////////////////////////////////// - Uint64 getSampleCount() const; + std::uint64_t getSampleCount() const; //////////////////////////////////////////////////////////// /// \brief Get the sample rate of the sound diff --git a/include/SFML/Audio/SoundFileReader.hpp b/include/SFML/Audio/SoundFileReader.hpp index dafd2a3db..2882aaa43 100644 --- a/include/SFML/Audio/SoundFileReader.hpp +++ b/include/SFML/Audio/SoundFileReader.hpp @@ -30,6 +30,8 @@ //////////////////////////////////////////////////////////// #include +#include + namespace sf { @@ -48,9 +50,9 @@ public: //////////////////////////////////////////////////////////// struct Info { - Uint64 sampleCount; //!< Total number of samples in the file - unsigned int channelCount; //!< Number of channels of the sound - unsigned int sampleRate; //!< Samples rate of the sound, in samples per second + std::uint64_t sampleCount; //!< Total number of samples in the file + unsigned int channelCount; //!< Number of channels of the sound + unsigned int sampleRate; //!< Samples rate of the sound, in samples per second }; //////////////////////////////////////////////////////////// @@ -89,7 +91,7 @@ public: /// \param sampleOffset Index of the sample to jump to, relative to the beginning /// //////////////////////////////////////////////////////////// - virtual void seek(Uint64 sampleOffset) = 0; + virtual void seek(std::uint64_t sampleOffset) = 0; //////////////////////////////////////////////////////////// /// \brief Read audio samples from the open file @@ -100,7 +102,7 @@ public: /// \return Number of samples actually read (may be less than \a maxCount) /// //////////////////////////////////////////////////////////// - [[nodiscard]] virtual Uint64 read(std::int16_t* samples, Uint64 maxCount) = 0; + [[nodiscard]] virtual std::uint64_t read(std::int16_t* samples, std::uint64_t maxCount) = 0; }; } // namespace sf @@ -143,13 +145,13 @@ public: /// // return true on success /// } /// -/// void seek(sf::Uint64 sampleOffset) override +/// void seek(std::uint64_t sampleOffset) override /// { /// // advance to the sampleOffset-th sample from the beginning of the /// sound /// } /// -/// sf::Uint64 read(std::int16_t* samples, sf::Uint64 maxCount) override +/// std::uint64_t read(std::int16_t* samples, std::uint64_t maxCount) override /// { /// // read up to 'maxCount' samples into the 'samples' array, /// // convert them (for example from normalized float) if they are not stored diff --git a/include/SFML/Audio/SoundFileWriter.hpp b/include/SFML/Audio/SoundFileWriter.hpp index c8b6c55e9..ff2ae0fa4 100644 --- a/include/SFML/Audio/SoundFileWriter.hpp +++ b/include/SFML/Audio/SoundFileWriter.hpp @@ -72,7 +72,7 @@ public: /// \param count Number of samples to write /// //////////////////////////////////////////////////////////// - virtual void write(const std::int16_t* samples, Uint64 count) = 0; + virtual void write(const std::int16_t* samples, std::uint64_t count) = 0; }; } // namespace sf @@ -115,7 +115,7 @@ public: /// // return true on success /// } /// -/// void write(const std::int16_t* samples, sf::Uint64 count) override +/// void write(const std::int16_t* samples, std::uint64_t count) override /// { /// // write 'count' samples stored at address 'samples', /// // convert them (for example to normalized float) if the format requires it diff --git a/include/SFML/Audio/SoundStream.hpp b/include/SFML/Audio/SoundStream.hpp index 24e3d9565..2c9eea72b 100644 --- a/include/SFML/Audio/SoundStream.hpp +++ b/include/SFML/Audio/SoundStream.hpp @@ -346,7 +346,7 @@ private: unsigned int m_sampleRate; //!< Frequency (samples / second) std::int32_t m_format; //!< Format of the internal sound buffers bool m_loop; //!< Loop flag (true to loop, false to play once) - Uint64 m_samplesProcessed; //!< Number of samples processed since beginning of the stream + std::uint64_t m_samplesProcessed; //!< Number of samples processed since beginning of the stream std::int64_t m_bufferSeeks[BufferCount]; //!< If buffer is an "end buffer", holds next seek position, else NoLoop. For play offset calculation. Time m_processingInterval; //!< Interval for checking and filling the internal sound buffers. }; diff --git a/include/SFML/Config.hpp b/include/SFML/Config.hpp index 39648c6fc..4f4fce024 100644 --- a/include/SFML/Config.hpp +++ b/include/SFML/Config.hpp @@ -26,12 +26,6 @@ #define SFML_CONFIG_HPP -//////////////////////////////////////////////////////////// -// Headers -//////////////////////////////////////////////////////////// -#include - - //////////////////////////////////////////////////////////// // Define the SFML version //////////////////////////////////////////////////////////// @@ -162,15 +156,4 @@ #endif -//////////////////////////////////////////////////////////// -// Define portable fixed-size types -//////////////////////////////////////////////////////////// -namespace sf -{ -// 64 bits integer types -using Uint64 = std::uint64_t; - -} // namespace sf - - #endif // SFML_CONFIG_HPP diff --git a/include/SFML/Graphics/Color.hpp b/include/SFML/Graphics/Color.hpp index 04b5f438f..46f8a0f22 100644 --- a/include/SFML/Graphics/Color.hpp +++ b/include/SFML/Graphics/Color.hpp @@ -30,6 +30,8 @@ //////////////////////////////////////////////////////////// #include +#include + namespace sf { diff --git a/include/SFML/Graphics/Font.hpp b/include/SFML/Graphics/Font.hpp index 2b90f4501..39f7a89ff 100644 --- a/include/SFML/Graphics/Font.hpp +++ b/include/SFML/Graphics/Font.hpp @@ -348,7 +348,7 @@ private: //////////////////////////////////////////////////////////// // Types //////////////////////////////////////////////////////////// - using GlyphTable = std::unordered_map; //!< Table mapping a codepoint to its glyph + using GlyphTable = std::unordered_map; //!< Table mapping a codepoint to its glyph //////////////////////////////////////////////////////////// /// \brief Structure defining a page of glyphs diff --git a/include/SFML/Graphics/RenderTarget.hpp b/include/SFML/Graphics/RenderTarget.hpp index d8515b29b..b821321b2 100644 --- a/include/SFML/Graphics/RenderTarget.hpp +++ b/include/SFML/Graphics/RenderTarget.hpp @@ -485,23 +485,23 @@ private: VertexCacheSize = 4 }; - bool enable; //!< Is the cache enabled? - bool glStatesSet; //!< Are our internal GL states set yet? - bool viewChanged; //!< Has the current view changed since last draw? - BlendMode lastBlendMode; //!< Cached blending mode - Uint64 lastTextureId; //!< Cached texture - bool texCoordsArrayEnabled; //!< Is GL_TEXTURE_COORD_ARRAY client state enabled? - bool useVertexCache; //!< Did we previously use the vertex cache? - Vertex vertexCache[VertexCacheSize]; //!< Pre-transformed vertices cache + bool enable; //!< Is the cache enabled? + bool glStatesSet; //!< Are our internal GL states set yet? + bool viewChanged; //!< Has the current view changed since last draw? + BlendMode lastBlendMode; //!< Cached blending mode + std::uint64_t lastTextureId; //!< Cached texture + bool texCoordsArrayEnabled; //!< Is GL_TEXTURE_COORD_ARRAY client state enabled? + bool useVertexCache; //!< Did we previously use the vertex cache? + Vertex vertexCache[VertexCacheSize]; //!< Pre-transformed vertices cache }; //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - View m_defaultView; //!< Default view - View m_view; //!< Current view - StatesCache m_cache; //!< Render states cache - Uint64 m_id; //!< Unique number that identifies the RenderTarget + View m_defaultView; //!< Default view + View m_view; //!< Current view + StatesCache m_cache; //!< Render states cache + std::uint64_t m_id; //!< Unique number that identifies the RenderTarget }; } // namespace sf diff --git a/include/SFML/Graphics/Text.hpp b/include/SFML/Graphics/Text.hpp index 5a3a18507..e97e34fde 100644 --- a/include/SFML/Graphics/Text.hpp +++ b/include/SFML/Graphics/Text.hpp @@ -428,20 +428,20 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - String m_string; //!< String to display - const Font* m_font; //!< Font used to display the string - unsigned int m_characterSize; //!< Base size of characters, in pixels - float m_letterSpacingFactor; //!< Spacing factor between letters - float m_lineSpacingFactor; //!< Spacing factor between lines - std::uint32_t m_style; //!< Text style (see Style enum) - Color m_fillColor; //!< Text fill color - Color m_outlineColor; //!< Text outline color - float m_outlineThickness; //!< Thickness of the text's outline - mutable VertexArray m_vertices; //!< Vertex array containing the fill geometry - mutable VertexArray m_outlineVertices; //!< Vertex array containing the outline geometry - mutable FloatRect m_bounds; //!< Bounding rectangle of the text (in local coordinates) - mutable bool m_geometryNeedUpdate; //!< Does the geometry need to be recomputed? - mutable Uint64 m_fontTextureId; //!< The font texture id + String m_string; //!< String to display + const Font* m_font; //!< Font used to display the string + unsigned int m_characterSize; //!< Base size of characters, in pixels + float m_letterSpacingFactor; //!< Spacing factor between letters + float m_lineSpacingFactor; //!< Spacing factor between lines + std::uint32_t m_style; //!< Text style (see Style enum) + Color m_fillColor; //!< Text fill color + Color m_outlineColor; //!< Text outline color + float m_outlineThickness; //!< Thickness of the text's outline + mutable VertexArray m_vertices; //!< Vertex array containing the fill geometry + mutable VertexArray m_outlineVertices; //!< Vertex array containing the outline geometry + mutable FloatRect m_bounds; //!< Bounding rectangle of the text (in local coordinates) + mutable bool m_geometryNeedUpdate; //!< Does the geometry need to be recomputed? + mutable std::uint64_t m_fontTextureId; //!< The font texture id }; } // namespace sf diff --git a/include/SFML/Graphics/Texture.hpp b/include/SFML/Graphics/Texture.hpp index 9f661834c..f26bfaa2c 100644 --- a/include/SFML/Graphics/Texture.hpp +++ b/include/SFML/Graphics/Texture.hpp @@ -611,16 +611,16 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - Vector2u m_size; //!< Public texture size - Vector2u m_actualSize; //!< Actual texture size (can be greater than public size because of padding) - unsigned int m_texture; //!< Internal texture identifier - bool m_isSmooth; //!< Status of the smooth filter - bool m_sRgb; //!< Should the texture source be converted from sRGB? - bool m_isRepeated; //!< Is the texture in repeat mode? - mutable bool m_pixelsFlipped; //!< To work around the inconsistency in Y orientation - bool m_fboAttachment; //!< Is this texture owned by a framebuffer object? - bool m_hasMipmap; //!< Has the mipmap been generated? - Uint64 m_cacheId; //!< Unique number that identifies the texture to the render target's cache + Vector2u m_size; //!< Public texture size + Vector2u m_actualSize; //!< Actual texture size (can be greater than public size because of padding) + unsigned int m_texture; //!< Internal texture identifier + bool m_isSmooth; //!< Status of the smooth filter + bool m_sRgb; //!< Should the texture source be converted from sRGB? + bool m_isRepeated; //!< Is the texture in repeat mode? + mutable bool m_pixelsFlipped; //!< To work around the inconsistency in Y orientation + bool m_fboAttachment; //!< Is this texture owned by a framebuffer object? + bool m_hasMipmap; //!< Has the mipmap been generated? + std::uint64_t m_cacheId; //!< Unique number that identifies the texture to the render target's cache }; } // namespace sf diff --git a/include/SFML/Network/Packet.hpp b/include/SFML/Network/Packet.hpp index 01ba3bef6..077f34bb6 100644 --- a/include/SFML/Network/Packet.hpp +++ b/include/SFML/Network/Packet.hpp @@ -248,7 +248,7 @@ public: //////////////////////////////////////////////////////////// /// \overload //////////////////////////////////////////////////////////// - Packet& operator>>(Uint64& data); + Packet& operator>>(std::uint64_t& data); //////////////////////////////////////////////////////////// /// \overload @@ -329,7 +329,7 @@ public: //////////////////////////////////////////////////////////// /// \overload //////////////////////////////////////////////////////////// - Packet& operator<<(Uint64 data); + Packet& operator<<(std::uint64_t data); //////////////////////////////////////////////////////////// /// \overload diff --git a/include/SFML/System/InputStream.hpp b/include/SFML/System/InputStream.hpp index c91c84f77..a2d8e0764 100644 --- a/include/SFML/System/InputStream.hpp +++ b/include/SFML/System/InputStream.hpp @@ -32,6 +32,8 @@ #include +#include + namespace sf { diff --git a/include/SFML/Window/Context.hpp b/include/SFML/Window/Context.hpp index 001ae1121..15e9b6449 100644 --- a/include/SFML/Window/Context.hpp +++ b/include/SFML/Window/Context.hpp @@ -33,6 +33,7 @@ #include #include +#include #include @@ -145,7 +146,7 @@ public: /// \return The active context's ID or 0 if no context is currently active /// //////////////////////////////////////////////////////////// - static Uint64 getActiveContextId(); + static std::uint64_t getActiveContextId(); //////////////////////////////////////////////////////////// /// \brief Construct a in-memory context diff --git a/include/SFML/Window/ContextSettings.hpp b/include/SFML/Window/ContextSettings.hpp index 5c222fa82..01c486d14 100644 --- a/include/SFML/Window/ContextSettings.hpp +++ b/include/SFML/Window/ContextSettings.hpp @@ -27,6 +27,8 @@ #include +#include + namespace sf { //////////////////////////////////////////////////////////// diff --git a/include/SFML/Window/Cursor.hpp b/include/SFML/Window/Cursor.hpp index bf0daf5c9..0db282cab 100644 --- a/include/SFML/Window/Cursor.hpp +++ b/include/SFML/Window/Cursor.hpp @@ -32,6 +32,7 @@ #include +#include #include namespace sf diff --git a/src/SFML/Audio/InputSoundFile.cpp b/src/SFML/Audio/InputSoundFile.cpp index 1d023d2b8..088911c34 100644 --- a/src/SFML/Audio/InputSoundFile.cpp +++ b/src/SFML/Audio/InputSoundFile.cpp @@ -189,7 +189,7 @@ bool InputSoundFile::openFromStream(InputStream& stream) //////////////////////////////////////////////////////////// -Uint64 InputSoundFile::getSampleCount() const +std::uint64_t InputSoundFile::getSampleCount() const { return m_sampleCount; } @@ -234,14 +234,14 @@ Time InputSoundFile::getTimeOffset() const //////////////////////////////////////////////////////////// -Uint64 InputSoundFile::getSampleOffset() const +std::uint64_t InputSoundFile::getSampleOffset() const { return m_sampleOffset; } //////////////////////////////////////////////////////////// -void InputSoundFile::seek(Uint64 sampleOffset) +void InputSoundFile::seek(std::uint64_t sampleOffset) { if (m_reader && m_channelCount != 0) { @@ -256,14 +256,14 @@ void InputSoundFile::seek(Uint64 sampleOffset) //////////////////////////////////////////////////////////// void InputSoundFile::seek(Time timeOffset) { - seek(static_cast(timeOffset.asSeconds() * static_cast(m_sampleRate)) * m_channelCount); + seek(static_cast(timeOffset.asSeconds() * static_cast(m_sampleRate)) * m_channelCount); } //////////////////////////////////////////////////////////// -Uint64 InputSoundFile::read(std::int16_t* samples, Uint64 maxCount) +std::uint64_t InputSoundFile::read(std::int16_t* samples, std::uint64_t maxCount) { - Uint64 readSamples = 0; + std::uint64_t readSamples = 0; if (m_reader && samples && maxCount) readSamples = m_reader->read(samples, maxCount); m_sampleOffset += readSamples; diff --git a/src/SFML/Audio/Music.cpp b/src/SFML/Audio/Music.cpp index f3d0d5f95..821d332c5 100644 --- a/src/SFML/Audio/Music.cpp +++ b/src/SFML/Audio/Music.cpp @@ -123,7 +123,7 @@ Music::TimeSpan Music::getLoopPoints() const //////////////////////////////////////////////////////////// void Music::setLoopPoints(TimeSpan timePoints) { - Span samplePoints(timeToSamples(timePoints.offset), timeToSamples(timePoints.length)); + Span samplePoints(timeToSamples(timePoints.offset), timeToSamples(timePoints.length)); // Check our state. This averts a divide-by-zero. GetChannelCount() is cheap enough to use often if (getChannelCount() == 0 || m_file.getSampleCount() == 0) @@ -184,9 +184,9 @@ bool Music::onGetData(SoundStream::Chunk& data) { std::scoped_lock lock(m_mutex); - std::size_t toFill = m_samples.size(); - Uint64 currentOffset = m_file.getSampleOffset(); - Uint64 loopEnd = m_loopSpan.offset + m_loopSpan.length; + std::size_t toFill = m_samples.size(); + std::uint64_t currentOffset = m_file.getSampleOffset(); + std::uint64_t loopEnd = m_loopSpan.offset + m_loopSpan.length; // If the loop end is enabled and imminent, request less data. // This will trip an "onLoop()" call from the underlying SoundStream, @@ -218,7 +218,7 @@ std::int64_t Music::onLoop() { // Called by underlying SoundStream so we can determine where to loop. std::scoped_lock lock(m_mutex); - Uint64 currentOffset = m_file.getSampleOffset(); + std::uint64_t currentOffset = m_file.getSampleOffset(); if (getLoop() && (m_loopSpan.length != 0) && (currentOffset == m_loopSpan.offset + m_loopSpan.length)) { // Looping is enabled, and either we're at the loop end, or we're at the EOF @@ -251,18 +251,18 @@ void Music::initialize() } //////////////////////////////////////////////////////////// -Uint64 Music::timeToSamples(Time position) const +std::uint64_t Music::timeToSamples(Time position) const { // Always ROUND, no unchecked truncation, hence the addition in the numerator. // This avoids most precision errors arising from "samples => Time => samples" conversions // Original rounding calculation is ((Micros * Freq * Channels) / 1000000) + 0.5 // We refactor it to keep std::int64_t as the data type throughout the whole operation. - return ((static_cast(position.asMicroseconds()) * getSampleRate() * getChannelCount()) + 500000) / 1000000; + return ((static_cast(position.asMicroseconds()) * getSampleRate() * getChannelCount()) + 500000) / 1000000; } //////////////////////////////////////////////////////////// -Time Music::samplesToTime(Uint64 samples) const +Time Music::samplesToTime(std::uint64_t samples) const { Time position = Time::Zero; diff --git a/src/SFML/Audio/OutputSoundFile.cpp b/src/SFML/Audio/OutputSoundFile.cpp index c90a08b60..d3bab8d63 100644 --- a/src/SFML/Audio/OutputSoundFile.cpp +++ b/src/SFML/Audio/OutputSoundFile.cpp @@ -69,7 +69,7 @@ bool OutputSoundFile::openFromFile(const std::filesystem::path& filename, unsign //////////////////////////////////////////////////////////// -void OutputSoundFile::write(const std::int16_t* samples, Uint64 count) +void OutputSoundFile::write(const std::int16_t* samples, std::uint64_t count) { if (m_writer && samples && count) m_writer->write(samples, count); diff --git a/src/SFML/Audio/SoundBuffer.cpp b/src/SFML/Audio/SoundBuffer.cpp index 7c22fd0b7..e2ad96334 100644 --- a/src/SFML/Audio/SoundBuffer.cpp +++ b/src/SFML/Audio/SoundBuffer.cpp @@ -120,7 +120,10 @@ bool SoundBuffer::loadFromStream(InputStream& stream) //////////////////////////////////////////////////////////// -bool SoundBuffer::loadFromSamples(const std::int16_t* samples, Uint64 sampleCount, unsigned int channelCount, unsigned int sampleRate) +bool SoundBuffer::loadFromSamples(const std::int16_t* samples, + std::uint64_t sampleCount, + unsigned int channelCount, + unsigned int sampleRate) { if (samples && sampleCount && channelCount && sampleRate) { @@ -171,7 +174,7 @@ const std::int16_t* SoundBuffer::getSamples() const //////////////////////////////////////////////////////////// -Uint64 SoundBuffer::getSampleCount() const +std::uint64_t SoundBuffer::getSampleCount() const { return m_samples.size(); } @@ -222,9 +225,9 @@ SoundBuffer& SoundBuffer::operator=(const SoundBuffer& right) bool SoundBuffer::initialize(InputSoundFile& file) { // Retrieve the sound parameters - Uint64 sampleCount = file.getSampleCount(); - unsigned int channelCount = file.getChannelCount(); - unsigned int sampleRate = file.getSampleRate(); + std::uint64_t sampleCount = file.getSampleCount(); + unsigned int channelCount = file.getChannelCount(); + unsigned int sampleRate = file.getSampleRate(); // Read the samples from the provided file m_samples.resize(static_cast(sampleCount)); diff --git a/src/SFML/Audio/SoundFileReaderFlac.cpp b/src/SFML/Audio/SoundFileReaderFlac.cpp index 36659b329..19d50f169 100644 --- a/src/SFML/Audio/SoundFileReaderFlac.cpp +++ b/src/SFML/Audio/SoundFileReaderFlac.cpp @@ -271,7 +271,7 @@ bool SoundFileReaderFlac::open(InputStream& stream, Info& info) //////////////////////////////////////////////////////////// -void SoundFileReaderFlac::seek(Uint64 sampleOffset) +void SoundFileReaderFlac::seek(std::uint64_t sampleOffset) { assert(m_decoder); @@ -300,7 +300,7 @@ void SoundFileReaderFlac::seek(Uint64 sampleOffset) //////////////////////////////////////////////////////////// -Uint64 SoundFileReaderFlac::read(std::int16_t* samples, Uint64 maxCount) +std::uint64_t SoundFileReaderFlac::read(std::int16_t* samples, std::uint64_t maxCount) { assert(m_decoder); diff --git a/src/SFML/Audio/SoundFileReaderFlac.hpp b/src/SFML/Audio/SoundFileReaderFlac.hpp index e4d939b80..aafefd1c6 100644 --- a/src/SFML/Audio/SoundFileReaderFlac.hpp +++ b/src/SFML/Audio/SoundFileReaderFlac.hpp @@ -90,7 +90,7 @@ public: /// \param sampleOffset Index of the sample to jump to, relative to the beginning /// //////////////////////////////////////////////////////////// - void seek(Uint64 sampleOffset) override; + void seek(std::uint64_t sampleOffset) override; //////////////////////////////////////////////////////////// /// \brief Read audio samples from the open file @@ -101,7 +101,7 @@ public: /// \return Number of samples actually read (may be less than \a maxCount) /// //////////////////////////////////////////////////////////// - [[nodiscard]] Uint64 read(std::int16_t* samples, Uint64 maxCount) override; + [[nodiscard]] std::uint64_t read(std::int16_t* samples, std::uint64_t maxCount) override; public: //////////////////////////////////////////////////////////// @@ -113,7 +113,7 @@ public: InputStream* stream; SoundFileReader::Info info; std::int16_t* buffer; - Uint64 remaining; + std::uint64_t remaining; std::vector leftovers; bool error; }; diff --git a/src/SFML/Audio/SoundFileReaderMp3.cpp b/src/SFML/Audio/SoundFileReaderMp3.cpp index 9051eb016..0d44e7019 100644 --- a/src/SFML/Audio/SoundFileReaderMp3.cpp +++ b/src/SFML/Audio/SoundFileReaderMp3.cpp @@ -136,7 +136,7 @@ bool SoundFileReaderMp3::open(InputStream& stream, Info& info) //////////////////////////////////////////////////////////// -void SoundFileReaderMp3::seek(Uint64 sampleOffset) +void SoundFileReaderMp3::seek(std::uint64_t sampleOffset) { m_position = std::min(sampleOffset, m_numSamples); mp3dec_ex_seek(&m_decoder, m_position); @@ -144,10 +144,10 @@ void SoundFileReaderMp3::seek(Uint64 sampleOffset) //////////////////////////////////////////////////////////// -Uint64 SoundFileReaderMp3::read(std::int16_t* samples, Uint64 maxCount) +std::uint64_t SoundFileReaderMp3::read(std::int16_t* samples, std::uint64_t maxCount) { - Uint64 toRead = std::min(maxCount, m_numSamples - m_position); - toRead = static_cast(mp3dec_ex_read(&m_decoder, samples, static_cast(toRead))); + std::uint64_t toRead = std::min(maxCount, m_numSamples - m_position); + toRead = static_cast(mp3dec_ex_read(&m_decoder, samples, static_cast(toRead))); m_position += toRead; return toRead; } diff --git a/src/SFML/Audio/SoundFileReaderMp3.hpp b/src/SFML/Audio/SoundFileReaderMp3.hpp index e808f5766..bf687d614 100644 --- a/src/SFML/Audio/SoundFileReaderMp3.hpp +++ b/src/SFML/Audio/SoundFileReaderMp3.hpp @@ -110,7 +110,7 @@ public: /// \param sampleOffset Index of the sample to jump to, relative to the beginning /// //////////////////////////////////////////////////////////// - void seek(Uint64 sampleOffset) override; + void seek(std::uint64_t sampleOffset) override; //////////////////////////////////////////////////////////// /// \brief Read audio samples from the open file @@ -121,16 +121,16 @@ public: /// \return Number of samples actually read (may be less than \a maxCount) /// //////////////////////////////////////////////////////////// - [[nodiscard]] Uint64 read(std::int16_t* samples, Uint64 maxCount) override; + [[nodiscard]] std::uint64_t read(std::int16_t* samples, std::uint64_t maxCount) override; private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - mp3dec_io_t m_io; - mp3dec_ex_t m_decoder; - Uint64 m_numSamples; // Decompressed audio storage size - Uint64 m_position; // Position in decompressed audio buffer + mp3dec_io_t m_io; + mp3dec_ex_t m_decoder; + std::uint64_t m_numSamples; // Decompressed audio storage size + std::uint64_t m_position; // Position in decompressed audio buffer }; } // namespace priv diff --git a/src/SFML/Audio/SoundFileReaderOgg.cpp b/src/SFML/Audio/SoundFileReaderOgg.cpp index 04d9144f1..d9eec6df6 100644 --- a/src/SFML/Audio/SoundFileReaderOgg.cpp +++ b/src/SFML/Audio/SoundFileReaderOgg.cpp @@ -126,7 +126,7 @@ bool SoundFileReaderOgg::open(InputStream& stream, Info& info) //////////////////////////////////////////////////////////// -void SoundFileReaderOgg::seek(Uint64 sampleOffset) +void SoundFileReaderOgg::seek(std::uint64_t sampleOffset) { assert(m_vorbis.datasource); @@ -135,12 +135,12 @@ void SoundFileReaderOgg::seek(Uint64 sampleOffset) //////////////////////////////////////////////////////////// -Uint64 SoundFileReaderOgg::read(std::int16_t* samples, Uint64 maxCount) +std::uint64_t SoundFileReaderOgg::read(std::int16_t* samples, std::uint64_t maxCount) { assert(m_vorbis.datasource); // Try to read the requested number of samples, stop only on error or end of file - Uint64 count = 0; + std::uint64_t count = 0; while (count < maxCount) { int bytesToRead = static_cast(maxCount - count) * static_cast(sizeof(std::int16_t)); @@ -148,7 +148,7 @@ Uint64 SoundFileReaderOgg::read(std::int16_t* samples, Uint64 maxCount) if (bytesRead > 0) { long samplesRead = bytesRead / static_cast(sizeof(std::int16_t)); - count += static_cast(samplesRead); + count += static_cast(samplesRead); samples += samplesRead; } else diff --git a/src/SFML/Audio/SoundFileReaderOgg.hpp b/src/SFML/Audio/SoundFileReaderOgg.hpp index fff9a0e4c..456051618 100644 --- a/src/SFML/Audio/SoundFileReaderOgg.hpp +++ b/src/SFML/Audio/SoundFileReaderOgg.hpp @@ -91,7 +91,7 @@ public: /// \param sampleOffset Index of the sample to jump to, relative to the beginning /// //////////////////////////////////////////////////////////// - void seek(Uint64 sampleOffset) override; + void seek(std::uint64_t sampleOffset) override; //////////////////////////////////////////////////////////// /// \brief Read audio samples from the open file @@ -102,7 +102,7 @@ public: /// \return Number of samples actually read (may be less than \a maxCount) /// //////////////////////////////////////////////////////////// - [[nodiscard]] Uint64 read(std::int16_t* samples, Uint64 maxCount) override; + [[nodiscard]] std::uint64_t read(std::int16_t* samples, std::uint64_t maxCount) override; private: //////////////////////////////////////////////////////////// diff --git a/src/SFML/Audio/SoundFileReaderWav.cpp b/src/SFML/Audio/SoundFileReaderWav.cpp index 05a75b9b9..9d6b66d62 100644 --- a/src/SFML/Audio/SoundFileReaderWav.cpp +++ b/src/SFML/Audio/SoundFileReaderWav.cpp @@ -90,7 +90,7 @@ bool decode(sf::InputStream& stream, std::uint32_t& value) return true; } -const sf::Uint64 mainChunkSize = 12; +const std::uint64_t mainChunkSize = 12; const std::uint16_t waveFormatPcm = 1; @@ -139,7 +139,7 @@ bool SoundFileReaderWav::open(InputStream& stream, Info& info) //////////////////////////////////////////////////////////// -void SoundFileReaderWav::seek(Uint64 sampleOffset) +void SoundFileReaderWav::seek(std::uint64_t sampleOffset) { assert(m_stream); @@ -149,12 +149,12 @@ void SoundFileReaderWav::seek(Uint64 sampleOffset) //////////////////////////////////////////////////////////// -Uint64 SoundFileReaderWav::read(std::int16_t* samples, Uint64 maxCount) +std::uint64_t SoundFileReaderWav::read(std::int16_t* samples, std::uint64_t maxCount) { assert(m_stream); - Uint64 count = 0; - auto startPos = static_cast(m_stream->tell()); + std::uint64_t count = 0; + auto startPos = static_cast(m_stream->tell()); // Tracking of m_dataEnd is important to prevent sf::Music from reading // data until EOF, as WAV files may have metadata at the end. @@ -341,7 +341,7 @@ bool SoundFileReaderWav::parseHeader(Info& info) info.sampleCount = subChunkSize / m_bytesPerSample; // Store the start and end position of samples in the file - m_dataStart = static_cast(subChunkStart); + m_dataStart = static_cast(subChunkStart); m_dataEnd = m_dataStart + info.sampleCount * m_bytesPerSample; dataChunkFound = true; diff --git a/src/SFML/Audio/SoundFileReaderWav.hpp b/src/SFML/Audio/SoundFileReaderWav.hpp index ac8e05d04..03569dbf6 100644 --- a/src/SFML/Audio/SoundFileReaderWav.hpp +++ b/src/SFML/Audio/SoundFileReaderWav.hpp @@ -81,7 +81,7 @@ public: /// \param sampleOffset Index of the sample to jump to, relative to the beginning /// //////////////////////////////////////////////////////////// - void seek(Uint64 sampleOffset) override; + void seek(std::uint64_t sampleOffset) override; //////////////////////////////////////////////////////////// /// \brief Read audio samples from the open file @@ -92,7 +92,7 @@ public: /// \return Number of samples actually read (may be less than \a maxCount) /// //////////////////////////////////////////////////////////// - [[nodiscard]] Uint64 read(std::int16_t* samples, Uint64 maxCount) override; + [[nodiscard]] std::uint64_t read(std::int16_t* samples, std::uint64_t maxCount) override; private: //////////////////////////////////////////////////////////// @@ -108,10 +108,10 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - InputStream* m_stream; //!< Source stream to read from - unsigned int m_bytesPerSample; //!< Size of a sample, in bytes - Uint64 m_dataStart; //!< Starting position of the audio data in the open file - Uint64 m_dataEnd; //!< Position one byte past the end of the audio data in the open file + InputStream* m_stream; //!< Source stream to read from + unsigned int m_bytesPerSample; //!< Size of a sample, in bytes + std::uint64_t m_dataStart; //!< Starting position of the audio data in the open file + std::uint64_t m_dataEnd; //!< Position one byte past the end of the audio data in the open file }; } // namespace priv diff --git a/src/SFML/Audio/SoundFileWriterFlac.cpp b/src/SFML/Audio/SoundFileWriterFlac.cpp index 1571e47d3..130f2d8e5 100644 --- a/src/SFML/Audio/SoundFileWriterFlac.cpp +++ b/src/SFML/Audio/SoundFileWriterFlac.cpp @@ -93,7 +93,7 @@ bool SoundFileWriterFlac::open(const std::filesystem::path& filename, unsigned i //////////////////////////////////////////////////////////// -void SoundFileWriterFlac::write(const std::int16_t* samples, Uint64 count) +void SoundFileWriterFlac::write(const std::int16_t* samples, std::uint64_t count) { while (count > 0) { diff --git a/src/SFML/Audio/SoundFileWriterFlac.hpp b/src/SFML/Audio/SoundFileWriterFlac.hpp index 79fc0e06d..eb1a0b268 100644 --- a/src/SFML/Audio/SoundFileWriterFlac.hpp +++ b/src/SFML/Audio/SoundFileWriterFlac.hpp @@ -88,7 +88,7 @@ public: /// \param count Number of samples to write /// //////////////////////////////////////////////////////////// - void write(const std::int16_t* samples, Uint64 count) override; + void write(const std::int16_t* samples, std::uint64_t count) override; private: //////////////////////////////////////////////////////////// diff --git a/src/SFML/Audio/SoundFileWriterOgg.cpp b/src/SFML/Audio/SoundFileWriterOgg.cpp index 1294c15e8..74f07fe46 100644 --- a/src/SFML/Audio/SoundFileWriterOgg.cpp +++ b/src/SFML/Audio/SoundFileWriterOgg.cpp @@ -125,7 +125,7 @@ bool SoundFileWriterOgg::open(const std::filesystem::path& filename, unsigned in //////////////////////////////////////////////////////////// -void SoundFileWriterOgg::write(const std::int16_t* samples, Uint64 count) +void SoundFileWriterOgg::write(const std::int16_t* samples, std::uint64_t count) { // Vorbis has issues with buffers that are too large, so we ask for 64K constexpr int bufferSize = 65536; diff --git a/src/SFML/Audio/SoundFileWriterOgg.hpp b/src/SFML/Audio/SoundFileWriterOgg.hpp index 6129c6096..5ca759231 100644 --- a/src/SFML/Audio/SoundFileWriterOgg.hpp +++ b/src/SFML/Audio/SoundFileWriterOgg.hpp @@ -89,7 +89,7 @@ public: /// \param count Number of samples to write /// //////////////////////////////////////////////////////////// - void write(const std::int16_t* samples, Uint64 count) override; + void write(const std::int16_t* samples, std::uint64_t count) override; private: //////////////////////////////////////////////////////////// diff --git a/src/SFML/Audio/SoundFileWriterWav.cpp b/src/SFML/Audio/SoundFileWriterWav.cpp index e944a72bf..21d68b4aa 100644 --- a/src/SFML/Audio/SoundFileWriterWav.cpp +++ b/src/SFML/Audio/SoundFileWriterWav.cpp @@ -109,7 +109,7 @@ bool SoundFileWriterWav::open(const std::filesystem::path& filename, unsigned in //////////////////////////////////////////////////////////// -void SoundFileWriterWav::write(const std::int16_t* samples, Uint64 count) +void SoundFileWriterWav::write(const std::int16_t* samples, std::uint64_t count) { assert(m_file.good()); diff --git a/src/SFML/Audio/SoundFileWriterWav.hpp b/src/SFML/Audio/SoundFileWriterWav.hpp index ab66718c7..e496022b3 100644 --- a/src/SFML/Audio/SoundFileWriterWav.hpp +++ b/src/SFML/Audio/SoundFileWriterWav.hpp @@ -87,7 +87,7 @@ public: /// \param count Number of samples to write /// //////////////////////////////////////////////////////////// - void write(const std::int16_t* samples, Uint64 count) override; + void write(const std::int16_t* samples, std::uint64_t count) override; private: //////////////////////////////////////////////////////////// diff --git a/src/SFML/Audio/SoundStream.cpp b/src/SFML/Audio/SoundStream.cpp index 385911c45..2f2ec5630 100644 --- a/src/SFML/Audio/SoundStream.cpp +++ b/src/SFML/Audio/SoundStream.cpp @@ -218,7 +218,8 @@ void SoundStream::setPlayingOffset(Time timeOffset) onSeek(timeOffset); // Restart streaming - m_samplesProcessed = static_cast(timeOffset.asSeconds() * static_cast(m_sampleRate)) * m_channelCount; + m_samplesProcessed = static_cast(timeOffset.asSeconds() * static_cast(m_sampleRate)) * + m_channelCount; if (oldStatus == Stopped) return; @@ -354,7 +355,7 @@ void SoundStream::streamData() if (m_bufferSeeks[bufferNum] != NoLoop) { // This was the last buffer before EOF or Loop End: reset the sample count - m_samplesProcessed = static_cast(m_bufferSeeks[bufferNum]); + m_samplesProcessed = static_cast(m_bufferSeeks[bufferNum]); m_bufferSeeks[bufferNum] = NoLoop; } else @@ -377,7 +378,7 @@ void SoundStream::streamData() } else { - m_samplesProcessed += static_cast(size / (bits / 8)); + m_samplesProcessed += static_cast(size / (bits / 8)); } } @@ -449,7 +450,7 @@ bool SoundStream::fillAndPushBuffer(unsigned int bufferNum, bool immediateLoop) if (immediateLoop && (m_bufferSeeks[bufferNum] != NoLoop)) { // We just tried to begin preloading at EOF or Loop End: reset the sample count - m_samplesProcessed = static_cast(m_bufferSeeks[bufferNum]); + m_samplesProcessed = static_cast(m_bufferSeeks[bufferNum]); m_bufferSeeks[bufferNum] = NoLoop; } diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index b4f58fbdf..86f70b57a 100644 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp @@ -80,10 +80,10 @@ inline T reinterpret(const U& input) } // Combine outline thickness, boldness and font glyph index into a single 64-bit key -sf::Uint64 combine(float outlineThickness, bool bold, std::uint32_t index) +std::uint64_t combine(float outlineThickness, bool bold, std::uint32_t index) { - return (static_cast(reinterpret(outlineThickness)) << 32) | - (static_cast(bold) << 31) | index; + return (static_cast(reinterpret(outlineThickness)) << 32) | + (static_cast(bold) << 31) | index; } } // namespace @@ -357,9 +357,9 @@ const Glyph& Font::getGlyph(std::uint32_t codePoint, unsigned int characterSize, GlyphTable& glyphs = loadPage(characterSize).glyphs; // Build the key by combining the glyph index (based on code point), bold flag, and outline thickness - Uint64 key = combine(outlineThickness, - bold, - FT_Get_Char_Index(m_fontHandles ? m_fontHandles->face.get() : nullptr, codePoint)); + std::uint64_t key = combine(outlineThickness, + bold, + FT_Get_Char_Index(m_fontHandles ? m_fontHandles->face.get() : nullptr, codePoint)); // Search the glyph into the cache if (auto it = glyphs.find(key); it != glyphs.end()) diff --git a/src/SFML/Graphics/RenderTarget.cpp b/src/SFML/Graphics/RenderTarget.cpp index 59befffb9..aa72921d9 100644 --- a/src/SFML/Graphics/RenderTarget.cpp +++ b/src/SFML/Graphics/RenderTarget.cpp @@ -53,22 +53,22 @@ std::recursive_mutex mutex; // Unique identifier, used for identifying RenderTargets when // tracking the currently active RenderTarget within a given context -sf::Uint64 getUniqueId() +std::uint64_t getUniqueId() { std::scoped_lock lock(mutex); - static sf::Uint64 id = 1; // start at 1, zero is "no RenderTarget" + static std::uint64_t id = 1; // start at 1, zero is "no RenderTarget" return id++; } // Map to help us detect whether a different RenderTarget // has been activated within a single context -using ContextRenderTargetMap = std::unordered_map; +using ContextRenderTargetMap = std::unordered_map; ContextRenderTargetMap contextRenderTargetMap; // Check if a RenderTarget with the given ID is active in the current context -bool isActive(sf::Uint64 id) +bool isActive(std::uint64_t id) { auto it = contextRenderTargetMap.find(sf::Context::getActiveContextId()); @@ -397,7 +397,7 @@ bool RenderTarget::setActive(bool active) { std::scoped_lock lock(RenderTargetImpl::mutex); - Uint64 contextId = Context::getActiveContextId(); + std::uint64_t contextId = Context::getActiveContextId(); using RenderTargetImpl::contextRenderTargetMap; auto it = contextRenderTargetMap.find(contextId); @@ -709,7 +709,7 @@ void RenderTarget::setupDraw(bool useVertexCache, const RenderStates& states) } else { - Uint64 textureId = states.texture ? states.texture->m_cacheId : 0; + std::uint64_t textureId = states.texture ? states.texture->m_cacheId : 0; if (textureId != m_cache.lastTextureId) applyTexture(states.texture); } diff --git a/src/SFML/Graphics/RenderTextureImplFBO.cpp b/src/SFML/Graphics/RenderTextureImplFBO.cpp index 17df6fd19..40a528ac9 100644 --- a/src/SFML/Graphics/RenderTextureImplFBO.cpp +++ b/src/SFML/Graphics/RenderTextureImplFBO.cpp @@ -45,7 +45,7 @@ namespace // Set to track all active FBO mappings // This is used to free active FBOs while their owning // RenderTextureImplFBO is still alive -std::unordered_set*> frameBuffers; +std::unordered_set*> frameBuffers; // Set to track all stale FBOs // This is used to free stale FBOs after their owning @@ -53,7 +53,7 @@ std::unordered_set*> frameBuffers; // An FBO cannot be destroyed until it's containing context // becomes active, so the destruction of the RenderTextureImplFBO // has to be decoupled from the destruction of the FBOs themselves -std::set> staleFrameBuffers; +std::set> staleFrameBuffers; // Mutex to protect both active and stale frame buffer sets std::recursive_mutex mutex; @@ -63,7 +63,7 @@ std::recursive_mutex mutex; // might trigger deletion of its contained stale FBOs void destroyStaleFBOs() { - sf::Uint64 contextId = sf::Context::getActiveContextId(); + std::uint64_t contextId = sf::Context::getActiveContextId(); for (auto it = staleFrameBuffers.begin(); it != staleFrameBuffers.end();) { @@ -86,7 +86,7 @@ void contextDestroyCallback(void* /*arg*/) { std::scoped_lock lock(mutex); - sf::Uint64 contextId = sf::Context::getActiveContextId(); + std::uint64_t contextId = sf::Context::getActiveContextId(); // Destroy active frame buffer objects for (auto* frameBuffer : frameBuffers) @@ -552,7 +552,7 @@ bool RenderTextureImplFBO::activate(bool active) return true; } - Uint64 contextId = Context::getActiveContextId(); + std::uint64_t contextId = Context::getActiveContextId(); // In the odd case we have to activate and there is no active // context yet, we have to create one @@ -582,7 +582,7 @@ bool RenderTextureImplFBO::activate(bool active) { std::scoped_lock lock(mutex); - std::unordered_map::iterator it; + std::unordered_map::iterator it; if (m_multisample) { @@ -632,7 +632,7 @@ void RenderTextureImplFBO::updateTexture(unsigned int) // are already available within the current context if (m_multisample && m_size.x && m_size.y && activate(true)) { - Uint64 contextId = Context::getActiveContextId(); + std::uint64_t contextId = Context::getActiveContextId(); std::scoped_lock lock(mutex); diff --git a/src/SFML/Graphics/RenderTextureImplFBO.hpp b/src/SFML/Graphics/RenderTextureImplFBO.hpp index 775e47d42..6732d04d1 100644 --- a/src/SFML/Graphics/RenderTextureImplFBO.hpp +++ b/src/SFML/Graphics/RenderTextureImplFBO.hpp @@ -137,8 +137,8 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - std::unordered_map m_frameBuffers; //!< OpenGL frame buffer objects per context - std::unordered_map m_multisampleFrameBuffers; //!< Optional per-context OpenGL frame buffer objects with multisample attachments + std::unordered_map m_frameBuffers; //!< OpenGL frame buffer objects per context + std::unordered_map m_multisampleFrameBuffers; //!< Optional per-context OpenGL frame buffer objects with multisample attachments unsigned int m_depthStencilBuffer; //!< Optional depth/stencil buffer attached to the frame buffer unsigned int m_colorBuffer; //!< Optional multisample color buffer attached to the frame buffer Vector2u m_size; //!< Width and height of the attachments diff --git a/src/SFML/Graphics/Texture.cpp b/src/SFML/Graphics/Texture.cpp index 9597dda49..b6ef4a846 100644 --- a/src/SFML/Graphics/Texture.cpp +++ b/src/SFML/Graphics/Texture.cpp @@ -50,11 +50,11 @@ std::recursive_mutex maximumSizeMutex; // Thread-safe unique identifier generator, // is used for states cache (see RenderTarget) -sf::Uint64 getUniqueId() +std::uint64_t getUniqueId() { std::scoped_lock lock(idMutex); - static sf::Uint64 id = 1; // start at 1, zero is "no texture" + static std::uint64_t id = 1; // start at 1, zero is "no texture" return id++; } diff --git a/src/SFML/Network/Packet.cpp b/src/SFML/Network/Packet.cpp index d1a8bb5be..ee0c61843 100644 --- a/src/SFML/Network/Packet.cpp +++ b/src/SFML/Network/Packet.cpp @@ -233,7 +233,7 @@ Packet& Packet::operator>>(std::int64_t& data) //////////////////////////////////////////////////////////// -Packet& Packet::operator>>(Uint64& data) +Packet& Packet::operator>>(std::uint64_t& data) { if (checkSize(sizeof(data))) { @@ -242,10 +242,10 @@ Packet& Packet::operator>>(Uint64& data) std::uint8_t bytes[sizeof(data)]; std::memcpy(bytes, &m_data[m_readPos], sizeof(data)); - data = (static_cast(bytes[0]) << 56) | (static_cast(bytes[1]) << 48) | - (static_cast(bytes[2]) << 40) | (static_cast(bytes[3]) << 32) | - (static_cast(bytes[4]) << 24) | (static_cast(bytes[5]) << 16) | - (static_cast(bytes[6]) << 8) | (static_cast(bytes[7])); + data = (static_cast(bytes[0]) << 56) | (static_cast(bytes[1]) << 48) | + (static_cast(bytes[2]) << 40) | (static_cast(bytes[3]) << 32) | + (static_cast(bytes[4]) << 24) | (static_cast(bytes[5]) << 16) | + (static_cast(bytes[6]) << 8) | (static_cast(bytes[7])); m_readPos += sizeof(data); } @@ -472,7 +472,7 @@ Packet& Packet::operator<<(std::int64_t data) //////////////////////////////////////////////////////////// -Packet& Packet::operator<<(Uint64 data) +Packet& Packet::operator<<(std::uint64_t data) { // Since htonll is not available everywhere, we have to convert // to network byte order (big endian) manually diff --git a/src/SFML/Network/Unix/SocketImpl.hpp b/src/SFML/Network/Unix/SocketImpl.hpp index 636aded28..3e510f3c1 100644 --- a/src/SFML/Network/Unix/SocketImpl.hpp +++ b/src/SFML/Network/Unix/SocketImpl.hpp @@ -31,6 +31,7 @@ #include #include +#include #include #include #include diff --git a/src/SFML/Network/Win32/SocketImpl.hpp b/src/SFML/Network/Win32/SocketImpl.hpp index 37144ae02..86fb90153 100644 --- a/src/SFML/Network/Win32/SocketImpl.hpp +++ b/src/SFML/Network/Win32/SocketImpl.hpp @@ -31,6 +31,7 @@ #include #include +#include #include #include diff --git a/src/SFML/Window/Context.cpp b/src/SFML/Window/Context.cpp index 99edf7792..de6309286 100644 --- a/src/SFML/Window/Context.cpp +++ b/src/SFML/Window/Context.cpp @@ -97,7 +97,7 @@ const Context* Context::getActiveContext() //////////////////////////////////////////////////////////// -Uint64 Context::getActiveContextId() +std::uint64_t Context::getActiveContextId() { return priv::GlContext::getActiveContextId(); } diff --git a/src/SFML/Window/GlContext.cpp b/src/SFML/Window/GlContext.cpp index 31a868458..3ea3d63c8 100644 --- a/src/SFML/Window/GlContext.cpp +++ b/src/SFML/Window/GlContext.cpp @@ -180,7 +180,7 @@ thread_local sf::priv::GlContext* currentContext(nullptr); std::unique_ptr sharedContext; // Unique identifier, used for identifying contexts when managing unshareable OpenGL resources -sf::Uint64 id = 1; // start at 1, zero is "no context" +std::uint64_t id = 1; // start at 1, zero is "no context" // Set containing callback functions to be called whenever a // context is going to be destroyed @@ -601,7 +601,7 @@ const GlContext* GlContext::getActiveContext() //////////////////////////////////////////////////////////// -Uint64 GlContext::getActiveContextId() +std::uint64_t GlContext::getActiveContextId() { using GlContextImpl::currentContext; return currentContext ? currentContext->m_id : 0; diff --git a/src/SFML/Window/GlContext.hpp b/src/SFML/Window/GlContext.hpp index d376d9ede..adcfe89a3 100644 --- a/src/SFML/Window/GlContext.hpp +++ b/src/SFML/Window/GlContext.hpp @@ -34,6 +34,7 @@ #include #include +#include #include @@ -174,7 +175,7 @@ public: /// \return The active context's ID or 0 if no context is currently active /// //////////////////////////////////////////////////////////// - static Uint64 getActiveContextId(); + static std::uint64_t getActiveContextId(); //////////////////////////////////////////////////////////// /// \brief Destructor @@ -319,7 +320,7 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - const Uint64 m_id; //!< Unique number that identifies the context + const std::uint64_t m_id; //!< Unique number that identifies the context }; } // namespace priv diff --git a/src/SFML/Window/OSX/NSImage+raw.h b/src/SFML/Window/OSX/NSImage+raw.h index f9a759263..07d6e395f 100644 --- a/src/SFML/Window/OSX/NSImage+raw.h +++ b/src/SFML/Window/OSX/NSImage+raw.h @@ -29,6 +29,7 @@ #include #import +#include //////////////////////////////////////////////////////////// /// Extends NSImage with a convenience method to load images diff --git a/src/SFML/Window/OSX/WindowImplDelegateProtocol.h b/src/SFML/Window/OSX/WindowImplDelegateProtocol.h index a4a0541e2..fe93f56c8 100644 --- a/src/SFML/Window/OSX/WindowImplDelegateProtocol.h +++ b/src/SFML/Window/OSX/WindowImplDelegateProtocol.h @@ -31,6 +31,7 @@ #include #import +#include #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" diff --git a/test/System/Config.cpp b/test/System/Config.cpp index 61c1df28b..4f6089c87 100644 --- a/test/System/Config.cpp +++ b/test/System/Config.cpp @@ -11,9 +11,4 @@ TEST_CASE("SFML/Config.hpp") CHECK(SFML_VERSION_PATCH == EXPECTED_SFML_VERSION_PATCH); CHECK(SFML_VERSION_IS_RELEASE == EXPECTED_SFML_VERSION_IS_RELEASE); } - - SUBCASE("Fixed width types") - { - CHECK(sizeof(sf::Uint64) == 8); - } }