mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-23 21:14:18 +00:00
Fix warnings in unit test code when compiling with stricter GCC settings
This commit is contained in:
parent
98c741976b
commit
d133999e1d
@ -164,8 +164,8 @@ START_TEST(test_pbuf_take_at_edge)
|
||||
res = pbuf_take_at(p, &testdata, sizeof(testdata), 0);
|
||||
fail_unless(res == ERR_OK);
|
||||
|
||||
out = p->payload;
|
||||
for (i = 0; i < sizeof(testdata); i++) {
|
||||
out = (u8_t*)p->payload;
|
||||
for (i = 0; i < (int)sizeof(testdata); i++) {
|
||||
fail_unless(out[i] == testdata[i],
|
||||
"Bad data at pos %d, was %02X, expected %02X", i, out[i], testdata[i]);
|
||||
}
|
||||
@ -174,11 +174,11 @@ START_TEST(test_pbuf_take_at_edge)
|
||||
res = pbuf_take_at(p, &testdata, sizeof(testdata), p->len - 1);
|
||||
fail_unless(res == ERR_OK);
|
||||
|
||||
out = p->payload;
|
||||
out = (u8_t*)p->payload;
|
||||
fail_unless(out[p->len - 1] == testdata[0],
|
||||
"Bad data at pos %d, was %02X, expected %02X", p->len - 1, out[p->len - 1], testdata[0]);
|
||||
out = q->payload;
|
||||
for (i = 1; i < sizeof(testdata); i++) {
|
||||
out = (u8_t*)q->payload;
|
||||
for (i = 1; i < (int)sizeof(testdata); i++) {
|
||||
fail_unless(out[i-1] == testdata[i],
|
||||
"Bad data at pos %d, was %02X, expected %02X", p->len - 1 + i, out[i-1], testdata[i]);
|
||||
}
|
||||
@ -187,8 +187,8 @@ START_TEST(test_pbuf_take_at_edge)
|
||||
res = pbuf_take_at(p, &testdata, sizeof(testdata), p->len);
|
||||
fail_unless(res == ERR_OK);
|
||||
|
||||
out = p->payload;
|
||||
for (i = 0; i < sizeof(testdata); i++) {
|
||||
out = (u8_t*)p->payload;
|
||||
for (i = 0; i < (int)sizeof(testdata); i++) {
|
||||
fail_unless(out[i] == testdata[i],
|
||||
"Bad data at pos %d, was %02X, expected %02X", p->len+i, out[i], testdata[i]);
|
||||
}
|
||||
@ -214,7 +214,7 @@ START_TEST(test_pbuf_get_put_at_edge)
|
||||
/* put byte at the beginning of second pbuf */
|
||||
pbuf_put_at(p, p->len, testdata);
|
||||
|
||||
out = q->payload;
|
||||
out = (u8_t*)q->payload;
|
||||
fail_unless(*out == testdata,
|
||||
"Bad data at pos %d, was %02X, expected %02X", p->len, *out, testdata);
|
||||
|
||||
|
@ -203,7 +203,7 @@ static void check_pkt(struct pbuf *p, u32_t pos, const u8_t *mem, u32_t len)
|
||||
fail_if(p == NULL);
|
||||
fail_unless(pos + len <= p->len); /* All data we seek within same pbuf */
|
||||
|
||||
data = p->payload;
|
||||
data = (u8_t*)p->payload;
|
||||
fail_if(memcmp(&data[pos], mem, len), "data at pos %d, len %d in packet %d did not match", pos, len, txpacket);
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ static void check_pkt_fuzzy(struct pbuf *p, u32_t startpos, const u8_t *mem, u32
|
||||
fail_unless(startpos + len <= p->len); /* All data we seek within same pbuf */
|
||||
|
||||
found = 0;
|
||||
data = p->payload;
|
||||
data = (u8_t*)p->payload;
|
||||
for (i = startpos; i <= (p->len - len); i++) {
|
||||
if (memcmp(&data[i], mem, len) == 0) {
|
||||
found = 1;
|
||||
@ -301,6 +301,9 @@ static err_t lwip_tx_func(struct netif *netif, struct pbuf *p)
|
||||
check_pkt(p, 12, arpproto, sizeof(arpproto)); /* eth level proto: ip */
|
||||
break;
|
||||
}
|
||||
default:
|
||||
fail();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -405,6 +408,9 @@ static err_t lwip_tx_func(struct netif *netif, struct pbuf *p)
|
||||
check_pkt_fuzzy(p, 282, dhcp_request_opt, sizeof(dhcp_request_opt));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
fail();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -160,11 +160,11 @@ START_TEST(test_etharp_table)
|
||||
struct pbuf *p = pbuf_alloc(PBUF_TRANSPORT, 10, PBUF_RAM);
|
||||
fail_unless(p != NULL);
|
||||
if (p != NULL) {
|
||||
err_t err;
|
||||
err_t err2;
|
||||
ip_addr_t dst;
|
||||
ip_addr_copy_from_ip4(dst, adrs[i]);
|
||||
err = udp_sendto(pcb, p, &dst, 123);
|
||||
fail_unless(err == ERR_OK);
|
||||
err2 = udp_sendto(pcb, p, &dst, 123);
|
||||
fail_unless(err2 == ERR_OK);
|
||||
/* etharp request sent? */
|
||||
fail_unless(linkoutput_ctr == (2*i) + 1);
|
||||
pbuf_free(p);
|
||||
@ -195,11 +195,11 @@ START_TEST(test_etharp_table)
|
||||
struct pbuf *p = pbuf_alloc(PBUF_TRANSPORT, 10, PBUF_RAM);
|
||||
fail_unless(p != NULL);
|
||||
if (p != NULL) {
|
||||
err_t err;
|
||||
err_t err2;
|
||||
ip_addr_t dst;
|
||||
ip_addr_copy_from_ip4(dst, adrs[i]);
|
||||
err = udp_sendto(pcb, p, &dst, 123);
|
||||
fail_unless(err == ERR_OK);
|
||||
err2 = udp_sendto(pcb, p, &dst, 123);
|
||||
fail_unless(err2 == ERR_OK);
|
||||
/* etharp request sent? */
|
||||
fail_unless(linkoutput_ctr == (2*i) + 1);
|
||||
pbuf_free(p);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user