fixed (yet another?) crash in wxStrtok

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17071 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-09-08 00:49:26 +00:00
parent 7e92d86d78
commit 72d35070d8

View File

@@ -920,22 +920,35 @@ int WXDLLEXPORT wxStrnicmp(const wxChar *s1, const wxChar *s2, size_t n)
#ifndef wxStrtok
WXDLLEXPORT wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_ptr)
{
if (!psz) psz = *save_ptr;
if (!psz)
{
psz = *save_ptr;
if ( !psz )
return NULL;
}
psz += wxStrspn(psz, delim);
if (!*psz) {
if (!*psz)
{
*save_ptr = (wxChar *)NULL;
return (wxChar *)NULL;
}
wxChar *ret = psz;
psz = wxStrpbrk(psz, delim);
if (!psz) *save_ptr = (wxChar*)NULL;
else {
if (!psz)
{
*save_ptr = (wxChar*)NULL;
}
else
{
*psz = wxT('\0');
*save_ptr = psz + 1;
}
return ret;
}
#endif
#endif // wxStrtok
#ifndef wxSetlocale
WXDLLEXPORT wxWCharBuffer wxSetlocale(int category, const wxChar *locale)