diff options
author | harti <harti@FreeBSD.org> | 2003-07-29 13:35:03 +0000 |
---|---|---|
committer | harti <harti@FreeBSD.org> | 2003-07-29 13:35:03 +0000 |
commit | 651b54f4726197de352365675e3c76551409d5d3 (patch) | |
tree | 6127c580673b53233ee74bf74702ed9dffd1e03b /lib/libatm/ip_checksum.c | |
parent | 7708c2e2d094277a614ab5b842d23b184a061584 (diff) | |
download | FreeBSD-src-651b54f4726197de352365675e3c76551409d5d3.zip FreeBSD-src-651b54f4726197de352365675e3c76551409d5d3.tar.gz |
Use the appropriate [s]size_t type where a buffer size is meant.
Add const specifiers to constant function arguments.
Diffstat (limited to 'lib/libatm/ip_checksum.c')
-rw-r--r-- | lib/libatm/ip_checksum.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libatm/ip_checksum.c b/lib/libatm/ip_checksum.c index 71ef7b4..2881c24 100644 --- a/lib/libatm/ip_checksum.c +++ b/lib/libatm/ip_checksum.c @@ -66,9 +66,7 @@ __FBSDID("$FreeBSD$"); * */ short -ip_checksum(addr, count) - char *addr; - int count; +ip_checksum(const char *addr, int count) { /* Compute Internet Checksum for "count" bytes * beginning at location "addr". @@ -77,14 +75,14 @@ ip_checksum(addr, count) while( count > 1 ) { /* This is the inner loop */ - sum += ntohs(* (unsigned short *)(void *)addr); + sum += ntohs(* (const unsigned short *)(const void *)addr); addr += sizeof(unsigned short); count -= sizeof(unsigned short); } /* Add left-over byte, if any */ if( count > 0 ) - sum += * (unsigned char *) addr; + sum += * (const unsigned char *) addr; /* Fold 32-bit sum to 16 bits */ while (sum>>16) |