From ec93b03d8d638752db02e702044f94f3e87a3fda Mon Sep 17 00:00:00 2001 From: goldsimon Date: Fri, 7 Nov 2014 14:29:53 +0100 Subject: [PATCH] Fixed multiple smaller compiler warnings --- src/core/ipv4/ip4.c | 2 +- src/core/mem.c | 2 +- src/include/lwip/arch.h | 4 ++++ src/include/lwip/dhcp.h | 2 -- src/include/lwip/opt.h | 21 ++++++++++++++------- src/include/lwip/pbuf.h | 2 +- src/netif/ppp/polarssl/des.c | 2 ++ src/netif/ppp/polarssl/md4.c | 2 ++ src/netif/ppp/polarssl/md5.c | 2 ++ src/netif/ppp/polarssl/sha1.c | 2 ++ 10 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c index b07483c7..5922fcd0 100644 --- a/src/core/ipv4/ip4.c +++ b/src/core/ipv4/ip4.c @@ -552,7 +552,7 @@ ip_input(struct pbuf *p, struct netif *inp) if (raw_input(p, inp) == 0) #endif /* LWIP_RAW */ { - pbuf_header(p, -iphdr_hlen); /* Move to payload, no check necessary. */ + pbuf_header(p, -(s16_t)iphdr_hlen); /* Move to payload, no check necessary. */ switch (IPH_PROTO(iphdr)) { #if LWIP_UDP diff --git a/src/core/mem.c b/src/core/mem.c index 85386cd6..bda808bc 100644 --- a/src/core/mem.c +++ b/src/core/mem.c @@ -179,7 +179,7 @@ struct mem { * how that space is calculated). */ #ifndef LWIP_RAM_HEAP_POINTER /** the heap. we need one struct mem at the end and some room for alignment */ -u8_t ram_heap[MEM_SIZE_ALIGNED + (2*SIZEOF_STRUCT_MEM) + MEM_ALIGNMENT]; +u8_t ram_heap[MEM_SIZE_ALIGNED + (2U*SIZEOF_STRUCT_MEM) + MEM_ALIGNMENT]; #define LWIP_RAM_HEAP_POINTER ram_heap #endif /* LWIP_RAM_HEAP_POINTER */ diff --git a/src/include/lwip/arch.h b/src/include/lwip/arch.h index 083a9dc5..4cdb764a 100644 --- a/src/include/lwip/arch.h +++ b/src/include/lwip/arch.h @@ -64,6 +64,10 @@ extern "C" { #define PACK_STRUCT_END #endif /* PACK_STRUCT_END */ +#ifndef PACK_STRUCT_STRUCT +#define PACK_STRUCT_STRUCT +#endif /* PACK_STRUCT_STRUCT */ + #ifndef PACK_STRUCT_FIELD #define PACK_STRUCT_FIELD(x) x #endif /* PACK_STRUCT_FIELD */ diff --git a/src/include/lwip/dhcp.h b/src/include/lwip/dhcp.h index bba08970..c8eede1c 100644 --- a/src/include/lwip/dhcp.h +++ b/src/include/lwip/dhcp.h @@ -57,8 +57,6 @@ struct dhcp u32_t offered_t0_lease; /* lease period (in seconds) */ u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */ u32_t offered_t2_rebind; /* recommended rebind time (usually 66% of lease period) */ - /* @todo: LWIP_DHCP_BOOTP_FILE configuration option? - integrate with possible TFTP-client for booting? */ #if LWIP_DHCP_BOOTP_FILE ip_addr_t offered_si_addr; char boot_file_name[DHCP_FILE_LEN]; diff --git a/src/include/lwip/opt.h b/src/include/lwip/opt.h index 481bf766..e0adf77e 100644 --- a/src/include/lwip/opt.h +++ b/src/include/lwip/opt.h @@ -751,6 +751,13 @@ #define DHCP_DOES_ARP_CHECK ((LWIP_DHCP) && (LWIP_ARP)) #endif +/** + * LWIP_DHCP_BOOTP_FILE==1: Store offered_si_addr and boot_file_name. + */ +#ifndef LWIP_DHCP_BOOTP_FILE +#define LWIP_DHCP_BOOTP_FILE 0 +#endif + /* ------------------------------------ ---------- AUTOIP options ---------- @@ -1767,6 +1774,13 @@ #define PPPOS_SUPPORT PPP_SUPPORT #endif +/** + * LWIP_PPP_API==1: Enable PPP API (in pppapi.c) + */ +#ifndef LWIP_PPP_API +#define LWIP_PPP_API 0 +#endif + #if PPP_SUPPORT /** @@ -1794,13 +1808,6 @@ #define PPP_IPV6_SUPPORT 0 #endif -/** - * LWIP_PPP_API==1: Enable PPP API (in pppapi.c) - */ -#ifndef LWIP_PPP_API -#define LWIP_PPP_API 0 -#endif - /** * PPP_NOTIFY_PHASE==1: Support PPP notify phase support * diff --git a/src/include/lwip/pbuf.h b/src/include/lwip/pbuf.h index b99e1c4a..25a32d7d 100644 --- a/src/include/lwip/pbuf.h +++ b/src/include/lwip/pbuf.h @@ -156,7 +156,7 @@ struct pbuf *pbuf_alloced_custom(pbuf_layer l, u16_t length, pbuf_type type, struct pbuf_custom *p, void *payload_mem, u16_t payload_mem_len); #endif /* LWIP_SUPPORT_CUSTOM_PBUF */ -void pbuf_realloc(struct pbuf *p, u16_t size); +void pbuf_realloc(struct pbuf *p, u16_t size); u8_t pbuf_header(struct pbuf *p, s16_t header_size); void pbuf_ref(struct pbuf *p); u8_t pbuf_free(struct pbuf *p); diff --git a/src/netif/ppp/polarssl/des.c b/src/netif/ppp/polarssl/des.c index e6a7a0dd..fde4809a 100644 --- a/src/netif/ppp/polarssl/des.c +++ b/src/netif/ppp/polarssl/des.c @@ -40,6 +40,7 @@ */ #include "lwip/opt.h" +#if PPP_SUPPORT #if LWIP_INCLUDED_POLARSSL_DES #include "netif/ppp/polarssl/des.h" @@ -419,4 +420,5 @@ void des_crypt_ecb( des_context *ctx, PUT_ULONG_BE( X, output, 4 ); } +#endif /* PPP_SUPPORT */ #endif /* LWIP_INCLUDED_POLARSSL_DES */ diff --git a/src/netif/ppp/polarssl/md4.c b/src/netif/ppp/polarssl/md4.c index aea6ed8f..e7692ad8 100644 --- a/src/netif/ppp/polarssl/md4.c +++ b/src/netif/ppp/polarssl/md4.c @@ -40,6 +40,7 @@ */ #include "lwip/opt.h" +#if PPP_SUPPORT #if LWIP_INCLUDED_POLARSSL_MD4 #include "netif/ppp/polarssl/md4.h" @@ -276,4 +277,5 @@ void md4( unsigned char *input, int ilen, unsigned char output[16] ) md4_finish( &ctx, output ); } +#endif /* PPP_SUPPORT */ #endif /* LWIP_INCLUDED_POLARSSL_MD4 */ diff --git a/src/netif/ppp/polarssl/md5.c b/src/netif/ppp/polarssl/md5.c index c5e08a0d..877c9cd1 100644 --- a/src/netif/ppp/polarssl/md5.c +++ b/src/netif/ppp/polarssl/md5.c @@ -39,6 +39,7 @@ */ #include "lwip/opt.h" +#if PPP_SUPPORT #if LWIP_INCLUDED_POLARSSL_MD5 #include "netif/ppp/polarssl/md5.h" @@ -295,4 +296,5 @@ void md5( unsigned char *input, int ilen, unsigned char output[16] ) md5_finish( &ctx, output ); } +#endif /* PPP_SUPPORT */ #endif /* LWIP_INCLUDED_POLARSSL_MD5 */ diff --git a/src/netif/ppp/polarssl/sha1.c b/src/netif/ppp/polarssl/sha1.c index f71ec416..0887b4ea 100644 --- a/src/netif/ppp/polarssl/sha1.c +++ b/src/netif/ppp/polarssl/sha1.c @@ -39,6 +39,7 @@ */ #include "lwip/opt.h" +#if PPP_SUPPORT #if LWIP_INCLUDED_POLARSSL_SHA1 #include "netif/ppp/polarssl/sha1.h" @@ -330,4 +331,5 @@ void sha1( unsigned char *input, int ilen, unsigned char output[20] ) sha1_finish( &ctx, output ); } +#endif /* PPP_SUPPORT */ #endif /* LWIP_INCLUDED_POLARSSL_SHA1 */