sockets_translate: Make use of designated initializers

Same behavior, less typing.
This commit is contained in:
Lioncash 2020-09-07 00:53:08 -04:00
parent 188a3cf74c
commit 180fa6859f
1 changed files with 12 additions and 12 deletions

View File

@ -131,21 +131,21 @@ u16 TranslatePollEventsToGuest(u16 flags) {
Network::SockAddrIn Translate(SockAddrIn value) { Network::SockAddrIn Translate(SockAddrIn value) {
ASSERT(value.len == 0 || value.len == sizeof(value)); ASSERT(value.len == 0 || value.len == sizeof(value));
Network::SockAddrIn result; return {
result.family = Translate(static_cast<Domain>(value.family)); .family = Translate(static_cast<Domain>(value.family)),
result.ip = value.ip; .ip = value.ip,
result.portno = value.portno >> 8 | value.portno << 8; .portno = static_cast<u16>(value.portno >> 8 | value.portno << 8),
return result; };
} }
SockAddrIn Translate(Network::SockAddrIn value) { SockAddrIn Translate(Network::SockAddrIn value) {
SockAddrIn result; return {
result.len = sizeof(result); .len = sizeof(SockAddrIn),
result.family = static_cast<u8>(Translate(value.family)); .family = static_cast<u8>(Translate(value.family)),
result.portno = value.portno >> 8 | value.portno << 8; .portno = static_cast<u16>(value.portno >> 8 | value.portno << 8),
result.ip = value.ip; .ip = value.ip,
result.zeroes = {}; .zeroes = {},
return result; };
} }
Network::ShutdownHow Translate(ShutdownHow how) { Network::ShutdownHow Translate(ShutdownHow how) {