From 5eed83ee177b95f86eab793660cbea50841dc941 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 19 Oct 2022 11:55:31 +0000 Subject: [PATCH] add casts to silence implicit conversion warnings Fixes #1821 --- lib/nghttp2_net.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/nghttp2_net.h b/lib/nghttp2_net.h index 345f6c83..521f9814 100644 --- a/lib/nghttp2_net.h +++ b/lib/nghttp2_net.h @@ -71,9 +71,9 @@ STIN uint16_t htons(uint16_t hostshort) { STIN uint32_t ntohl(uint32_t netlong) { uint32_t res; unsigned char *p = (unsigned char *)&netlong; - res = *p++ << 24; - res += *p++ << 16; - res += *p++ << 8; + res = (uint32_t)(*p++ << 24); + res += (uint32_t)(*p++ << 16); + res += (uint32_t)(*p++ << 8); res += *p; return res; } @@ -81,7 +81,7 @@ STIN uint32_t ntohl(uint32_t netlong) { STIN uint16_t ntohs(uint16_t netshort) { uint16_t res; unsigned char *p = (unsigned char *)&netshort; - res = *p++ << 8; + res = (uint16_t)(*p++ << 8); res += *p; return res; }