summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/network/packet.cpp18
-rw-r--r--src/network/room.cpp19
-rw-r--r--src/web_service/announce_room_json.cpp8
-rw-r--r--src/web_service/announce_room_json.h4
-rw-r--r--src/yuzu/multiplayer/lobby_p.h6
-rw-r--r--src/yuzu/multiplayer/state.cpp8
6 files changed, 32 insertions, 31 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;
diff --git a/src/web_service/announce_room_json.cpp b/src/web_service/announce_room_json.cpp
index 32249f28e..984a59f77 100644
--- a/src/web_service/announce_room_json.cpp
+++ b/src/web_service/announce_room_json.cpp
@@ -11,7 +11,7 @@
namespace AnnounceMultiplayerRoom {
-void to_json(nlohmann::json& json, const Room::Member& member) {
+static void to_json(nlohmann::json& json, const Room::Member& member) {
if (!member.username.empty()) {
json["username"] = member.username;
}
@@ -23,7 +23,7 @@ void to_json(nlohmann::json& json, const Room::Member& member) {
json["gameId"] = member.game_id;
}
-void from_json(const nlohmann::json& json, Room::Member& member) {
+static void from_json(const nlohmann::json& json, Room::Member& member) {
member.nickname = json.at("nickname").get<std::string>();
member.game_name = json.at("gameName").get<std::string>();
member.game_id = json.at("gameId").get<u64>();
@@ -36,7 +36,7 @@ void from_json(const nlohmann::json& json, Room::Member& member) {
}
}
-void to_json(nlohmann::json& json, const Room& room) {
+static void to_json(nlohmann::json& json, const Room& room) {
json["port"] = room.port;
json["name"] = room.name;
if (!room.description.empty()) {
@@ -53,7 +53,7 @@ void to_json(nlohmann::json& json, const Room& room) {
}
}
-void from_json(const nlohmann::json& json, Room& room) {
+static void from_json(const nlohmann::json& json, Room& room) {
room.verify_UID = json.at("externalGuid").get<std::string>();
room.ip = json.at("address").get<std::string>();
room.name = json.at("name").get<std::string>();
diff --git a/src/web_service/announce_room_json.h b/src/web_service/announce_room_json.h
index ac02af5b1..f65c93214 100644
--- a/src/web_service/announce_room_json.h
+++ b/src/web_service/announce_room_json.h
@@ -17,8 +17,8 @@ namespace WebService {
*/
class RoomJson : public AnnounceMultiplayerRoom::Backend {
public:
- RoomJson(const std::string& host, const std::string& username, const std::string& token)
- : client(host, username, token), host(host), username(username), token(token) {}
+ RoomJson(const std::string& host_, const std::string& username_, const std::string& token_)
+ : client(host_, username_, token_), host(host_), username(username_), token(token_) {}
~RoomJson() = default;
void SetRoomInformation(const std::string& name, const std::string& description, const u16 port,
const u32 max_player, const u32 net_version, const bool has_password,
diff --git a/src/yuzu/multiplayer/lobby_p.h b/src/yuzu/multiplayer/lobby_p.h
index 749ca627f..afb8b99dc 100644
--- a/src/yuzu/multiplayer/lobby_p.h
+++ b/src/yuzu/multiplayer/lobby_p.h
@@ -148,9 +148,9 @@ class LobbyMember {
public:
LobbyMember() = default;
LobbyMember(const LobbyMember& other) = default;
- explicit LobbyMember(QString username, QString nickname, u64 title_id, QString game_name)
- : username(std::move(username)), nickname(std::move(nickname)), title_id(title_id),
- game_name(std::move(game_name)) {}
+ explicit LobbyMember(QString username_, QString nickname_, u64 title_id_, QString game_name_)
+ : username(std::move(username_)), nickname(std::move(nickname_)), title_id(title_id_),
+ game_name(std::move(game_name_)) {}
~LobbyMember() = default;
QString GetName() const {
diff --git a/src/yuzu/multiplayer/state.cpp b/src/yuzu/multiplayer/state.cpp
index b2aaed982..e96b03e5d 100644
--- a/src/yuzu/multiplayer/state.cpp
+++ b/src/yuzu/multiplayer/state.cpp
@@ -19,10 +19,10 @@
#include "yuzu/uisettings.h"
#include "yuzu/util/clickable_label.h"
-MultiplayerState::MultiplayerState(QWidget* parent, QStandardItemModel* game_list_model,
- QAction* leave_room, QAction* show_room)
- : QWidget(parent), game_list_model(game_list_model), leave_room(leave_room),
- show_room(show_room) {
+MultiplayerState::MultiplayerState(QWidget* parent, QStandardItemModel* game_list_model_,
+ QAction* leave_room_, QAction* show_room_)
+ : QWidget(parent), game_list_model(game_list_model_), leave_room(leave_room_),
+ show_room(show_room_) {
if (auto member = Network::GetRoomMember().lock()) {
// register the network structs to use in slots and signals
state_callback_handle = member->BindOnStateChanged(