]> git.feebdaed.xyz Git - 0xmirror/cJSON.git/commitdiff
fix error C2124 in visual studio
authorAlanscut <wp_scut@163.com>
Thu, 2 Apr 2020 15:32:30 +0000 (23:32 +0800)
committerAlanscut <wp_scut@163.com>
Thu, 2 Apr 2020 15:32:30 +0000 (23:32 +0800)
cJSON.c

diff --git a/cJSON.c b/cJSON.c
index 5bde90660fd8e1e7bd1907a3115ab5f5521c7380..5a666db20e9d25882cdec8a1c06828efb6a796e0 100644 (file)
--- a/cJSON.c
+++ b/cJSON.c
 #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;