added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.)
authorOzkan Sezer <sezeroz@gmail.com>
Wed, 20 Nov 2019 20:40:50 +0300
changeset 13262d6decc5d2464
parent 13261 33390f96674c
child 13263 7e5406b2375a
added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.)
CMakeLists.txt
Makefile.os2
Makefile.psp
VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj
VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters
VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj
VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters
VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj
VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters
VisualC/SDL/SDL.vcxproj
VisualC/SDL/SDL.vcxproj.filters
Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
Xcode/SDL/SDL.xcodeproj/project.pbxproj
configure
configure.ac
include/SDL_config.h.cmake
include/SDL_config.h.in
include/SDL_config_android.h
include/SDL_config_iphoneos.h
include/SDL_config_macosx.h
include/SDL_config_os2.h
include/SDL_config_windows.h
include/SDL_config_winrt.h
include/SDL_config_wiz.h
include/SDL_stdinc.h
src/dynapi/SDL_dynapi_overrides.h
src/dynapi/SDL_dynapi_procs.h
src/stdlib/SDL_strtokr.c
     1.1 --- a/CMakeLists.txt	Wed Nov 20 08:43:24 2019 -0800
     1.2 +++ b/CMakeLists.txt	Wed Nov 20 20:40:50 2019 +0300
     1.3 @@ -763,7 +763,7 @@
     1.4              wcslen wcscmp
     1.5              strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
     1.6              _ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp
     1.7 -            _stricmp _strnicmp sscanf
     1.8 +            _stricmp _strnicmp strtok_s sscanf
     1.9              acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf
    1.10              copysign copysignf cos cosf exp expf fabs fabsf floor floorf fmod fmodf
    1.11              log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
    1.12 @@ -797,7 +797,7 @@
    1.13      foreach(_FN
    1.14              strtod malloc calloc realloc free getenv setenv putenv unsetenv
    1.15              qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat
    1.16 -            _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
    1.17 +            _strrev _strupr _strlwr strchr strrchr strstr strtok_r itoa _ltoa
    1.18              _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull
    1.19              atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp
    1.20              vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp
     2.1 --- a/Makefile.os2	Wed Nov 20 08:43:24 2019 -0800
     2.2 +++ b/Makefile.os2	Wed Nov 20 20:40:50 2019 +0300
     2.3 @@ -1,4 +1,4 @@
     2.4 -# Open Watcom makefile to build SDL2.dll for OS/2:
     2.5 +# Open Watcom makefile to build SDL2.dll for OS/2
     2.6  # wmake -f Makefile.os2
     2.7  
     2.8  LIBNAME = SDL2
     2.9 @@ -33,7 +33,7 @@
    2.10         s_atan.c s_copysign.c s_cos.c s_fabs.c s_floor.c s_scalbn.c s_sin.c s_tan.c
    2.11  
    2.12  SRCS = SDL.c SDL_assert.c SDL_error.c SDL_log.c SDL_dataqueue.c SDL_hints.c
    2.13 -SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c
    2.14 +SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c
    2.15  SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c
    2.16  SRCS+= SDL_rwops.c SDL_power.c
    2.17  SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c
     3.1 --- a/Makefile.psp	Wed Nov 20 08:43:24 2019 -0800
     3.2 +++ b/Makefile.psp	Wed Nov 20 20:40:50 2019 +0300
     3.3 @@ -50,6 +50,7 @@
     3.4        src/stdlib/SDL_qsort.o \
     3.5        src/stdlib/SDL_stdlib.o \
     3.6        src/stdlib/SDL_string.o \
     3.7 +      src/stdlib/SDL_strtokr.o \
     3.8        src/thread/SDL_thread.o \
     3.9        src/thread/generic/SDL_systls.o \
    3.10        src/thread/psp/SDL_syssem.o \
    3.11 @@ -78,7 +79,7 @@
    3.12        src/video/psp/SDL_pspevents.o \
    3.13        src/video/psp/SDL_pspvideo.o \
    3.14        src/video/psp/SDL_pspgl.o \
    3.15 -      src/video/psp/SDL_pspmouse.o \
    3.16 +      src/video/psp/SDL_pspmouse.o
    3.17  
    3.18  INCDIR = ./include
    3.19  CFLAGS = -g -O2 -G0 -Wall -D__PSP__ -DHAVE_OPENGL
     4.1 --- a/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj	Wed Nov 20 08:43:24 2019 -0800
     4.2 +++ b/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj	Wed Nov 20 20:40:50 2019 +0300
     4.3 @@ -285,6 +285,7 @@
     4.4      <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
     4.5      <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
     4.6      <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
     4.7 +    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
     4.8      <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c" />
     4.9      <ClCompile Include="..\..\src\thread\SDL_thread.c" />
    4.10      <ClCompile Include="..\..\src\thread\stdcpp\SDL_syscond.cpp" />
     5.1 --- a/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters	Wed Nov 20 08:43:24 2019 -0800
     5.2 +++ b/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters	Wed Nov 20 20:40:50 2019 +0300
     5.3 @@ -626,6 +626,9 @@
     5.4      <ClCompile Include="..\..\src\stdlib\SDL_string.c">
     5.5        <Filter>Source Files</Filter>
     5.6      </ClCompile>
     5.7 +    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c">
     5.8 +      <Filter>Source Files</Filter>
     5.9 +    </ClCompile>
    5.10      <ClCompile Include="..\..\src\thread\generic\SDL_syssem.c">
    5.11        <Filter>Source Files</Filter>
    5.12      </ClCompile>
     6.1 --- a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj	Wed Nov 20 08:43:24 2019 -0800
     6.2 +++ b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj	Wed Nov 20 20:40:50 2019 +0300
     6.3 @@ -251,6 +251,7 @@
     6.4      <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
     6.5      <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
     6.6      <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
     6.7 +    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
     6.8      <ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
     6.9      <ClCompile Include="..\..\src\thread\SDL_thread.c" />
    6.10      <ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c" />
     7.1 --- a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters	Wed Nov 20 08:43:24 2019 -0800
     7.2 +++ b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters	Wed Nov 20 20:40:50 2019 +0300
     7.3 @@ -593,6 +593,9 @@
     7.4      <ClCompile Include="..\..\src\stdlib\SDL_string.c">
     7.5        <Filter>Source Files</Filter>
     7.6      </ClCompile>
     7.7 +    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c">
     7.8 +      <Filter>Source Files</Filter>
     7.9 +    </ClCompile>
    7.10      <ClCompile Include="..\..\src\thread\SDL_thread.c">
    7.11        <Filter>Source Files</Filter>
    7.12      </ClCompile>
     8.1 --- a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj	Wed Nov 20 08:43:24 2019 -0800
     8.2 +++ b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj	Wed Nov 20 20:40:50 2019 +0300
     8.3 @@ -283,6 +283,7 @@
     8.4      <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
     8.5      <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
     8.6      <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
     8.7 +    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
     8.8      <ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
     8.9      <ClCompile Include="..\..\src\thread\SDL_thread.c" />
    8.10      <ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c" />
     9.1 --- a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters	Wed Nov 20 08:43:24 2019 -0800
     9.2 +++ b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters	Wed Nov 20 20:40:50 2019 +0300
     9.3 @@ -611,6 +611,9 @@
     9.4      <ClCompile Include="..\..\src\stdlib\SDL_string.c">
     9.5        <Filter>Source Files</Filter>
     9.6      </ClCompile>
     9.7 +    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c">
     9.8 +      <Filter>Source Files</Filter>
     9.9 +    </ClCompile>
    9.10      <ClCompile Include="..\..\src\thread\SDL_thread.c">
    9.11        <Filter>Source Files</Filter>
    9.12      </ClCompile>
    10.1 --- a/VisualC/SDL/SDL.vcxproj	Wed Nov 20 08:43:24 2019 -0800
    10.2 +++ b/VisualC/SDL/SDL.vcxproj	Wed Nov 20 20:40:50 2019 +0300
    10.3 @@ -484,6 +484,7 @@
    10.4      <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
    10.5      <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
    10.6      <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
    10.7 +    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
    10.8      <ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
    10.9      <ClCompile Include="..\..\src\thread\SDL_thread.c" />
   10.10      <ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c" />
    11.1 --- a/VisualC/SDL/SDL.vcxproj.filters	Wed Nov 20 08:43:24 2019 -0800
    11.2 +++ b/VisualC/SDL/SDL.vcxproj.filters	Wed Nov 20 20:40:50 2019 +0300
    11.3 @@ -426,6 +426,7 @@
    11.4      <ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
    11.5      <ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
    11.6      <ClCompile Include="..\..\src\stdlib\SDL_string.c" />
    11.7 +    <ClCompile Include="..\..\src\stdlib\SDL_strtokr.c" />
    11.8      <ClCompile Include="..\..\src\thread\generic\SDL_syscond.c" />
    11.9      <ClCompile Include="..\..\src\thread\SDL_thread.c" />
   11.10      <ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c" />
    12.1 --- a/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj	Wed Nov 20 08:43:24 2019 -0800
    12.2 +++ b/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj	Wed Nov 20 20:40:50 2019 +0300
    12.3 @@ -355,6 +355,10 @@
    12.4  		56ED04E1118A8EE200A56AA6 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E0118A8EE200A56AA6 /* SDL_power.c */; };
    12.5  		56ED04E3118A8EFD00A56AA6 /* SDL_syspower.m in Sources */ = {isa = PBXBuildFile; fileRef = 56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */; };
    12.6  		56F9D5601DF73BA400C15B5D /* SDL_dataqueue.c in Sources */ = {isa = PBXBuildFile; fileRef = 566726431DF72CF5001DD3DB /* SDL_dataqueue.c */; };
    12.7 +		63CC93C723849391002A5C54 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63CC93C623849391002A5C54 /* SDL_strtokr.c */; };
    12.8 +		63CC93C823849391002A5C54 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63CC93C623849391002A5C54 /* SDL_strtokr.c */; };
    12.9 +		63CC93C923849391002A5C54 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63CC93C623849391002A5C54 /* SDL_strtokr.c */; };
   12.10 +		63CC93CA23849391002A5C54 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63CC93C623849391002A5C54 /* SDL_strtokr.c */; };
   12.11  		93CB792313FC5E5200BD3E05 /* SDL_uikitviewcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CB792213FC5E5200BD3E05 /* SDL_uikitviewcontroller.h */; };
   12.12  		93CB792613FC5F5300BD3E05 /* SDL_uikitviewcontroller.m in Sources */ = {isa = PBXBuildFile; fileRef = 93CB792513FC5F5300BD3E05 /* SDL_uikitviewcontroller.m */; };
   12.13  		A704172E20F7E74800A82227 /* controller_type.h in Headers */ = {isa = PBXBuildFile; fileRef = A704172D20F7E74800A82227 /* controller_type.h */; };
   12.14 @@ -963,6 +967,7 @@
   12.15  		56EA86FA13E9EC2B002E47EB /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_coreaudio.h; sourceTree = "<group>"; };
   12.16  		56ED04E0118A8EE200A56AA6 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_power.c; sourceTree = "<group>"; };
   12.17  		56ED04E2118A8EFD00A56AA6 /* SDL_syspower.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_syspower.m; sourceTree = "<group>"; };
   12.18 +		63CC93C623849391002A5C54 /* SDL_strtokr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_strtokr.c; sourceTree = "<group>"; };
   12.19  		93CB792213FC5E5200BD3E05 /* SDL_uikitviewcontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitviewcontroller.h; sourceTree = "<group>"; };
   12.20  		93CB792513FC5F5300BD3E05 /* SDL_uikitviewcontroller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitviewcontroller.m; sourceTree = "<group>"; };
   12.21  		A704172D20F7E74800A82227 /* controller_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = controller_type.h; sourceTree = "<group>"; };
   12.22 @@ -1491,6 +1496,7 @@
   12.23  		FD3F4A6F0DEA620800C5B771 /* stdlib */ = {
   12.24  			isa = PBXGroup;
   12.25  			children = (
   12.26 +				63CC93C623849391002A5C54 /* SDL_strtokr.c */,
   12.27  				FD3F4A700DEA620800C5B771 /* SDL_getenv.c */,
   12.28  				FD3F4A710DEA620800C5B771 /* SDL_iconv.c */,
   12.29  				FD3F4A720DEA620800C5B771 /* SDL_malloc.c */,
   12.30 @@ -2568,6 +2574,7 @@
   12.31  				52ED1E56222889500061FCE0 /* SDL_gamecontroller.c in Sources */,
   12.32  				52ED1E57222889500061FCE0 /* SDL_systls.c in Sources */,
   12.33  				52ED1E58222889500061FCE0 /* SDL_sysfilesystem.m in Sources */,
   12.34 +				63CC93C823849391002A5C54 /* SDL_strtokr.c in Sources */,
   12.35  			);
   12.36  			runOnlyForDeploymentPostprocessing = 0;
   12.37  		};
   12.38 @@ -2696,6 +2703,7 @@
   12.39  				F3E3C7452241389A007D243C /* SDL_gamecontroller.c in Sources */,
   12.40  				F3E3C7462241389A007D243C /* SDL_systls.c in Sources */,
   12.41  				F3E3C7472241389A007D243C /* SDL_sysfilesystem.m in Sources */,
   12.42 +				63CC93CA23849391002A5C54 /* SDL_strtokr.c in Sources */,
   12.43  			);
   12.44  			runOnlyForDeploymentPostprocessing = 0;
   12.45  		};
   12.46 @@ -2822,6 +2830,7 @@
   12.47  				FAB598BD1BB5C31600BE72C5 /* SDL_hints.c in Sources */,
   12.48  				FAB598BE1BB5C31600BE72C5 /* SDL_log.c in Sources */,
   12.49  				FAB598BF1BB5C31600BE72C5 /* SDL.c in Sources */,
   12.50 +				63CC93C923849391002A5C54 /* SDL_strtokr.c in Sources */,
   12.51  			);
   12.52  			runOnlyForDeploymentPostprocessing = 0;
   12.53  		};
   12.54 @@ -2942,6 +2951,7 @@
   12.55  				AA0AD06216647BBB00CE5896 /* SDL_gamecontroller.c in Sources */,
   12.56  				AA0F8495178D5F1A00823F9D /* SDL_systls.c in Sources */,
   12.57  				56C181E217C44D7A00406AE3 /* SDL_sysfilesystem.m in Sources */,
   12.58 +				63CC93C723849391002A5C54 /* SDL_strtokr.c in Sources */,
   12.59  			);
   12.60  			runOnlyForDeploymentPostprocessing = 0;
   12.61  		};
    13.1 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Wed Nov 20 08:43:24 2019 -0800
    13.2 +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Wed Nov 20 20:40:50 2019 +0300
    13.3 @@ -456,6 +456,9 @@
    13.4  		5C2EF6FE1FC9EE65003F5197 /* SDL_egl.c in Sources */ = {isa = PBXBuildFile; fileRef = 5C2EF6F51FC9EE35003F5197 /* SDL_egl.c */; };
    13.5  		5C2EF6FF1FC9EE65003F5197 /* SDL_rect_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF6F41FC9EE34003F5197 /* SDL_rect_c.h */; };
    13.6  		5C2EF7011FC9EF10003F5197 /* SDL_egl.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C2EF7001FC9EF0F003F5197 /* SDL_egl.h */; };
    13.7 +		63994BE7238492D000F9C268 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63994BE6238492D000F9C268 /* SDL_strtokr.c */; };
    13.8 +		63994BE8238492D000F9C268 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63994BE6238492D000F9C268 /* SDL_strtokr.c */; };
    13.9 +		63994BE9238492D000F9C268 /* SDL_strtokr.c in Sources */ = {isa = PBXBuildFile; fileRef = 63994BE6238492D000F9C268 /* SDL_strtokr.c */; };
   13.10  		A704170920F09A9800A82227 /* hid.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170820F09A9800A82227 /* hid.c */; };
   13.11  		A704170A20F09A9800A82227 /* hid.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170820F09A9800A82227 /* hid.c */; };
   13.12  		A704170B20F09A9800A82227 /* hid.c in Sources */ = {isa = PBXBuildFile; fileRef = A704170820F09A9800A82227 /* hid.c */; };
   13.13 @@ -1152,6 +1155,7 @@
   13.14  		5C2EF6F51FC9EE35003F5197 /* SDL_egl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_egl.c; sourceTree = "<group>"; };
   13.15  		5C2EF6F61FC9EE35003F5197 /* SDL_egl_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_egl_c.h; sourceTree = "<group>"; };
   13.16  		5C2EF7001FC9EF0F003F5197 /* SDL_egl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_egl.h; sourceTree = "<group>"; };
   13.17 +		63994BE6238492D000F9C268 /* SDL_strtokr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_strtokr.c; sourceTree = "<group>"; };
   13.18  		A704170820F09A9800A82227 /* hid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hid.c; sourceTree = "<group>"; };
   13.19  		A704170D20F09AC800A82227 /* SDL_hidapijoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapijoystick.c; sourceTree = "<group>"; };
   13.20  		A704170E20F09AC800A82227 /* SDL_hidapijoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapijoystick_c.h; sourceTree = "<group>"; };
   13.21 @@ -1636,6 +1640,7 @@
   13.22  		04BDFE5D12E6671700899322 /* stdlib */ = {
   13.23  			isa = PBXGroup;
   13.24  			children = (
   13.25 +				63994BE6238492D000F9C268 /* SDL_strtokr.c */,
   13.26  				04BDFE5E12E6671700899322 /* SDL_getenv.c */,
   13.27  				04BDFE5F12E6671700899322 /* SDL_iconv.c */,
   13.28  				04BDFE6012E6671700899322 /* SDL_malloc.c */,
   13.29 @@ -2812,6 +2817,7 @@
   13.30  				AA0F8491178D5ECC00823F9D /* SDL_systls.c in Sources */,
   13.31  				D55A1B82179F262300625D7C /* SDL_cocoamousetap.m in Sources */,
   13.32  				567E2F1C17C44BB2005F1892 /* SDL_sysfilesystem.m in Sources */,
   13.33 +				63994BE7238492D000F9C268 /* SDL_strtokr.c in Sources */,
   13.34  			);
   13.35  			runOnlyForDeploymentPostprocessing = 0;
   13.36  		};
   13.37 @@ -2950,6 +2956,7 @@
   13.38  				AA0F8492178D5ECC00823F9D /* SDL_systls.c in Sources */,
   13.39  				D55A1B84179F263600625D7C /* SDL_cocoamousetap.m in Sources */,
   13.40  				DB0F490817CA5292008798C5 /* SDL_sysfilesystem.m in Sources */,
   13.41 +				63994BE8238492D000F9C268 /* SDL_strtokr.c in Sources */,
   13.42  			);
   13.43  			runOnlyForDeploymentPostprocessing = 0;
   13.44  		};
   13.45 @@ -3088,6 +3095,7 @@
   13.46  				AA0F8493178D5ECC00823F9D /* SDL_systls.c in Sources */,
   13.47  				D55A1B83179F263500625D7C /* SDL_cocoamousetap.m in Sources */,
   13.48  				DB0F490A17CA5293008798C5 /* SDL_sysfilesystem.m in Sources */,
   13.49 +				63994BE9238492D000F9C268 /* SDL_strtokr.c in Sources */,
   13.50  			);
   13.51  			runOnlyForDeploymentPostprocessing = 0;
   13.52  		};
    14.1 --- a/configure	Wed Nov 20 08:43:24 2019 -0800
    14.2 +++ b/configure	Wed Nov 20 20:40:50 2019 +0300
    14.3 @@ -16978,7 +16978,7 @@
    14.4  rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    14.5  fi
    14.6  
    14.7 -    for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll _Exit
    14.8 +    for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll _Exit
    14.9  do :
   14.10    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
   14.11  ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
    15.1 --- a/configure.ac	Wed Nov 20 08:43:24 2019 -0800
    15.2 +++ b/configure.ac	Wed Nov 20 20:40:50 2019 +0300
    15.3 @@ -335,7 +335,7 @@
    15.4          AC_DEFINE(HAVE_MPROTECT, 1, [ ])
    15.5          ]),
    15.6      )
    15.7 -    AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll _Exit)
    15.8 +    AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll _Exit)
    15.9  
   15.10      AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
   15.11      AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
    16.1 --- a/include/SDL_config.h.cmake	Wed Nov 20 08:43:24 2019 -0800
    16.2 +++ b/include/SDL_config.h.cmake	Wed Nov 20 20:40:50 2019 +0300
    16.3 @@ -108,6 +108,8 @@
    16.4  #cmakedefine HAVE_STRCHR 1
    16.5  #cmakedefine HAVE_STRRCHR 1
    16.6  #cmakedefine HAVE_STRSTR 1
    16.7 +#cmakedefine HAVE_STRTOK_R 1
    16.8 +#cmakedefine HAVE_STRTOK_S 1
    16.9  #cmakedefine HAVE_ITOA 1
   16.10  #cmakedefine HAVE__LTOA 1
   16.11  #cmakedefine HAVE__UITOA 1
    17.1 --- a/include/SDL_config.h.in	Wed Nov 20 08:43:24 2019 -0800
    17.2 +++ b/include/SDL_config.h.in	Wed Nov 20 20:40:50 2019 +0300
    17.3 @@ -111,6 +111,8 @@
    17.4  #undef HAVE_STRCHR
    17.5  #undef HAVE_STRRCHR
    17.6  #undef HAVE_STRSTR
    17.7 +#undef HAVE_STRTOK_R
    17.8 +#undef HAVE_STRTOK_S
    17.9  #undef HAVE_ITOA
   17.10  #undef HAVE__LTOA
   17.11  #undef HAVE__UITOA
    18.1 --- a/include/SDL_config_android.h	Wed Nov 20 08:43:24 2019 -0800
    18.2 +++ b/include/SDL_config_android.h	Wed Nov 20 20:40:50 2019 +0300
    18.3 @@ -71,6 +71,7 @@
    18.4  #define HAVE_STRCHR 1
    18.5  #define HAVE_STRRCHR    1
    18.6  #define HAVE_STRSTR 1
    18.7 +#define HAVE_STRTOK_R 1
    18.8  #define HAVE_STRTOL 1
    18.9  #define HAVE_STRTOUL    1
   18.10  #define HAVE_STRTOLL    1
    19.1 --- a/include/SDL_config_iphoneos.h	Wed Nov 20 08:43:24 2019 -0800
    19.2 +++ b/include/SDL_config_iphoneos.h	Wed Nov 20 20:40:50 2019 +0300
    19.3 @@ -71,6 +71,7 @@
    19.4  #define HAVE_STRCHR 1
    19.5  #define HAVE_STRRCHR    1
    19.6  #define HAVE_STRSTR 1
    19.7 +#define HAVE_STRTOK_R 1
    19.8  #define HAVE_STRTOL 1
    19.9  #define HAVE_STRTOUL    1
   19.10  #define HAVE_STRTOLL    1
    20.1 --- a/include/SDL_config_macosx.h	Wed Nov 20 08:43:24 2019 -0800
    20.2 +++ b/include/SDL_config_macosx.h	Wed Nov 20 20:40:50 2019 +0300
    20.3 @@ -74,6 +74,7 @@
    20.4  #define HAVE_STRCHR 1
    20.5  #define HAVE_STRRCHR    1
    20.6  #define HAVE_STRSTR 1
    20.7 +#define HAVE_STRTOK_R 1
    20.8  #define HAVE_STRTOL 1
    20.9  #define HAVE_STRTOUL    1
   20.10  #define HAVE_STRTOLL    1
    21.1 --- a/include/SDL_config_os2.h	Wed Nov 20 08:43:24 2019 -0800
    21.2 +++ b/include/SDL_config_os2.h	Wed Nov 20 20:40:50 2019 +0300
    21.3 @@ -110,6 +110,7 @@
    21.4  #define HAVE_STRCHR 1
    21.5  #define HAVE_STRRCHR 1
    21.6  #define HAVE_STRSTR 1
    21.7 +/* #undef HAVE_STRTOK_R */
    21.8  #define HAVE_ITOA 1
    21.9  #define HAVE__LTOA 1
   21.10  #define HAVE__ULTOA 1
    22.1 --- a/include/SDL_config_windows.h	Wed Nov 20 08:43:24 2019 -0800
    22.2 +++ b/include/SDL_config_windows.h	Wed Nov 20 20:40:50 2019 +0300
    22.3 @@ -117,6 +117,10 @@
    22.4  #define HAVE_STRCHR 1
    22.5  #define HAVE_STRRCHR 1
    22.6  #define HAVE_STRSTR 1
    22.7 +/* #undef HAVE_STRTOK_R */
    22.8 +#if defined(_MSC_VER)
    22.9 +#define HAVE_STRTOK_S 1
   22.10 +#endif
   22.11  /* These functions have security warnings, so we won't use them */
   22.12  /* #undef HAVE__LTOA */
   22.13  /* #undef HAVE__ULTOA */
    23.1 --- a/include/SDL_config_winrt.h	Wed Nov 20 08:43:24 2019 -0800
    23.2 +++ b/include/SDL_config_winrt.h	Wed Nov 20 20:40:50 2019 +0300
    23.3 @@ -130,6 +130,7 @@
    23.4  #define HAVE_STRCHR 1
    23.5  #define HAVE_STRRCHR 1
    23.6  #define HAVE_STRSTR 1
    23.7 +#define HAVE_STRTOK_S 1
    23.8  //#define HAVE_ITOA 1   // TODO, WinRT: consider using _itoa_s instead
    23.9  //#define HAVE__LTOA 1  // TODO, WinRT: consider using _ltoa_s instead
   23.10  //#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead
    24.1 --- a/include/SDL_config_wiz.h	Wed Nov 20 08:43:24 2019 -0800
    24.2 +++ b/include/SDL_config_wiz.h	Wed Nov 20 20:40:50 2019 +0300
    24.3 @@ -67,6 +67,7 @@
    24.4  #define HAVE_STRCHR 1
    24.5  #define HAVE_STRRCHR 1
    24.6  #define HAVE_STRSTR 1
    24.7 +#define HAVE_STRTOK_R 1
    24.8  #define HAVE_STRTOL 1
    24.9  #define HAVE_STRTOUL 1
   24.10  #define HAVE_STRTOLL 1
    25.1 --- a/include/SDL_stdinc.h	Wed Nov 20 08:43:24 2019 -0800
    25.2 +++ b/include/SDL_stdinc.h	Wed Nov 20 20:40:50 2019 +0300
    25.3 @@ -470,6 +470,7 @@
    25.4  extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
    25.5  extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
    25.6  extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
    25.7 +extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr);
    25.8  extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
    25.9  
   25.10  extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix);
   25.11 @@ -584,6 +585,7 @@
   25.12  #define SDL_strchr strchr
   25.13  #define SDL_strrchr strrchr
   25.14  #define SDL_strstr strstr
   25.15 +#define SDL_strtokr strtok_r
   25.16  #define SDL_strcmp strcmp
   25.17  #define SDL_strncmp strncmp
   25.18  #define SDL_strcasecmp strcasecmp
    26.1 --- a/src/dynapi/SDL_dynapi_overrides.h	Wed Nov 20 08:43:24 2019 -0800
    26.2 +++ b/src/dynapi/SDL_dynapi_overrides.h	Wed Nov 20 20:40:50 2019 +0300
    26.3 @@ -728,3 +728,4 @@
    26.4  #define SDL_Metal_DestroyView SDL_Metal_DestroyView_REAL
    26.5  #define SDL_LockTextureToSurface SDL_LockTextureToSurface_REAL
    26.6  #define SDL_HasARMSIMD SDL_HasARMSIMD_REAL
    26.7 +#define SDL_strtokr SDL_strtokr_REAL
    27.1 --- a/src/dynapi/SDL_dynapi_procs.h	Wed Nov 20 08:43:24 2019 -0800
    27.2 +++ b/src/dynapi/SDL_dynapi_procs.h	Wed Nov 20 20:40:50 2019 +0300
    27.3 @@ -784,3 +784,4 @@
    27.4  SDL_DYNAPI_PROC(void,SDL_Metal_DestroyView,(SDL_MetalView a),(a),)
    27.5  SDL_DYNAPI_PROC(int,SDL_LockTextureToSurface,(SDL_Texture *a, const SDL_Rect *b, SDL_Surface **c),(a,b,c),return)
    27.6  SDL_DYNAPI_PROC(SDL_bool,SDL_HasARMSIMD,(void),(),return)
    27.7 +SDL_DYNAPI_PROC(char*,SDL_strtokr,(char *a, const char *b, char **c),(a,b,c),return)
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/src/stdlib/SDL_strtokr.c	Wed Nov 20 20:40:50 2019 +0300
    28.3 @@ -0,0 +1,103 @@
    28.4 +/*
    28.5 +  Simple DirectMedia Layer
    28.6 +  Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
    28.7 +
    28.8 +  This software is provided 'as-is', without any express or implied
    28.9 +  warranty.  In no event will the authors be held liable for any damages
   28.10 +  arising from the use of this software.
   28.11 +
   28.12 +  Permission is granted to anyone to use this software for any purpose,
   28.13 +  including commercial applications, and to alter it and redistribute it
   28.14 +  freely, subject to the following restrictions:
   28.15 +
   28.16 +  1. The origin of this software must not be misrepresented; you must not
   28.17 +     claim that you wrote the original software. If you use this software
   28.18 +     in a product, an acknowledgment in the product documentation would be
   28.19 +     appreciated but is not required.
   28.20 +  2. Altered source versions must be plainly marked as such, and must not be
   28.21 +     misrepresented as being the original software.
   28.22 +  3. This notice may not be removed or altered from any source distribution.
   28.23 +*/
   28.24 +#if defined(__clang_analyzer__)
   28.25 +#define SDL_DISABLE_ANALYZE_MACROS 1
   28.26 +#endif
   28.27 +
   28.28 +#include "../SDL_internal.h"
   28.29 +
   28.30 +#include "SDL_stdinc.h"
   28.31 +
   28.32 +char *SDL_strtokr(char *s1, const char *s2, char **ptr)
   28.33 +{
   28.34 +#if defined(HAVE_STRTOK_R)
   28.35 +    return strtok_r(s1, s2, ptr);
   28.36 +
   28.37 +#elif defined(_MSC_VER) && defined(HAVE_STRTOK_S)
   28.38 +    return strtok_s(s1, s2, ptr);
   28.39 +
   28.40 +#else /* SDL implementation */
   28.41 +/*
   28.42 + * Adapted from _PDCLIB_strtok() of PDClib library at
   28.43 + * https://github.com/DevSolar/pdclib.git
   28.44 + *
   28.45 + * The code was under CC0 license:
   28.46 + * https://creativecommons.org/publicdomain/zero/1.0/legalcode :
   28.47 + *
   28.48 + *                        No Copyright
   28.49 + *
   28.50 + * The person who associated a work with this deed has dedicated the
   28.51 + * work to the public domain by waiving all of his or her rights to
   28.52 + * the work worldwide under copyright law, including all related and
   28.53 + * neighboring rights, to the extent allowed by law.
   28.54 + *
   28.55 + * You can copy, modify, distribute and perform the work, even for
   28.56 + * commercial purposes, all without asking permission. See Other
   28.57 + * Information below.
   28.58 + */
   28.59 +    const char *p = s2;
   28.60 +
   28.61 +    if (!s2 || !ptr || (!s1 && !*ptr)) return NULL;
   28.62 +
   28.63 +    if (s1 != NULL) {  /* new string */
   28.64 +        *ptr = s1;
   28.65 +    } else { /* old string continued */
   28.66 +        if (*ptr == NULL) {
   28.67 +        /* No old string, no new string, nothing to do */
   28.68 +            return NULL;
   28.69 +        }
   28.70 +        s1 = *ptr;
   28.71 +    }
   28.72 +
   28.73 +    /* skip leading s2 characters */
   28.74 +    while (*p && *s1) {
   28.75 +        if (*s1 == *p) {
   28.76 +        /* found separator; skip and start over */
   28.77 +            ++s1;
   28.78 +            p = s2;
   28.79 +            continue;
   28.80 +        }
   28.81 +        ++p;
   28.82 +    }
   28.83 +
   28.84 +    if (! *s1) { /* no more to parse */
   28.85 +        *ptr = s1;
   28.86 +        return NULL;
   28.87 +    }
   28.88 +
   28.89 +    /* skipping non-s2 characters */
   28.90 +    *ptr = s1;
   28.91 +    while (**ptr) {
   28.92 +        p = s2;
   28.93 +        while (*p) {
   28.94 +            if (**ptr == *p++) {
   28.95 +            /* found separator; overwrite with '\0', position *ptr, return */
   28.96 +                *((*ptr)++) = '\0';
   28.97 +                return s1;
   28.98 +            }
   28.99 +        }
  28.100 +        ++(*ptr);
  28.101 +    }
  28.102 +
  28.103 +    /* parsed to end of string */
  28.104 +    return s1;
  28.105 +#endif
  28.106 +}