ctype: exclude control bytes from ISPRINT and ISGRAPH

Closes #22371
This commit is contained in:
Alhuda Khan 2026-07-23 12:09:04 +05:30 committed by Daniel Stenberg
parent 090056522b
commit 489a4c1b48
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 7 additions and 4 deletions

View file

@ -30,10 +30,8 @@
#define ISLOWCNTRL(x) ((unsigned char)(x) <= 0x1f)
#define IS7F(x) ((x) == 0x7f)
#define ISLOWPRINT(x) (((x) >= 9) && ((x) <= 0x0d))
#define ISPRINT(x) (ISLOWPRINT(x) || (((x) >= ' ') && ((x) <= 0x7e)))
#define ISGRAPH(x) (ISLOWPRINT(x) || (((x) > ' ') && ((x) <= 0x7e)))
#define ISPRINT(x) (((x) >= ' ') && ((x) <= 0x7e))
#define ISGRAPH(x) (((x) > ' ') && ((x) <= 0x7e))
#define ISCNTRL(x) (ISLOWCNTRL(x) || IS7F(x))
#define ISALPHA(x) (ISLOWER(x) || ISUPPER(x))
#define ISXDIGIT(x) (ISDIGIT(x) || ISLOWHEXALPHA(x) || ISUPHEXALPHA(x))

View file

@ -174,10 +174,15 @@ static CURLcode test_unit1307(const char *arg)
{ "[[:print:]]", "L", MATCH },
{ "[[:print:]]", "\10", NOMATCH },
{ "[[:print:]]", "\10", NOMATCH },
{ "[[:print:]]", "\t", NOMATCH },
{ "[[:print:]]", "\n", NOMATCH },
{ "[[:print:]]", "\r", NOMATCH },
{ "[[:space:]]", " ", MATCH },
{ "[[:space:]]", "x", NOMATCH },
{ "[[:graph:]]", " ", NOMATCH },
{ "[[:graph:]]", "x", MATCH },
{ "[[:graph:]]", "\t", NOMATCH },
{ "[[:graph:]]", "\r", NOMATCH },
{ "[[:blank:]]", "\t", MATCH },
{ "[[:blank:]]", " ", MATCH },
{ "[[:blank:]]", "\r", NOMATCH },