mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 05:24:37 +08:00
work on -Wconversion...
This commit is contained in:
parent
94beb4eddf
commit
d262132b92
@ -154,7 +154,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
|||||||
#endif /* CHECKSUM_CHECK_TCP */
|
#endif /* CHECKSUM_CHECK_TCP */
|
||||||
|
|
||||||
/* sanity-check header length */
|
/* sanity-check header length */
|
||||||
hdrlen_bytes = TCPH_HDRLEN(tcphdr) * 4;
|
hdrlen_bytes = TCPH_HDRLEN_BYTES(tcphdr);
|
||||||
if ((hdrlen_bytes < TCP_HLEN) || (hdrlen_bytes > p->tot_len)) {
|
if ((hdrlen_bytes < TCP_HLEN) || (hdrlen_bytes > p->tot_len)) {
|
||||||
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: invalid header length (%"U16_F")\n", (u16_t)hdrlen_bytes));
|
LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: invalid header length (%"U16_F")\n", (u16_t)hdrlen_bytes));
|
||||||
TCP_STATS_INC(tcp.lenerr);
|
TCP_STATS_INC(tcp.lenerr);
|
||||||
@ -163,12 +163,12 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
|||||||
|
|
||||||
/* Move the payload pointer in the pbuf so that it points to the
|
/* Move the payload pointer in the pbuf so that it points to the
|
||||||
TCP data instead of the TCP header. */
|
TCP data instead of the TCP header. */
|
||||||
tcphdr_optlen = hdrlen_bytes - TCP_HLEN;
|
tcphdr_optlen = (u16_t)(hdrlen_bytes - TCP_HLEN);
|
||||||
tcphdr_opt2 = NULL;
|
tcphdr_opt2 = NULL;
|
||||||
if (p->len >= hdrlen_bytes) {
|
if (p->len >= hdrlen_bytes) {
|
||||||
/* all options are in the first pbuf */
|
/* all options are in the first pbuf */
|
||||||
tcphdr_opt1len = tcphdr_optlen;
|
tcphdr_opt1len = tcphdr_optlen;
|
||||||
pbuf_header(p, -(s16_t)hdrlen_bytes); /* cannot fail */
|
pbuf_header(p, (s16_t)-(s16_t)hdrlen_bytes); /* cannot fail */
|
||||||
} else {
|
} else {
|
||||||
u16_t opt2len;
|
u16_t opt2len;
|
||||||
/* TCP header fits into first pbuf, options don't - data is in the next pbuf */
|
/* TCP header fits into first pbuf, options don't - data is in the next pbuf */
|
||||||
|
@ -1311,12 +1311,12 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb, struct netif *netif
|
|||||||
#endif /* TCP_CHECKSUM_ON_COPY_SANITY_CHECK */
|
#endif /* TCP_CHECKSUM_ON_COPY_SANITY_CHECK */
|
||||||
if ((seg->flags & TF_SEG_DATA_CHECKSUMMED) == 0) {
|
if ((seg->flags & TF_SEG_DATA_CHECKSUMMED) == 0) {
|
||||||
LWIP_ASSERT("data included but not checksummed",
|
LWIP_ASSERT("data included but not checksummed",
|
||||||
seg->p->tot_len == (TCPH_HDRLEN(seg->tcphdr) * 4));
|
seg->p->tot_len == TCPH_HDRLEN_BYTES(seg->tcphdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rebuild TCP header checksum (TCP header changes for retransmissions!) */
|
/* rebuild TCP header checksum (TCP header changes for retransmissions!) */
|
||||||
acc = ip_chksum_pseudo_partial(seg->p, IP_PROTO_TCP,
|
acc = ip_chksum_pseudo_partial(seg->p, IP_PROTO_TCP,
|
||||||
seg->p->tot_len, TCPH_HDRLEN(seg->tcphdr) * 4, &pcb->local_ip, &pcb->remote_ip);
|
seg->p->tot_len, TCPH_HDRLEN_BYTES(seg->tcphdr), &pcb->local_ip, &pcb->remote_ip);
|
||||||
/* add payload checksum */
|
/* add payload checksum */
|
||||||
if (seg->chksum_swapped) {
|
if (seg->chksum_swapped) {
|
||||||
seg->chksum = SWAP_BYTES_IN_WORD(seg->chksum);
|
seg->chksum = SWAP_BYTES_IN_WORD(seg->chksum);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user