# HG changeset patch # User Alanscut <wp_scut@163.com> # Date 1585841550 -28800 # Thu Apr 02 23:32:30 2020 +0800 # Node ID d26e0df32d3778769121cfaff2c74788d4d5c056 # Parent f619dbf013acfc88c6005edf5e62c31f5c201372 fix error C2124 in visual studio diff --git a/cJSON.c b/cJSON.c --- 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 @@ { if (!cJSON_IsNumber(item)) { - return 0.0/0.0; + return NAN; } return item->valuedouble;