net-snk: Fix gcc warnings

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.

The make command used to test:
make qemu WARNFLAGS=-Wextra

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Alexey Kardashevskiy 2016-01-22 11:39:25 +11:00
parent 253298295e
commit f344ef9b22
7 changed files with 12 additions and 12 deletions

View File

@ -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 +

View File

@ -295,7 +295,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;
@ -682,7 +682,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;

View File

@ -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

View File

@ -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;

View File

@ -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,

View File

@ -58,7 +58,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;

View File

@ -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. */