diff options
author | Jere Leppänen <jere.leppanen@nokia.com> | 2022-08-24 16:42:05 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2022-09-09 10:24:07 +0300 |
commit | feede82f598040f7459d845789cae9d4be22dbfe (patch) | |
tree | 65eb627f0a4cebf11a6e4f3e568cfcadfd808159 /helper | |
parent | f4df0fa8ef0426d88d240e60eba20217193634e1 (diff) |
helper: ip: avoid conversion warnings with gcc-7
Use an explicit cast to avoid conversion warnings, when application is
compiled with gcc-7 and -Wconversion option.
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'helper')
-rw-r--r-- | helper/include/odp/helper/ip.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/helper/include/odp/helper/ip.h b/helper/include/odp/helper/ip.h index e0a7e63fe..0faf47f82 100644 --- a/helper/include/odp/helper/ip.h +++ b/helper/include/odp/helper/ip.h @@ -111,7 +111,7 @@ static inline int odph_ipv4_csum(odp_packet_t pkt, odph_ipv4hdr_t *ip, odp_u16sum_t *chksum) { - unsigned nleft = ODPH_IPV4HDR_IHL(ip->ver_ihl) * 4; + uint32_t nleft = (uint32_t)(ODPH_IPV4HDR_IHL(ip->ver_ihl) * 4); uint16_t buf[nleft / 2]; int res; @@ -119,13 +119,13 @@ static inline int odph_ipv4_csum(odp_packet_t pkt, return -1; ip->chksum = 0; memcpy(buf, ip, sizeof(*ip)); - res = odp_packet_copy_to_mem(pkt, offset + sizeof(*ip), + res = odp_packet_copy_to_mem(pkt, offset + (uint32_t)sizeof(*ip), nleft - (uint32_t)sizeof(*ip), buf + sizeof(*ip) / 2); if (odp_unlikely(res < 0)) return res; - *chksum = ~odp_chksum_ones_comp16(buf, nleft); + *chksum = (odp_u16sum_t)~odp_chksum_ones_comp16(buf, nleft); return 0; } |