Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace C++ int types with SFML ones #2576

Merged
merged 1 commit into from Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SFML/Network/IpAddress.cpp
Expand Up @@ -69,7 +69,7 @@ m_valid (false)

////////////////////////////////////////////////////////////
IpAddress::IpAddress(Uint8 byte0, Uint8 byte1, Uint8 byte2, Uint8 byte3) :
m_address(htonl(static_cast<uint32_t>((byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3))),
m_address(htonl(static_cast<Uint32>((byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3))),
m_valid (true)
{
}
Expand Down
8 changes: 4 additions & 4 deletions src/SFML/Network/Packet.cpp
Expand Up @@ -150,7 +150,7 @@ Packet& Packet::operator >>(Int16& data)
if (checkSize(sizeof(data)))
{
std::memcpy(&data, &m_data[m_readPos], sizeof(data));
data = static_cast<Int16>(ntohs(static_cast<uint16_t>(data)));
data = static_cast<Int16>(ntohs(static_cast<Uint16>(data)));
m_readPos += sizeof(data);
}

Expand Down Expand Up @@ -178,7 +178,7 @@ Packet& Packet::operator >>(Int32& data)
if (checkSize(sizeof(data)))
{
std::memcpy(&data, &m_data[m_readPos], sizeof(data));
data = static_cast<Int32>(ntohl(static_cast<uint32_t>(data)));
data = static_cast<Int32>(ntohl(static_cast<Uint32>(data)));
m_readPos += sizeof(data);
}

Expand Down Expand Up @@ -412,7 +412,7 @@ Packet& Packet::operator <<(Uint8 data)
////////////////////////////////////////////////////////////
Packet& Packet::operator <<(Int16 data)
{
Int16 toWrite = static_cast<Int16>(htons(static_cast<uint16_t>(data)));
Int16 toWrite = static_cast<Int16>(htons(static_cast<Uint16>(data)));
append(&toWrite, sizeof(toWrite));
return *this;
}
Expand All @@ -430,7 +430,7 @@ Packet& Packet::operator <<(Uint16 data)
////////////////////////////////////////////////////////////
Packet& Packet::operator <<(Int32 data)
{
Int32 toWrite = static_cast<Int32>(htonl(static_cast<uint32_t>(data)));
Int32 toWrite = static_cast<Int32>(htonl(static_cast<Uint32>(data)));
append(&toWrite, sizeof(toWrite));
return *this;
}
Expand Down