music.c (Mix_EachSoundFont): use SDL_strtokr().
authorOzkan Sezer
Wed, 20 Nov 2019 20:50:02 +0300
changeset 10127642e4258f8e
parent 1011 5346b25e84e6
child 1013 dbd9c60beacd
music.c (Mix_EachSoundFont): use SDL_strtokr().

provide it in a compat module if SDL2 < 2.0.12.
minor tidy-up.
CMakeLists.txt
Makefile.in
VisualC-WinRT/UWP_VS2015/SDL_mixer-UWP.vcxproj
VisualC-WinRT/UWP_VS2015/SDL_mixer-UWP.vcxproj.filters
VisualC-WinRT/WinPhone80_VS2012/SDL_mixer-WinPhone80.vcxproj
VisualC-WinRT/WinPhone80_VS2012/SDL_mixer-WinPhone80.vcxproj.filters
VisualC-WinRT/WinPhone81_VS2013/SDL_mixer-WinPhone81.vcxproj
VisualC-WinRT/WinPhone81_VS2013/SDL_mixer-WinPhone81.vcxproj.filters
VisualC-WinRT/WinRT80_VS2012/SDL_mixer-WinRT80.vcxproj
VisualC-WinRT/WinRT81_VS2013/SDL_mixer-WinRT81.vcxproj
VisualC/SDL_mixer.vcxproj
VisualC/SDL_mixer.vcxproj.filters
Xcode-iOS/SDL_mixer.xcodeproj/project.pbxproj
Xcode/SDL_mixer.xcodeproj/project.pbxproj
src/compat.c
src/compat.h
src/music.c
     1.1 --- a/CMakeLists.txt	Wed Nov 20 18:56:10 2019 +0300
     1.2 +++ b/CMakeLists.txt	Wed Nov 20 20:50:02 2019 +0300
     1.3 @@ -19,7 +19,7 @@
     1.4  
     1.5      target_sources(SDL2_mixer PRIVATE
     1.6              src/effect_position.c src/effects_internal.c src/effect_stereoreverse.c
     1.7 -            src/mixer.c src/music.c
     1.8 +            src/mixer.c src/music.c src/compat.c
     1.9              src/codecs/load_aiff.c src/codecs/load_voc.c
    1.10              src/codecs/music_cmd.c src/codecs/music_flac.c
    1.11              src/codecs/music_fluidsynth.c src/codecs/music_mad.c
     2.1 --- a/Makefile.in	Wed Nov 20 18:56:10 2019 +0300
     2.2 +++ b/Makefile.in	Wed Nov 20 20:50:02 2019 +0300
     2.3 @@ -38,7 +38,7 @@
     2.4  PLAYWAVE_OBJECTS = @PLAYWAVE_OBJECTS@
     2.5  PLAYMUS_OBJECTS = @PLAYMUS_OBJECTS@
     2.6  
     2.7 -DIST = *.txt Android.mk Makefile.in SDL2_mixer.pc.in SDL2_mixer.spec.in include/SDL_mixer.h VisualC VisualC-WinRT Xcode Xcode-iOS acinclude aclocal.m4 autogen.sh build-scripts configure configure.in debian external gcc-fat.sh src/effect_position.c src/effect_stereoreverse.c src/effects_internal.c src/effects_internal.h src/codecs/load_aiff.c src/codecs/load_aiff.h src/codecs/load_voc.c src/codecs/load_voc.h src/mixer.c src/mixer.h src/music.c src/music.h src/codecs/music_cmd.c src/codecs/music_cmd.h src/codecs/music_flac.c src/codecs/music_flac.h src/codecs/music_fluidsynth.c src/codecs/music_fluidsynth.h src/codecs/music_mad.c src/codecs/music_mad.h src/codecs/music_mikmod.c src/codecs/music_mikmod.h src/codecs/music_modplug.c src/codecs/music_modplug.h src/codecs/music_mpg123.c src/codecs/music_mpg123.h src/codecs/music_nativemidi.c src/codecs/music_nativemidi.h src/codecs/music_ogg.c src/codecs/music_ogg.h src/codecs/music_opus.c src/codecs/music_opus.h src/codecs/music_timidity.c src/codecs/music_timidity.h src/codecs/music_wav.c src/codecs/music_wav.h src/codecs/native_midi playmus.c playwave.c src/codecs/timidity version.rc
     2.8 +DIST = *.txt Android.mk Makefile.in SDL2_mixer.pc.in SDL2_mixer.spec.in include/SDL_mixer.h VisualC VisualC-WinRT Xcode Xcode-iOS acinclude aclocal.m4 autogen.sh build-scripts configure configure.in debian external gcc-fat.sh src/compat.c src/compat.h src/effect_position.c src/effect_stereoreverse.c src/effects_internal.c src/effects_internal.h src/codecs/load_aiff.c src/codecs/load_aiff.h src/codecs/load_voc.c src/codecs/load_voc.h src/mixer.c src/mixer.h src/music.c src/music.h src/codecs/music_cmd.c src/codecs/music_cmd.h src/codecs/music_flac.c src/codecs/music_flac.h src/codecs/music_fluidsynth.c src/codecs/music_fluidsynth.h src/codecs/music_mad.c src/codecs/music_mad.h src/codecs/music_mikmod.c src/codecs/music_mikmod.h src/codecs/music_modplug.c src/codecs/music_modplug.h src/codecs/music_mpg123.c src/codecs/music_mpg123.h src/codecs/music_nativemidi.c src/codecs/music_nativemidi.h src/codecs/music_ogg.c src/codecs/music_ogg.h src/codecs/music_opus.c src/codecs/music_opus.h src/codecs/music_timidity.c src/codecs/music_timidity.h src/codecs/music_wav.c src/codecs/music_wav.h src/codecs/native_midi playmus.c playwave.c src/codecs/timidity version.rc
     2.9  
    2.10  LT_AGE      = @LT_AGE@
    2.11  LT_CURRENT  = @LT_CURRENT@
     3.1 --- a/VisualC-WinRT/UWP_VS2015/SDL_mixer-UWP.vcxproj	Wed Nov 20 18:56:10 2019 +0300
     3.2 +++ b/VisualC-WinRT/UWP_VS2015/SDL_mixer-UWP.vcxproj	Wed Nov 20 20:50:02 2019 +0300
     3.3 @@ -27,6 +27,7 @@
     3.4      </ProjectConfiguration>
     3.5    </ItemGroup>
     3.6    <ItemGroup>
     3.7 +    <ClCompile Include="..\..\src\compat.c" />
     3.8      <ClCompile Include="..\..\src\effects_internal.c" />
     3.9      <ClCompile Include="..\..\src\effect_position.c" />
    3.10      <ClCompile Include="..\..\src\effect_stereoreverse.c" />
    3.11 @@ -58,6 +59,7 @@
    3.12    </ItemGroup>
    3.13    <ItemGroup>
    3.14      <ClInclude Include="..\..\include\SDL_mixer.h" />
    3.15 +    <ClInclude Include="..\..\src\compat.h" />
    3.16      <ClInclude Include="..\..\src\codecs\timidity\common.h" />
    3.17      <ClInclude Include="..\..\src\codecs\timidity\instrum.h" />
    3.18      <ClInclude Include="..\..\src\codecs\timidity\mix.h" />
     4.1 --- a/VisualC-WinRT/UWP_VS2015/SDL_mixer-UWP.vcxproj.filters	Wed Nov 20 18:56:10 2019 +0300
     4.2 +++ b/VisualC-WinRT/UWP_VS2015/SDL_mixer-UWP.vcxproj.filters	Wed Nov 20 20:50:02 2019 +0300
     4.3 @@ -1,6 +1,7 @@
     4.4  <?xml version="1.0" encoding="utf-8"?>
     4.5  <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     4.6    <ItemGroup>
     4.7 +    <ClCompile Include="..\..\src\compat.c" />
     4.8      <ClCompile Include="..\..\src\effect_position.c" />
     4.9      <ClCompile Include="..\..\src\effect_stereoreverse.c" />
    4.10      <ClCompile Include="..\..\src\effects_internal.c" />
    4.11 @@ -50,6 +51,7 @@
    4.12    </ItemGroup>
    4.13    <ItemGroup>
    4.14      <ClInclude Include="..\..\include\SDL_mixer.h" />
    4.15 +    <ClInclude Include="..\..\src\compat.h" />
    4.16      <ClInclude Include="..\..\src\codecs\timidity\common.h">
    4.17        <Filter>Timidity</Filter>
    4.18      </ClInclude>
     5.1 --- a/VisualC-WinRT/WinPhone80_VS2012/SDL_mixer-WinPhone80.vcxproj	Wed Nov 20 18:56:10 2019 +0300
     5.2 +++ b/VisualC-WinRT/WinPhone80_VS2012/SDL_mixer-WinPhone80.vcxproj	Wed Nov 20 20:50:02 2019 +0300
     5.3 @@ -164,6 +164,7 @@
     5.4      </ProjectReference>
     5.5    </ItemGroup>
     5.6    <ItemGroup>
     5.7 +    <ClCompile Include="..\..\src\compat.c" />
     5.8      <ClCompile Include="..\..\src\effects_internal.c" />
     5.9      <ClCompile Include="..\..\src\effect_position.c" />
    5.10      <ClCompile Include="..\..\src\effect_stereoreverse.c" />
    5.11 @@ -195,6 +196,7 @@
    5.12    </ItemGroup>
    5.13    <ItemGroup>
    5.14      <ClInclude Include="..\..\include\SDL_mixer.h" />
    5.15 +    <ClInclude Include="..\..\src\compat.h" />
    5.16      <ClInclude Include="..\..\src\effects_internal.h" />
    5.17      <ClInclude Include="..\..\src\mixer.h" />
    5.18      <ClInclude Include="..\..\src\music.h" />
     6.1 --- a/VisualC-WinRT/WinPhone80_VS2012/SDL_mixer-WinPhone80.vcxproj.filters	Wed Nov 20 18:56:10 2019 +0300
     6.2 +++ b/VisualC-WinRT/WinPhone80_VS2012/SDL_mixer-WinPhone80.vcxproj.filters	Wed Nov 20 20:50:02 2019 +0300
     6.3 @@ -1,6 +1,7 @@
     6.4  <?xml version="1.0" encoding="utf-8"?>
     6.5  <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     6.6    <ItemGroup>
     6.7 +    <ClCompile Include="..\..\src\compat.c" />
     6.8      <ClCompile Include="..\..\src\effect_position.c" />
     6.9      <ClCompile Include="..\..\src\effect_stereoreverse.c" />
    6.10      <ClCompile Include="..\..\src\effects_internal.c" />
    6.11 @@ -50,6 +51,7 @@
    6.12    </ItemGroup>
    6.13    <ItemGroup>
    6.14      <ClInclude Include="..\..\include\SDL_mixer.h" />
    6.15 +    <ClInclude Include="..\..\src\compat.h" />
    6.16      <ClInclude Include="..\..\src\effects_internal.h" />
    6.17      <ClInclude Include="..\..\src\mixer.h" />
    6.18      <ClInclude Include="..\..\src\music.h" />
     7.1 --- a/VisualC-WinRT/WinPhone81_VS2013/SDL_mixer-WinPhone81.vcxproj	Wed Nov 20 18:56:10 2019 +0300
     7.2 +++ b/VisualC-WinRT/WinPhone81_VS2013/SDL_mixer-WinPhone81.vcxproj	Wed Nov 20 20:50:02 2019 +0300
     7.3 @@ -33,6 +33,7 @@
     7.4      </ProjectReference>
     7.5    </ItemGroup>
     7.6    <ItemGroup>
     7.7 +    <ClCompile Include="..\..\src\compat.c" />
     7.8      <ClCompile Include="..\..\src\effects_internal.c" />
     7.9      <ClCompile Include="..\..\src\effect_position.c" />
    7.10      <ClCompile Include="..\..\src\effect_stereoreverse.c" />
    7.11 @@ -64,6 +65,7 @@
    7.12    </ItemGroup>
    7.13    <ItemGroup>
    7.14      <ClInclude Include="..\..\include\SDL_mixer.h" />
    7.15 +    <ClInclude Include="..\..\src\compat.h" />
    7.16      <ClInclude Include="..\..\src\effects_internal.h" />
    7.17      <ClInclude Include="..\..\src\mixer.h" />
    7.18      <ClInclude Include="..\..\src\music.h" />
     8.1 --- a/VisualC-WinRT/WinPhone81_VS2013/SDL_mixer-WinPhone81.vcxproj.filters	Wed Nov 20 18:56:10 2019 +0300
     8.2 +++ b/VisualC-WinRT/WinPhone81_VS2013/SDL_mixer-WinPhone81.vcxproj.filters	Wed Nov 20 20:50:02 2019 +0300
     8.3 @@ -1,6 +1,7 @@
     8.4  <?xml version="1.0" encoding="utf-8"?>
     8.5  <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     8.6    <ItemGroup>
     8.7 +    <ClCompile Include="..\..\src\compat.c" />
     8.8      <ClCompile Include="..\..\src\effect_position.c" />
     8.9      <ClCompile Include="..\..\src\effect_stereoreverse.c" />
    8.10      <ClCompile Include="..\..\src\effects_internal.c" />
    8.11 @@ -50,6 +51,7 @@
    8.12    </ItemGroup>
    8.13    <ItemGroup>
    8.14      <ClInclude Include="..\..\include\SDL_mixer.h" />
    8.15 +    <ClInclude Include="..\..\src\compat.h" />
    8.16      <ClInclude Include="..\..\src\effects_internal.h" />
    8.17      <ClInclude Include="..\..\src\mixer.h" />
    8.18      <ClInclude Include="..\..\src\music.h" />
     9.1 --- a/VisualC-WinRT/WinRT80_VS2012/SDL_mixer-WinRT80.vcxproj	Wed Nov 20 18:56:10 2019 +0300
     9.2 +++ b/VisualC-WinRT/WinRT80_VS2012/SDL_mixer-WinRT80.vcxproj	Wed Nov 20 20:50:02 2019 +0300
     9.3 @@ -41,6 +41,7 @@
     9.4      </ProjectReference>
     9.5    </ItemGroup>
     9.6    <ItemGroup>
     9.7 +    <ClCompile Include="..\..\src\compat.c" />
     9.8      <ClCompile Include="..\..\src\effects_internal.c" />
     9.9      <ClCompile Include="..\..\src\effect_position.c" />
    9.10      <ClCompile Include="..\..\src\effect_stereoreverse.c" />
    9.11 @@ -72,6 +73,7 @@
    9.12    </ItemGroup>
    9.13    <ItemGroup>
    9.14      <ClInclude Include="..\..\include\SDL_mixer.h" />
    9.15 +    <ClInclude Include="..\..\src\compat.h" />
    9.16      <ClInclude Include="..\..\src\effects_internal.h" />
    9.17      <ClInclude Include="..\..\src\mixer.h" />
    9.18      <ClInclude Include="..\..\src\music.h" />
    10.1 --- a/VisualC-WinRT/WinRT81_VS2013/SDL_mixer-WinRT81.vcxproj	Wed Nov 20 18:56:10 2019 +0300
    10.2 +++ b/VisualC-WinRT/WinRT81_VS2013/SDL_mixer-WinRT81.vcxproj	Wed Nov 20 20:50:02 2019 +0300
    10.3 @@ -41,6 +41,7 @@
    10.4      </ProjectReference>
    10.5    </ItemGroup>
    10.6    <ItemGroup>
    10.7 +    <ClCompile Include="..\..\src\compat.c" />
    10.8      <ClCompile Include="..\..\src\effects_internal.c" />
    10.9      <ClCompile Include="..\..\src\effect_position.c" />
   10.10      <ClCompile Include="..\..\src\effect_stereoreverse.c" />
   10.11 @@ -72,6 +73,7 @@
   10.12    </ItemGroup>
   10.13    <ItemGroup>
   10.14      <ClInclude Include="..\..\include\SDL_mixer.h" />
   10.15 +    <ClInclude Include="..\..\src\compat.h" />
   10.16      <ClInclude Include="..\..\src\effects_internal.h" />
   10.17      <ClInclude Include="..\..\src\mixer.h" />
   10.18      <ClInclude Include="..\..\src\music.h" />
    11.1 --- a/VisualC/SDL_mixer.vcxproj	Wed Nov 20 18:56:10 2019 +0300
    11.2 +++ b/VisualC/SDL_mixer.vcxproj	Wed Nov 20 20:50:02 2019 +0300
    11.3 @@ -195,6 +195,7 @@
    11.4    </ItemDefinitionGroup>
    11.5    <ItemGroup>
    11.6      <ClInclude Include="..\include\SDL_mixer.h" />
    11.7 +    <ClInclude Include="..\src\compat.h" />
    11.8      <ClInclude Include="..\src\effects_internal.h" />
    11.9      <ClInclude Include="..\src\mixer.h" />
   11.10      <ClInclude Include="..\src\music.h" />
   11.11 @@ -448,6 +449,7 @@
   11.12      </CustomBuild>
   11.13    </ItemGroup>
   11.14    <ItemGroup>
   11.15 +    <ClCompile Include="..\src\compat.c" />
   11.16      <ClCompile Include="..\src\effects_internal.c" />
   11.17      <ClCompile Include="..\src\effect_position.c" />
   11.18      <ClCompile Include="..\src\effect_stereoreverse.c" />
    12.1 --- a/VisualC/SDL_mixer.vcxproj.filters	Wed Nov 20 18:56:10 2019 +0300
    12.2 +++ b/VisualC/SDL_mixer.vcxproj.filters	Wed Nov 20 20:50:02 2019 +0300
    12.3 @@ -4,6 +4,9 @@
    12.4      <ClInclude Include="..\include\SDL_mixer.h">
    12.5        <Filter>Public Headers</Filter>
    12.6      </ClInclude>
    12.7 +    <ClInclude Include="..\src\compat.h">
    12.8 +      <Filter>Sources</Filter>
    12.9 +    </ClInclude>
   12.10      <ClInclude Include="..\src\effects_internal.h">
   12.11        <Filter>Sources</Filter>
   12.12      </ClInclude>
   12.13 @@ -167,6 +170,9 @@
   12.14      </CustomBuild>
   12.15    </ItemGroup>
   12.16    <ItemGroup>
   12.17 +    <ClCompile Include="..\src\compat.c">
   12.18 +      <Filter>Sources</Filter>
   12.19 +    </ClCompile>
   12.20      <ClCompile Include="..\src\effects_internal.c">
   12.21        <Filter>Sources</Filter>
   12.22      </ClCompile>
    13.1 --- a/Xcode-iOS/SDL_mixer.xcodeproj/project.pbxproj	Wed Nov 20 18:56:10 2019 +0300
    13.2 +++ b/Xcode-iOS/SDL_mixer.xcodeproj/project.pbxproj	Wed Nov 20 20:50:02 2019 +0300
    13.3 @@ -32,6 +32,10 @@
    13.4  /* End PBXAggregateTarget section */
    13.5  
    13.6  /* Begin PBXBuildFile section */
    13.7 +		639008DE2385A84C009019FA /* compat.c in Sources */ = {isa = PBXBuildFile; fileRef = 639008DC2385A84C009019FA /* compat.c */; };
    13.8 +		639008DF2385A84C009019FA /* compat.h in Headers */ = {isa = PBXBuildFile; fileRef = 639008DD2385A84C009019FA /* compat.h */; };
    13.9 +		639008E02385A84C009019FA /* compat.c in Sources */ = {isa = PBXBuildFile; fileRef = 639008DC2385A84C009019FA /* compat.c */; };
   13.10 +		639008E12385A84C009019FA /* compat.h in Headers */ = {isa = PBXBuildFile; fileRef = 639008DD2385A84C009019FA /* compat.h */; };
   13.11  		AA1C71151F9BC66000A6BC31 /* effect_position.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1C71131F9BC66000A6BC31 /* effect_position.c */; };
   13.12  		AA1C71161F9BC66000A6BC31 /* effect_stereoreverse.c in Sources */ = {isa = PBXBuildFile; fileRef = AA1C71141F9BC66000A6BC31 /* effect_stereoreverse.c */; };
   13.13  		AA1C71191F9BC67200A6BC31 /* effects_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = AA1C71171F9BC67100A6BC31 /* effects_internal.h */; };
   13.14 @@ -338,6 +342,8 @@
   13.15  
   13.16  /* Begin PBXFileReference section */
   13.17  		1014BAEA010A4B677F000001 /* SDL_mixer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SDL_mixer.h; sourceTree = "<group>"; };
   13.18 +		639008DC2385A84C009019FA /* compat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compat.c; sourceTree = "<group>"; };
   13.19 +		639008DD2385A84C009019FA /* compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compat.h; sourceTree = "<group>"; };
   13.20  		AA1C71131F9BC66000A6BC31 /* effect_position.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = effect_position.c; sourceTree = "<group>"; };
   13.21  		AA1C71141F9BC66000A6BC31 /* effect_stereoreverse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = effect_stereoreverse.c; sourceTree = "<group>"; };
   13.22  		AA1C71171F9BC67100A6BC31 /* effects_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = effects_internal.h; sourceTree = "<group>"; };
   13.23 @@ -624,6 +630,8 @@
   13.24  		63FD69ED23853ABC00C3C961 /* mixersrc */ = {
   13.25  			isa = PBXGroup;
   13.26  			children = (
   13.27 +				639008DC2385A84C009019FA /* compat.c */,
   13.28 +				639008DD2385A84C009019FA /* compat.h */,
   13.29  				AAE406151F9609BA00EDAF53 /* music.c */,
   13.30  				AAE4060A1F9609B900EDAF53 /* music.h */,
   13.31  				AAE406091F9609B900EDAF53 /* mixer.c */,
   13.32 @@ -811,6 +819,7 @@
   13.33  				AA53147D1FE0FE2E0025C9BE /* music_ogg.h in Headers */,
   13.34  				AA53147E1FE0FE2E0025C9BE /* tables.h in Headers */,
   13.35  				AA53147F1FE0FE2E0025C9BE /* music_wav.h in Headers */,
   13.36 +				639008E12385A84C009019FA /* compat.h in Headers */,
   13.37  			);
   13.38  			runOnlyForDeploymentPostprocessing = 0;
   13.39  		};
   13.40 @@ -863,6 +872,7 @@
   13.41  				AAE406371F9609BD00EDAF53 /* music_ogg.h in Headers */,
   13.42  				AA60219617653A9800662B9C /* tables.h in Headers */,
   13.43  				AAE406301F9609BD00EDAF53 /* music_wav.h in Headers */,
   13.44 +				639008DF2385A84C009019FA /* compat.h in Headers */,
   13.45  			);
   13.46  			runOnlyForDeploymentPostprocessing = 0;
   13.47  		};
   13.48 @@ -1109,6 +1119,7 @@
   13.49  				AA5314E91FE0FE2E0025C9BE /* mixer.c in Sources */,
   13.50  				AA5314EA1FE0FE2E0025C9BE /* sndfile.cpp in Sources */,
   13.51  				AA5314EB1FE0FE2E0025C9BE /* sndmix.cpp in Sources */,
   13.52 +				639008E02385A84C009019FA /* compat.c in Sources */,
   13.53  			);
   13.54  			runOnlyForDeploymentPostprocessing = 0;
   13.55  		};
   13.56 @@ -1222,6 +1233,7 @@
   13.57  				AAE406291F9609BD00EDAF53 /* mixer.c in Sources */,
   13.58  				AA60219417653A9800662B9C /* sndfile.cpp in Sources */,
   13.59  				AA60219517653A9800662B9C /* sndmix.cpp in Sources */,
   13.60 +				639008DE2385A84C009019FA /* compat.c in Sources */,
   13.61  			);
   13.62  			runOnlyForDeploymentPostprocessing = 0;
   13.63  		};
    14.1 --- a/Xcode/SDL_mixer.xcodeproj/project.pbxproj	Wed Nov 20 18:56:10 2019 +0300
    14.2 +++ b/Xcode/SDL_mixer.xcodeproj/project.pbxproj	Wed Nov 20 20:50:02 2019 +0300
    14.3 @@ -11,6 +11,8 @@
    14.4  		0448E8AF108B937A00C9D3EA /* native_midi_macosx.c in Sources */ = {isa = PBXBuildFile; fileRef = 0448E8AD108B937A00C9D3EA /* native_midi_macosx.c */; };
    14.5  		630FBD8320D52105009867AB /* music_opus.c in Sources */ = {isa = PBXBuildFile; fileRef = 630FBD8220D52105009867AB /* music_opus.c */; };
    14.6  		630FBD8520D5211F009867AB /* music_opus.h in Headers */ = {isa = PBXBuildFile; fileRef = 630FBD8420D5211F009867AB /* music_opus.h */; };
    14.7 +		639008C82385A822009019FA /* compat.c in Sources */ = {isa = PBXBuildFile; fileRef = 639008C62385A822009019FA /* compat.c */; };
    14.8 +		639008C92385A822009019FA /* compat.h in Headers */ = {isa = PBXBuildFile; fileRef = 639008C72385A822009019FA /* compat.h */; };
    14.9  		63CD6ADC20D52DE20096FB34 /* Opus.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 630FBD7620D52063009867AB /* Opus.framework */; };
   14.10  		63CD6ADD20D52DE90096FB34 /* OpusFile.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 630FBD7C20D5206E009867AB /* OpusFile.framework */; };
   14.11  		AA6021301765383B00662B9C /* modplug.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = AA60212F1765382200662B9C /* modplug.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
   14.12 @@ -115,6 +117,8 @@
   14.13  		630FBD7C20D5206E009867AB /* OpusFile.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpusFile.framework; path = Frameworks/OpusFile.framework; sourceTree = "<group>"; };
   14.14  		630FBD8220D52105009867AB /* music_opus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = music_opus.c; sourceTree = "<group>"; };
   14.15  		630FBD8420D5211F009867AB /* music_opus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = music_opus.h; sourceTree = "<group>"; };
   14.16 +		639008C62385A822009019FA /* compat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = compat.c; sourceTree = "<group>"; };
   14.17 +		639008C72385A822009019FA /* compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compat.h; sourceTree = "<group>"; };
   14.18  		AA60212F1765382200662B9C /* modplug.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = modplug.framework; path = Frameworks/modplug.framework; sourceTree = "<group>"; };
   14.19  		AA64428E175AA7A500A2125A /* mpg123.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = mpg123.framework; path = Frameworks/mpg123.framework; sourceTree = "<group>"; };
   14.20  		AA6442D0175B181300A2125A /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
   14.21 @@ -326,6 +330,8 @@
   14.22  		6398B0D4238528C10024EEA1 /* mixersrc */ = {
   14.23  			isa = PBXGroup;
   14.24  			children = (
   14.25 +				639008C62385A822009019FA /* compat.c */,
   14.26 +				639008C72385A822009019FA /* compat.h */,
   14.27  				AAE405D01F9607C100EDAF53 /* effect_position.c */,
   14.28  				AAE405E01F9607C300EDAF53 /* effect_stereoreverse.c */,
   14.29  				AAE405CE1F9607C100EDAF53 /* effects_internal.c */,
   14.30 @@ -428,6 +434,7 @@
   14.31  				BE1FA8CD07AF96B2004B6283 /* SDL_mixer.h in Headers */,
   14.32  				AAE405F51F9607C300EDAF53 /* music_ogg.h in Headers */,
   14.33  				630FBD8520D5211F009867AB /* music_opus.h in Headers */,
   14.34 +				639008C92385A822009019FA /* compat.h in Headers */,
   14.35  			);
   14.36  			runOnlyForDeploymentPostprocessing = 0;
   14.37  		};
   14.38 @@ -630,6 +637,7 @@
   14.39  				AAE405E51F9607C300EDAF53 /* mixer.c in Sources */,
   14.40  				0448E8AE108B937A00C9D3EA /* native_midi_macosx.c in Sources */,
   14.41  				630FBD8320D52105009867AB /* music_opus.c in Sources */,
   14.42 +				639008C82385A822009019FA /* compat.c in Sources */,
   14.43  			);
   14.44  			runOnlyForDeploymentPostprocessing = 0;
   14.45  		};
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/src/compat.c	Wed Nov 20 20:50:02 2019 +0300
    15.3 @@ -0,0 +1,93 @@
    15.4 +/*
    15.5 +  SDL_mixer:  An audio mixer library based on the SDL library
    15.6 +  Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
    15.7 +
    15.8 +  This software is provided 'as-is', without any express or implied
    15.9 +  warranty.  In no event will the authors be held liable for any damages
   15.10 +  arising from the use of this software.
   15.11 +
   15.12 +  Permission is granted to anyone to use this software for any purpose,
   15.13 +  including commercial applications, and to alter it and redistribute it
   15.14 +  freely, subject to the following restrictions:
   15.15 +
   15.16 +  1. The origin of this software must not be misrepresented; you must not
   15.17 +     claim that you wrote the original software. If you use this software
   15.18 +     in a product, an acknowledgment in the product documentation would be
   15.19 +     appreciated but is not required.
   15.20 +  2. Altered source versions must be plainly marked as such, and must not be
   15.21 +     misrepresented as being the original software.
   15.22 +  3. This notice may not be removed or altered from any source distribution.
   15.23 +*/
   15.24 +
   15.25 +#include <stddef.h>
   15.26 +#include "compat.h"
   15.27 +
   15.28 +#if !defined(HAVE_SDL_STRTOKR)
   15.29 +/*
   15.30 + * Adapted from _PDCLIB_strtok() of PDClib library at
   15.31 + * https://github.com/DevSolar/pdclib.git
   15.32 + *
   15.33 + * The code was under CC0 license:
   15.34 + * https://creativecommons.org/publicdomain/zero/1.0/legalcode :
   15.35 + *
   15.36 + *                        No Copyright
   15.37 + *
   15.38 + * The person who associated a work with this deed has dedicated the
   15.39 + * work to the public domain by waiving all of his or her rights to
   15.40 + * the work worldwide under copyright law, including all related and
   15.41 + * neighboring rights, to the extent allowed by law.
   15.42 + *
   15.43 + * You can copy, modify, distribute and perform the work, even for
   15.44 + * commercial purposes, all without asking permission. See Other
   15.45 + * Information below.
   15.46 + */
   15.47 +char *SDL_strtokr(char *s1, const char *s2, char **ptr)
   15.48 +{
   15.49 +    const char *p = s2;
   15.50 +
   15.51 +    if (!s2 || !ptr || (!s1 && !*ptr)) return NULL;
   15.52 +
   15.53 +    if (s1 != NULL) {  /* new string */
   15.54 +        *ptr = s1;
   15.55 +    } else { /* old string continued */
   15.56 +        if (*ptr == NULL) {
   15.57 +        /* No old string, no new string, nothing to do */
   15.58 +            return NULL;
   15.59 +        }
   15.60 +        s1 = *ptr;
   15.61 +    }
   15.62 +
   15.63 +    /* skip leading s2 characters */
   15.64 +    while (*p && *s1) {
   15.65 +        if (*s1 == *p) {
   15.66 +        /* found separator; skip and start over */
   15.67 +            ++s1;
   15.68 +            p = s2;
   15.69 +            continue;
   15.70 +        }
   15.71 +        ++p;
   15.72 +    }
   15.73 +
   15.74 +    if (! *s1) { /* no more to parse */
   15.75 +        *ptr = s1;
   15.76 +        return NULL;
   15.77 +    }
   15.78 +
   15.79 +    /* skipping non-s2 characters */
   15.80 +    *ptr = s1;
   15.81 +    while (**ptr) {
   15.82 +        p = s2;
   15.83 +        while (*p) {
   15.84 +            if (**ptr == *p++) {
   15.85 +            /* found separator; overwrite with '\0', position *ptr, return */
   15.86 +                *((*ptr)++) = '\0';
   15.87 +                return s1;
   15.88 +            }
   15.89 +        }
   15.90 +        ++(*ptr);
   15.91 +    }
   15.92 +
   15.93 +    /* parsed to end of string */
   15.94 +    return s1;
   15.95 +}
   15.96 +#endif /* HAVE_SDL_STRTOKR */
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/src/compat.h	Wed Nov 20 20:50:02 2019 +0300
    16.3 @@ -0,0 +1,34 @@
    16.4 +/*
    16.5 +  SDL_mixer:  An audio mixer library based on the SDL library
    16.6 +  Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
    16.7 +
    16.8 +  This software is provided 'as-is', without any express or implied
    16.9 +  warranty.  In no event will the authors be held liable for any damages
   16.10 +  arising from the use of this software.
   16.11 +
   16.12 +  Permission is granted to anyone to use this software for any purpose,
   16.13 +  including commercial applications, and to alter it and redistribute it
   16.14 +  freely, subject to the following restrictions:
   16.15 +
   16.16 +  1. The origin of this software must not be misrepresented; you must not
   16.17 +     claim that you wrote the original software. If you use this software
   16.18 +     in a product, an acknowledgment in the product documentation would be
   16.19 +     appreciated but is not required.
   16.20 +  2. Altered source versions must be plainly marked as such, and must not be
   16.21 +     misrepresented as being the original software.
   16.22 +  3. This notice may not be removed or altered from any source distribution.
   16.23 +*/
   16.24 +
   16.25 +#ifndef COMPAT_H_
   16.26 +#define COMPAT_H_
   16.27 +
   16.28 +#include "SDL.h"
   16.29 +
   16.30 +#if SDL_VERSION_ATLEAST(2,0,12)
   16.31 +#define HAVE_SDL_STRTOKR
   16.32 +#else
   16.33 +#define SDL_strtokr _MIX_strtokr
   16.34 +extern char *SDL_strtokr(char *s1, const char *s2, char **saveptr);
   16.35 +#endif
   16.36 +
   16.37 +#endif /* COMPAT_H_ */
    17.1 --- a/src/music.c	Wed Nov 20 18:56:10 2019 +0300
    17.2 +++ b/src/music.c	Wed Nov 20 20:50:02 2019 +0300
    17.3 @@ -18,8 +18,6 @@
    17.4       misrepresented as being the original software.
    17.5    3. This notice may not be removed or altered from any source distribution.
    17.6  */
    17.7 -#include <string.h> /* for strtok() and strtok_s() */
    17.8 -
    17.9  #include "SDL_hints.h"
   17.10  #include "SDL_log.h"
   17.11  #include "SDL_timer.h"
   17.12 @@ -42,6 +40,8 @@
   17.13  #include "music_flac.h"
   17.14  #include "native_midi/native_midi.h"
   17.15  
   17.16 +#include "compat.h"
   17.17 +
   17.18  /* Check to make sure we are building with a new enough SDL */
   17.19  #if SDL_COMPILEDVERSION < SDL_VERSIONNUM(2, 0, 7)
   17.20  #error You need SDL 2.0.7 or newer from http://www.libsdl.org
   17.21 @@ -1097,38 +1097,6 @@
   17.22      return NULL;
   17.23  }
   17.24  
   17.25 -/*
   17.26 - * public domain strtok_r() by Charlie Gordon
   17.27 - *
   17.28 - *   from comp.lang.c  9/14/2007
   17.29 - *
   17.30 - *      http://groups.google.com/group/comp.lang.c/msg/2ab1ecbb86646684
   17.31 - *
   17.32 - *     (Declaration that it's public domain):
   17.33 - *      http://groups.google.com/group/comp.lang.c/msg/7c7b39328fefab9c
   17.34 - */
   17.35 -static char *_strtok_safe(char *str, const char *delim, char **nextp)
   17.36 -{
   17.37 -    char *ret;
   17.38 -    if (str == NULL) {
   17.39 -        str = *nextp;
   17.40 -    }
   17.41 -
   17.42 -    str += strspn(str, delim);
   17.43 -    if (*str == '\0') {
   17.44 -        return NULL;
   17.45 -    }
   17.46 -    ret = str;
   17.47 -
   17.48 -    str += strcspn(str, delim);
   17.49 -    if (*str) {
   17.50 -        *str++ = '\0';
   17.51 -    }
   17.52 -
   17.53 -    *nextp = str;
   17.54 -    return ret;
   17.55 -}
   17.56 -
   17.57  int Mix_EachSoundFont(int (SDLCALL *function)(const char*, void*), void *data)
   17.58  {
   17.59      char *context, *path, *paths;
   17.60 @@ -1146,26 +1114,20 @@
   17.61      }
   17.62  
   17.63  #if defined(_WIN32)||defined(__OS2__)
   17.64 -#define SEPARATOR ";"
   17.65 +#define PATHSEP ";"
   17.66  #else
   17.67 -#define SEPARATOR ":;"
   17.68 +#define PATHSEP ":;"
   17.69  #endif
   17.70 -    for (path = _strtok_safe(paths, SEPARATOR, &context); path;
   17.71 -         path = _strtok_safe(NULL,  SEPARATOR, &context))
   17.72 -    {
   17.73 +    for (path = SDL_strtokr(paths, PATHSEP, &context); path;
   17.74 +         path = SDL_strtokr(NULL,  PATHSEP, &context)) {
   17.75          if (!function(path, data)) {
   17.76              continue;
   17.77 -        } else {
   17.78 -            soundfonts_found++;
   17.79          }
   17.80 +        soundfonts_found++;
   17.81      }
   17.82 -#undef SEPARATOR
   17.83  
   17.84      SDL_free(paths);
   17.85 -    if (soundfonts_found > 0)
   17.86 -        return 1;
   17.87 -    else
   17.88 -        return 0;
   17.89 +    return (soundfonts_found > 0);
   17.90  }
   17.91  
   17.92  /* vi: set ts=4 sw=4 expandtab: */