Commit 6f5222a8 authored by Bruno Randolf's avatar Bruno Randolf

fix signed/unsigned warnings

parent 293e6381
......@@ -179,8 +179,8 @@ struct node_info {
unsigned int pkt_count; /* nr of packets seen */
/* wlan phy (from radiotap) */
int phy_snr_min;
int phy_snr_max;
unsigned int phy_snr_min;
unsigned int phy_snr_max;
struct ewma phy_snr_avg;
int phy_sig_max;
struct ewma phy_sig_avg;
......
......@@ -215,7 +215,7 @@ net_send_packet(struct packet_info *p)
static int
net_receive_packet(unsigned char *buffer, int len)
net_receive_packet(unsigned char *buffer, size_t len)
{
struct net_packet_info *np;
struct packet_info p;
......@@ -290,7 +290,7 @@ net_send_conf_chan(int fd)
static int
net_receive_conf_chan(unsigned char *buffer, int len)
net_receive_conf_chan(unsigned char *buffer, size_t len)
{
struct net_conf_chan *nc;
......@@ -336,7 +336,7 @@ net_send_conf_filter(int fd)
static int
net_receive_conf_filter(unsigned char *buffer, int len)
net_receive_conf_filter(unsigned char *buffer, size_t len)
{
struct net_conf_filter *nc;
int i;
......@@ -386,7 +386,7 @@ net_send_chan_list(int fd)
static int
net_receive_chan_list(unsigned char *buffer, int len)
net_receive_chan_list(unsigned char *buffer, size_t len)
{
struct net_chan_list *nc;
int i;
......@@ -410,7 +410,7 @@ net_receive_chan_list(unsigned char *buffer, int len)
static int
try_receive_packet(unsigned char* buf, int len)
try_receive_packet(unsigned char* buf, size_t len)
{
struct net_header *nh = (struct net_header *)buf;
......
......@@ -96,7 +96,7 @@ parse_prism_header(unsigned char** buf, int len, struct packet_info* p)
DEBUG("PRISM2 HEADER\n");
if (len < sizeof(wlan_ng_prism2_header))
if (len > 0 && (size_t)len < sizeof(wlan_ng_prism2_header))
return -1;
ph = (wlan_ng_prism2_header*)*buf;
......@@ -128,8 +128,6 @@ parse_prism_header(unsigned char** buf, int len, struct packet_info* p)
p->phy_rate = ph->rate.data * 10;
/* just in case...*/
if (p->phy_snr < 0)
p->phy_snr = -p->phy_snr;
if (p->phy_snr > 99)
p->phy_snr = 99;
if (p->phy_rate == 0 || p->phy_rate > 1080) {
......@@ -584,7 +582,7 @@ parse_ip_header(unsigned char** buf, int len, struct packet_info* p)
DEBUG("* parse IP\n");
if (len < sizeof(struct ip))
if (len > 0 && (size_t)len < sizeof(struct ip))
return -1;
ih = (struct ip*)*buf;
......@@ -614,7 +612,7 @@ parse_udp_header(unsigned char** buf, int len, struct packet_info* p)
{
struct udphdr* uh;
if (len < sizeof(struct udphdr))
if (len > 0 && (size_t)len < sizeof(struct udphdr))
return -1;
uh = (struct udphdr*)*buf;
......@@ -645,7 +643,7 @@ parse_olsr_packet(unsigned char** buf, int len, struct packet_info* p)
struct olsr* oh;
int number, i, msgtype;
if (len < sizeof(struct olsr))
if (len > 0 && (size_t)len < sizeof(struct olsr))
return -1;
oh = (struct olsr*)*buf;
......
......@@ -172,7 +172,7 @@ convert_string_to_mac(const char* string, unsigned char* mac)
char
get_packet_type_char(int type)
get_packet_type_char(unsigned int type)
{
if (type == 1) /* special case for bad FCS */
return '*';
......@@ -201,7 +201,7 @@ get_packet_type_char(int type)
const char*
get_packet_type_name(int type)
get_packet_type_name(unsigned int type)
{
if (type == 1) /* special case for bad FCS */
return "BADFCS";
......
......@@ -117,10 +117,10 @@ static inline int normalize_db(int val, int max)
}
char
get_packet_type_char(int type);
get_packet_type_char(unsigned int type);
const char*
get_packet_type_name(int type);
get_packet_type_name(unsigned int type);
const char*
kilo_mega_ize(unsigned int val);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment