mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-25 18:14:53 +00:00
Fix bug #52611: Incorrect use of ctype macros?
by applying a modified version of Axel Lin's patch including Mike Kleshov's comments.
This commit is contained in:
parent
ec9f227eae
commit
60063b98e1
@ -213,17 +213,17 @@ typedef int ssize_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LWIP_NO_CTYPE_H
|
#if LWIP_NO_CTYPE_H
|
||||||
#define lwip_in_range(c, lo, up) ((u8_t)c >= lo && (u8_t)c <= up)
|
#define lwip_in_range(c, lo, up) ((u8_t)(c) >= (lo) && (u8_t)(c) <= (up))
|
||||||
#define lwip_isdigit(c) lwip_in_range(c, '0', '9')
|
#define lwip_isdigit(c) lwip_in_range((c), '0', '9')
|
||||||
#define lwip_isxdigit(c) (lwip_isdigit(c) || lwip_in_range(c, 'a', 'f') || lwip_in_range(c, 'A', 'F'))
|
#define lwip_isxdigit(c) (lwip_isdigit(c) || lwip_in_range((c), 'a', 'f') || lwip_in_range((c), 'A', 'F'))
|
||||||
#define lwip_islower(c) lwip_in_range(c, 'a', 'z')
|
#define lwip_islower(c) lwip_in_range((c), 'a', 'z')
|
||||||
#define lwip_isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
|
#define lwip_isspace(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || (c) == '\r' || (c) == '\t' || (c) == '\v')
|
||||||
#else
|
#else
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#define lwip_isdigit(c) isdigit((int)c)
|
#define lwip_isdigit(c) isdigit((unsigned char)(c))
|
||||||
#define lwip_isxdigit(c) isxdigit((int)c)
|
#define lwip_isxdigit(c) isxdigit((unsigned char)(c))
|
||||||
#define lwip_islower(c) islower((int)c)
|
#define lwip_islower(c) islower((unsigned char)(c))
|
||||||
#define lwip_isspace(c) isspace((int)c)
|
#define lwip_isspace(c) isspace((unsigned char)(c))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** C++ const_cast<target_type>(val) equivalent to remove constness from a value (GCC -Wcast-qual) */
|
/** C++ const_cast<target_type>(val) equivalent to remove constness from a value (GCC -Wcast-qual) */
|
||||||
|
Loading…
Reference in New Issue
Block a user