Просмотр исходного кода

Use pragma to ignore deprecated integer-to-ascii CRT conversion functions

Anonymous Maarten 23 часов назад
Родитель
Сommit
dcf063178c
2 измененных файлов с 7 добавлено и 7 удалено
  1. 0 7
      CMakeLists.txt
  2. 7 0
      src/stdlib/SDL_string.c

+ 0 - 7
CMakeLists.txt

@@ -696,13 +696,6 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC)
 endif()
 endif()
 
 
 if(MSVC)
 if(MSVC)
-  sdl_compile_definitions(
-    PRIVATE
-      "_CRT_SECURE_NO_DEPRECATE"
-      "_CRT_NONSTDC_NO_DEPRECATE"
-      "_CRT_SECURE_NO_WARNINGS"
-  )
-
   # CET support was added in VS 2019 16.7
   # CET support was added in VS 2019 16.7
   if(MSVC_VERSION GREATER 1926 AND CMAKE_GENERATOR_PLATFORM MATCHES "Win32|x64")
   if(MSVC_VERSION GREATER 1926 AND CMAKE_GENERATOR_PLATFORM MATCHES "Win32|x64")
     # Mark SDL3.dll as compatible with Control-flow Enforcement Technology (CET)
     # Mark SDL3.dll as compatible with Control-flow Enforcement Technology (CET)

+ 7 - 0
src/stdlib/SDL_string.c

@@ -1158,6 +1158,10 @@ char *SDL_uitoa(unsigned int value, char *string, int radix)
     return SDL_ultoa((unsigned long)value, string, radix);
     return SDL_ultoa((unsigned long)value, string, radix);
 }
 }
 
 
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4996) // Ignore warning about deprecated itoa, _ltoa, _ultoa, _i64toa, _ui64toa
+#endif
 char *SDL_itoa(int value, char *string, int radix)
 char *SDL_itoa(int value, char *string, int radix)
 {
 {
 #ifdef HAVE_ITOA
 #ifdef HAVE_ITOA
@@ -1250,6 +1254,9 @@ char *SDL_ulltoa(unsigned long long value, char *string, int radix)
     return string;
     return string;
 #endif // HAVE__UI64TOA
 #endif // HAVE__UI64TOA
 }
 }
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
 
 
 int SDL_atoi(const char *string)
 int SDL_atoi(const char *string)
 {
 {