diff options
author | nyamatongwe <unknown> | 2008-04-20 03:01:04 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2008-04-20 03:01:04 +0000 |
commit | bcceb7d8295269d7b468d41f70413ea108abb192 (patch) | |
tree | fd4f9af4c09e56d957cc1ac5de7b1b40809632f9 /src/LexCSS.cxx | |
parent | 71c30fc4aa2cea19dc884ede105fa098cc99a210 (diff) | |
download | scintilla-mirror-bcceb7d8295269d7b468d41f70413ea108abb192.tar.gz |
Safety for non-ASCII characters when calling ctype functions.
Diffstat (limited to 'src/LexCSS.cxx')
-rw-r--r-- | src/LexCSS.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/LexCSS.cxx b/src/LexCSS.cxx index f5c112d6f..73f419cf5 100644 --- a/src/LexCSS.cxx +++ b/src/LexCSS.cxx @@ -31,8 +31,8 @@ static inline bool IsAWordChar(const unsigned int ch) { return (isalnum(ch) || ch == '-' || ch == '_' || ch >= 161); // _ is not in fact correct CSS word-character } -inline bool IsCssOperator(const char ch) { - if (!isalnum(ch) && +inline bool IsCssOperator(const int ch) { + if (!((ch < 0x80) && isalnum(ch)) && (ch == '{' || ch == '}' || ch == ':' || ch == ',' || ch == ';' || ch == '.' || ch == '#' || ch == '!' || ch == '@' || /* CSS2 */ @@ -232,7 +232,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo sc.Forward(); } else if (sc.state == SCE_CSS_VALUE && (sc.ch == '\"' || sc.ch == '\'')) { sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING)); - } else if (IsCssOperator(static_cast<char>(sc.ch)) + } else if (IsCssOperator(sc.ch) && (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']') && (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!') && (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{') |