citra-emu
/
citra
Archived
1
0
Fork 0

Merge pull request #5393 from lioncash/signed

nwm: Eliminate signed conversion warnings
This commit is contained in:
Pengfei Zhu 2020-06-07 22:52:18 +08:00 committed by GitHub
commit dbd1a389ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -1314,23 +1314,23 @@ void NWM_UDS::DecryptBeaconData(Kernel::HLERequestContext& ctx, u16 command_id)
// TODO(Subv): Verify the MD5 hash of the data and return 0xE1211005 if invalid. // TODO(Subv): Verify the MD5 hash of the data and return 0xE1211005 if invalid.
u8 num_nodes = net_info.max_nodes; const std::size_t num_nodes = net_info.max_nodes;
std::vector<NodeInfo> nodes; std::vector<NodeInfo> nodes;
nodes.reserve(num_nodes);
for (int i = 0; i < num_nodes; ++i) { for (std::size_t i = 0; i < num_nodes; ++i) {
BeaconNodeInfo info; BeaconNodeInfo info;
std::memcpy(&info, beacon_data.data() + sizeof(beacon_header) + i * sizeof(info), std::memcpy(&info, beacon_data.data() + sizeof(beacon_header) + i * sizeof(info),
sizeof(info)); sizeof(info));
// Deserialize the node information. // Deserialize the node information.
NodeInfo node{}; auto& node = nodes.emplace_back();
node.friend_code_seed = info.friend_code_seed; node.friend_code_seed = info.friend_code_seed;
node.network_node_id = info.network_node_id; node.network_node_id = info.network_node_id;
for (int i = 0; i < info.username.size(); ++i) for (std::size_t i = 0; i < info.username.size(); ++i) {
node.username[i] = info.username[i]; node.username[i] = info.username[i];
}
nodes.push_back(node);
} }
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2); IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);

View File

@ -197,8 +197,9 @@ std::vector<u8> GeneratedEncryptedData(const NetworkInfo& network_info, const No
BeaconNodeInfo info{}; BeaconNodeInfo info{};
info.friend_code_seed = node.friend_code_seed; info.friend_code_seed = node.friend_code_seed;
info.network_node_id = node.network_node_id; info.network_node_id = node.network_node_id;
for (int i = 0; i < info.username.size(); ++i) for (std::size_t i = 0; i < info.username.size(); ++i) {
info.username[i] = node.username[i]; info.username[i] = node.username[i];
}
buffer.insert(buffer.end(), reinterpret_cast<u8*>(&info), buffer.insert(buffer.end(), reinterpret_cast<u8*>(&info),
reinterpret_cast<u8*>(&info) + sizeof(info)); reinterpret_cast<u8*>(&info) + sizeof(info));