Use more [[nodiscard]]

This commit is contained in:
Chris Thrasher committed 2024-09-03 14:45:19 -06:00
1 parent 4d23a89918
commit 1a95bf0807
2 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -46,7 +46,7 @@ static_assert(alignof(sfChar32) == alignof(char32_t));
////////////////////////////////////////////////////////////
// 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();
auto* utf32 = static_cast<sfChar32*>(malloc(byteCount + sizeof(sfChar32)));
+2 -2
View File
@@ -35,7 +35,7 @@
namespace
{
// 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};
@@ -48,7 +48,7 @@ sfIpAddress fromSFMLAddress(std::optional<sf::IpAddress> address)
}
// 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);
}