diff options
| author | nyamatongwe <devnull@localhost> | 2008-04-20 03:01:04 +0000 | 
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2008-04-20 03:01:04 +0000 | 
| commit | 3be48e12ea69c4443d7296ad6e00bb77bf9d6f04 (patch) | |
| tree | fd4f9af4c09e56d957cc1ac5de7b1b40809632f9 | |
| parent | 75eaf540335c5960d49bbda02bf83ac412019025 (diff) | |
| download | scintilla-mirror-3be48e12ea69c4443d7296ad6e00bb77bf9d6f04.tar.gz | |
Safety for non-ASCII characters when calling ctype functions.
| -rw-r--r-- | src/LexAsm.cxx | 8 | ||||
| -rw-r--r-- | src/LexBash.cxx | 2 | ||||
| -rw-r--r-- | src/LexCSS.cxx | 6 | 
3 files changed, 8 insertions, 8 deletions
| diff --git a/src/LexAsm.cxx b/src/LexAsm.cxx index 9dd4df456..6a3902d52 100644 --- a/src/LexAsm.cxx +++ b/src/LexAsm.cxx @@ -37,8 +37,8 @@ static inline bool IsAWordStart(const int ch) {  		ch == '%' || ch == '@' || ch == '$' || ch == '?');  } -static inline bool IsAsmOperator(char ch) { -	if (isalnum(ch)) +static inline bool IsAsmOperator(const int ch) { +	if ((ch < 0x80) && (isalnum(ch)))  		return false;  	// '.' left out as it is used to make up numbers  	if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || @@ -89,7 +89,7 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo  		// Determine if the current state should terminate.  		if (sc.state == SCE_ASM_OPERATOR) { -			if (!IsAsmOperator(static_cast<char>(sc.ch))) { +			if (!IsAsmOperator(sc.ch)) {  			    sc.SetState(SCE_ASM_DEFAULT);  			}  		}else if (sc.state == SCE_ASM_NUMBER) { @@ -157,7 +157,7 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo  				sc.SetState(SCE_ASM_STRING);  			} else if (sc.ch == '\'') {  				sc.SetState(SCE_ASM_CHARACTER); -			} else if (IsAsmOperator(static_cast<char>(sc.ch))) { +			} else if (IsAsmOperator(sc.ch)) {  				sc.SetState(SCE_ASM_OPERATOR);  			}  		} diff --git a/src/LexBash.cxx b/src/LexBash.cxx index f0376b947..0797e68a9 100644 --- a/src/LexBash.cxx +++ b/src/LexBash.cxx @@ -273,7 +273,7 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,  				ch = chNext;  				chNext = chNext2;  				styler.ColourTo(i, SCE_SH_IDENTIFIER); -			} else if (isdigit(ch)) { +			} else if (isascii(ch) && isdigit(ch)) {  				state = SCE_SH_NUMBER;  				numBase = BASH_BASE_DECIMAL;  				if (ch == '0') {	// hex,octal 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 == '{') | 
