diff --git a/CMakeLists.txt b/CMakeLists.txt index c9a22ff..730ee1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,7 @@ if (ENABLE_CUSTOM_COMPILER_FLAGS) -Wc++-compat -fstack-protector-strong -Wcomma + -Wdouble-promotion ) endif() diff --git a/cJSON.c b/cJSON.c index 71dee8d..392da69 100644 --- a/cJSON.c +++ b/cJSON.c @@ -1914,7 +1914,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count) for(i = 0; a && (i < (size_t)count); i++) { - n = cJSON_CreateNumber(numbers[i]); + n = cJSON_CreateNumber((double)numbers[i]); if(!n) { cJSON_Delete(a);