From 74b2f038371d0359c11bf082c603e7aa11d360b2 Mon Sep 17 00:00:00 2001 From: Alanscut Date: Sat, 18 Jan 2020 23:02:55 +0800 Subject: [PATCH] remove annoying float-equal option --- CMakeLists.txt | 1 - cJSON.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b64ad36..34ad39f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,6 @@ if (ENABLE_CUSTOM_COMPILER_FLAGS) -Wmissing-variable-declarations -Wused-but-marked-unused -Wswitch-enum - -Wfloat-equal ) elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") # Disable warning c4001 - nonstandard extension 'single line comment' was used diff --git a/cJSON.c b/cJSON.c index e71d22f..bc95cde 100644 --- a/cJSON.c +++ b/cJSON.c @@ -503,7 +503,7 @@ static cJSON_bool print_number(const cJSON * const item, printbuffer * const out } /* This checks for NaN and Infinity */ - if (!compare_double(d * 0, 0)) + if ((d * 0) != 0) { length = sprintf((char*)number_buffer, "null"); }