summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorFearlessTobi <thm.frey@gmail.com>2022-07-11 20:40:57 +0200
committerFearlessTobi <thm.frey@gmail.com>2022-07-25 21:59:30 +0200
commitec407bd3f1988c6f5d147307c662703c7bc94751 (patch)
tree8792652886c6b9250bea7e609b9828d9a94d3e31 /src/network
parentweb_service: Fix -Wmissing-field-initializers (diff)
downloadyuzu-ec407bd3f1988c6f5d147307c662703c7bc94751.tar
yuzu-ec407bd3f1988c6f5d147307c662703c7bc94751.tar.gz
yuzu-ec407bd3f1988c6f5d147307c662703c7bc94751.tar.bz2
yuzu-ec407bd3f1988c6f5d147307c662703c7bc94751.tar.lz
yuzu-ec407bd3f1988c6f5d147307c662703c7bc94751.tar.xz
yuzu-ec407bd3f1988c6f5d147307c662703c7bc94751.tar.zst
yuzu-ec407bd3f1988c6f5d147307c662703c7bc94751.zip
Diffstat (limited to 'src/network')
-rw-r--r--src/network/packet.cpp18
-rw-r--r--src/network/room.cpp19
2 files changed, 19 insertions, 18 deletions
diff --git a/src/network/packet.cpp b/src/network/packet.cpp
index 8fc5feabd..a3c1e1644 100644
--- a/src/network/packet.cpp
+++ b/src/network/packet.cpp
@@ -14,13 +14,13 @@
namespace Network {
#ifndef htonll
-u64 htonll(u64 x) {
+static u64 htonll(u64 x) {
return ((1 == htonl(1)) ? (x) : ((uint64_t)htonl((x)&0xFFFFFFFF) << 32) | htonl((x) >> 32));
}
#endif
#ifndef ntohll
-u64 ntohll(u64 x) {
+static u64 ntohll(u64 x) {
return ((1 == ntohl(1)) ? (x) : ((uint64_t)ntohl((x)&0xFFFFFFFF) << 32) | ntohl((x) >> 32));
}
#endif
@@ -67,7 +67,7 @@ Packet::operator bool() const {
}
Packet& Packet::operator>>(bool& out_data) {
- u8 value;
+ u8 value{};
if (*this >> value) {
out_data = (value != 0);
}
@@ -85,42 +85,42 @@ Packet& Packet::operator>>(u8& out_data) {
}
Packet& Packet::operator>>(s16& out_data) {
- s16 value;
+ s16 value{};
Read(&value, sizeof(value));
out_data = ntohs(value);
return *this;
}
Packet& Packet::operator>>(u16& out_data) {
- u16 value;
+ u16 value{};
Read(&value, sizeof(value));
out_data = ntohs(value);
return *this;
}
Packet& Packet::operator>>(s32& out_data) {
- s32 value;
+ s32 value{};
Read(&value, sizeof(value));
out_data = ntohl(value);
return *this;
}
Packet& Packet::operator>>(u32& out_data) {
- u32 value;
+ u32 value{};
Read(&value, sizeof(value));
out_data = ntohl(value);
return *this;
}
Packet& Packet::operator>>(s64& out_data) {
- s64 value;
+ s64 value{};
Read(&value, sizeof(value));
out_data = ntohll(value);
return *this;
}
Packet& Packet::operator>>(u64& out_data) {
- u64 value;
+ u64 value{};
Read(&value, sizeof(value));
out_data = ntohll(value);
return *this;
diff --git a/src/network/room.cpp b/src/network/room.cpp
index 528867146..b82a75749 100644
--- a/src/network/room.cpp
+++ b/src/network/room.cpp
@@ -877,8 +877,8 @@ void Room::RoomImpl::HandleWifiPacket(const ENetEvent* event) {
} else { // Send the data only to the destination client
std::lock_guard lock(member_mutex);
auto member = std::find_if(members.begin(), members.end(),
- [destination_address](const Member& member) -> bool {
- return member.mac_address == destination_address;
+ [destination_address](const Member& member_entry) -> bool {
+ return member_entry.mac_address == destination_address;
});
if (member != members.end()) {
enet_peer_send(member->peer, 0, enet_packet);
@@ -955,10 +955,10 @@ void Room::RoomImpl::HandleGameNamePacket(const ENetEvent* event) {
{
std::lock_guard lock(member_mutex);
- auto member =
- std::find_if(members.begin(), members.end(), [event](const Member& member) -> bool {
- return member.peer == event->peer;
- });
+ auto member = std::find_if(members.begin(), members.end(),
+ [event](const Member& member_entry) -> bool {
+ return member_entry.peer == event->peer;
+ });
if (member != members.end()) {
member->game_info = game_info;
@@ -982,9 +982,10 @@ void Room::RoomImpl::HandleClientDisconnection(ENetPeer* client) {
std::string nickname, username, ip;
{
std::lock_guard lock(member_mutex);
- auto member = std::find_if(members.begin(), members.end(), [client](const Member& member) {
- return member.peer == client;
- });
+ auto member =
+ std::find_if(members.begin(), members.end(), [client](const Member& member_entry) {
+ return member_entry.peer == client;
+ });
if (member != members.end()) {
nickname = member->nickname;
username = member->user_data.username;