Fix for 'isalnum' in Windows
According to the MSN documentation 'isalnum(c)' is only valid when c equals EOF, or is in the range 0 to 255 inclusive. It states the behavior is undefined outside this range, and in Debug mode triggers an assert dialog.
This commit is contained in:
parent
fd77312175
commit
77420b94d0
10
src/attrs.c
10
src/attrs.c
|
@ -1475,13 +1475,21 @@ static void CheckLowerCaseAttrValue( TidyDocImpl* doc, Node *node, AttVal *attva
|
||||||
}
|
}
|
||||||
|
|
||||||
/* methods for checking value of a specific attribute */
|
/* methods for checking value of a specific attribute */
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define ISUPPER(a) ((a >= 'A') && (a <= 'Z'))
|
||||||
|
#define ISLOWER(a) ((a >= 'a') && (a <= 'z'))
|
||||||
|
#define ISNUMERIC(a) ((a >= '0') && (a <= '9'))
|
||||||
|
#define ISALNUM(a) (ISUPPER(a) || ISLOWER(a) || ISNUMERIC(a))
|
||||||
|
#else
|
||||||
|
#define ISALNUM(a) isalnum(a)
|
||||||
|
#endif
|
||||||
|
|
||||||
static Bool IsURLCodePoint( ctmbstr p, uint *increment )
|
static Bool IsURLCodePoint( ctmbstr p, uint *increment )
|
||||||
{
|
{
|
||||||
uint c;
|
uint c;
|
||||||
*increment = TY_(GetUTF8)( p, &c ) + 1;
|
*increment = TY_(GetUTF8)( p, &c ) + 1;
|
||||||
|
|
||||||
return isalnum( c ) ||
|
return ISALNUM( c ) ||
|
||||||
c == '%' || /* not a valid codepoint, but an escape sequence */
|
c == '%' || /* not a valid codepoint, but an escape sequence */
|
||||||
c == '#' || /* not a valid codepoint, but a delimiter */
|
c == '#' || /* not a valid codepoint, but a delimiter */
|
||||||
c == '!' ||
|
c == '!' ||
|
||||||
|
|
Loading…
Reference in a new issue