summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomasVolkert <thomas@homer-conferencing.com>2012-12-18 12:55:12 +0100
committerSam Roberts <vieuxtech@gmail.com>2012-12-18 21:26:33 -0800
commit6618c579da4f90756391af7334ea10e03873af78 (patch)
tree3d37b7c598641e1b11acc797bd01be2b3e7047bd
parent4ba2f0c0749e8216c0742edce8adfc25f1587ced (diff)
downloadlibnet-6618c579da4f90756391af7334ea10e03873af78.tar.gz
Avoids several warnings for MS C/C++ compiler
-rw-r--r--libnet/src/libnet_asn1.c2
-rw-r--r--libnet/src/libnet_build_dns.c2
-rw-r--r--libnet/src/libnet_checksum.c10
-rw-r--r--libnet/src/libnet_init.c2
4 files changed, 8 insertions, 8 deletions
diff --git a/libnet/src/libnet_asn1.c b/libnet/src/libnet_asn1.c
index 9a01855..2445715 100644
--- a/libnet/src/libnet_asn1.c
+++ b/libnet/src/libnet_asn1.c
@@ -265,7 +265,7 @@ libnet_build_asn1_length(uint8_t *data, int *datalen, int len)
*data++ = (uint8_t)((len >> 8) & 0xFF);
*data++ = (uint8_t)(len & 0xFF);
}
- *datalen -= (data - start_data);
+ *datalen -= (int)(data - start_data);
return (data);
}
diff --git a/libnet/src/libnet_build_dns.c b/libnet/src/libnet_build_dns.c
index 26c6f3a..308124c 100644
--- a/libnet/src/libnet_build_dns.c
+++ b/libnet/src/libnet_build_dns.c
@@ -77,7 +77,7 @@ libnet_build_dnsv4(uint16_t h_len, uint16_t id, uint16_t flags,
* anyway.
*/
memset(&dns_hdr, 0, sizeof(dns_hdr));
- dns_hdr.h_len = htons(n - sizeof (dns_hdr.h_len));
+ dns_hdr.h_len = htons((u_short)(n - sizeof (dns_hdr.h_len)));
dns_hdr.id = htons(id);
dns_hdr.flags = htons(flags);
dns_hdr.num_q = htons(num_q);
diff --git a/libnet/src/libnet_checksum.c b/libnet/src/libnet_checksum.c
index 01a1dd4..69ccfea 100644
--- a/libnet/src/libnet_checksum.c
+++ b/libnet/src/libnet_checksum.c
@@ -231,7 +231,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const
struct libnet_tcp_hdr *tcph_p =
(struct libnet_tcp_hdr *)(iphdr + ip_hl);
- h_len = end - (uint8_t*) tcph_p; /* ignore h_len, sum the packet we've coalesced */
+ h_len = (int)(end - (uint8_t*) tcph_p); /* ignore h_len, sum the packet we've coalesced */
CHECK_IP_PAYLOAD_SIZE();
@@ -285,7 +285,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const
struct libnet_udp_hdr *udph_p =
(struct libnet_udp_hdr *)(iphdr + ip_hl);
- h_len = end - (uint8_t*) udph_p; /* ignore h_len, sum the packet we've coalesced */
+ h_len = (int)(end - (uint8_t*) udph_p); /* ignore h_len, sum the packet we've coalesced */
CHECK_IP_PAYLOAD_SIZE();
@@ -308,7 +308,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const
struct libnet_icmpv4_hdr *icmph_p =
(struct libnet_icmpv4_hdr *)(iphdr + ip_hl);
- h_len = end - (uint8_t*) icmph_p; /* ignore h_len, sum the packet we've coalesced */
+ h_len = (int)(end - (uint8_t*) icmph_p); /* ignore h_len, sum the packet we've coalesced */
CHECK_IP_PAYLOAD_SIZE();
@@ -330,7 +330,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const
struct libnet_icmpv6_hdr *icmph_p =
(struct libnet_icmpv6_hdr *)(iphdr + ip_hl);
- h_len = end - (uint8_t*) icmph_p; /* ignore h_len, sum the packet we've coalesced */
+ h_len = (int)(end - (uint8_t*) icmph_p); /* ignore h_len, sum the packet we've coalesced */
CHECK_IP_PAYLOAD_SIZE();
@@ -349,7 +349,7 @@ libnet_inet_checksum(libnet_t *l, uint8_t *iphdr, int protocol, int h_len, const
struct libnet_igmp_hdr *igmph_p =
(struct libnet_igmp_hdr *)(iphdr + ip_hl);
- h_len = end - (uint8_t*) igmph_p; /* ignore h_len, sum the packet we've coalesced */
+ h_len = (int)(end - (uint8_t*) igmph_p); /* ignore h_len, sum the packet we've coalesced */
CHECK_IP_PAYLOAD_SIZE();
diff --git a/libnet/src/libnet_init.c b/libnet/src/libnet_init.c
index c00f5a9..10b8de7 100644
--- a/libnet/src/libnet_init.c
+++ b/libnet/src/libnet_init.c
@@ -168,7 +168,7 @@ libnet_getfd(libnet_t *l)
return (-1);
}
- return (l->fd);
+ return (int)(l->fd);
}
const char *