MS implementation does not set *context to NULL, but instead sets it to the pointer to nul char which is after the last char of the input string.
This change is needed for mingw-w64's wcstok_s which needs to distinguish between invalid parameters (and call exception handler) and valid parameters resulted from the last wcstok_s call of the last token. --- mingw-w64-crt/string/msvcr80pre_wcstok.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mingw-w64-crt/string/msvcr80pre_wcstok.c b/mingw-w64-crt/string/msvcr80pre_wcstok.c index f411936741f5..3200c7a6bc36 100644 --- a/mingw-w64-crt/string/msvcr80pre_wcstok.c +++ b/mingw-w64-crt/string/msvcr80pre_wcstok.c @@ -27,10 +27,9 @@ wchar_t *__cdecl wcstok(wchar_t *restrict s, const wchar_t *restrict sep, wchar_ { if (!s && !(s = *p)) return NULL; s += wcsspn(s, sep); - if (!*s) return *p = NULL; + if (!*s) return *p = s, NULL; *p = s + wcscspn(s, sep); if (**p) *(*p)++ = 0; - else *p = 0; return s; } wchar_t *(__cdecl *__MINGW_IMP_SYMBOL(wcstok))(wchar_t *restrict, const wchar_t *restrict, wchar_t **restrict) = wcstok; -- 2.20.1 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public