From 2d026f661c2b6f430c35acc37bc6728dfa91ee31 Mon Sep 17 00:00:00 2001 From: Jonas Vautherin Date: Fri, 2 Apr 2021 22:42:26 +0200 Subject: [PATCH] Fix jsoncpp Werror with NDK r22b --- third_party/jsoncpp/CMakeLists.txt | 2 +- third_party/jsoncpp/fix_werror.patch | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 third_party/jsoncpp/fix_werror.patch diff --git a/third_party/jsoncpp/CMakeLists.txt b/third_party/jsoncpp/CMakeLists.txt index e32a506b60..0cd9bd0ecb 100644 --- a/third_party/jsoncpp/CMakeLists.txt +++ b/third_party/jsoncpp/CMakeLists.txt @@ -31,6 +31,6 @@ ExternalProject_Add( GIT_REPOSITORY https://github.com/open-source-parsers/jsoncpp GIT_TAG 1.8.4 PREFIX jsoncpp - PATCH_COMMAND git checkout . && git apply ${PROJECT_SOURCE_DIR}/fixlibname.patch + PATCH_COMMAND git checkout . && git apply ${PROJECT_SOURCE_DIR}/fixlibname.patch && git apply ${PROJECT_SOURCE_DIR}/fix_werror.patch CMAKE_ARGS "${CMAKE_ARGS}" ) diff --git a/third_party/jsoncpp/fix_werror.patch b/third_party/jsoncpp/fix_werror.patch new file mode 100644 index 0000000000..c7d3d8a031 --- /dev/null +++ b/third_party/jsoncpp/fix_werror.patch @@ -0,0 +1,14 @@ +diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp +index 91d4802..62b9475 100644 +--- a/src/lib_json/json_value.cpp ++++ b/src/lib_json/json_value.cpp +@@ -69,8 +69,7 @@ template + static inline bool InRange(double d, T min, U max) { + // The casts can lose precision, but we are looking only for + // an approximate range. Might fail on edge cases though. ~cdunn +- //return d >= static_cast(min) && d <= static_cast(max); +- return d >= min && d <= max; ++ return d >= static_cast(min) && d <= static_cast(max); + } + #else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + static inline double integerToDouble(Json::UInt64 value) {