From eb30dbfdc5d458d4b996987d8be9c818743e59e5 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 30 Nov 2017 11:27:42 +0800 Subject: [PATCH] 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 --- src/include/lwip/arch.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/include/lwip/arch.h b/src/include/lwip/arch.h index 0d5db73e..71863b7f 100644 --- a/src/include/lwip/arch.h +++ b/src/include/lwip/arch.h @@ -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 -#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(val) equivalent to remove constness from a value (GCC -Wcast-qual) */