diff options
| author | nyamatongwe <devnull@localhost> | 2001-02-05 04:39:42 +0000 | 
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2001-02-05 04:39:42 +0000 | 
| commit | bc28310ef52287aef419d8edf728a1c6f47fe27e (patch) | |
| tree | abedd8d80bacfd6f5c9e754109c8687ab98d10ec /src/PropSet.cxx | |
| parent | 6fbd45ca439f4e3e744a183a9bbaaa012fea98c9 (diff) | |
| download | scintilla-mirror-bc28310ef52287aef419d8edf728a1c6f47fe27e.tar.gz | |
Patch from John to make GTK+ version build on Win32.
Modified by me to avoid pointless warnings and print error message if try
to build with Borland C++.
Diffstat (limited to 'src/PropSet.cxx')
| -rw-r--r-- | src/PropSet.cxx | 28 | 
1 files changed, 23 insertions, 5 deletions
| diff --git a/src/PropSet.cxx b/src/PropSet.cxx index 368d2a484..fa26d3133 100644 --- a/src/PropSet.cxx +++ b/src/PropSet.cxx @@ -16,7 +16,11 @@  bool EqualCaseInsensitive(const char *a, const char *b) {  #if PLAT_GTK  +#  ifdef G_OS_WIN32 +	return 0 == stricmp(a, b); +#  else  	return 0 == strcasecmp(a, b); +#  endif   #elif PLAT_WIN   	return 0 == stricmp(a, b);  #elif PLAT_WX  @@ -24,6 +28,20 @@ bool EqualCaseInsensitive(const char *a, const char *b) {  #endif   } +bool EqualNCaseInsensitive(const char *a, const char *b, int len) { +#if PLAT_GTK +#  ifdef G_OS_WIN32 +	return 0 == strnicmp(a, b, len); +#  else +	return 0 == strncasecmp(a, b, len); +#  endif +#elif PLAT_WIN +	return 0 == strnicmp(a, b, len); +#elif PLAT_WX +	return 0 == wxStrnicmp(a, b, len); +#endif +} +   inline unsigned int HashString(const char *s) {  	unsigned int ret = 0;  	while (*s) { @@ -360,7 +378,7 @@ int cmpString(const void *a1, const void *a2) {  int cmpStringNoCase(const void *a1, const void *a2) {  	// Can't work out the correct incantation to use modern casts here -	return strcasecmp(*(char**)(a1), *(char**)(a2)); +	return EqualCaseInsensitive(*(char**)(a1), *(char**)(a2));  }  static void SortWordList(char **words, char **wordsNoCase, unsigned int len) { @@ -425,7 +443,7 @@ const char *WordList::GetNearestWord(const char *wordStart, int searchLen /*= -1  		while (start <= end) { // binary searching loop  			pivot = (start + end) >> 1;  			word = wordsNoCase[pivot]; -			cond = strncasecmp(wordStart, word, searchLen); +			cond = EqualNCaseInsensitive(wordStart, word, searchLen);  			if (!cond && nonFuncChar(word[searchLen])) // maybe there should be a "non-word character" test here?  				return word; // result must not be freed with free()  			else if (cond >= 0) @@ -485,7 +503,7 @@ char *WordList::GetNearestWords(const char *wordStart, int searchLen /*= -1*/, b  		while (start <= end) { // binary searching loop  			pivot = (start + end) >> 1;  			word = wordsNoCase[pivot]; -			cond = strncasecmp(wordStart, word, searchLen); +			cond = EqualNCaseInsensitive(wordStart, word, searchLen);  			if (!cond) {  				oldpivot = pivot;  				do { // browse sequentially the rest after the hit @@ -520,14 +538,14 @@ char *WordList::GetNearestWords(const char *wordStart, int searchLen /*= -1*/, b  					if (++pivot > end)  						break;  					word = wordsNoCase[pivot]; -				} while (!strncasecmp(wordStart, word, searchLen)); +				} while (!EqualNCaseInsensitive(wordStart, word, searchLen));  				pivot = oldpivot;  				for (;;) { // browse sequentially the rest before the hit  					if (--pivot < start)  						break;  					word = wordsNoCase[pivot]; -					if (strncasecmp(wordStart, word, searchLen)) +					if (EqualNCaseInsensitive(wordStart, word, searchLen))  						break;  					brace = strchr(word, '(');  					if (brace) | 
