From 5d55c6c2ee77805f4c8943ed419fb97fb60d748d Mon Sep 17 00:00:00 2001 From: Alanscut Date: Thu, 2 Apr 2020 23:32:30 +0800 Subject: [PATCH] fix error C2124 in visual studio --- cJSON.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cJSON.c b/cJSON.c index 5bde906..5a666db 100644 --- a/cJSON.c +++ b/cJSON.c @@ -77,6 +77,10 @@ #define isnan(d) (d != d) #endif +#ifndef NAN +#define NAN 0.0/0.0 +#endif + typedef struct { const unsigned char *json; size_t position; @@ -102,7 +106,7 @@ CJSON_PUBLIC(double) cJSON_GetNumberValue(cJSON *item) { if (!cJSON_IsNumber(item)) { - return 0.0/0.0; + return NAN; } return item->valuedouble;