ENH: MSVS 2013 snprintf compatible substitute

Simplify the backwards compatible snprintf configuration for pre
1900 version of MSVC.  Otherwise prefer C++11 syntax using std::snprintf.
This commit is contained in:
Hans Johnson
2018-12-12 13:31:55 -06:00
committed by Christopher Dunn
parent ccd077ffce
commit 5c8e539af4
5 changed files with 37 additions and 27 deletions

View File

@@ -27,9 +27,6 @@
#define isfinite std::isfinite
#endif
#if !defined(snprintf)
#define snprintf std::snprintf
#endif
#else
#include <math.h>
#include <stdio.h>
@@ -46,9 +43,6 @@
#endif
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
#if !defined(snprintf)
#define snprintf _snprintf
#endif
#endif
#if defined(__sun) && defined(__SVR4) // Solaris
@@ -145,7 +139,7 @@ JSONCPP_STRING valueToString(double value,
JSONCPP_STRING buffer(size_t(36), '\0');
while (true) {
int len = snprintf(
int len = jsoncpp_snprintf(
&*buffer.begin(), buffer.size(),
(precisionType == PrecisionType::significantDigits) ? "%.*g" : "%.*f",
precision, value);