yuzu-emu
/
yuzu
Archived
1
0
Fork 0

input_common/udp_client: Prevent unnecessary string copies

We can also remove some redundant const on the return values, since
these don't do anything
This commit is contained in:
Lioncash 2022-01-24 10:58:22 -05:00
parent 2136ebccd6
commit b084a9bf0a
2 changed files with 4 additions and 4 deletions

View File

@ -339,7 +339,7 @@ void UDPClient::StartCommunication(std::size_t client, const std::string& host,
} }
} }
const PadIdentifier UDPClient::GetPadIdentifier(std::size_t pad_index) const { PadIdentifier UDPClient::GetPadIdentifier(std::size_t pad_index) const {
const std::size_t client = pad_index / PADS_PER_CLIENT; const std::size_t client = pad_index / PADS_PER_CLIENT;
return { return {
.guid = clients[client].uuid, .guid = clients[client].uuid,
@ -348,7 +348,7 @@ const PadIdentifier UDPClient::GetPadIdentifier(std::size_t pad_index) const {
}; };
} }
const Common::UUID UDPClient::GetHostUUID(const std::string host) const { Common::UUID UDPClient::GetHostUUID(const std::string& host) const {
const auto ip = boost::asio::ip::address_v4::from_string(host); const auto ip = boost::asio::ip::address_v4::from_string(host);
const auto hex_host = fmt::format("{:06x}", ip.to_ulong()); const auto hex_host = fmt::format("{:06x}", ip.to_ulong());
return Common::UUID{hex_host}; return Common::UUID{hex_host};

View File

@ -145,8 +145,8 @@ private:
void OnPortInfo(Response::PortInfo); void OnPortInfo(Response::PortInfo);
void OnPadData(Response::PadData, std::size_t client); void OnPadData(Response::PadData, std::size_t client);
void StartCommunication(std::size_t client, const std::string& host, u16 port); void StartCommunication(std::size_t client, const std::string& host, u16 port);
const PadIdentifier GetPadIdentifier(std::size_t pad_index) const; PadIdentifier GetPadIdentifier(std::size_t pad_index) const;
const Common::UUID GetHostUUID(const std::string host) const; Common::UUID GetHostUUID(const std::string& host) const;
Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const; Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const;