removed MSVC strtok_s use from SDL_strtokr(). no other ??_s are used elsewhere in SDL_stdinc. besides, C11 has a strtok_s with a different signature.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 42a1a04..1bda90d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -780,7 +780,7 @@ if(LIBC)
wcslen wcsdup wcsstr wcscmp wcsncmp _wcsicmp _wcsnicmp
strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
_ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp
- _stricmp _strnicmp strtok_s sscanf
+ _stricmp _strnicmp sscanf
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 lround lroundf pow powf round roundf scalbn scalbnf
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index f9b1090..615675d 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -116,7 +116,6 @@
#cmakedefine HAVE_STRRCHR 1
#cmakedefine HAVE_STRSTR 1
#cmakedefine HAVE_STRTOK_R 1
-#cmakedefine HAVE_STRTOK_S 1
#cmakedefine HAVE_ITOA 1
#cmakedefine HAVE__LTOA 1
#cmakedefine HAVE__UITOA 1
@@ -207,6 +206,7 @@
#cmakedefine HAVE_STDARG_H 1
#cmakedefine HAVE_STDDEF_H 1
#cmakedefine HAVE_FLOAT_H 1
+
#else
/* We may need some replacement for stdarg.h here */
#include <stdarg.h>
diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in
index 88af73c..1e9980f 100644
--- a/include/SDL_config.h.in
+++ b/include/SDL_config.h.in
@@ -119,7 +119,6 @@
#undef HAVE_STRRCHR
#undef HAVE_STRSTR
#undef HAVE_STRTOK_R
-#undef HAVE_STRTOK_S
#undef HAVE_ITOA
#undef HAVE__LTOA
#undef HAVE__UITOA
diff --git a/include/SDL_config_windows.h b/include/SDL_config_windows.h
index 0eaef90..faaef72 100644
--- a/include/SDL_config_windows.h
+++ b/include/SDL_config_windows.h
@@ -119,9 +119,6 @@ typedef unsigned int uintptr_t;
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
/* #undef HAVE_STRTOK_R */
-#if defined(_MSC_VER)
-#define HAVE_STRTOK_S 1
-#endif
/* These functions have security warnings, so we won't use them */
/* #undef HAVE__LTOA */
/* #undef HAVE__ULTOA */
diff --git a/include/SDL_config_winrt.h b/include/SDL_config_winrt.h
index a00185a..6b40bc9 100644
--- a/include/SDL_config_winrt.h
+++ b/include/SDL_config_winrt.h
@@ -126,17 +126,12 @@ typedef unsigned int uintptr_t;
#define HAVE_STRLEN 1
#define HAVE__STRREV 1
#define HAVE__STRUPR 1
-//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
-#define HAVE_STRTOK_S 1
-//#define HAVE_ITOA 1 // TODO, WinRT: consider using _itoa_s instead
-//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead
-//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
-//#define HAVE_STRTOLL 1
+/* #undef HAVE_STRTOLL */
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
@@ -145,7 +140,12 @@ typedef unsigned int uintptr_t;
#define HAVE__STRICMP 1
#define HAVE__STRNICMP 1
#define HAVE_VSNPRINTF 1
-//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead
+/* TODO, WinRT: consider using ??_s versions of the following */
+/* #undef HAVE__STRLWR */
+/* #undef HAVE_ITOA */
+/* #undef HAVE__LTOA */
+/* #undef HAVE__ULTOA */
+/* #undef HAVE_SSCANF */
#define HAVE_M_PI 1
#define HAVE_ACOS 1
#define HAVE_ACOSF 1
diff --git a/src/stdlib/SDL_strtokr.c b/src/stdlib/SDL_strtokr.c
index 3d69363..0a53dc3 100644
--- a/src/stdlib/SDL_strtokr.c
+++ b/src/stdlib/SDL_strtokr.c
@@ -28,12 +28,9 @@
char *SDL_strtokr(char *s1, const char *s2, char **ptr)
{
-#if defined(HAVE_STRTOK_R)
+#ifdef HAVE_STRTOK_R
return strtok_r(s1, s2, ptr);
-#elif defined(_MSC_VER) && defined(HAVE_STRTOK_S)
- return strtok_s(s1, s2, ptr);
-
#else /* SDL implementation */
/*
* Adapted from _PDCLIB_strtok() of PDClib library at