X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/99c91c3aec40b691641374f58e798bd8d6b657bd..cc2d4cbd8ca150504127f375d8b51b194958d95b:/in_cksum.c diff --git a/in_cksum.c b/in_cksum.c index caf4b6af..eb7c634f 100644 --- a/in_cksum.c +++ b/in_cksum.c @@ -36,12 +36,12 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +# include #endif -#include +#include "netdissect-stdinc.h" -#include "interface.h" +#include "netdissect.h" /* * Checksum routine for Internet Protocol family headers (Portable Version). @@ -56,9 +56,9 @@ uint16_t in_cksum(const struct cksum_vec *vec, int veclen) { - register const uint16_t *w; - register int sum = 0; - register int mlen = 0; + const uint16_t *w; + int sum = 0; + int mlen = 0; int byte_swapped = 0; union { @@ -92,7 +92,7 @@ in_cksum(const struct cksum_vec *vec, int veclen) /* * Force to even boundary. */ - if ((1 & (unsigned long) w) && (mlen > 0)) { + if ((1 & (uintptr_t) w) && (mlen > 0)) { REDUCE; sum <<= 8; s_util.c[0] = *(const uint8_t *)w; @@ -196,5 +196,5 @@ in_cksum_shouldbe(uint16_t sum, uint16_t computed_sum) shouldbe += ntohs(computed_sum); shouldbe = (shouldbe & 0xFFFF) + (shouldbe >> 16); shouldbe = (shouldbe & 0xFFFF) + (shouldbe >> 16); - return shouldbe; + return (uint16_t)shouldbe; }