From 80497f102e307a153823bc9d29510c5916a2b632 Mon Sep 17 00:00:00 2001 From: Connor Manning Date: Tue, 10 Mar 2015 18:48:45 -0500 Subject: [PATCH 1/4] Use C++ standard headers. --- src/lib_json/json_writer.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index c7f72ee..dc76032 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -12,15 +12,20 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include #if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below #include #define isfinite _finite #define snprintf _snprintf +#elif defined(__sun) && defined(__SVR4) //Solaris +#include +#define isfinite finite +#else +#include +#define isfinite std::isfinite #endif #if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0 @@ -28,11 +33,6 @@ #pragma warning(disable : 4996) #endif -#if defined(__sun) && defined(__SVR4) //Solaris -#include -#define isfinite finite -#endif - namespace Json { #if __cplusplus >= 201103L From 7020451b448598811fd5bb5a5f8dd62b0e7c738e Mon Sep 17 00:00:00 2001 From: Dani-Hub Date: Tue, 10 Mar 2015 18:50:16 -0500 Subject: [PATCH 2/4] Fix isfinite for MSVC. --- src/lib_json/json_writer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index dc76032..de13f1b 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -16,7 +16,7 @@ #include #include -#if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below +#if defined(_MSC_VER) && _MSC_VER >= 1200 // VC++ 6.0 and above #include #define isfinite _finite #define snprintf _snprintf @@ -28,6 +28,11 @@ #define isfinite std::isfinite #endif +#if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below +#include +#define snprintf _snprintf +#endif + #if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0 // Disable warning about strdup being deprecated. #pragma warning(disable : 4996) From 2f2034629eeef2ff351fc085b81926c23379244b Mon Sep 17 00:00:00 2001 From: Connor Manning Date: Wed, 11 Mar 2015 09:01:49 -0500 Subject: [PATCH 3/4] Constrain MSVC _isfinite to before 2013, remove duplicate includes. --- src/lib_json/json_writer.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index de13f1b..f7ad1e2 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -16,10 +16,9 @@ #include #include -#if defined(_MSC_VER) && _MSC_VER >= 1200 // VC++ 6.0 and above +#if defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1800 // Between VC++ 6.0 and VC++ 11.0 #include #define isfinite _finite -#define snprintf _snprintf #elif defined(__sun) && defined(__SVR4) //Solaris #include #define isfinite finite @@ -29,7 +28,6 @@ #endif #if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below -#include #define snprintf _snprintf #endif From 1c58876185d2a4ed87dac4a54b82f607e74f55fd Mon Sep 17 00:00:00 2001 From: Connor Manning Date: Wed, 11 Mar 2015 13:13:42 -0500 Subject: [PATCH 4/4] Use std namespace for snprintf. --- src/lib_json/json_writer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index f7ad1e2..83102fd 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -29,6 +29,8 @@ #if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below #define snprintf _snprintf +#else +#define snprintf std::snprintf #endif #if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0