forked from aniani/vim
patch 7.4.1408
Problem: MS-Windows doesn't have isnan() and isinf(). Solution: Use _isnan() and _isinf().
This commit is contained in:
@@ -27,9 +27,15 @@
|
|||||||
# include <time.h> /* for time_t */
|
# include <time.h> /* for time_t */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
|
#if defined(FEAT_FLOAT)
|
||||||
|
# include <float.h>
|
||||||
|
# if defined(HAVE_MATH_H)
|
||||||
# include <math.h>
|
# include <math.h>
|
||||||
# endif
|
# endif
|
||||||
|
# if defined(WIN32) && !defined(isnan)
|
||||||
|
# define isnan(x) _isnan(x)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
|
#define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
|
||||||
|
|
||||||
|
17
src/json.c
17
src/json.c
@@ -17,10 +17,21 @@
|
|||||||
|
|
||||||
#if defined(FEAT_EVAL) || defined(PROTO)
|
#if defined(FEAT_EVAL) || defined(PROTO)
|
||||||
|
|
||||||
#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
|
#if defined(FEAT_FLOAT)
|
||||||
|
# include <float.h>
|
||||||
|
# if defined(HAVE_MATH_H)
|
||||||
/* for isnan() and isinf() */
|
/* for isnan() and isinf() */
|
||||||
# include <math.h>
|
# include <math.h>
|
||||||
# endif
|
# 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);
|
static int json_encode_item(garray_T *gap, typval_T *val, int copyID, int options);
|
||||||
static int json_decode_item(js_read_T *reader, typval_T *res, int options);
|
static int json_decode_item(js_read_T *reader, typval_T *res, int options);
|
||||||
@@ -745,7 +756,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
|
|||||||
if (res != NULL)
|
if (res != NULL)
|
||||||
{
|
{
|
||||||
res->v_type = VAR_FLOAT;
|
res->v_type = VAR_FLOAT;
|
||||||
res->vval.v_float = 0.0 / 0.0;
|
res->vval.v_float = NAN;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -755,7 +766,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options)
|
|||||||
if (res != NULL)
|
if (res != NULL)
|
||||||
{
|
{
|
||||||
res->v_type = VAR_FLOAT;
|
res->v_type = VAR_FLOAT;
|
||||||
res->vval.v_float = 1.0 / 0.0;
|
res->vval.v_float = INFINITY;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@@ -748,6 +748,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1408,
|
||||||
/**/
|
/**/
|
||||||
1407,
|
1407,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user