diff --git a/src/core/dns.c b/src/core/dns.c index 69c1e663..ed0264d4 100644 --- a/src/core/dns.c +++ b/src/core/dns.c @@ -694,8 +694,8 @@ dns_send(struct dns_table_entry* entry) LWIP_ASSERT("dns server has no IP address set", !ip_addr_isany(&dns_servers[entry->server_idx])); /* if here, we have either a new query or a retry on a previous query to process */ - p = pbuf_alloc(PBUF_TRANSPORT, SIZEOF_DNS_HDR + strlen(entry->name) + 2 + - SIZEOF_DNS_QUERY, PBUF_RAM); + p = pbuf_alloc(PBUF_TRANSPORT, (u16_t)(SIZEOF_DNS_HDR + strlen(entry->name) + 2 + + SIZEOF_DNS_QUERY), PBUF_RAM); if (p != NULL) { /* fill dns header */ memset(&hdr, 0, SIZEOF_DNS_HDR); @@ -714,7 +714,7 @@ dns_send(struct dns_table_entry* entry) for(n = 0; *hostname != '.' && *hostname != 0; ++hostname) { ++n; } - copy_len = hostname - hostname_part; + copy_len = (u16_t)(hostname - hostname_part); pbuf_put_at(p, query_idx, n); pbuf_take_at(p, hostname_part, copy_len, query_idx + 1); query_idx += n + 1; @@ -759,7 +759,7 @@ dns_alloc_random_port(void) return NULL; } do { - u16_t port = DNS_RAND_TXID(); + u16_t port = (u16_t)DNS_RAND_TXID(); if (!DNS_PORT_ALLOWED(port)) { /* this port is not allowed, try again */ err = ERR_USE; @@ -875,7 +875,7 @@ dns_create_txid(void) u8_t i; again: - txid = DNS_RAND_TXID(); + txid = (u16_t)DNS_RAND_TXID(); /* check whether the ID is unique */ for (i = 0; i < DNS_TABLE_SIZE; i++) { diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index c82aed9f..6e913e30 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -1596,7 +1596,7 @@ tcp_receive(struct tcp_pcb *pcb) TCPH_FLAGS_SET(next->next->tcphdr, TCPH_FLAGS(next->next->tcphdr) &~ TCP_FIN); } /* Adjust length of segment to fit in the window. */ - next->next->len = pcb->rcv_nxt + pcb->rcv_wnd - seqno; + next->next->len = (u16_t)(pcb->rcv_nxt + pcb->rcv_wnd - seqno); pbuf_realloc(next->next->p, next->next->len); tcplen = TCP_TCPLEN(next->next); LWIP_ASSERT("tcp_receive: segment not trimmed correctly to rcv_wnd\n", @@ -1657,7 +1657,7 @@ static u8_t tcp_getoptbyte(void) u8_t* opts = (u8_t *)tcphdr + TCP_HLEN; return opts[tcp_optidx++]; } else { - u8_t idx = tcp_optidx++ - tcphdr_opt1len; + u8_t idx = (u8_t)(tcp_optidx++ - tcphdr_opt1len); return tcphdr_opt2[idx]; } } diff --git a/src/include/lwip/ip4.h b/src/include/lwip/ip4.h index 1375654f..db1866dc 100644 --- a/src/include/lwip/ip4.h +++ b/src/include/lwip/ip4.h @@ -97,7 +97,7 @@ PACK_STRUCT_END #define IPH_PROTO(hdr) ((hdr)->_proto) #define IPH_CHKSUM(hdr) ((hdr)->_chksum) -#define IPH_VHL_SET(hdr, v, hl) (hdr)->_v_hl = (((v) << 4) | (hl)) +#define IPH_VHL_SET(hdr, v, hl) (hdr)->_v_hl = (u8_t)((((v) << 4) | (hl))) #define IPH_TOS_SET(hdr, tos) (hdr)->_tos = (tos) #define IPH_LEN_SET(hdr, len) (hdr)->_len = (len) #define IPH_ID_SET(hdr, id) (hdr)->_id = (id)