From f68c3b758ebb9cb5ea2463aa195e345341db7221 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Mon, 23 May 2022 02:01:59 +0200 Subject: [PATCH] Common/Network: Use std::array in IPv4Header. --- Source/Core/Common/Network.cpp | 4 ++-- Source/Core/Common/Network.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Core/Common/Network.cpp b/Source/Core/Common/Network.cpp index e2fdc3d2d6..2c548347a3 100644 --- a/Source/Core/Common/Network.cpp +++ b/Source/Core/Common/Network.cpp @@ -102,8 +102,8 @@ IPv4Header::IPv4Header(u16 data_size, u8 ip_proto, const sockaddr_in& from, cons flags_fragment_offset = htons(0x4000); ttl = 0x40; protocol = ip_proto; - std::memcpy(&source_addr, &from.sin_addr, IPV4_ADDR_LEN); - std::memcpy(&destination_addr, &to.sin_addr, IPV4_ADDR_LEN); + std::memcpy(source_addr.data(), &from.sin_addr, IPV4_ADDR_LEN); + std::memcpy(destination_addr.data(), &to.sin_addr, IPV4_ADDR_LEN); header_checksum = htons(ComputeNetworkChecksum(this, Size())); } diff --git a/Source/Core/Common/Network.h b/Source/Core/Common/Network.h index cd4e27ddc9..a1fcc9ea42 100644 --- a/Source/Core/Common/Network.h +++ b/Source/Core/Common/Network.h @@ -58,8 +58,8 @@ struct IPv4Header u8 ttl = 0; u8 protocol = 0; u16 header_checksum = 0; - u8 source_addr[IPV4_ADDR_LEN]{}; - u8 destination_addr[IPV4_ADDR_LEN]{}; + std::array source_addr{}; + std::array destination_addr{}; }; static_assert(sizeof(IPv4Header) == IPv4Header::SIZE);