X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/676a5687088dbed70a176056c00ee39f087517cf..f54e5c1a4f6952c62ed4480f7d26feddc20f98ba:/include/wx/wxcrtbase.h?ds=sidebyside diff --git a/include/wx/wxcrtbase.h b/include/wx/wxcrtbase.h index f7c77daeb7..27aafc6e8b 100644 --- a/include/wx/wxcrtbase.h +++ b/include/wx/wxcrtbase.h @@ -222,34 +222,50 @@ WXDLLIMPEXP_BASE void *calloc( size_t num, size_t size ); #endif /* HAVE_WCSTOULL */ #endif +/* Not all compilers have strnlen(); e.g. MSVC 6.x and 7.x don't have it */ +#if wxCHECK_VISUALC_VERSION(8) || defined(HAVE_STRNLEN) + #define wxCRT_StrnlenA strnlen +#endif + +#if wxCHECK_VISUALC_VERSION(8) || defined(HAVE_WCSNLEN) + #define wxCRT_StrnlenW wcsnlen +#endif /* define wxCRT_StricmpA/W and wxCRT_StrnicmpA/W for various compilers */ -/* note that we definitely are going to need our own version for widechar - * versions */ -#if !defined(wxCRT_StricmpA) - #if defined(__BORLANDC__) || defined(__WATCOMC__) || \ - defined(__VISAGECPP__) || \ - defined(__EMX__) || defined(__DJGPP__) - #define wxCRT_StricmpA stricmp - #define wxCRT_StrnicmpA strnicmp - #elif defined(__WXPALMOS__) - /* FIXME: There is no equivalent to strnicmp in the Palm OS API. This - * quick hack should do until one can be written. - */ - #define wxCRT_StricmpA StrCaselessCompare - #define wxCRT_StrnicmpA StrNCaselessCompare - #elif defined(__SYMANTEC__) || defined(__VISUALC__) || \ - (defined(__MWERKS__) && defined(__INTEL__)) - #define wxCRT_StricmpA _stricmp - #define wxCRT_StrnicmpA _strnicmp - #elif defined(__UNIX__) || defined(__GNUWIN32__) - #define wxCRT_StricmpA strcasecmp - #define wxCRT_StrnicmpA strncasecmp - /* #else -- use wxWidgets implementation */ +#if defined(__BORLANDC__) || defined(__WATCOMC__) || \ + defined(__VISAGECPP__) || \ + defined(__EMX__) || defined(__DJGPP__) + #define wxCRT_StricmpA stricmp + #define wxCRT_StrnicmpA strnicmp +#elif defined(__WXPALMOS__) + /* FIXME: There is no equivalent to strnicmp in the Palm OS API. This + * quick hack should do until one can be written. + */ + #define wxCRT_StricmpA StrCaselessCompare + #define wxCRT_StrnicmpA StrNCaselessCompare +#elif defined(__SYMANTEC__) || defined(__VISUALC__) || \ + (defined(__MWERKS__) && defined(__INTEL__)) + #define wxCRT_StricmpA _stricmp + #define wxCRT_StrnicmpA _strnicmp +#elif defined(__UNIX__) || defined(__GNUWIN32__) + #define wxCRT_StricmpA strcasecmp + #define wxCRT_StrnicmpA strncasecmp +/* #else -- use wxWidgets implementation */ +#endif + +#ifdef __VISUALC__ + #define wxCRT_StricmpW _wcsicmp + #define wxCRT_StrnicmpW _wcsnicmp +#elif defined(__UNIX__) + #ifdef HAVE_WCSCASECMP + #define wxCRT_StricmpW wcscasecmp #endif -#endif /* !defined(wxCRT_StricmpA) */ -/* FIXME-UTF8: use wcs(n)casecmp if available for *W versions */ + #ifdef HAVE_WCSNCASECMP + #define wxCRT_StrnicmpW wcsncasecmp + #endif +/* #else -- use wxWidgets implementation */ +#endif #ifdef HAVE_STRTOK_R #define wxCRT_StrtokA(str, sep, last) strtok_r(str, sep, last) @@ -665,10 +681,10 @@ WXDLLIMPEXP_BASE size_t wxCRT_StrftimeW(wchar_t *s, size_t max, inline size_t wxStrlen(const char *s) { return s ? wxCRT_StrlenA(s) : 0; } inline size_t wxStrlen(const wchar_t *s) { return s ? wxCRT_StrlenW(s) : 0; } #ifndef wxWCHAR_T_IS_WXCHAR16 - size_t wxStrlen(const wxChar16 *s ); + WXDLLIMPEXP_BASE size_t wxStrlen(const wxChar16 *s ); #endif #ifndef wxWCHAR_T_IS_WXCHAR32 - size_t wxStrlen(const wxChar32 *s ); + WXDLLIMPEXP_BASE size_t wxStrlen(const wxChar32 *s ); #endif #define wxWcslen wxCRT_StrlenW @@ -677,10 +693,10 @@ inline size_t wxStrlen(const wchar_t *s) { return s ? wxCRT_StrlenW(s) : 0; } inline char* wxStrdup(const char *s) { return wxCRT_StrdupA(s); } inline wchar_t* wxStrdup(const wchar_t *s) { return wxCRT_StrdupW(s); } #ifndef wxWCHAR_T_IS_WXCHAR16 - wxChar16* wxStrdup(const wxChar16* s); + WXDLLIMPEXP_BASE wxChar16* wxStrdup(const wxChar16* s); #endif #ifndef wxWCHAR_T_IS_WXCHAR32 - wxChar32* wxStrdup(const wxChar32* s); + WXDLLIMPEXP_BASE wxChar32* wxStrdup(const wxChar32* s); #endif #endif /* __cplusplus */