diff options
| author | nyamatongwe <unknown> | 2004-06-08 12:36:48 +0000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2004-06-08 12:36:48 +0000 | 
| commit | 8109f9b2131a3c5458734a1fa5bd005b43fb632f (patch) | |
| tree | 058802b4a4ed5ecde2ef679270c47dc446a16b91 | |
| parent | 41aaf1a65a98fcfe37a67405213cc1a5d41a2b11 (diff) | |
| download | scintilla-mirror-8109f9b2131a3c5458734a1fa5bd005b43fb632f.tar.gz | |
Made safe for non-ASCII characters by using character
classification functions that accept non-ASCII or checking
for ASCII before calling ctype functions.
| -rw-r--r-- | src/LexAda.cxx | 20 | 
1 files changed, 10 insertions, 10 deletions
| diff --git a/src/LexAda.cxx b/src/LexAda.cxx index 2e5f891b4..0227ce110 100644 --- a/src/LexAda.cxx +++ b/src/LexAda.cxx @@ -256,7 +256,7 @@ static void ColouriseDocument(  			ColouriseLabel(sc, keywords, apostropheStartsAttribute);  		// Whitespace -		} else if (isspace(sc.ch)) { +		} else if (IsASpace(sc.ch)) {  			ColouriseWhiteSpace(sc, apostropheStartsAttribute);  		// Delimiters @@ -264,7 +264,7 @@ static void ColouriseDocument(  			ColouriseDelimiter(sc, apostropheStartsAttribute);  		// Numbers -		} else if (isdigit(sc.ch) || sc.ch == '#') { +		} else if (IsADigit(sc.ch) || sc.ch == '#') {  			ColouriseNumber(sc, apostropheStartsAttribute);  		// Keywords or identifiers @@ -310,11 +310,11 @@ static inline bool IsNumberCharacter(int ch) {  }  static inline bool IsNumberStartCharacter(int ch) { -	return isdigit(ch) != 0; +	return IsADigit(ch);  }  static inline bool IsSeparatorOrDelimiterCharacter(int ch) { -	return isspace(ch) || IsDelimiterCharacter(ch); +	return IsASpace(ch) || IsDelimiterCharacter(ch);  }  static bool IsValidIdentifier(const SString& identifier) { @@ -377,7 +377,7 @@ static bool IsValidNumber(const SString& number) {  				}  				canBeSpecial = false;  				seenDot = true; -			} else if (isdigit(number[i])) { +			} else if (IsADigit(number[i])) {  				canBeSpecial = true;  			} else {  				break; @@ -398,7 +398,7 @@ static bool IsValidNumber(const SString& number) {  				if (!canBeSpecial)  					return false;  				canBeSpecial = false; -			} else if (isdigit (ch)) { +			} else if (IsADigit(ch)) {  				base = base * 10 + (ch - '0');  				if (base > 16)  					return false; @@ -436,7 +436,7 @@ static bool IsValidNumber(const SString& number) {  				canBeSpecial = false;  				seenDot = true; -			} else if (isdigit (ch)) { +			} else if (IsADigit(ch)) {  				if (ch - '0' >= base) {  					return false;  				} @@ -496,7 +496,7 @@ static bool IsValidNumber(const SString& number) {  					return false;  				}  				canBeSpecial = false; -			} else if (isdigit(number[i])) { +			} else if (IsADigit(number[i])) {  				canBeSpecial = true;  			} else {  				return false; @@ -512,9 +512,9 @@ static bool IsValidNumber(const SString& number) {  }  static inline bool IsWordCharacter(int ch) { -	return IsWordStartCharacter(ch) || isdigit(ch); +	return IsWordStartCharacter(ch) || IsADigit(ch);  }  static inline bool IsWordStartCharacter(int ch) { -	return isalpha(ch) || ch == '_'; +	return (isascii(ch) && isalpha(ch)) || ch == '_';  } | 
