slipif: fix several compiler warnings

- include new SNMP header
- add missing pointer type casting
- add missing default cases
- use const for all ip address types
- distinguish between IPv4 and IPv6 address types

Signed-off-by: Stephan Linz <linz@li-pro.net>
This commit is contained in:
Stephan Linz 2016-01-18 09:27:07 +01:00 committed by Dirk Ziegelmeier
parent f2c7e9c939
commit 289d1dd7f3

View File

@ -63,7 +63,7 @@
#include "lwip/def.h"
#include "lwip/pbuf.h"
#include "lwip/stats.h"
#include "lwip/snmp_mib2.h"
#include "lwip/snmp.h"
#include "lwip/sys.h"
#include "lwip/sio.h"
@ -87,7 +87,7 @@
enum slipif_recv_state {
SLIP_RECV_NORMAL,
SLIP_RECV_ESCAPE,
SLIP_RECV_ESCAPE
};
struct slipif_priv {
@ -123,7 +123,7 @@ slipif_output(struct netif *netif, struct pbuf *p)
LWIP_ASSERT("p != NULL", (p != NULL));
LWIP_DEBUGF(SLIP_DEBUG, ("slipif_output(%"U16_F"): sending %"U16_F" bytes\n", (u16_t)netif->num, p->tot_len));
priv = netif->state;
priv = (struct slipif_priv *)netif->state;
/* Send pbuf out on the serial I/O device. */
/* Start with packet delimiter. */
@ -166,7 +166,7 @@ slipif_output(struct netif *netif, struct pbuf *p)
* @return always returns ERR_OK since the serial layer does not provide return values
*/
static err_t
slipif_output_v4(struct netif *netif, struct pbuf *p, ip_addr_t *ipaddr)
slipif_output_v4(struct netif *netif, struct pbuf *p, const ip4_addr_t *ipaddr)
{
LWIP_UNUSED_ARG(ipaddr);
return slipif_output(netif, p);
@ -184,7 +184,7 @@ slipif_output_v4(struct netif *netif, struct pbuf *p, ip_addr_t *ipaddr)
* @return always returns ERR_OK since the serial layer does not provide return values
*/
static err_t
slipif_output_v6(struct netif *netif, struct pbuf *p, ip6_addr_t *ipaddr)
slipif_output_v6(struct netif *netif, struct pbuf *p, const ip6_addr_t *ipaddr)
{
LWIP_UNUSED_ARG(ipaddr);
return slipif_output(netif, p);
@ -208,7 +208,7 @@ slipif_rxbyte(struct netif *netif, u8_t c)
LWIP_ASSERT("netif != NULL", (netif != NULL));
LWIP_ASSERT("netif->state != NULL", (netif->state != NULL));
priv = netif->state;
priv = (struct slipif_priv *)netif->state;
switch (priv->state) {
case SLIP_RECV_NORMAL:
@ -231,6 +231,8 @@ slipif_rxbyte(struct netif *netif, u8_t c)
case SLIP_ESC:
priv->state = SLIP_RECV_ESCAPE;
return NULL;
default:
break;
} /* end switch (c) */
break;
case SLIP_RECV_ESCAPE:
@ -243,9 +245,13 @@ slipif_rxbyte(struct netif *netif, u8_t c)
case SLIP_ESC_ESC:
c = SLIP_ESC;
break;
default:
break;
}
priv->state = SLIP_RECV_NORMAL;
break;
default:
break;
} /* end switch (priv->state) */
/* byte received, packet not yet completely received */