diff options
| -rw-r--r-- | src/Document.cxx | 27 | ||||
| -rw-r--r-- | src/PosRegExp.cxx | 9 | ||||
| -rw-r--r-- | src/PropSet.cxx | 2 | ||||
| -rw-r--r-- | win32/makefile | 4 | 
4 files changed, 34 insertions, 8 deletions
| diff --git a/src/Document.cxx b/src/Document.cxx index babe25bcf..ac9c381a0 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -747,6 +747,23 @@ char Document::DocCharAt(int pos, void *param) {  	return reinterpret_cast<Document*>(param)->CharAt(pos);  } +// The comparison and case changing functions here assume ASCII +// or extended ASCII such as the normal Windows code page. + +static inline char MakeUpperCase(char ch) { +	if (ch < 'a' || ch > 'z') +		return ch; +	else +		return static_cast<char>(ch - 'a' + 'A'); +} + +static inline char MakeLowerCase(char ch) { +	if (ch < 'A' || ch > 'Z') +		return ch; +	else +		return static_cast<char>(ch - 'A' + 'a'); +} +  // Find text in document, supporting both forward and backward  // searches (just pass minPos > maxPos to do a backward search)  // Has not been tested with backwards DBCS searches yet. @@ -811,7 +828,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,  		//Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind);  		char firstChar = s[0];  		if (!caseSensitive) -			firstChar = static_cast<char>(toupper(firstChar)); +			firstChar = static_cast<char>(MakeUpperCase(firstChar));  		int pos = startPos;  		while (forward ? (pos < endSearch) : (pos >= endSearch)) {  			char ch = CharAt(pos); @@ -831,11 +848,11 @@ long Document::FindText(int minPos, int maxPos, const char *s,  					}  				}  			} else { -				if (toupper(ch) == firstChar) { +				if (MakeUpperCase(ch) == firstChar) {  					bool found = true;  					for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {  						ch = CharAt(pos + posMatch); -						if (toupper(ch) != toupper(s[posMatch])) +						if (MakeUpperCase(ch) != MakeUpperCase(s[posMatch]))  							found = false;  					}  					if (found) { @@ -869,11 +886,11 @@ void Document::ChangeCase(Range r, bool makeUpperCase) {  		} else {  			if (makeUpperCase) {  				if (islower(ch)) { -					ChangeChar(pos, static_cast<char>(toupper(ch))); +					ChangeChar(pos, static_cast<char>(MakeUpperCase(ch)));  				}  			} else {  				if (isupper(ch)) { -					ChangeChar(pos, static_cast<char>(tolower(ch))); +					ChangeChar(pos, static_cast<char>(MakeLowerCase(ch)));  				}  			}  		} diff --git a/src/PosRegExp.cxx b/src/PosRegExp.cxx index 01870848d..eb240e2fb 100644 --- a/src/PosRegExp.cxx +++ b/src/PosRegExp.cxx @@ -8,7 +8,14 @@  #ifdef _MSC_VER  #pragma warning(disable: 4244)  #endif - +#ifdef __BORLANDC__ +// Too much effort to to cean this code up so just ignore badly  +// bracketed initialisers, conversions losing significant digits,  +// and values assigned but not used. +#pragma warn -pin +#pragma warn -sig +#pragma warn -aus +#endif  //Up: /[A-Z \x80-\x9f \xf0 ]/x  //Lo: /[a-z \xa0-\xaf \xe0-\xef \xf1 ]/x  //Wd: /[\d _ A-Z a-z \xa0-\xaf \xe0-\xf1 \x80-\x9f]/x diff --git a/src/PropSet.cxx b/src/PropSet.cxx index 573991870..5f4e20a1c 100644 --- a/src/PropSet.cxx +++ b/src/PropSet.cxx @@ -19,7 +19,7 @@  // The comparison and case changing functions here assume ASCII  // or extended ASCII such as the normal Windows code page. -inline char MakeUpperCase(char ch) { +static inline char MakeUpperCase(char ch) {  	if (ch < 'a' || ch > 'z')  		return ch;  	else diff --git a/win32/makefile b/win32/makefile index b0e5d0609..66691288a 100644 --- a/win32/makefile +++ b/win32/makefile @@ -58,7 +58,6 @@ CellBuffer.o: CellBuffer.cxx Platform.h Scintilla.h CellBuffer.h  ContractionState.o: ContractionState.cxx Platform.h ContractionState.h  Document.o: Document.cxx Platform.h Scintilla.h PosRegExp.h CellBuffer.h \   Document.h -PosRegExp.o: PosRegExp.cxx PosRegExp.h  DocumentAccessor.o: DocumentAccessor.cxx Platform.h PropSet.h \   SString.h Accessor.h DocumentAccessor.h Scintilla.h  Editor.o: Editor.cxx Platform.h Scintilla.h ContractionState.h \ @@ -92,6 +91,9 @@ KeyWords.o: KeyWords.cxx Platform.h PropSet.h SString.h Accessor.h KeyWords.h \   Scintilla.h SciLexer.h  LineMarker.o: LineMarker.cxx Platform.h Scintilla.h LineMarker.h  PlatWin.o: PlatWin.cxx Platform.h PlatformRes.h UniConversion.h +# PosRegExp.cxx is an external library so is not purged of warnings so turn the warnings off with -w. +PosRegExp.o: PosRegExp.cxx PosRegExp.h +	$(CC) $(CXXFLAGS) -w -c $< -o $@  PropSet.o: PropSet.cxx Platform.h PropSet.h SString.h  ScintillaBase.o: ScintillaBase.cxx Platform.h Scintilla.h \   ContractionState.h CellBuffer.h CallTip.h KeyMap.h Indicator.h \ | 
