Add (unsigned char) cast to all ctype macros

This commit is contained in:
Andrey A. Chernov 1997-10-23 01:29:44 +00:00
parent 48f814b934
commit 92463139ce
2 changed files with 37 additions and 37 deletions

View File

@ -65,30 +65,30 @@ extern int errno;
#if defined(STDC_HEADERS) || (!defined(isascii) && !defined(HAVE_ISASCII)) #if defined(STDC_HEADERS) || (!defined(isascii) && !defined(HAVE_ISASCII))
#define ISASCII(c) 1 #define ISASCII(c) 1
#else #else
#define ISASCII(c) isascii(c) #define ISASCII(c) isascii((unsigned char)c)
#endif #endif
#ifdef isblank #ifdef isblank
#define ISBLANK(c) (ISASCII(c) && isblank(c)) #define ISBLANK(c) (ISASCII(c) && isblank((unsigned char)c))
#else #else
#define ISBLANK(c) ((c) == ' ' || (c) == '\t') #define ISBLANK(c) ((c) == ' ' || (c) == '\t')
#endif #endif
#ifdef isgraph #ifdef isgraph
#define ISGRAPH(c) (ISASCII(c) && isgraph(c)) #define ISGRAPH(c) (ISASCII(c) && isgraph((unsigned char)c))
#else #else
#define ISGRAPH(c) (ISASCII(c) && isprint(c) && !isspace(c)) #define ISGRAPH(c) (ISASCII(c) && isprint((unsigned char)c) && !isspace((unsigned char)c))
#endif #endif
#define ISPRINT(c) (ISASCII (c) && isprint (c)) #define ISPRINT(c) (ISASCII (c) && isprint ((unsigned char)c))
#define ISDIGIT(c) (ISASCII (c) && isdigit (c)) #define ISDIGIT(c) (ISASCII (c) && isdigit ((unsigned char)c))
#define ISALNUM(c) (ISASCII (c) && isalnum (c)) #define ISALNUM(c) (ISASCII (c) && isalnum ((unsigned char)c))
#define ISALPHA(c) (ISASCII (c) && isalpha (c)) #define ISALPHA(c) (ISASCII (c) && isalpha ((unsigned char)c))
#define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) #define ISCNTRL(c) (ISASCII (c) && iscntrl ((unsigned char)c))
#define ISLOWER(c) (ISASCII (c) && islower (c)) #define ISLOWER(c) (ISASCII (c) && islower ((unsigned char)c))
#define ISPUNCT(c) (ISASCII (c) && ispunct (c)) #define ISPUNCT(c) (ISASCII (c) && ispunct ((unsigned char)c))
#define ISSPACE(c) (ISASCII (c) && isspace (c)) #define ISSPACE(c) (ISASCII (c) && isspace ((unsigned char)c))
#define ISUPPER(c) (ISASCII (c) && isupper (c)) #define ISUPPER(c) (ISASCII (c) && isupper ((unsigned char)c))
#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c)) #define ISXDIGIT(c) (ISASCII (c) && isxdigit ((unsigned char)c))
#ifdef __STDC__ #ifdef __STDC__

View File

@ -48,33 +48,33 @@ extern void free();
#endif /* DEBUG */ #endif /* DEBUG */
#ifndef isgraph #ifndef isgraph
#define isgraph(C) (isprint(C) && !isspace(C)) #define isgraph(C) (isprint((unsigned char)C) && !isspace((unsigned char)C))
#endif #endif
#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
#define ISALPHA(C) isalpha(C) #define ISALPHA(C) isalpha((unsigned char)C)
#define ISUPPER(C) isupper(C) #define ISUPPER(C) isupper((unsigned char)C)
#define ISLOWER(C) islower(C) #define ISLOWER(C) islower((unsigned char)C)
#define ISDIGIT(C) isdigit(C) #define ISDIGIT(C) isdigit((unsigned char)C)
#define ISXDIGIT(C) isxdigit(C) #define ISXDIGIT(C) isxdigit((unsigned char)C)
#define ISSPACE(C) isspace(C) #define ISSPACE(C) isspace((unsigned char)C)
#define ISPUNCT(C) ispunct(C) #define ISPUNCT(C) ispunct((unsigned char)C)
#define ISALNUM(C) isalnum(C) #define ISALNUM(C) isalnum((unsigned char)C)
#define ISPRINT(C) isprint(C) #define ISPRINT(C) isprint((unsigned char)C)
#define ISGRAPH(C) isgraph(C) #define ISGRAPH(C) isgraph((unsigned char)C)
#define ISCNTRL(C) iscntrl(C) #define ISCNTRL(C) iscntrl((unsigned char)C)
#else #else
#define ISALPHA(C) (isascii(C) && isalpha(C)) #define ISALPHA(C) (isascii((unsigned char)C) && isalpha(C))
#define ISUPPER(C) (isascii(C) && isupper(C)) #define ISUPPER(C) (isascii((unsigned char)C) && isupper(C))
#define ISLOWER(C) (isascii(C) && islower(C)) #define ISLOWER(C) (isascii((unsigned char)C) && islower(C))
#define ISDIGIT(C) (isascii(C) && isdigit(C)) #define ISDIGIT(C) (isascii((unsigned char)C) && isdigit(C))
#define ISXDIGIT(C) (isascii(C) && isxdigit(C)) #define ISXDIGIT(C) (isascii((unsigned char)C) && isxdigit(C))
#define ISSPACE(C) (isascii(C) && isspace(C)) #define ISSPACE(C) (isascii((unsigned char)C) && isspace(C))
#define ISPUNCT(C) (isascii(C) && ispunct(C)) #define ISPUNCT(C) (isascii((unsigned char)C) && ispunct(C))
#define ISALNUM(C) (isascii(C) && isalnum(C)) #define ISALNUM(C) (isascii((unsigned char)C) && isalnum(C))
#define ISPRINT(C) (isascii(C) && isprint(C)) #define ISPRINT(C) (isascii((unsigned char)C) && isprint(C))
#define ISGRAPH(C) (isascii(C) && isgraph(C)) #define ISGRAPH(C) (isascii((unsigned char)C) && isgraph(C))
#define ISCNTRL(C) (isascii(C) && iscntrl(C)) #define ISCNTRL(C) (isascii((unsigned char)C) && iscntrl(C))
#endif #endif
#ifndef __FreeBSD__ #ifndef __FreeBSD__