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 - Compile Fail: MinGW has no strtok_? function, w/ fix
Summary: Compile Fail: MinGW has no strtok_? function, w/ fix
Status: RESOLVED FIXED
Alias: None
Product: SDL_mixer
Classification: Unclassified
Component: misc (show other bugs)
Version: unspecified
Hardware: x86 Windows 7
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-30 15:37 UTC by Mike Kasprzak
Modified: 2011-08-27 22:37 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.