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 #ifndef wxStrtok
WXDLLEXPORT wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_ptr) WXDLLEXPORT wxChar * wxStrtok(wxChar *psz, const wxChar *delim, wxChar **save_ptr)
{ {
if (!psz) psz = *save_ptr; if (!psz)
psz += wxStrspn(psz, delim); {
if (!*psz) { psz = *save_ptr;
*save_ptr = (wxChar *)NULL; if ( !psz )
return (wxChar *)NULL; return NULL;
} }
wxChar *ret = psz;
psz = wxStrpbrk(psz, delim); psz += wxStrspn(psz, delim);
if (!psz) *save_ptr = (wxChar*)NULL; if (!*psz)
else { {
*psz = wxT('\0'); *save_ptr = (wxChar *)NULL;
*save_ptr = psz + 1; return (wxChar *)NULL;
} }
return ret;
wxChar *ret = psz;
psz = wxStrpbrk(psz, delim);
if (!psz)
{
*save_ptr = (wxChar*)NULL;
}
else
{
*psz = wxT('\0');
*save_ptr = psz + 1;
}
return ret;
} }
#endif #endif // wxStrtok
#ifndef wxSetlocale #ifndef wxSetlocale
WXDLLEXPORT wxWCharBuffer wxSetlocale(int category, const wxChar *locale) WXDLLEXPORT wxWCharBuffer wxSetlocale(int category, const wxChar *locale)