mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-27 05:26:13 +01:00
Use more [[nodiscard]]
This commit is contained in:
1 parent
4d23a89918
commit
1a95bf0807
2 files changed
+3
-3
No files matched your search
@@ -46,7 +46,7 @@ static_assert(alignof(sfChar32) == alignof(char32_t));
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Define utils to copy from / to sfChar32 and sf::String
|
// Define utils to copy from / to sfChar32 and sf::String
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
inline sfChar32* copyToChar32(const sf::String& str)
|
[[nodiscard]] inline sfChar32* copyToChar32(const sf::String& str)
|
||||||
{
|
{
|
||||||
std::size_t byteCount = sizeof(sfChar32) * str.getSize();
|
std::size_t byteCount = sizeof(sfChar32) * str.getSize();
|
||||||
auto* utf32 = static_cast<sfChar32*>(malloc(byteCount + sizeof(sfChar32)));
|
auto* utf32 = static_cast<sfChar32*>(malloc(byteCount + sizeof(sfChar32)));
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// Helper function for converting a SFML address to a CSFML one
|
// Helper function for converting a SFML address to a CSFML one
|
||||||
sfIpAddress fromSFMLAddress(std::optional<sf::IpAddress> address)
|
[[nodiscard]] sfIpAddress fromSFMLAddress(std::optional<sf::IpAddress> address)
|
||||||
{
|
{
|
||||||
sfIpAddress result = {0};
|
sfIpAddress result = {0};
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ sfIpAddress fromSFMLAddress(std::optional<sf::IpAddress> address)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Helper function for converting a CSFML address to a SFML one
|
// Helper function for converting a CSFML address to a SFML one
|
||||||
std::optional<sf::IpAddress> toSFMLAddress(sfIpAddress address)
|
[[nodiscard]] std::optional<sf::IpAddress> toSFMLAddress(sfIpAddress address)
|
||||||
{
|
{
|
||||||
return sf::IpAddress::resolve(address.address);
|
return sf::IpAddress::resolve(address.address);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user