From af347941237b0887722d54837eadf9edd7e5246d Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Sat, 3 Sep 2022 13:58:02 -0600 Subject: [PATCH] Replace `sf::Int8` with `std::int8_t` --- include/SFML/Config.hpp | 1 - include/SFML/Network/Packet.hpp | 8 ++++---- src/SFML/Network/Packet.cpp | 4 ++-- test/Network/Packet.cpp | 10 +++++----- test/System/Config.cpp | 1 - 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/SFML/Config.hpp b/include/SFML/Config.hpp index 7a1d0bfc..fee139b8 100644 --- a/include/SFML/Config.hpp +++ b/include/SFML/Config.hpp @@ -168,7 +168,6 @@ namespace sf { // 8 bits integer types -using Int8 = std::int8_t; using Uint8 = std::uint8_t; // 16 bits integer types diff --git a/include/SFML/Network/Packet.hpp b/include/SFML/Network/Packet.hpp index 1226f248..ba23b99d 100644 --- a/include/SFML/Network/Packet.hpp +++ b/include/SFML/Network/Packet.hpp @@ -213,7 +213,7 @@ public: //////////////////////////////////////////////////////////// /// \overload //////////////////////////////////////////////////////////// - Packet& operator>>(Int8& data); + Packet& operator>>(std::int8_t& data); //////////////////////////////////////////////////////////// /// \overload @@ -294,7 +294,7 @@ public: //////////////////////////////////////////////////////////// /// \overload //////////////////////////////////////////////////////////// - Packet& operator<<(Int8 data); + Packet& operator<<(std::int8_t data); //////////////////////////////////////////////////////////// /// \overload @@ -498,7 +498,7 @@ private: /// Packets have built-in operator >> and << overloads for /// standard types: /// \li bool -/// \li fixed-size integer types (sf::Int8/16/32, sf::Uint8/16/32) +/// \li fixed-size integer types (int[8|16|32]_t, uint[8|16|32]_t) /// \li floating point numbers (float, double) /// \li string types (char*, wchar_t*, std::string, std::wstring, sf::String) /// @@ -510,7 +510,7 @@ private: /// struct MyStruct /// { /// float number; -/// sf::Int8 integer; +/// std::int8_t integer; /// std::string str; /// }; /// diff --git a/src/SFML/Network/Packet.cpp b/src/SFML/Network/Packet.cpp index ce3dbe6f..372eb6e3 100644 --- a/src/SFML/Network/Packet.cpp +++ b/src/SFML/Network/Packet.cpp @@ -129,7 +129,7 @@ Packet& Packet::operator>>(bool& data) //////////////////////////////////////////////////////////// -Packet& Packet::operator>>(Int8& data) +Packet& Packet::operator>>(std::int8_t& data) { if (checkSize(sizeof(data))) { @@ -400,7 +400,7 @@ Packet& Packet::operator<<(bool data) //////////////////////////////////////////////////////////// -Packet& Packet::operator<<(Int8 data) +Packet& Packet::operator<<(std::int8_t data) { append(&data, sizeof(data)); return *this; diff --git a/test/Network/Packet.cpp b/test/Network/Packet.cpp index 8315c152..e8b43120 100644 --- a/test/Network/Packet.cpp +++ b/test/Network/Packet.cpp @@ -18,12 +18,12 @@ TEST_CASE("sf::Packet class - [network]") { SUBCASE("Stream operators") { - SUBCASE("Int8") + SUBCASE("std::int8_t") { - testPacketStreamOperators(sf::Int8(0)); - testPacketStreamOperators(sf::Int8(1)); - testPacketStreamOperators(std::numeric_limits::min()); - testPacketStreamOperators(std::numeric_limits::max()); + testPacketStreamOperators(std::int8_t(0)); + testPacketStreamOperators(std::int8_t(1)); + testPacketStreamOperators(std::numeric_limits::min()); + testPacketStreamOperators(std::numeric_limits::max()); } SUBCASE("Int16") diff --git a/test/System/Config.cpp b/test/System/Config.cpp index 0499dd75..482d5b92 100644 --- a/test/System/Config.cpp +++ b/test/System/Config.cpp @@ -14,7 +14,6 @@ TEST_CASE("SFML/Config.hpp") SUBCASE("Fixed width types") { - CHECK(sizeof(sf::Int8) == 1); CHECK(sizeof(sf::Uint8) == 1); CHECK(sizeof(sf::Int16) == 2);