diff options
author | spacewander <spacewanderlzx@gmail.com> | 2017-01-31 13:09:55 +0800 |
---|---|---|
committer | Yichun Zhang (agentzh) <agentzh@gmail.com> | 2017-01-31 12:17:37 -0800 |
commit | fd35fd98035735bc91c55d14832461e41dd0e193 (patch) | |
tree | 364d8e04b07fdb7390e76629afd2e7ccaff2cacd /lua_cjson.c | |
parent | a61d7840ba2d79df8cb73d8c864a99d0eb06d580 (diff) | |
download | lua-cjson-fd35fd98035735bc91c55d14832461e41dd0e193.tar.gz lua-cjson-fd35fd98035735bc91c55d14832461e41dd0e193.tar.bz2 lua-cjson-fd35fd98035735bc91c55d14832461e41dd0e193.zip |
feature: supports MS C compiler older than VC2012.
Signed-off-by: Yichun Zhang (agentzh) <agentzh@gmail.com>
Diffstat (limited to 'lua_cjson.c')
-rw-r--r-- | lua_cjson.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lua_cjson.c b/lua_cjson.c index 1695979..89cba6d 100644 --- a/lua_cjson.c +++ b/lua_cjson.c | |||
@@ -54,6 +54,16 @@ | |||
54 | #define CJSON_VERSION "2.1devel" | 54 | #define CJSON_VERSION "2.1devel" |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | #ifdef _MSC_VER | ||
58 | #define snprintf sprintf_s | ||
59 | |||
60 | #ifndef isnan | ||
61 | #include <float.h> | ||
62 | #define isnan(x) _isnan(x) | ||
63 | #endif | ||
64 | |||
65 | #endif | ||
66 | |||
57 | /* Workaround for Solaris platforms missing isinf() */ | 67 | /* Workaround for Solaris platforms missing isinf() */ |
58 | #if !defined(isinf) && (defined(USE_INTERNAL_ISINF) || defined(MISSING_ISINF)) | 68 | #if !defined(isinf) && (defined(USE_INTERNAL_ISINF) || defined(MISSING_ISINF)) |
59 | #define isinf(x) (!isnan(x) && isnan((x) - (x))) | 69 | #define isinf(x) (!isnan(x) && isnan((x) - (x))) |