Skip to content

Commit 8aec8d8

Browse files
committed
Merge pull request open-source-parsers#46 from chuckatkins/fix-for-old-msvc
Workaround for missing C99 functions in older versions of Visual Studio
2 parents 4002f8a + 9dc9026 commit 8aec8d8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/lib_json/json_reader.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
#include <cstring>
1616
#include <istream>
1717

18+
#if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below
19+
#define snprintf _snprintf
20+
#endif
21+
1822
#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
1923
// Disable warning about strdup being deprecated.
2024
#pragma warning(disable : 4996)

src/lib_json/json_writer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
#include <iomanip>
1616
#include <math.h>
1717

18+
#if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below
19+
#include <float.h>
20+
#define isfinite _finite
21+
#define snprintf _snprintf
22+
#endif
23+
1824
#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
1925
// Disable warning about strdup being deprecated.
2026
#pragma warning(disable : 4996)

0 commit comments

Comments
 (0)