From 85ab39985a0cbb963110214b00ddfb080e64061c Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Mon, 8 Aug 2016 22:15:01 +0200 Subject: [PATCH] Fix a few incorrect uses of err_t. Found by converting lwip error codes to an enum, but I'm not sure wether I want to commit the actual enum conversion. --- src/apps/lwiperf/lwiperf.c | 5 +++-- src/apps/sntp/sntp.c | 2 +- src/core/ipv6/ip6_frag.c | 12 ++++++------ src/netif/ppp/pppoe.c | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/apps/lwiperf/lwiperf.c b/src/apps/lwiperf/lwiperf.c index 06868676..1682f358 100644 --- a/src/apps/lwiperf/lwiperf.c +++ b/src/apps/lwiperf/lwiperf.c @@ -405,6 +405,7 @@ lwiperf_tx_start(lwiperf_state_tcp_t* conn) static err_t lwiperf_tcp_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) { + u8_t tmp; u16_t tot_len; u32_t packet_idx; struct pbuf* q; @@ -470,8 +471,8 @@ lwiperf_tcp_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) return ERR_OK; } conn->next_num = 4; /* 24 bytes received... */ - err = pbuf_header(p, -24); - LWIP_ASSERT("pbuf_header failed", err == ERR_OK); + tmp = pbuf_header(p, -24); + LWIP_ASSERT("pbuf_header failed", tmp == 0); } packet_idx = 0; diff --git a/src/apps/sntp/sntp.c b/src/apps/sntp/sntp.c index 8d43eb0b..a9143180 100644 --- a/src/apps/sntp/sntp.c +++ b/src/apps/sntp/sntp.c @@ -94,7 +94,7 @@ #define SNTP_DEBUG_WARN_STATE (SNTP_DEBUG | LWIP_DBG_LEVEL_WARNING | LWIP_DBG_STATE) #define SNTP_DEBUG_SERIOUS (SNTP_DEBUG | LWIP_DBG_LEVEL_SERIOUS) -#define SNTP_ERR_KOD 1 +#define SNTP_ERR_KOD ERR_CLSD /* SNTP protocol defines */ #define SNTP_MSG_LEN 48 diff --git a/src/core/ipv6/ip6_frag.c b/src/core/ipv6/ip6_frag.c index f574d380..a5f28906 100644 --- a/src/core/ipv6/ip6_frag.c +++ b/src/core/ipv6/ip6_frag.c @@ -377,8 +377,8 @@ ip6_reass(struct pbuf *p) if (IPV6_FRAG_REQROOM > 0) { /* Make room for struct ip6_reass_helper (only required if sizeof(void*) > 4). This cannot fail since we already checked when receiving this fragment. */ - err_t hdrerr = pbuf_header_force(p, IPV6_FRAG_REQROOM); - LWIP_ASSERT("no room for struct ip6_reass_helper", hdrerr == ERR_OK); + u8_t hdrerr = pbuf_header_force(p, IPV6_FRAG_REQROOM); + LWIP_ASSERT("no room for struct ip6_reass_helper", hdrerr == 0); } #else /* IPV6_FRAG_COPYHEADER */ LWIP_ASSERT("sizeof(struct ip6_reass_helper) <= IP6_FRAG_HLEN, set IPV6_FRAG_COPYHEADER to 1", @@ -528,8 +528,8 @@ ip6_reass(struct pbuf *p) #if IPV6_FRAG_COPYHEADER if (IPV6_FRAG_REQROOM > 0) { /* hide the extra bytes borrowed from ip6_hdr for struct ip6_reass_helper */ - err_t hdrerr = pbuf_header(next_pbuf, -(s16_t)(IPV6_FRAG_REQROOM)); - LWIP_ASSERT("no room for struct ip6_reass_helper", hdrerr == ERR_OK); + u8_t hdrerr = pbuf_header(next_pbuf, -(s16_t)(IPV6_FRAG_REQROOM)); + LWIP_ASSERT("no room for struct ip6_reass_helper", hdrerr == 0); } #endif pbuf_cat(ipr->p, next_pbuf); @@ -544,8 +544,8 @@ ip6_reass(struct pbuf *p) #if IPV6_FRAG_COPYHEADER if (IPV6_FRAG_REQROOM > 0) { /* get back room for struct ip6_reass_helper (only required if sizeof(void*) > 4) */ - err_t hdrerr = pbuf_header(ipr->p, -(s16_t)(IPV6_FRAG_REQROOM)); - LWIP_ASSERT("no room for struct ip6_reass_helper", hdrerr == ERR_OK); + u8_t hdrerr = pbuf_header(ipr->p, -(s16_t)(IPV6_FRAG_REQROOM)); + LWIP_ASSERT("no room for struct ip6_reass_helper", hdrerr == 0); } iphdr_ptr = (struct ip6_hdr*)((u8_t*)ipr->p->payload - IP6_HLEN); MEMCPY(iphdr_ptr, &ipr->iphdr, IP6_HLEN); diff --git a/src/netif/ppp/pppoe.c b/src/netif/ppp/pppoe.c index 1530611d..24d9c4f5 100644 --- a/src/netif/ppp/pppoe.c +++ b/src/netif/ppp/pppoe.c @@ -881,7 +881,7 @@ pppoe_timeout(void *arg) static err_t pppoe_connect(ppp_pcb *ppp, void *ctx) { - int err; + err_t err; struct pppoe_softc *sc = (struct pppoe_softc *)ctx; lcp_options *lcp_wo; lcp_options *lcp_ao;