use wcs(n)casecmp() if available; use wxStricmp() to implement wxString::CmpNoCase() as it's significantly more efficient than wx code (closes #10375)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ca44dbde5f
commit
6689960c3c
6
configure
vendored
6
configure
vendored
@ -1,5 +1,5 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# From configure.in Id: configure.in 58060 2009-01-12 23:25:39Z FM .
|
# From configure.in Id: configure.in 58069 2009-01-13 12:01:30Z FM .
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.61 for wxWidgets 2.9.0.
|
# Generated by GNU Autoconf 2.61 for wxWidgets 2.9.0.
|
||||||
#
|
#
|
||||||
@ -34957,7 +34957,9 @@ _ACEOF
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
for ac_func in wcsdup strnlen wcsnlen
|
|
||||||
|
|
||||||
|
for ac_func in wcsdup strnlen wcsnlen wcscasecmp wcsncasecmp
|
||||||
do
|
do
|
||||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
|
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||||
|
@ -4047,7 +4047,7 @@ if test "$wxUSE_WCHAR_T" = "yes"; then
|
|||||||
AC_DEFINE(HAVE_WCSLEN)
|
AC_DEFINE(HAVE_WCSLEN)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_FUNCS([wcsdup strnlen wcsnlen])
|
AC_CHECK_FUNCS([wcsdup strnlen wcsnlen wcscasecmp wcsncasecmp])
|
||||||
|
|
||||||
dnl On HP-UX aCC need this define to find mbstrtowcs() &c
|
dnl On HP-UX aCC need this define to find mbstrtowcs() &c
|
||||||
dnl Can't be used for g++ since the mbstate_t in wchar.h can conflict
|
dnl Can't be used for g++ since the mbstate_t in wchar.h can conflict
|
||||||
|
@ -233,31 +233,39 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size );
|
|||||||
|
|
||||||
/* define wxCRT_StricmpA/W and wxCRT_StrnicmpA/W for various compilers */
|
/* define wxCRT_StricmpA/W and wxCRT_StrnicmpA/W for various compilers */
|
||||||
|
|
||||||
/* note that we definitely are going to need our own version for widechar
|
#if defined(__BORLANDC__) || defined(__WATCOMC__) || \
|
||||||
* versions */
|
defined(__VISAGECPP__) || \
|
||||||
#if !defined(wxCRT_StricmpA)
|
defined(__EMX__) || defined(__DJGPP__)
|
||||||
#if defined(__BORLANDC__) || defined(__WATCOMC__) || \
|
#define wxCRT_StricmpA stricmp
|
||||||
defined(__VISAGECPP__) || \
|
#define wxCRT_StrnicmpA strnicmp
|
||||||
defined(__EMX__) || defined(__DJGPP__)
|
#elif defined(__WXPALMOS__)
|
||||||
#define wxCRT_StricmpA stricmp
|
/* FIXME: There is no equivalent to strnicmp in the Palm OS API. This
|
||||||
#define wxCRT_StrnicmpA strnicmp
|
* quick hack should do until one can be written.
|
||||||
#elif defined(__WXPALMOS__)
|
*/
|
||||||
/* FIXME: There is no equivalent to strnicmp in the Palm OS API. This
|
#define wxCRT_StricmpA StrCaselessCompare
|
||||||
* quick hack should do until one can be written.
|
#define wxCRT_StrnicmpA StrNCaselessCompare
|
||||||
*/
|
#elif defined(__SYMANTEC__) || defined(__VISUALC__) || \
|
||||||
#define wxCRT_StricmpA StrCaselessCompare
|
(defined(__MWERKS__) && defined(__INTEL__))
|
||||||
#define wxCRT_StrnicmpA StrNCaselessCompare
|
#define wxCRT_StricmpA _stricmp
|
||||||
#elif defined(__SYMANTEC__) || defined(__VISUALC__) || \
|
#define wxCRT_StrnicmpA _strnicmp
|
||||||
(defined(__MWERKS__) && defined(__INTEL__))
|
#elif defined(__UNIX__) || defined(__GNUWIN32__)
|
||||||
#define wxCRT_StricmpA _stricmp
|
#define wxCRT_StricmpA strcasecmp
|
||||||
#define wxCRT_StrnicmpA _strnicmp
|
#define wxCRT_StrnicmpA strncasecmp
|
||||||
#elif defined(__UNIX__) || defined(__GNUWIN32__)
|
/* #else -- use wxWidgets implementation */
|
||||||
#define wxCRT_StricmpA strcasecmp
|
#endif
|
||||||
#define wxCRT_StrnicmpA strncasecmp
|
|
||||||
/* #else -- use wxWidgets implementation */
|
#ifdef __VISUALC__
|
||||||
|
#define wxCRT_StricmpW _wcsicmp
|
||||||
|
#define wxCRT_StrnicmpW _wcsnicmp
|
||||||
|
#elif defined(__UNIX__)
|
||||||
|
#ifdef HAVE_WCSCASECMP
|
||||||
|
#define wxCRT_StricmpW wcscasecmp
|
||||||
#endif
|
#endif
|
||||||
#endif /* !defined(wxCRT_StricmpA) */
|
#ifdef HAVE_WCSNCASECMP
|
||||||
/* FIXME-UTF8: use wcs(n)casecmp if available for *W versions */
|
#define wxCRT_StrnicmpW wcsncasecmp
|
||||||
|
#endif
|
||||||
|
/* #else -- use wxWidgets implementation */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_STRTOK_R
|
#ifdef HAVE_STRTOK_R
|
||||||
#define wxCRT_StrtokA(str, sep, last) strtok_r(str, sep, last)
|
#define wxCRT_StrtokA(str, sep, last) strtok_r(str, sep, last)
|
||||||
|
@ -912,6 +912,12 @@
|
|||||||
/* Define if you have usleep() */
|
/* Define if you have usleep() */
|
||||||
#undef HAVE_USLEEP
|
#undef HAVE_USLEEP
|
||||||
|
|
||||||
|
/* Define if you have wcscasecmp() function */
|
||||||
|
#undef HAVE_WCSCASECMP
|
||||||
|
|
||||||
|
/* Define if you have wcsncasecmp() function */
|
||||||
|
#undef HAVE_WCSNCASECMP
|
||||||
|
|
||||||
/* Define if you have wcslen function */
|
/* Define if you have wcslen function */
|
||||||
#undef HAVE_WCSLEN
|
#undef HAVE_WCSLEN
|
||||||
|
|
||||||
|
@ -1115,6 +1115,7 @@ size_t wxString::find_last_not_of(const wxOtherCharType* sz, size_t nStart,
|
|||||||
|
|
||||||
int wxString::CmpNoCase(const wxString& s) const
|
int wxString::CmpNoCase(const wxString& s) const
|
||||||
{
|
{
|
||||||
|
#if wxUSE_UNICODE_UTF8
|
||||||
// FIXME-UTF8: use wxUniChar::ToLower/ToUpper once added
|
// FIXME-UTF8: use wxUniChar::ToLower/ToUpper once added
|
||||||
|
|
||||||
const_iterator i1 = begin();
|
const_iterator i1 = begin();
|
||||||
@ -1138,6 +1139,9 @@ int wxString::CmpNoCase(const wxString& s) const
|
|||||||
else if ( len1 > len2 )
|
else if ( len1 > len2 )
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
#else // wxUSE_UNICODE_WCHAR or ANSI
|
||||||
|
return wxStricmp(m_impl.c_str(), s.m_impl.c_str());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user