[SLOF] [PATCH slof v2 2/4] net-snk: Fix gcc warnings
Alexey Kardashevskiy
aik at ozlabs.ru
Thu Jan 21 12:39:21 AEDT 2016
This replaces some local variable types and some function parameters from
signed to unsigned to fix gcc warnings.
Tested DHCP+TFTP on both IPv4 and IPv6.
Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
---
clients/net-snk/app/netlib/dhcp.c | 8 ++++----
clients/net-snk/app/netlib/ipv4.c | 4 ++--
clients/net-snk/app/netlib/ipv4.h | 4 ++--
clients/net-snk/app/netlib/ipv6.c | 2 +-
clients/net-snk/app/netlib/ipv6.h | 2 +-
clients/net-snk/app/netlib/udp.c | 2 +-
clients/net-snk/app/netlib/udp.h | 2 +-
7 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/clients/net-snk/app/netlib/dhcp.c b/clients/net-snk/app/netlib/dhcp.c
index 0e5cc18..6a1f802 100644
--- a/clients/net-snk/app/netlib/dhcp.c
+++ b/clients/net-snk/app/netlib/dhcp.c
@@ -387,7 +387,7 @@ static int32_t dhcp_encode_options(uint8_t * opt_field, dhcp_options_t * opt_str
static int32_t dhcp_decode_options(uint8_t opt_field[], uint32_t opt_len,
dhcp_options_t * opt_struct)
{
- int32_t offset = 0;
+ uint32_t offset = 0;
memset(opt_struct, 0, sizeof(dhcp_options_t));
@@ -489,10 +489,10 @@ static int32_t dhcp_decode_options(uint8_t opt_field[], uint32_t opt_len,
static int8_t dhcp_merge_options(uint8_t dst_options[], uint32_t * dst_len,
uint8_t src_options[], uint32_t src_len)
{
- int32_t dst_offset, src_offset = 0;
+ uint32_t dst_offset, src_offset = 0;
// remove ENDOPT if presented
- if (dhcp_find_option(dst_options, * dst_len, DHCP_ENDOPT, (uint32_t *) &dst_offset))
+ if (dhcp_find_option(dst_options, * dst_len, DHCP_ENDOPT, &dst_offset))
* dst_len = dst_offset;
while (src_offset < src_len) {
@@ -505,7 +505,7 @@ static int8_t dhcp_merge_options(uint8_t dst_options[], uint32_t * dst_len,
default:
if (dhcp_find_option(dst_options, * dst_len,
src_options[src_offset],
- (uint32_t *) &dst_offset)) {
+ &dst_offset)) {
dhcp_combine_option(dst_options, dst_len,
dst_offset,
(uint8_t *) src_options +
diff --git a/clients/net-snk/app/netlib/ipv4.c b/clients/net-snk/app/netlib/ipv4.c
index 1a648b0..8f47c40 100644
--- a/clients/net-snk/app/netlib/ipv4.c
+++ b/clients/net-snk/app/netlib/ipv4.c
@@ -301,7 +301,7 @@ void fill_iphdr(uint8_t * packet, uint16_t packetsize,
* @see receive_ether
* @see iphdr
*/
-int8_t handle_ipv4(int fd, uint8_t * ip_packet, int32_t packetsize)
+int8_t handle_ipv4(int fd, uint8_t * ip_packet, uint32_t packetsize)
{
struct iphdr * iph;
int32_t old_sum;
@@ -688,7 +688,7 @@ static void fill_arphdr(uint8_t * packet, uint8_t opcode,
* @see receive_ether
* @see arphdr
*/
-int8_t handle_arp(int fd, uint8_t * packet, int32_t packetsize)
+int8_t handle_arp(int fd, uint8_t * packet, uint32_t packetsize)
{
struct arphdr * arph = (struct arphdr *) packet;
diff --git a/clients/net-snk/app/netlib/ipv4.h b/clients/net-snk/app/netlib/ipv4.h
index 008f6de..18821ea 100644
--- a/clients/net-snk/app/netlib/ipv4.h
+++ b/clients/net-snk/app/netlib/ipv4.h
@@ -88,9 +88,9 @@ extern void ping_ipv4(int fd, uint32_t _ping_dst_ip);
extern uint32_t pong_ipv4(void);
/* Handles IPv4-packets that are detected by receive_ether. */
-extern int8_t handle_ipv4(int fd, uint8_t * packet, int32_t packetsize);
+extern int8_t handle_ipv4(int fd, uint8_t * packet, uint32_t packetsize);
/* Handles ARP-packets that are detected by receive_ether. */
-extern int8_t handle_arp(int fd, uint8_t * packet, int32_t packetsize);
+extern int8_t handle_arp(int fd, uint8_t * packet, uint32_t packetsize);
#endif
diff --git a/clients/net-snk/app/netlib/ipv6.c b/clients/net-snk/app/netlib/ipv6.c
index 46dd94e..faa2943 100644
--- a/clients/net-snk/app/netlib/ipv6.c
+++ b/clients/net-snk/app/netlib/ipv6.c
@@ -140,7 +140,7 @@ static int8_t find_ip6addr(ip6_addr_t *ip)
* @see handle_udp
* @see ip6hdr
*/
-int8_t handle_ipv6(int fd, uint8_t * ip6_packet, int32_t packetsize)
+int8_t handle_ipv6(int fd, uint8_t * ip6_packet, uint32_t packetsize)
{
struct ip6hdr *ip6 = NULL;
diff --git a/clients/net-snk/app/netlib/ipv6.h b/clients/net-snk/app/netlib/ipv6.h
index b171667..72c6ee2 100644
--- a/clients/net-snk/app/netlib/ipv6.h
+++ b/clients/net-snk/app/netlib/ipv6.h
@@ -137,7 +137,7 @@ extern struct ip6_config ip6_state;
/******************** FUNCTIONS *********************************************/
/* Handles IPv6-packets that are detected by receive_ether. */
-int8_t handle_ipv6(int fd, uint8_t * ip6_packet, int32_t packetsize);
+int8_t handle_ipv6(int fd, uint8_t * ip6_packet, uint32_t packetsize);
/* Fill IPv6 header */
void fill_ip6hdr(uint8_t * packet, uint16_t packetsize,
diff --git a/clients/net-snk/app/netlib/udp.c b/clients/net-snk/app/netlib/udp.c
index 0a1601d..7c91297 100644
--- a/clients/net-snk/app/netlib/udp.c
+++ b/clients/net-snk/app/netlib/udp.c
@@ -56,7 +56,7 @@ void net_set_mtftp_port(uint16_t tftp_port) {
* @see receive_ether
* @see udphdr
*/
-int8_t handle_udp(int fd, uint8_t * udp_packet, int32_t packetsize)
+int8_t handle_udp(int fd, uint8_t * udp_packet, uint32_t packetsize)
{
struct udphdr * udph = (struct udphdr *) udp_packet;
diff --git a/clients/net-snk/app/netlib/udp.h b/clients/net-snk/app/netlib/udp.h
index 1ba9332..f154542 100644
--- a/clients/net-snk/app/netlib/udp.h
+++ b/clients/net-snk/app/netlib/udp.h
@@ -40,7 +40,7 @@ typedef int32_t *(*handle_upper_udp_t)(uint8_t *, int32_t);
typedef void *(*handle_upper_udp_dun_t)(uint8_t);
/* Handles UDP-packets that are detected by any network layer. */
-extern int8_t handle_udp(int fd, uint8_t * udp_packet, int32_t packetsize);
+extern int8_t handle_udp(int fd, uint8_t * udp_packet, uint32_t packetsize);
/* Handles UDP related ICMP-Dest.Unreachable packets that are detected by
* the network layers. */
--
2.5.0.rc3
More information about the SLOF
mailing list