Fix two -Wconversion warnings

This commit is contained in:
Dirk Ziegelmeier 2017-07-15 10:25:19 +02:00
parent 3c371e4d52
commit 328134fdba
2 changed files with 2 additions and 2 deletions

View File

@ -1887,7 +1887,7 @@ tcp_parseopt(struct tcp_pcb *pcb)
return;
}
/* An MSS option with the right option length. */
mss = (tcp_getoptbyte() << 8);
mss = (u16_t)(tcp_getoptbyte() << 8);
mss |= tcp_getoptbyte();
/* Limit the mss to the configured TCP_MSS and prevent division by zero */
pcb->mss = ((mss > TCP_MSS) || (mss == 0)) ? TCP_MSS : mss;

View File

@ -82,7 +82,7 @@ PACK_STRUCT_END
#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_FLAGS(phdr) ((u8_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))
#define TCPH_FLAGS_SET(phdr, flags) (phdr)->_hdrlen_rsvd_flags = (((phdr)->_hdrlen_rsvd_flags & PP_HTONS(~TCP_FLAGS)) | lwip_htons(flags))