diff options
author | nyamatongwe <unknown> | 2010-03-23 06:15:55 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2010-03-23 06:15:55 +0000 |
commit | bf33a815919332706a503dcc28a31582b50d0991 (patch) | |
tree | f2701136167e4dce853202b4a207ec66418ff156 | |
parent | fd0e4a02c782d1a37f552ccfa06743f82bd7c091 (diff) | |
download | scintilla-mirror-bf33a815919332706a503dcc28a31582b50d0991.tar.gz |
Fixed bug where isalpha was called on non-ASCII bytes causing error
reports with Visual Studio.
-rw-r--r-- | src/LexOthers.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/LexOthers.cxx b/src/LexOthers.cxx index 205e0e14a..c8f6ca977 100644 --- a/src/LexOthers.cxx +++ b/src/LexOthers.cxx @@ -37,6 +37,10 @@ static bool Is1To9(char ch) { return (ch >= '1') && (ch <= '9'); } +static bool IsAlphabetic(int ch) { + return isascii(ch) && isalpha(ch); +} + static inline bool AtEOL(Accessor &styler, unsigned int i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); @@ -101,7 +105,7 @@ static void ColouriseBatchLine( } return; // Check for Drive Change (Drive Change is internal command) - return if found - } else if ((isalpha(lineBuffer[offset])) && + } else if ((IsAlphabetic(lineBuffer[offset])) && (lineBuffer[offset + 1] == ':') && ((isspacechar(lineBuffer[offset + 2])) || (((lineBuffer[offset + 2] == '\\')) && @@ -1065,7 +1069,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i. else numstep = 2; // otherwise add 2. - for (j = i + numstep; j < lengthLine && isalpha(lineBuffer[j]) && chPos < sizeof(word) - 1; j++) + for (j = i + numstep; j < lengthLine && IsAlphabetic(lineBuffer[j]) && chPos < sizeof(word) - 1; j++) word[chPos++] = lineBuffer[j]; word[chPos] = 0; if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") || |