lib/net: enable strict warnings

Enables strict warnings in the net lib and fixes all related compile errors.

Fixes #4924
This commit is contained in:
Martin Stein 2023-06-13 14:32:35 +02:00 committed by Norman Feske
parent c907e44a02
commit bf18ffbbdd
2 changed files with 8 additions and 10 deletions

View File

@ -1,6 +1,4 @@
SRC_CC += ethernet.cc ipv4.cc dhcp.cc arp.cc udp.cc tcp.cc
SRC_CC += icmp.cc internet_checksum.cc
CC_CXX_WARN_STRICT_CONVERSION =
vpath %.cc $(REP_DIR)/src/lib/net

View File

@ -68,10 +68,10 @@ uint32_t Ipv4_address::to_uint32_big_endian() const
Ipv4_address Ipv4_address::from_uint32_big_endian(uint32_t ip_raw)
{
Ipv4_address ip;
ip.addr[0] = ip_raw;
ip.addr[1] = ip_raw >> 8;
ip.addr[2] = ip_raw >> 16;
ip.addr[3] = ip_raw >> 24;
ip.addr[0] = (uint8_t)(ip_raw);
ip.addr[1] = (uint8_t)(ip_raw >> 8);
ip.addr[2] = (uint8_t)(ip_raw >> 16);
ip.addr[3] = (uint8_t)(ip_raw >> 24);
return ip;
}
@ -88,10 +88,10 @@ uint32_t Ipv4_address::to_uint32_little_endian() const
Ipv4_address Ipv4_address::from_uint32_little_endian(uint32_t ip_raw)
{
Ipv4_address ip;
ip.addr[3] = ip_raw;
ip.addr[2] = ip_raw >> 8;
ip.addr[1] = ip_raw >> 16;
ip.addr[0] = ip_raw >> 24;
ip.addr[3] = (uint8_t)(ip_raw);
ip.addr[2] = (uint8_t)(ip_raw >> 8);
ip.addr[1] = (uint8_t)(ip_raw >> 16);
ip.addr[0] = (uint8_t)(ip_raw >> 24);
return ip;
}