We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1263

Summary: Compile Fail: MinGW has no strtok_? function, w/ fix
Product: SDL_mixer Reporter: Mike Kasprzak <mike>
Component: miscAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: unspecified   
Hardware: x86   
OS: Windows 7   

Description Mike Kasprzak 2011-07-30 15:37:08 UTC
From HG (checkout made today). The file "music.c" near the bottom makes reference to a function strtok_s (and strtok_r), thread safe versions of strtok.

Unfortunately it seems MinGW does not (and will not) get a strtok_? function. See here:

http://sourceforge.net/tracker/?func=detail&aid=2673480&group_id=2435&atid=352435

A solution would be to, in the case of MinGW, make a call to the ordinary thread unsafe version.



#if defined(__MINGW32__) || defined(__MINGW64__)
	for (path = strtok(paths, ";"); path; path = strtok(NULL, ";")) {
#elif defined(_WIN32)
	for (path = strtok_s(paths, ";", &context); path; path = strtok_s(NULL, ";", &context)) {
#else
	for (path = strtok_r(paths, ":;", &context); path; path = strtok_r(NULL, ":;", &context)) {
#endif
Comment 1 Ryan C. Gordon 2011-08-27 22:37:20 UTC
This patch is now hg changeset 48731fa9ca41, thanks!

--ryan.