Explorar o código

MSVC: Disable deprecation warnings for C89 functions

C89 sadly doesn't provide safe alternatives for strcpy, sprintf and the
like.
Max Bruckner %!s(int64=8) %!d(string=hai) anos
pai
achega
e872d40223
Modificáronse 2 ficheiros con 9 adicións e 0 borrados
  1. 5 0
      cJSON.c
  2. 4 0
      cJSON_Utils.c

+ 5 - 0
cJSON.c

@@ -23,6 +23,11 @@
 /* cJSON */
 /* JSON parser in C. */
 
+/* disable warnings about old C89 functions in MSVC */
+#if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
+#define _CRT_SECURE_NO_DEPRECATE
+#endif
+
 #ifdef __GNUC__
 #pragma GCC visibility push(default)
 #endif

+ 4 - 0
cJSON_Utils.c

@@ -20,6 +20,10 @@
   THE SOFTWARE.
 */
 
+/* disable warnings about old C89 functions in MSVC */
+#if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER)
+#define _CRT_SECURE_NO_DEPRECATE
+#endif
 #pragma GCC visibility push(default)
 #include <ctype.h>
 #include <string.h>