瀏覽代碼

fix error C2124 in visual studio

Alanscut 5 年之前
父節點
當前提交
5d55c6c2ee
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      cJSON.c

+ 5 - 1
cJSON.c

@@ -77,6 +77,10 @@
 #define isnan(d) (d != d)
 #define isnan(d) (d != d)
 #endif
 #endif
 
 
+#ifndef NAN
+#define NAN 0.0/0.0
+#endif
+
 typedef struct {
 typedef struct {
     const unsigned char *json;
     const unsigned char *json;
     size_t position;
     size_t position;
@@ -102,7 +106,7 @@ CJSON_PUBLIC(double) cJSON_GetNumberValue(cJSON *item)
 {
 {
     if (!cJSON_IsNumber(item)) 
     if (!cJSON_IsNumber(item)) 
     {
     {
-        return 0.0/0.0;
+        return NAN;
     }
     }
 
 
     return item->valuedouble;
     return item->valuedouble;