Skip to content

Commit 6147e59

Browse files
committed
isfinite global declaration conflicted with boost
1 parent b905735 commit 6147e59

File tree

3 files changed

+8
-50
lines changed

3 files changed

+8
-50
lines changed

include/json/writer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ typename _Value::String JSON_API valueToQuotedString(const char* value);
341341

342342
} // namespace detail
343343

344+
bool jsonIsFinite(double value);
345+
344346
typedef detail::FastWriter<detail::Value<>> FastWriter; // class Json::FastWriter
345347
typedef detail::StreamWriter<detail::Value<>> StreamWriter; // class Json::StreamWriter
346348
typedef detail::StreamWriterBuilder<detail::Value<>> StreamWriterBuilder; // class Json::StreamWriterBuilder

include/json/writer.inl

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,6 @@
1919
#include <cstring>
2020
#include <cstdio>
2121

22-
#if defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1800 // Between VC++ 6.0 and VC++ 11.0
23-
#include <float.h>
24-
#define isfinite _finite
25-
#elif defined(__sun) && defined(__SVR4) //Solaris
26-
#if !defined(isfinite)
27-
#include <ieeefp.h>
28-
#define isfinite finite
29-
#endif
30-
#elif defined(_AIX)
31-
#if !defined(isfinite)
32-
#include <math.h>
33-
#define isfinite finite
34-
#endif
35-
#elif defined(__hpux)
36-
#if !defined(isfinite)
37-
#if defined(__ia64) && !defined(finite)
38-
#define isfinite(x) ((sizeof(x) == sizeof(float) ? \
39-
_Isfinitef(x) : _IsFinite(x)))
40-
#else
41-
#include <math.h>
42-
#define isfinite finite
43-
#endif
44-
#endif
45-
#else
46-
#include <cmath>
47-
#if !(defined(__QNXNTO__)) // QNX already defines isfinite
48-
#define isfinite std::isfinite
49-
#endif
50-
#endif
51-
5222
#if defined(_MSC_VER)
5323
#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above
5424
#define snprintf sprintf_s
@@ -67,7 +37,6 @@
6737

6838
#if defined(__BORLANDC__)
6939
#include <float.h>
70-
#define isfinite _finite
7140
#define snprintf _snprintf
7241
#endif
7342

@@ -137,7 +106,7 @@ typename _Value::String valueToString(double value, bool useSpecialFloats, unsig
137106
// Print into the buffer. We need not request the alternative representation
138107
// that always has a decimal point because JSON doesn't distingish the
139108
// concepts of reals and integers.
140-
if (isfinite(value)) {
109+
if (jsonIsFinite(value)) {
141110
len = snprintf(buffer, sizeof(buffer), formatString, value);
142111
} else {
143112
// IEEE standard states that NaN values will not compare to themselves

src/lib_json/json_writer.cpp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,9 @@
4646
#endif
4747
#endif
4848

49-
#if defined(_MSC_VER)
50-
#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above
51-
#define snprintf sprintf_s
52-
#elif _MSC_VER >= 1900 // VC++ 14.0 and above
53-
#define snprintf std::snprintf
54-
#else
55-
#define snprintf _snprintf
56-
#endif
57-
#elif defined(__ANDROID__) || defined(__QNXNTO__)
58-
#define snprintf snprintf
59-
#elif __cplusplus >= 201103L
60-
#if !defined(__MINGW32__)
61-
#define snprintf std::snprintf
62-
#endif
63-
#endif
64-
65-
#if defined(__BORLANDC__)
49+
#if defined(__BORLANDC__)
6650
#include <float.h>
6751
#define isfinite _finite
68-
#define snprintf _snprintf
6952
#endif
7053

7154
#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
@@ -81,6 +64,10 @@ typedef std::unique_ptr<StreamWriter> StreamWriterPtr;
8164
typedef std::auto_ptr<StreamWriter> StreamWriterPtr;
8265
#endif
8366

67+
bool jsonIsFinite(double value) {
68+
return isfinite(value);
69+
}
70+
8471
namespace detail {
8572

8673
bool containsControlCharacter(const char* str) {

0 commit comments

Comments
 (0)