Fix build warning for lwip_isdigit/isxdigit/islower/isspace

lwip_isdigit/isxdigit/islower/isspace takes int as argument, so
explicitly cast to int to silence below build warnings.

src/core/ipv4/ip4_addr.c: In function 'ip4addr_aton':
src/core/ipv4/ip4_addr.c:160:5: warning: array subscript has type 'char' [-Wchar-subscripts]
     if (!lwip_isdigit(c)) {
     ^
src/core/ipv4/ip4_addr.c:175:7: warning: array subscript has type 'char' [-Wchar-subscripts]
       if (lwip_isdigit(c)) {
       ^
src/core/ipv4/ip4_addr.c:178:7: warning: array subscript has type 'char' [-Wchar-subscripts]
       } else if (base == 16 && lwip_isxdigit(c)) {
       ^
src/core/ipv4/ip4_addr.c:179:9: warning: array subscript has type 'char' [-Wchar-subscripts]
         val = (val << 4) | (u32_t)(c + 10 - (lwip_islower(c) ? 'a' : 'A'));
         ^
src/core/ipv4/ip4_addr.c:204:3: warning: array subscript has type 'char' [-Wchar-subscripts]
   if (c != '\0' && !lwip_isspace(c)) {
   ^

Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
Axel Lin 2017-11-30 11:27:42 +08:00 committed by Dirk Ziegelmeier
parent 975e23bf5e
commit eb30dbfdc5

View File

@ -220,10 +220,10 @@ typedef int ssize_t;
#define lwip_isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
#else
#include <ctype.h>
#define lwip_isdigit(c) isdigit(c)
#define lwip_isxdigit(c) isxdigit(c)
#define lwip_islower(c) islower(c)
#define lwip_isspace(c) isspace(c)
#define lwip_isdigit(c) isdigit((int)c)
#define lwip_isxdigit(c) isxdigit((int)c)
#define lwip_islower(c) islower((int)c)
#define lwip_isspace(c) isspace((int)c)
#endif
/** C++ const_cast<target_type>(val) equivalent to remove constness from a value (GCC -Wcast-qual) */