work on -Wconversion...

This commit is contained in:
goldsimon 2017-06-30 22:10:16 +02:00
parent c636072362
commit 41177cfd1c
7 changed files with 32 additions and 20 deletions

View File

@ -284,7 +284,7 @@ raw_connect(struct raw_pcb *pcb, const ip_addr_t *ipaddr)
ip6_addr_select_zone(ip_2_ip6(&pcb->remote_ip), ip_2_ip6(&pcb->local_ip));
}
#endif /* LWIP_IPV6 && LWIP_IPV6_SCOPES */
pcb->flags |= RAW_FLAGS_CONNECTED;
raw_set_flags(pcb, RAW_FLAGS_CONNECTED);
return ERR_OK;
}
@ -309,7 +309,7 @@ raw_disconnect(struct raw_pcb *pcb)
#endif
pcb->netif_idx = NETIF_NO_INDEX;
/* mark PCB as unconnected */
pcb->flags &= ~RAW_FLAGS_CONNECTED;
raw_clear_flags(pcb, RAW_FLAGS_CONNECTED);
}
/**
@ -468,7 +468,7 @@ raw_sendto_if_src(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
} else {
/* first pbuf q equals given pbuf */
q = p;
if (pbuf_header(q, -header_size)) {
if (pbuf_header(q, (s16_t)-header_size)) {
LWIP_ASSERT("Can't restore header we just removed!", 0);
return ERR_MEM;
}

View File

@ -71,7 +71,7 @@
"The Dynamic and/or Private Ports are those from 49152 through 65535" */
#define TCP_LOCAL_PORT_RANGE_START 0xc000
#define TCP_LOCAL_PORT_RANGE_END 0xffff
#define TCP_ENSURE_LOCAL_PORT_RANGE(port) ((u16_t)(((port) & ~TCP_LOCAL_PORT_RANGE_START) + TCP_LOCAL_PORT_RANGE_START))
#define TCP_ENSURE_LOCAL_PORT_RANGE(port) ((u16_t)(((port) & (u16_t)~TCP_LOCAL_PORT_RANGE_START) + TCP_LOCAL_PORT_RANGE_START))
#endif
#if LWIP_TCP_KEEPALIVE
@ -239,7 +239,7 @@ tcp_backlog_accepted(struct tcp_pcb* pcb)
if (pcb->listener != NULL) {
LWIP_ASSERT("accepts_pending != 0", pcb->listener->accepts_pending != 0);
pcb->listener->accepts_pending--;
pcb->flags &= ~TF_BACKLOGPEND;
tcp_clear_flags(pcb, TF_BACKLOGPEND);
}
}
}
@ -824,13 +824,13 @@ tcp_update_rcv_ann_wnd(struct tcp_pcb *pcb)
void
tcp_recved(struct tcp_pcb *pcb, u16_t len)
{
int wnd_inflation;
uint32_t wnd_inflation;
/* pcb->state LISTEN not allowed here */
LWIP_ASSERT("don't call tcp_recved for listen-pcbs",
pcb->state != LISTEN);
pcb->rcv_wnd += len;
pcb->rcv_wnd = (tcpwnd_size_t)(pcb->rcv_wnd + len);
if (pcb->rcv_wnd > TCP_WND_MAX(pcb)) {
pcb->rcv_wnd = TCP_WND_MAX(pcb);
} else if (pcb->rcv_wnd == 0) {
@ -1107,7 +1107,8 @@ tcp_slowtmr_start:
* connect to somebody (i.e., we are in SYN_SENT). */
if (pcb->state != SYN_SENT) {
u8_t backoff_idx = LWIP_MIN(pcb->nrtx, sizeof(tcp_backoff)-1);
pcb->rto = ((pcb->sa >> 3) + pcb->sv) << tcp_backoff[backoff_idx];
int calc_rto = ((pcb->sa >> 3) + pcb->sv) << tcp_backoff[backoff_idx];
pcb->rto = (s16_t)LWIP_MIN(calc_rto, 0x7FFF);
}
/* Reset the retransmission timer. */
@ -1117,7 +1118,7 @@ tcp_slowtmr_start:
eff_wnd = LWIP_MIN(pcb->cwnd, pcb->snd_wnd);
pcb->ssthresh = eff_wnd >> 1;
if (pcb->ssthresh < (tcpwnd_size_t)(pcb->mss << 1)) {
pcb->ssthresh = (pcb->mss << 1);
pcb->ssthresh = (tcpwnd_size_t)(pcb->mss << 1);
}
pcb->cwnd = pcb->mss;
LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_slowtmr: cwnd %"TCPWNDSIZE_F
@ -1174,7 +1175,7 @@ tcp_slowtmr_start:
be retransmitted). */
#if TCP_QUEUE_OOSEQ
if (pcb->ooseq != NULL &&
(u32_t)tcp_ticks - pcb->tmr >= pcb->rto * TCP_OOSEQ_TIMEOUT) {
(tcp_ticks - pcb->tmr >= (u32_t)pcb->rto * TCP_OOSEQ_TIMEOUT)) {
tcp_segs_free(pcb->ooseq);
pcb->ooseq = NULL;
LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_slowtmr: dropping OOSEQ queued data\n"));
@ -1317,12 +1318,12 @@ tcp_fasttmr_start:
LWIP_DEBUGF(TCP_DEBUG, ("tcp_fasttmr: delayed ACK\n"));
tcp_ack_now(pcb);
tcp_output(pcb);
pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW);
tcp_clear_flags(pcb, TF_ACK_DELAY | TF_ACK_NOW);
}
/* send pending FIN */
if (pcb->flags & TF_CLOSEPEND) {
LWIP_DEBUGF(TCP_DEBUG, ("tcp_fasttmr: pending FIN\n"));
pcb->flags &= ~(TF_CLOSEPEND);
tcp_clear_flags(pcb, TF_CLOSEPEND);
tcp_close_shutdown_fin(pcb);
}
@ -1968,7 +1969,7 @@ u16_t
tcp_eff_send_mss_netif(u16_t sendmss, struct netif *outif, const ip_addr_t *dest)
{
u16_t mss_s;
s16_t mtu;
u16_t mtu;
LWIP_UNUSED_ARG(dest); /* in case IPv6 is disabled */
@ -1994,12 +1995,13 @@ tcp_eff_send_mss_netif(u16_t sendmss, struct netif *outif, const ip_addr_t *dest
#endif /* LWIP_IPV4 */
if (mtu != 0) {
u16_t offset;
#if LWIP_IPV6
#if LWIP_IPV4
if (IP_IS_V6(dest))
#endif /* LWIP_IPV4 */
{
mss_s = mtu - IP6_HLEN - TCP_HLEN;
offset = IP6_HLEN + TCP_HLEN;
}
#if LWIP_IPV4
else
@ -2007,9 +2009,10 @@ tcp_eff_send_mss_netif(u16_t sendmss, struct netif *outif, const ip_addr_t *dest
#endif /* LWIP_IPV6 */
#if LWIP_IPV4
{
mss_s = mtu - IP_HLEN - TCP_HLEN;
offset = IP_HLEN + TCP_HLEN;
}
#endif /* LWIP_IPV4 */
mss_s = (mtu > offset) ? (u16_t)(mtu - offset) : 0;
/* RFC 1122, chap 4.2.2.6:
* Eff.snd.MSS = min(SendMSS+20, MMS_S) - TCPhdrsize - IPoptionsize
* We correct for TCP options in tcp_write(), and don't support IP options.

View File

@ -428,7 +428,7 @@ void netif_set_gw(struct netif *netif, const ip4_addr_t *gw);
#endif /* LWIP_IPV4 */
#define netif_set_flags(netif, set_flags) do { (netif)->flags = (u8_t)((netif)->flags | (set_flags)); } while(0)
#define netif_clear_flags(netif, set_flags) do { (netif)->flags = (u8_t)((netif)->flags & ~(set_flags)); } while(0)
#define netif_clear_flags(netif, clr_flags) do { (netif)->flags = (u8_t)((netif)->flags & ~(clr_flags)); } while(0)
#define netif_is_flag_set(nefif, flag) (((netif)->flags & (flag)) != 0)
void netif_set_up(struct netif *netif);

View File

@ -81,6 +81,7 @@ PACK_STRUCT_END
#define TCP_FLAGS 0x3fU
#define TCPH_HDRLEN(phdr) ((u16_t)(lwip_ntohs((phdr)->_hdrlen_rsvd_flags) >> 12))
#define TCPH_HDRLEN_BYTES(phdr) ((u8_t)(TCPH_HDRLEN(phdr) << 2))
#define TCPH_FLAGS(phdr) ((u16_t)(lwip_ntohs((phdr)->_hdrlen_rsvd_flags) & TCP_FLAGS))
#define TCPH_HDRLEN_SET(phdr, len) (phdr)->_hdrlen_rsvd_flags = lwip_htons(((len) << 12) | TCPH_FLAGS(phdr))

View File

@ -118,6 +118,10 @@ void raw_recv (struct raw_pcb *pcb, raw_recv_fn recv, void *re
#define raw_flags(pcb) ((pcb)->flags)
#define raw_setflags(pcb,f) ((pcb)->flags = (f))
#define raw_set_flags(pcb, set_flags) do { (pcb)->flags = (u8_t)((pcb)->flags | (set_flags)); } while(0)
#define raw_clear_flags(pcb, clr_flags) do { (pcb)->flags = (u8_t)((pcb)->flags & ~(clr_flags)); } while(0)
#define raw_is_flag_set(pcb, flag) (((pcb)->flags & (flag)) != 0)
/* The following functions are the lower layer interface to RAW. */
u8_t raw_input (struct pbuf *p, struct netif *inp);
#define raw_init() /* Compatibility define, no init needed. */

View File

@ -358,6 +358,10 @@ void tcp_accept (struct tcp_pcb *pcb, tcp_accept_fn accept);
#endif /* LWIP_CALLBACK_API */
void tcp_poll (struct tcp_pcb *pcb, tcp_poll_fn poll, u8_t interval);
#define tcp_set_flags(pcb, set_flags) do { (pcb)->flags = (tcpflags_t)((pcb)->flags | (set_flags)); } while(0)
#define tcp_clear_flags(pcb, clr_flags) do { (pcb)->flags = (tcpflags_t)((pcb)->flags & ~(clr_flags)); } while(0)
#define tcp_is_flag_set(pcb, flag) (((pcb)->flags & (flag)) != 0)
#if LWIP_TCP_TIMESTAMPS
#define tcp_mss(pcb) (((pcb)->flags & TF_TIMESTAMP) ? ((pcb)->mss - 12) : (pcb)->mss)
#else /* LWIP_TCP_TIMESTAMPS */
@ -369,11 +373,11 @@ void tcp_poll (struct tcp_pcb *pcb, tcp_poll_fn poll, u8_t interv
/** @ingroup tcp_raw */
#define tcp_sndqueuelen(pcb) ((pcb)->snd_queuelen)
/** @ingroup tcp_raw */
#define tcp_nagle_disable(pcb) ((pcb)->flags |= TF_NODELAY)
#define tcp_nagle_disable(pcb) tcp_set_flags(pcb, TF_NODELAY)
/** @ingroup tcp_raw */
#define tcp_nagle_enable(pcb) ((pcb)->flags = (tcpflags_t)((pcb)->flags & ~TF_NODELAY))
#define tcp_nagle_enable(pcb) tcp_clear_flags(pcb, TF_NODELAY)
/** @ingroup tcp_raw */
#define tcp_nagle_disabled(pcb) (((pcb)->flags & TF_NODELAY) != 0)
#define tcp_nagle_disabled(pcb) tcp_is_flag_set(pcb, TF_NODELAY)
#if TCP_LISTEN_BACKLOG
#define tcp_backlog_set(pcb, new_backlog) do { \

View File

@ -471,7 +471,7 @@ vj_uncompress_uncomp(struct pbuf *nb, struct vjcompress *comp)
hlen = IPH_HL(ip) << 2;
if (IPH_PROTO(ip) >= MAX_SLOTS
|| hlen + sizeof(struct tcp_hdr) > nb->len
|| (hlen += TCPH_HDRLEN(((struct tcp_hdr *)&((char *)ip)[hlen])) << 2)
|| (hlen += TCPH_HDRLEN_BYTES((struct tcp_hdr *)&((char *)ip)[hlen]))
> nb->len
|| hlen > MAX_HDR) {
PPPDEBUG(LOG_INFO, ("vj_uncompress_uncomp: bad cid=%d, hlen=%d buflen=%d\n",