From e872d402235f1e5aecb99a32960fc0bbb478b9c9 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Sat, 17 Jun 2017 14:21:08 +0200 Subject: [PATCH] MSVC: Disable deprecation warnings for C89 functions C89 sadly doesn't provide safe alternatives for strcpy, sprintf and the like. --- cJSON.c | 5 +++++ cJSON_Utils.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/cJSON.c b/cJSON.c index 6e8255a..9c86128 100644 --- a/cJSON.c +++ b/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 diff --git a/cJSON_Utils.c b/cJSON_Utils.c index 84319cc..e7bf802 100644 --- a/cJSON_Utils.c +++ b/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 #include -- GitLab