summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-02-23 22:07:32 +0100
committerBram Moolenaar <Bram@vim.org>2016-02-23 22:07:32 +0100
commit3ea0f1ae318db6cd9413914bb2ff824d71cefc6e (patch)
treecd03221b14cb13f92b7851a4ac9f86298bd6c931
parentf1b6ac72293e658bb6e68c5cfd926c405b1b6f34 (diff)
downloadvim-git-7.4.1408.tar.gz
patch 7.4.1408v7.4.1408
Problem: MS-Windows doesn't have isnan() and isinf(). Solution: Use _isnan() and _isinf().
-rw-r--r--src/eval.c10
-rw-r--r--src/json.c21
-rw-r--r--src/version.c2
3 files changed, 26 insertions, 7 deletions
diff --git a/src/eval.c b/src/eval.c
index cf908d1d5..b04b6c282 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -27,8 +27,14 @@
# include <time.h> /* for time_t */
#endif
-#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
-# include <math.h>
+#if defined(FEAT_FLOAT)
+# include <float.h>
+# if defined(HAVE_MATH_H)
+# include <math.h>
+# endif
+# if defined(WIN32) && !defined(isnan)
+# define isnan(x) _isnan(x)
+# endif
#endif
#define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
diff --git a/src/json.c b/src/json.c
index 6eadd2e83..1a3dea1e5 100644
--- a/src/json.c
+++ b/src/json.c
@@ -17,9 +17,20 @@
#if defined(FEAT_EVAL) || defined(PROTO)
-#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
- /* for isnan() and isinf() */
-# include <math.h>
+#if defined(FEAT_FLOAT)
+# include <float.h>
+# if defined(HAVE_MATH_H)
+ /* for isnan() and isinf() */
+# include <math.h>
+# endif
+# if defined(WIN32) && !defined(isnan)
+# define isnan(x) _isnan(x)
+# define isinf(x) (!_finite(x) && !_isnan(x))
+# endif
+# if defined(_MSC_VER) && !defined(INFINITY)
+# define INFINITY (DBL_MAX+DBL_MAX)
+# define NAN (INFINITY-INFINITY)
+# endif
#endif
static int json_encode_item(garray_T *gap, typval_T *val, int copyID, int options);
@@ -745,7 +756,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
if (res != NULL)
{
res->v_type = VAR_FLOAT;
- res->vval.v_float = 0.0 / 0.0;
+ res->vval.v_float = NAN;
}
return OK;
}
@@ -755,7 +766,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
if (res != NULL)
{
res->v_type = VAR_FLOAT;
- res->vval.v_float = 1.0 / 0.0;
+ res->vval.v_float = INFINITY;
}
return OK;
}
diff --git a/src/version.c b/src/version.c
index 8d858d105..927e0b2f3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -749,6 +749,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1408,
+/**/
1407,
/**/
1406,