From 75e50d934d1efba928c1f133326c406d2e97b12d Mon Sep 17 00:00:00 2001 From: Zink Pavel Date: Fri, 31 Mar 2023 20:57:48 +0700 Subject: [PATCH 1/4] Fixed setting JSONCPP_USE_SECURE_MEMORY definition --- include/json/version.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/json/version.h b/include/json/version.h index e931d0383..bf7a6a367 100644 --- a/include/json/version.h +++ b/include/json/version.h @@ -18,10 +18,11 @@ ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \ (JSONCPP_VERSION_PATCH << 8)) -#ifdef JSONCPP_USING_SECURE_MEMORY -#undef JSONCPP_USING_SECURE_MEMORY +#if defined(JSONCPP_USE_SECURE_MEMORY) + #define JSONCPP_USING_SECURE_MEMORY 1 +#else + #define JSONCPP_USING_SECURE_MEMORY 0 #endif -#define JSONCPP_USING_SECURE_MEMORY 0 // If non-zero, the library zeroes any memory that it has allocated before // it frees its memory. From b7b2e0ace1193e9944ccdc4d835dc476b9186f78 Mon Sep 17 00:00:00 2001 From: Zink Pavel Date: Fri, 31 Mar 2023 21:18:12 +0700 Subject: [PATCH 2/4] fix indent --- include/json/version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/json/version.h b/include/json/version.h index bf7a6a367..f6118c016 100644 --- a/include/json/version.h +++ b/include/json/version.h @@ -19,9 +19,9 @@ (JSONCPP_VERSION_PATCH << 8)) #if defined(JSONCPP_USE_SECURE_MEMORY) - #define JSONCPP_USING_SECURE_MEMORY 1 +#define JSONCPP_USING_SECURE_MEMORY 1 #else - #define JSONCPP_USING_SECURE_MEMORY 0 +#define JSONCPP_USING_SECURE_MEMORY 0 #endif // If non-zero, the library zeroes any memory that it has allocated before // it frees its memory. From cb65c41345bedd02a01f62b7c3660a37263b5331 Mon Sep 17 00:00:00 2001 From: Zink Pavel Date: Sat, 1 Apr 2023 10:16:29 +0700 Subject: [PATCH 3/4] Fix passing from command line --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8920544a3..ac0a8eda2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,7 +103,9 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Executable/dll output dir.") endif() -set(JSONCPP_USE_SECURE_MEMORY "0" CACHE STRING "-D...=1 to use memory-wiping allocator for STL") +if(JSONCPP_USE_SECURE_MEMORY) + add_definitions("-DJSONCPP_USE_SECURE_MEMORY=1") +endif() configure_file("${PROJECT_SOURCE_DIR}/version.in" "${PROJECT_BINARY_DIR}/version" From b630af3a54a3d06fc53cbb683500e585d354b962 Mon Sep 17 00:00:00 2001 From: Zink Pavel Date: Tue, 4 Apr 2023 22:05:44 +0700 Subject: [PATCH 4/4] simplified definition --- include/json/version.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/json/version.h b/include/json/version.h index f6118c016..9e9541191 100644 --- a/include/json/version.h +++ b/include/json/version.h @@ -18,9 +18,7 @@ ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \ (JSONCPP_VERSION_PATCH << 8)) -#if defined(JSONCPP_USE_SECURE_MEMORY) -#define JSONCPP_USING_SECURE_MEMORY 1 -#else +#if !defined(JSONCPP_USE_SECURE_MEMORY) #define JSONCPP_USING_SECURE_MEMORY 0 #endif // If non-zero, the library zeroes any memory that it has allocated before