Fix warnings in unit test code when compiling with stricter GCC settings

This commit is contained in:
Dirk Ziegelmeier
2016-06-23 22:30:37 +02:00
parent 98c741976b
commit d133999e1d
5 changed files with 29 additions and 23 deletions

View File

@@ -62,7 +62,7 @@ tcp_create_segment_wnd(ip_addr_t* src_ip, ip_addr_t* dst_ip,
memset(q->payload, 0, q->len);
}
iphdr = p->payload;
iphdr = (struct ip_hdr*)p->payload;
/* fill IP header */
iphdr->dest.addr = ip_2_ip4(dst_ip)->addr;
iphdr->src.addr = ip_2_ip4(src_ip)->addr;
@@ -74,7 +74,7 @@ tcp_create_segment_wnd(ip_addr_t* src_ip, ip_addr_t* dst_ip,
/* let p point to TCP header */
pbuf_header(p, -(s16_t)sizeof(struct ip_hdr));
tcphdr = p->payload;
tcphdr = (struct tcp_hdr*)p->payload;
tcphdr->src = htons(src_port);
tcphdr->dest = htons(dst_port);
tcphdr->seqno = htonl(seqno);
@@ -168,7 +168,7 @@ tcp_set_state(struct tcp_pcb* pcb, enum tcp_state state, ip_addr_t* local_ip,
void
test_tcp_counters_err(void* arg, err_t err)
{
struct test_tcp_counters* counters = arg;
struct test_tcp_counters* counters = (struct test_tcp_counters*)arg;
EXPECT_RET(arg != NULL);
counters->err_calls++;
counters->last_err = err;
@@ -186,7 +186,7 @@ test_tcp_counters_check_rxdata(struct test_tcp_counters* counters, struct pbuf*
EXPECT_RET(counters->recved_bytes + p->tot_len <= counters->expected_data_len);
received = counters->recved_bytes;
for(q = p; q != NULL; q = q->next) {
char *data = q->payload;
char *data = (char*)q->payload;
for(i = 0; i < q->len; i++) {
EXPECT_RET(data[i] == counters->expected_data[received]);
received++;
@@ -198,7 +198,7 @@ test_tcp_counters_check_rxdata(struct test_tcp_counters* counters, struct pbuf*
err_t
test_tcp_counters_recv(void* arg, struct tcp_pcb* pcb, struct pbuf* p, err_t err)
{
struct test_tcp_counters* counters = arg;
struct test_tcp_counters* counters = (struct test_tcp_counters*)arg;
EXPECT_RETX(arg != NULL, ERR_OK);
EXPECT_RETX(pcb != NULL, ERR_OK);
EXPECT_RETX(err == ERR_OK, ERR_OK);

View File

@@ -471,7 +471,7 @@ START_TEST(test_tcp_recv_ooseq_overrun_rxwin)
int datalen = 0;
int datalen2;
for(i = 0; i < sizeof(data_full_wnd); i++) {
for(i = 0; i < (int)sizeof(data_full_wnd); i++) {
data_full_wnd[i] = (char)i;
}
@@ -840,7 +840,7 @@ static void test_tcp_recv_ooseq_double_FINs(int delay_packet)
u32_t exp_rx_calls = 0, exp_rx_bytes = 0, exp_close_calls = 0, exp_oos_pbufs = 0, exp_oos_tcplen = 0;
int first_dropped = 0xff;
for(i = 0; i < sizeof(data_full_wnd); i++) {
for(i = 0; i < (int)sizeof(data_full_wnd); i++) {
data_full_wnd[i] = (char)i;
}