Just forward Stricmp() in wx/string.h to wxCRT_StricmpA().
Don't redo the tests already done in wx/wxcrtbase.h in wx/string.h too, especially as they were not done correctly there (they didn't take into account the case of MinGW in strict ANSI mode). Just call wxCRT_StricmpA(). This also allows us to get rid of HAVE_STRCASECMP_IN_STRING[S]_H tests in configure. Closes #15349. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74571 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -43,10 +43,6 @@
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRCASECMP_IN_STRINGS_H
|
||||
#include <strings.h> // for strcasecmp()
|
||||
#endif // HAVE_STRCASECMP_IN_STRINGS_H
|
||||
|
||||
#include "wx/wxcrtbase.h" // for wxChar, wxStrlen() etc.
|
||||
#include "wx/strvararg.h"
|
||||
#include "wx/buffer.h" // for wxCharBuffer
|
||||
@@ -145,50 +141,7 @@ inline size_t Strlen(const char *psz)
|
||||
// portable strcasecmp/_stricmp
|
||||
wxDEPRECATED( inline int Stricmp(const char *psz1, const char *psz2) );
|
||||
inline int Stricmp(const char *psz1, const char *psz2)
|
||||
{
|
||||
#if defined(__VISUALC__) && defined(__WXWINCE__)
|
||||
register char c1, c2;
|
||||
do {
|
||||
c1 = tolower(*psz1++);
|
||||
c2 = tolower(*psz2++);
|
||||
} while ( c1 && (c1 == c2) );
|
||||
|
||||
return c1 - c2;
|
||||
#elif defined(__VISUALC__)
|
||||
return _stricmp(psz1, psz2);
|
||||
#elif defined(__SC__)
|
||||
return _stricmp(psz1, psz2);
|
||||
#elif defined(__BORLANDC__)
|
||||
return stricmp(psz1, psz2);
|
||||
#elif defined(__WATCOMC__)
|
||||
return stricmp(psz1, psz2);
|
||||
#elif defined(__DJGPP__)
|
||||
return stricmp(psz1, psz2);
|
||||
#elif defined(__EMX__)
|
||||
return stricmp(psz1, psz2);
|
||||
#elif defined(__WXPM__)
|
||||
return stricmp(psz1, psz2);
|
||||
#elif defined(HAVE_STRCASECMP_IN_STRING_H) || \
|
||||
defined(HAVE_STRCASECMP_IN_STRINGS_H) || \
|
||||
defined(__GNUWIN32__)
|
||||
return strcasecmp(psz1, psz2);
|
||||
#else
|
||||
// almost all compilers/libraries provide this function (unfortunately under
|
||||
// different names), that's why we don't implement our own which will surely
|
||||
// be more efficient than this code (uncomment to use):
|
||||
/*
|
||||
register char c1, c2;
|
||||
do {
|
||||
c1 = tolower(*psz1++);
|
||||
c2 = tolower(*psz2++);
|
||||
} while ( c1 && (c1 == c2) );
|
||||
|
||||
return c1 - c2;
|
||||
*/
|
||||
|
||||
#error "Please define string case-insensitive compare for your OS/compiler"
|
||||
#endif // OS/compiler
|
||||
}
|
||||
{ return wxCRT_StricmpA(psz1, psz2); }
|
||||
|
||||
#endif // WXWIN_COMPATIBILITY_2_8
|
||||
|
||||
|
Reference in New Issue
Block a user