From 58b8b3d610496867fe9a20c9b33f7e35c8121f95 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Wed, 23 Oct 2024 10:38:32 +0200 Subject: [PATCH] util: avoid C-style arrays --- src/uvw/util.h | 10 +++++----- src/uvw/util.ipp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/uvw/util.h b/src/uvw/util.h index d66cb377..ffdf42dc 100644 --- a/src/uvw/util.h +++ b/src/uvw/util.h @@ -238,11 +238,11 @@ struct cpu_info { * \brief Interface address. */ struct interface_address { - std::string name; /*!< The name of the interface (as an example _eth0_). */ - char physical[6]; /*!< The physical address. */ - bool internal; /*!< True if it is an internal interface (as an example _loopback_), false otherwise. */ - socket_address address; /*!< The address of the given interface. */ - socket_address netmask; /*!< The netmask of the given interface. */ + std::string name; /*!< The name of the interface (as an example _eth0_). */ + std::array physical; /*!< The physical address. */ + bool internal; /*!< True if it is an internal interface (as an example _loopback_), false otherwise. */ + socket_address address; /*!< The address of the given interface. */ + socket_address netmask; /*!< The netmask of the given interface. */ }; namespace details { diff --git a/src/uvw/util.ipp b/src/uvw/util.ipp index 22b5b087..24d9cd38 100644 --- a/src/uvw/util.ipp +++ b/src/uvw/util.ipp @@ -239,7 +239,7 @@ UVW_INLINE std::vector utilities::interface_addresses() noexc interface_address iface_addr; iface_addr.name = ifaces[next].name; - std::copy(ifaces[next].phys_addr, (ifaces[next].phys_addr + 6), iface_addr.physical); + std::copy(ifaces[next].phys_addr, (ifaces[next].phys_addr + 6), iface_addr.physical.data()); iface_addr.internal = ifaces[next].is_internal == 0 ? false : true; if(ifaces[next].address.address4.sin_family == AF_INET) {